Ticket #6235: 6235_2.patch

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

     
    9797        function getFullySelected( selection, elements )
    9898        {
    9999                var selectedElement = selection.getCommonAncestor();
     100
     101                var range = selection.getRanges()[ 0 ];
     102                var selectionStart = range.startContainer;
     103                var selectionEnd = range.endContainer;
     104                var parent;
     105
     106                // Check if all elements children are included in the selection.
     107                while ( ( parent = selectionStart.getParent() ) && parent.$ != selectedElement )
     108                        selectionStart = parent;
     109
     110                while ( ( parent = selectionEnd.getParent() ) && parent.$ != selectedElement )
     111                        selectionEnd = parent;
     112
     113                if ( selectionStart.getIndex() > 0 || selectionStart.getIndex() + 1 < selectedElement.getChildCount() )
     114                        return null;
     115
     116                // Enlarge selection to all elements with only one child (but stop on elements we want).
    100117                while( selectedElement.type == CKEDITOR.NODE_ELEMENT
    101118                                && !( selectedElement.getName() in elements )
    102119                                && selectedElement.getParent().getChildCount() == 1
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy