diff --git a/CHANGES.md b/CHANGES.md index 5f21db0eb5c..166895bd2c2 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -20,6 +20,7 @@ Fixed Issues: * [#11823](http://dev.ckeditor.com/ticket/11823): Fixed: [IE8] [Table Resize](http://ckeditor.com/addon/tableresize) throws error over scrollbar. * [#11788](http://dev.ckeditor.com/ticket/11788): Fixed: It is not possible to change language back to undefined in [Code Snippet](http://ckeditor.com/addon/codesnippet) dialog. * [#11788](http://dev.ckeditor.com/ticket/11788): Fixed: [Filter](http://docs.ckeditor.com/#!/api/CKEDITOR.htmlParser.filter) rules are not applied inside elements with `contenteditable` attribute set to `true`. +* [#11798](http://dev.ckeditor.com/ticket/11798): Fixed: Inserting non-editable element inside a table cell breaks the table badly. Other changes: diff --git a/core/dom/range.js b/core/dom/range.js index be7bf3088f2..d3cb71000af 100644 --- a/core/dom/range.js +++ b/core/dom/range.js @@ -1412,8 +1412,9 @@ CKEDITOR.dom.range = function( root ) { return; } - // Enlarging the end boundary. + // Set up new range and reset all flags (blockBoundary, inNonEditable, tailBr). + walkerRange = this.clone(); walkerRange.collapse(); walkerRange.setEndAt( boundary, CKEDITOR.POSITION_BEFORE_END ); @@ -1421,9 +1422,9 @@ CKEDITOR.dom.range = function( root ) { // tailBrGuard only used for on range end. walker.guard = ( unit == CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS ) ? tailBrGuard : boundaryGuard; - blockBoundary = null; - // End the range right before the block boundary node. + blockBoundary = inNonEditable = tailBr = null; + // End the range right before the block boundary node. enlargeable = walker.lastForward(); // It's the body which stop the enlarging if no block boundary found. @@ -1807,7 +1808,29 @@ CKEDITOR.dom.range = function( root ) { }, /** - * @todo + * Wraps inline content found around the range's start or end boundary + * with a block element. + * + * // Assuming following range: + * //

foo

ba^r
bom

foo

+ * // The result of executing: + * range.fixBlock( true, 'p' ); + * // Will be: + * //

foo

ba^r
bom

foo

+ * + * Non collapsed range: + * + * // Assuming following range: + * // ba[r

foo

bo]m + * // The result of executing: + * range.fixBlock( false, 'p' ); + * // Will be: + * // ba[r

foo

bo]m

+ * + * @param {Boolean} [isStart=false] Whether range's start or end boundary should be checked. + * @param {String} blockTag Name of a block element in which content will be wrapped. + * For example `'p'`. + * @returns {CKEDITOR.dom.element} Created block wrapper. */ fixBlock: function( isStart, blockTag ) { var bookmark = this.createBookmark(),