Ticket #6235: 6235.patch

File 6235.patch, 1.2 KB (added by Tobiasz Cudnik, 10 years ago)
  • _source/plugins/bidi/plugin.js

     
    105105        function getFullySelected( selection, elements )
    106106        {
    107107                var selectedElement = selection.getCommonAncestor();
     108
     109                var range = selection.getRanges()[ 0 ];
     110                var selectionStart = range.startContainer;
     111                var selectionEnd = range.endContainer;
     112                var parent;
     113
     114                // Check if all elements children are included in the selection.
     115                while ( ( parent = selectionStart.getParent() ) && parent.$ != selectedElement )
     116                        selectionStart = parent;
     117
     118                while ( ( parent = selectionEnd.getParent() ) && parent.$ != selectedElement )
     119                        selectionEnd = parent;
     120
     121                // TODO should we skip border text nodes here ?
     122                if ( selectionStart.getIndex() > 0 || selectionStart.getIndex() + 1 < selectedElement.getChildCount() )
     123                        return null;
     124
     125                // Enlarge selection to all elements with only one child (but stop on elements we want).
    108126                while( selectedElement.type == CKEDITOR.NODE_ELEMENT
    109127                                && !( selectedElement.getName() in elements )
    110128                                && selectedElement.getParent().getChildCount() == 1
© 2003 – 2020 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy