Skip to content

Commit bf353ce

Browse files
committed
Merge branch 't/12273'
2 parents 53a5fe4 + d027cf4 commit bf353ce

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Fixed Issues:
1010
* [#12111](http://dev.ckeditor.com/ticket/12111): Fixed: Linked image attributes are not read when opening the image dialog by doubleclick.
1111
* [#10030](http://dev.ckeditor.com/ticket/10030): [IE] Fixed: Prevented "Unspecified Error" thrown in various cases when IE8-9 does not allow access to `document.activeElement`.
1212
* [#12243](http://dev.ckeditor.com/ticket/12243): Fixed: Text formatting lost while pasting from Word. Thanks to [Alin Purcaru](https://github.com/mesmerizero)!
13+
* [#12273](http://dev.ckeditor.com/ticket/12273): Fixed: Applying block style in description list breaks it.
1314

1415
## CKEditor 4.4.3
1516

core/dom/iterator.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@
8282
whitespacesGuard = CKEDITOR.dom.walker.whitespaces( true ),
8383
skipGuard = function( node ) {
8484
return bookmarkGuard( node ) && whitespacesGuard( node );
85-
};
85+
},
86+
listItemNames = { dd: 1, dt: 1, li: 1 };
8687

8788
// Get a reference for the next element, bookmark nodes are skipped.
8889
function getNextSourceNode( node, startFromSibling, lastNode ) {
@@ -282,7 +283,7 @@
282283

283284
if ( !block && startBlockLimit && !this.enforceRealBlocks && checkLimits[ startBlockLimit.getName() ] && range.checkStartOfBlock() && range.checkEndOfBlock() && !startBlockLimit.equals( range.root ) )
284285
block = startBlockLimit;
285-
else if ( !block || ( this.enforceRealBlocks && block.getName() == 'li' ) ) {
286+
else if ( !block || ( this.enforceRealBlocks && block.is( listItemNames ) ) ) {
286287
// Create the fixed block.
287288
block = this.range.document.createElement( blockTag );
288289

tests/core/dom/iterator.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,16 @@ bender.test( {
202202
checkRangeIteration( source, { enforceRealBlocks: 1 }, [ 'p', 'p', 'p' , 'p', 'p' ], output2, 'Iteration should establish paragraph if not exists inside list item' );
203203
},
204204

205+
// #12273
206+
'test iterating over description list': function() {
207+
var source = '<dl><dt>[foo</dt><dd>bar]</dd><dt>bom</dt></dl>',
208+
output1 = '<dl><dt>foo</dt><dd>bar</dd><dt>bom</dt></dl>',
209+
output2 = '<dl><dt><p>foo</p></dt><dd><p>bar</p></dd><dt>bom</dt></dl>';
210+
211+
checkRangeIteration( source, null, [ 'dt', 'dd' ], output1, 'Two list items.' );
212+
checkRangeIteration( source, { enforceRealBlocks: true }, [ 'p', 'p' ], output2, 'Two real blocks.' );
213+
},
214+
205215
'test when iteration range is scoped in a single block': function() {
206216
var result = iterateScopedRange( '<div>^foo</div>' );
207217
arrayAssert.itemsAreEqual( [ 'p' ], result.list );

tests/core/style/applyremove.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,21 @@
606606
t.r( '<h1><b>a^b</b>c</h1>', '<p><b>ab</b>c</p>', 'tc3' );
607607

608608

609+
t = createAssertionFunction2( tcs, 'test apply block style - bulleted lists', { element: 'h1' } );
610+
611+
t.a( '<ul><li>x</li><li>a^b</li><li>x</li></ul>', '<ul><li>x</li><li><h1>ab</h1></li><li>x</li></ul>', 'tc1' );
612+
t.a( '<ul><li>x[y</li><li>a]b</li><li>x</li></ul>', '<ul><li><h1>xy</h1></li><li><h1>ab</h1></li><li>x</li></ul>', 'tc2' );
613+
t.a( '<ul><li><p>[x</p></li><li><p>a]</p><p>b</p></li><li>x</li></ul>', '<ul><li><h1>x</h1></li><li><h1>a</h1><p>b</p></li><li>x</li></ul>', 'tc3' );
614+
615+
616+
// #12273
617+
t = createAssertionFunction2( tcs, 'test apply block style - description lists', { element: 'h1' } );
618+
619+
t.a( '<dl><dt>x</dt><dd>a^b</dd><dt>x</dt></dl>', '<dl><dt>x</dt><dd><h1>ab</h1></dd><dt>x</dt></dl>', 'tc1' );
620+
t.a( '<dl><dt>x[y</dt><dd>a]b</dd><dt>x</dt></dl>', '<dl><dt><h1>xy</h1></dt><dd><h1>ab</h1></dd><dt>x</dt></dl>', 'tc2' );
621+
t.a( '<dl><dt><p>[x</p></dt><dd><p>a]</p><p>b</p></dd><dt>x</dt></dl>', '<dl><dt><h1>x</h1></dt><dd><h1>a</h1><p>b</p></dd><dt>x</dt></dl>', 'tc3' );
622+
623+
609624
t = createAssertionFunction2( tcs, 'test do not apply block styles to non-editable blocks', { element: 'h1' } );
610625

611626
t.a( '<p>[x</p><p @c=f>a</p><div @c=f>b</div><p>x]</p>', '<h1>x</h1><p @c=f>a</p><div @c=f>b</div><h1>x</h1>', 'tc1' );

0 commit comments

Comments
 (0)