diff options
Diffstat (limited to 'sources/plugins/enterkey')
-rw-r--r-- | sources/plugins/enterkey/plugin.js | 27 | ||||
-rw-r--r-- | sources/plugins/enterkey/samples/enterkey.html | 4 |
2 files changed, 16 insertions, 15 deletions
diff --git a/sources/plugins/enterkey/plugin.js b/sources/plugins/enterkey/plugin.js index 4cbb7bf..e65555f 100644 --- a/sources/plugins/enterkey/plugin.js +++ b/sources/plugins/enterkey/plugin.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved. |
3 | * For licensing, see LICENSE.md or http://ckeditor.com/license | 3 | * For licensing, see LICENSE.md or http://ckeditor.com/license |
4 | */ | 4 | */ |
5 | 5 | ||
@@ -43,7 +43,7 @@ | |||
43 | return; | 43 | return; |
44 | 44 | ||
45 | // When range is in nested editable, we have to replace range with this one, | 45 | // When range is in nested editable, we have to replace range with this one, |
46 | // which have root property set to closest editable, to make auto paragraphing work. (#12162) | 46 | // which have root property set to closest editable, to make auto paragraphing work. (http://dev.ckeditor.com/ticket/12162) |
47 | range = replaceRangeWithClosestEditableRoot( range ); | 47 | range = replaceRangeWithClosestEditableRoot( range ); |
48 | 48 | ||
49 | var doc = range.document; | 49 | var doc = range.document; |
@@ -58,9 +58,9 @@ | |||
58 | 58 | ||
59 | newBlock; | 59 | newBlock; |
60 | 60 | ||
61 | // Exit the list when we're inside an empty list item block. (#5376) | 61 | // Exit the list when we're inside an empty list item block. (http://dev.ckeditor.com/ticket/5376) |
62 | if ( atBlockStart && atBlockEnd ) { | 62 | if ( atBlockStart && atBlockEnd ) { |
63 | // Exit the list when we're inside an empty list item block. (#5376) | 63 | // Exit the list when we're inside an empty list item block. (http://dev.ckeditor.com/ticket/5376) |
64 | if ( block && ( block.is( 'li' ) || block.getParent().is( 'li' ) ) ) { | 64 | if ( block && ( block.is( 'li' ) || block.getParent().is( 'li' ) ) ) { |
65 | // Make sure to point to the li when dealing with empty list item. | 65 | // Make sure to point to the li when dealing with empty list item. |
66 | if ( !block.is( 'li' ) ) | 66 | if ( !block.is( 'li' ) ) |
@@ -293,7 +293,7 @@ | |||
293 | 293 | ||
294 | var node; | 294 | var node; |
295 | 295 | ||
296 | // If this is a block under a list item, split it as well. (#1647) | 296 | // If this is a block under a list item, split it as well. (http://dev.ckeditor.com/ticket/1647) |
297 | if ( nextBlock ) { | 297 | if ( nextBlock ) { |
298 | node = nextBlock.getParent(); | 298 | node = nextBlock.getParent(); |
299 | if ( node.is( 'li' ) ) { | 299 | if ( node.is( 'li' ) ) { |
@@ -313,7 +313,7 @@ | |||
313 | if ( !isStartOfBlock && !isEndOfBlock ) { | 313 | if ( !isStartOfBlock && !isEndOfBlock ) { |
314 | // If the next block is an <li> with another list tree as the first | 314 | // If the next block is an <li> with another list tree as the first |
315 | // child, we'll need to append a filler (<br>/NBSP) or the list item | 315 | // child, we'll need to append a filler (<br>/NBSP) or the list item |
316 | // wouldn't be editable. (#1420) | 316 | // wouldn't be editable. (http://dev.ckeditor.com/ticket/1420) |
317 | if ( nextBlock.is( 'li' ) ) { | 317 | if ( nextBlock.is( 'li' ) ) { |
318 | var walkerRange = range.clone(); | 318 | var walkerRange = range.clone(); |
319 | walkerRange.selectNodeContents( nextBlock ); | 319 | walkerRange.selectNodeContents( nextBlock ); |
@@ -335,7 +335,7 @@ | |||
335 | 335 | ||
336 | if ( previousBlock ) { | 336 | if ( previousBlock ) { |
337 | // Do not enter this block if it's a header tag, or we are in | 337 | // Do not enter this block if it's a header tag, or we are in |
338 | // a Shift+Enter (#77). Create a new block element instead | 338 | // a Shift+Enter (http://dev.ckeditor.com/ticket/77). Create a new block element instead |
339 | // (later in the code). | 339 | // (later in the code). |
340 | if ( previousBlock.is( 'li' ) || !( headerTagRegex.test( previousBlock.getName() ) || previousBlock.is( 'pre' ) ) ) { | 340 | if ( previousBlock.is( 'li' ) || !( headerTagRegex.test( previousBlock.getName() ) || previousBlock.is( 'pre' ) ) ) { |
341 | // Otherwise, duplicate the previous block. | 341 | // Otherwise, duplicate the previous block. |
@@ -346,7 +346,7 @@ | |||
346 | } | 346 | } |
347 | 347 | ||
348 | if ( !newBlock ) { | 348 | if ( !newBlock ) { |
349 | // We have already created a new list item. (#6849) | 349 | // We have already created a new list item. (http://dev.ckeditor.com/ticket/6849) |
350 | if ( node && node.is( 'li' ) ) | 350 | if ( node && node.is( 'li' ) ) |
351 | newBlock = node; | 351 | newBlock = node; |
352 | else { | 352 | else { |
@@ -384,8 +384,8 @@ | |||
384 | if ( !newBlock.getParent() ) | 384 | if ( !newBlock.getParent() ) |
385 | range.insertNode( newBlock ); | 385 | range.insertNode( newBlock ); |
386 | 386 | ||
387 | // list item start number should not be duplicated (#7330), but we need | 387 | // list item start number should not be duplicated (http://dev.ckeditor.com/ticket/7330), but we need |
388 | // to remove the attribute after it's onto the DOM tree because of old IEs (#7581). | 388 | // to remove the attribute after it's onto the DOM tree because of old IEs (http://dev.ckeditor.com/ticket/7581). |
389 | newBlock.is( 'li' ) && newBlock.removeAttribute( 'value' ); | 389 | newBlock.is( 'li' ) && newBlock.removeAttribute( 'value' ); |
390 | 390 | ||
391 | // This is tricky, but to make the new block visible correctly | 391 | // This is tricky, but to make the new block visible correctly |
@@ -453,7 +453,7 @@ | |||
453 | } else { | 453 | } else { |
454 | var lineBreak; | 454 | var lineBreak; |
455 | 455 | ||
456 | // IE<8 prefers text node as line-break inside of <pre> (#4711). | 456 | // IE<8 prefers text node as line-break inside of <pre> (http://dev.ckeditor.com/ticket/4711). |
457 | if ( startBlockTag == 'pre' && CKEDITOR.env.ie && CKEDITOR.env.version < 8 ) | 457 | if ( startBlockTag == 'pre' && CKEDITOR.env.ie && CKEDITOR.env.version < 8 ) |
458 | lineBreak = doc.createText( '\r' ); | 458 | lineBreak = doc.createText( '\r' ); |
459 | else | 459 | else |
@@ -503,7 +503,7 @@ | |||
503 | function shiftEnter( editor ) { | 503 | function shiftEnter( editor ) { |
504 | // On SHIFT+ENTER: | 504 | // On SHIFT+ENTER: |
505 | // 1. We want to enforce the mode to be respected, instead | 505 | // 1. We want to enforce the mode to be respected, instead |
506 | // of cloning the current block. (#77) | 506 | // of cloning the current block. (http://dev.ckeditor.com/ticket/77) |
507 | return enter( editor, editor.activeShiftEnterMode, 1 ); | 507 | return enter( editor, editor.activeShiftEnterMode, 1 ); |
508 | } | 508 | } |
509 | 509 | ||
@@ -521,7 +521,8 @@ | |||
521 | // Check path block specialities: | 521 | // Check path block specialities: |
522 | // 1. Cannot be a un-splittable element, e.g. table caption; | 522 | // 1. Cannot be a un-splittable element, e.g. table caption; |
523 | var path = editor.elementPath(); | 523 | var path = editor.elementPath(); |
524 | if ( !path.isContextFor( 'p' ) ) { | 524 | |
525 | if ( path && !path.isContextFor( 'p' ) ) { | ||
525 | mode = CKEDITOR.ENTER_BR; | 526 | mode = CKEDITOR.ENTER_BR; |
526 | forceMode = 1; | 527 | forceMode = 1; |
527 | } | 528 | } |
diff --git a/sources/plugins/enterkey/samples/enterkey.html b/sources/plugins/enterkey/samples/enterkey.html index 6b78e06..79afee3 100644 --- a/sources/plugins/enterkey/samples/enterkey.html +++ b/sources/plugins/enterkey/samples/enterkey.html | |||
@@ -1,6 +1,6 @@ | |||
1 | <!DOCTYPE html> | 1 | <!DOCTYPE html> |
2 | <!-- | 2 | <!-- |
3 | Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. | 3 | Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved. |
4 | For licensing, see LICENSE.md or http://ckeditor.com/license | 4 | For licensing, see LICENSE.md or http://ckeditor.com/license |
5 | --> | 5 | --> |
6 | <html> | 6 | <html> |
@@ -98,7 +98,7 @@ CKEDITOR.replace( '<em>textarea_id</em>', { | |||
98 | CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> | 98 | CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> |
99 | </p> | 99 | </p> |
100 | <p id="copy"> | 100 | <p id="copy"> |
101 | Copyright © 2003-2016, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico | 101 | Copyright © 2003-2017, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico |
102 | Knabben. All rights reserved. | 102 | Knabben. All rights reserved. |
103 | </p> | 103 | </p> |
104 | </div> | 104 | </div> |