diff --git a/CHANGES.md b/CHANGES.md index e51b5ce0f3e..d5141bedb9b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -15,6 +15,7 @@ Fixed Issues: * [#10835](http://dev.ckeditor.com/ticket/10835): [Enhanced Image](http://ckeditor.com/addon/image2): Improved visibility of the resize handle. * [#10836](http://dev.ckeditor.com/ticket/10836): [Enhanced Image](http://ckeditor.com/addon/image2): Preserve custom mouse cursor while resizing the image. * [#10881](http://dev.ckeditor.com/ticket/10881): Various improvements to *Enter* key behaviour in nested editables. +* [#10879](http://dev.ckeditor.com/ticket/10879): Remove format should not leak from nested editable. ## CKEditor 4.3 Beta diff --git a/core/dom/range.js b/core/dom/range.js index a66e2206230..8c3f74f12ea 100644 --- a/core/dom/range.js +++ b/core/dom/range.js @@ -982,6 +982,9 @@ CKEDITOR.dom.range = function( root ) { enlargeable = container; } + // Ensures that enlargeable can be indeed enlarged, if not it will be nulled. + enlargeable = getValidEnlargeable( enlargeable ); + while ( enlargeable || sibling ) { if ( enlargeable && !sibling ) { // If we reached the common ancestor, mark the flag @@ -1094,7 +1097,7 @@ CKEDITOR.dom.range = function( root ) { } if ( enlargeable ) - enlargeable = enlargeable.getParent(); + enlargeable = getValidEnlargeable( enlargeable.getParent() ); } // Process the end boundary. This is basically the same @@ -1225,7 +1228,7 @@ CKEDITOR.dom.range = function( root ) { } if ( enlargeable ) - enlargeable = enlargeable.getParent(); + enlargeable = getValidEnlargeable( enlargeable.getParent() ); } // If the common ancestor can be enlarged by both boundaries, then include it also. @@ -1321,6 +1324,13 @@ CKEDITOR.dom.range = function( root ) { if ( tailBr ) this.setEndAfter( tailBr ); } + + // Ensures that returned element can be enlarged by selection, null otherwise. + // @param {CKEDITOR.dom.element} enlargeable + // @returns {CKEDITOR.dom.element/null} + function getValidEnlargeable( enlargeable ) { + return enlargeable && enlargeable.type == CKEDITOR.NODE_ELEMENT && enlargeable.hasAttribute( 'contenteditable' ) ? null : enlargeable; + } }, /**