diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-03-21 02:20:06 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-03-21 02:20:15 +0100 |
commit | 3b35bd273a79f6b01fda7a246aed64aca147ea7a (patch) | |
tree | 5f259026b0771aceb2ad9a88619437ef1841d14c /sources/core | |
parent | 7adcb81e4f83f98c468889aaa5a85558ba88c770 (diff) | |
download | connexionswing-ckeditor-component-master.tar.gz connexionswing-ckeditor-component-master.tar.zst connexionswing-ckeditor-component-master.zip |
Diffstat (limited to 'sources/core')
59 files changed, 298 insertions, 203 deletions
diff --git a/sources/core/_bootstrap.js b/sources/core/_bootstrap.js index dac236bd..9fcbe25d 100644 --- a/sources/core/_bootstrap.js +++ b/sources/core/_bootstrap.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/ckeditor.js b/sources/core/ckeditor.js index 948bc13b..2b3e5cdd 100644 --- a/sources/core/ckeditor.js +++ b/sources/core/ckeditor.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/ckeditor_base.js b/sources/core/ckeditor_base.js index 10ae573d..1e90d72e 100644 --- a/sources/core/ckeditor_base.js +++ b/sources/core/ckeditor_base.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/ckeditor_basic.js b/sources/core/ckeditor_basic.js index f34921dc..847d661e 100644 --- a/sources/core/ckeditor_basic.js +++ b/sources/core/ckeditor_basic.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/command.js b/sources/core/command.js index c4e8a7ae..a0e07b59 100644 --- a/sources/core/command.js +++ b/sources/core/command.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/commanddefinition.js b/sources/core/commanddefinition.js index e09fee3f..68b22531 100644 --- a/sources/core/commanddefinition.js +++ b/sources/core/commanddefinition.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/config.js b/sources/core/config.js index 6bab846c..4ce98d76 100644 --- a/sources/core/config.js +++ b/sources/core/config.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/creators/inline.js b/sources/core/creators/inline.js index f6c3facd..a1a653c0 100644 --- a/sources/core/creators/inline.js +++ b/sources/core/creators/inline.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/creators/themedui.js b/sources/core/creators/themedui.js index b8bfcf3d..c87d0795 100644 --- a/sources/core/creators/themedui.js +++ b/sources/core/creators/themedui.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/dataprocessor.js b/sources/core/dataprocessor.js index f3ca2746..ebc4d1c7 100644 --- a/sources/core/dataprocessor.js +++ b/sources/core/dataprocessor.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/dom.js b/sources/core/dom.js index 4e0e2563..a806a746 100644 --- a/sources/core/dom.js +++ b/sources/core/dom.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/dom/comment.js b/sources/core/dom/comment.js index b4e67833..69828c2e 100644 --- a/sources/core/dom/comment.js +++ b/sources/core/dom/comment.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/dom/document.js b/sources/core/dom/document.js index ea0290f0..f287245e 100644 --- a/sources/core/dom/document.js +++ b/sources/core/dom/document.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/dom/documentfragment.js b/sources/core/dom/documentfragment.js index 5015144d..ffca9e5d 100644 --- a/sources/core/dom/documentfragment.js +++ b/sources/core/dom/documentfragment.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/dom/domobject.js b/sources/core/dom/domobject.js index 21a351d7..607e9f3c 100644 --- a/sources/core/dom/domobject.js +++ b/sources/core/dom/domobject.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/dom/element.js b/sources/core/dom/element.js index d5181282..b586b027 100644 --- a/sources/core/dom/element.js +++ b/sources/core/dom/element.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/dom/elementpath.js b/sources/core/dom/elementpath.js index 55b776d5..1ee551bb 100644 --- a/sources/core/dom/elementpath.js +++ b/sources/core/dom/elementpath.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/dom/event.js b/sources/core/dom/event.js index ee88d78c..7cc1bd80 100644 --- a/sources/core/dom/event.js +++ b/sources/core/dom/event.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/dom/iterator.js b/sources/core/dom/iterator.js index 99491218..41a823c8 100644 --- a/sources/core/dom/iterator.js +++ b/sources/core/dom/iterator.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/dom/node.js b/sources/core/dom/node.js index 5d791319..7818b079 100644 --- a/sources/core/dom/node.js +++ b/sources/core/dom/node.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
@@ -373,7 +373,7 @@ CKEDITOR.tools.extend( CKEDITOR.dom.node.prototype, { | |||
373 | // The idea is - all empty text nodes will be virtually merged into their adjacent text nodes. | 373 | // The idea is - all empty text nodes will be virtually merged into their adjacent text nodes. |
374 | // If an empty text node does not have an adjacent non-empty text node we can return -1 straight away, | 374 | // If an empty text node does not have an adjacent non-empty text node we can return -1 straight away, |
375 | // because it and all its sibling text nodes will be merged into an empty text node and then totally ignored. | 375 | // because it and all its sibling text nodes will be merged into an empty text node and then totally ignored. |
376 | if ( normalized && current.nodeType == CKEDITOR.NODE_TEXT && !current.nodeValue ) { | 376 | if ( normalized && current.nodeType == CKEDITOR.NODE_TEXT && isEmpty( current ) ) { |
377 | var adjacent = getAdjacentNonEmptyTextNode( current ) || getAdjacentNonEmptyTextNode( current, true ); | 377 | var adjacent = getAdjacentNonEmptyTextNode( current ) || getAdjacentNonEmptyTextNode( current, true ); |
378 | 378 | ||
379 | if ( !adjacent ) | 379 | if ( !adjacent ) |
@@ -382,7 +382,7 @@ CKEDITOR.tools.extend( CKEDITOR.dom.node.prototype, { | |||
382 | 382 | ||
383 | do { | 383 | do { |
384 | // Bypass blank node and adjacent text nodes. | 384 | // Bypass blank node and adjacent text nodes. |
385 | if ( normalized && current != this.$ && current.nodeType == CKEDITOR.NODE_TEXT && ( isNormalizing || !current.nodeValue ) ) | 385 | if ( normalized && current != this.$ && current.nodeType == CKEDITOR.NODE_TEXT && ( isNormalizing || isEmpty( current ) ) ) |
386 | continue; | 386 | continue; |
387 | 387 | ||
388 | index++; | 388 | index++; |
@@ -401,7 +401,12 @@ CKEDITOR.tools.extend( CKEDITOR.dom.node.prototype, { | |||
401 | 401 | ||
402 | // If found a non-empty text node, then return it. | 402 | // If found a non-empty text node, then return it. |
403 | // If not, then continue search. | 403 | // If not, then continue search. |
404 | return sibling.nodeValue ? sibling : getAdjacentNonEmptyTextNode( sibling, lookForward ); | 404 | return isEmpty( sibling ) ? getAdjacentNonEmptyTextNode( sibling, lookForward ) : sibling; |
405 | } | ||
406 | |||
407 | // Checks whether a text node is empty or is FCSeq string (which will be totally removed when normalizing). | ||
408 | function isEmpty( textNode ) { | ||
409 | return !textNode.nodeValue || textNode.nodeValue == CKEDITOR.dom.selection.FILLING_CHAR_SEQUENCE; | ||
405 | } | 410 | } |
406 | }, | 411 | }, |
407 | 412 | ||
diff --git a/sources/core/dom/nodelist.js b/sources/core/dom/nodelist.js index 0bbe3ee6..0f91eaa1 100644 --- a/sources/core/dom/nodelist.js +++ b/sources/core/dom/nodelist.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/dom/range.js b/sources/core/dom/range.js index fe75c550..b5e87363 100644 --- a/sources/core/dom/range.js +++ b/sources/core/dom/range.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
@@ -804,12 +804,12 @@ CKEDITOR.dom.range = function( root ) { | |||
804 | var sum = 0; | 804 | var sum = 0; |
805 | 805 | ||
806 | while ( ( node = node.getPrevious() ) && node.type == CKEDITOR.NODE_TEXT ) | 806 | while ( ( node = node.getPrevious() ) && node.type == CKEDITOR.NODE_TEXT ) |
807 | sum += node.getLength(); | 807 | sum += node.getText().replace( CKEDITOR.dom.selection.FILLING_CHAR_SEQUENCE, '' ).length; |
808 | 808 | ||
809 | return sum; | 809 | return sum; |
810 | } | 810 | } |
811 | 811 | ||
812 | function normalize( limit ) { | 812 | function normalizeTextNodes( limit ) { |
813 | var container = limit.container, | 813 | var container = limit.container, |
814 | offset = limit.offset; | 814 | offset = limit.offset; |
815 | 815 | ||
@@ -820,11 +820,13 @@ CKEDITOR.dom.range = function( root ) { | |||
820 | offset = container.getLength(); | 820 | offset = container.getLength(); |
821 | } | 821 | } |
822 | 822 | ||
823 | // Now, if limit is anchored in element and has at least two nodes before it, | 823 | // Now, if limit is anchored in element and has at least one node before it, |
824 | // it may happen that some of them will be merged. Normalize the offset | 824 | // it may happen that some of them will be merged. Normalize the offset |
825 | // by setting it to normalized index of its preceding node. | 825 | // by setting it to normalized index of its preceding, safe node. |
826 | if ( container.type == CKEDITOR.NODE_ELEMENT && offset > 1 ) | 826 | // (safe == one for which getIndex(true) does not return -1, so one which won't disappear). |
827 | offset = container.getChild( offset - 1 ).getIndex( true ) + 1; | 827 | if ( container.type == CKEDITOR.NODE_ELEMENT && offset > 0 ) { |
828 | offset = getPrecedingSafeNodeIndex( container, offset ) + 1; | ||
829 | } | ||
828 | 830 | ||
829 | // The last step - fix the offset inside text node by adding | 831 | // The last step - fix the offset inside text node by adding |
830 | // lengths of preceding text nodes which will be merged with container. | 832 | // lengths of preceding text nodes which will be merged with container. |
@@ -870,6 +872,48 @@ CKEDITOR.dom.range = function( root ) { | |||
870 | limit.offset = offset; | 872 | limit.offset = offset; |
871 | } | 873 | } |
872 | 874 | ||
875 | function normalizeFCSeq( limit, root ) { | ||
876 | var fcseq = root.getCustomData( 'cke-fillingChar' ); | ||
877 | |||
878 | if ( !fcseq ) { | ||
879 | return; | ||
880 | } | ||
881 | |||
882 | var container = limit.container; | ||
883 | |||
884 | if ( fcseq.equals( container ) ) { | ||
885 | limit.offset -= CKEDITOR.dom.selection.FILLING_CHAR_SEQUENCE.length; | ||
886 | |||
887 | // == 0 handles case when limit was at the end of FCS. | ||
888 | // < 0 handles all cases where limit was somewhere in the middle or at the beginning. | ||
889 | // > 0 (the "else" case) means cases where there are some more characters in the FCS node (FCSabc^def). | ||
890 | if ( limit.offset <= 0 ) { | ||
891 | limit.offset = container.getIndex(); | ||
892 | limit.container = container.getParent(); | ||
893 | } | ||
894 | return; | ||
895 | } | ||
896 | |||
897 | // And here goes the funny part - all other cases are handled inside node.getAddress() and getIndex() thanks to | ||
898 | // node.getIndex() being aware of FCS (handling it as an empty node). | ||
899 | } | ||
900 | |||
901 | // Finds a normalized index of a safe node preceding this one. | ||
902 | // Safe == one that will not disappear, so one for which getIndex( true ) does not return -1. | ||
903 | // Return -1 if there's no safe preceding node. | ||
904 | function getPrecedingSafeNodeIndex( container, offset ) { | ||
905 | var index; | ||
906 | |||
907 | while ( offset-- ) { | ||
908 | index = container.getChild( offset ).getIndex( true ); | ||
909 | |||
910 | if ( index >= 0 ) | ||
911 | return index; | ||
912 | } | ||
913 | |||
914 | return -1; | ||
915 | } | ||
916 | |||
873 | return function( normalized ) { | 917 | return function( normalized ) { |
874 | var collapsed = this.collapsed, | 918 | var collapsed = this.collapsed, |
875 | bmStart = { | 919 | bmStart = { |
@@ -882,10 +926,13 @@ CKEDITOR.dom.range = function( root ) { | |||
882 | }; | 926 | }; |
883 | 927 | ||
884 | if ( normalized ) { | 928 | if ( normalized ) { |
885 | normalize( bmStart ); | 929 | normalizeTextNodes( bmStart ); |
930 | normalizeFCSeq( bmStart, this.root ); | ||
886 | 931 | ||
887 | if ( !collapsed ) | 932 | if ( !collapsed ) { |
888 | normalize( bmEnd ); | 933 | normalizeTextNodes( bmEnd ); |
934 | normalizeFCSeq( bmEnd, this.root ); | ||
935 | } | ||
889 | } | 936 | } |
890 | 937 | ||
891 | return { | 938 | return { |
diff --git a/sources/core/dom/rangelist.js b/sources/core/dom/rangelist.js index 9c558b36..d02fc033 100644 --- a/sources/core/dom/rangelist.js +++ b/sources/core/dom/rangelist.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/dom/text.js b/sources/core/dom/text.js index 7c403f90..c3132590 100644 --- a/sources/core/dom/text.js +++ b/sources/core/dom/text.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/dom/walker.js b/sources/core/dom/walker.js index 5f2c8f40..746b4067 100644 --- a/sources/core/dom/walker.js +++ b/sources/core/dom/walker.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
@@ -388,9 +388,9 @@ | |||
388 | return function( node ) { | 388 | return function( node ) { |
389 | var isWhitespace; | 389 | var isWhitespace; |
390 | if ( node && node.type == CKEDITOR.NODE_TEXT ) { | 390 | if ( node && node.type == CKEDITOR.NODE_TEXT ) { |
391 | // whitespace, as well as the text cursor filler node we used in Webkit. (#9384) | 391 | // Whitespace, as well as the Filling Char Sequence text node used in Webkit. (#9384, #13816) |
392 | isWhitespace = !CKEDITOR.tools.trim( node.getText() ) || | 392 | isWhitespace = !CKEDITOR.tools.trim( node.getText() ) || |
393 | CKEDITOR.env.webkit && node.getText() == '\u200b'; | 393 | CKEDITOR.env.webkit && node.getText() == CKEDITOR.dom.selection.FILLING_CHAR_SEQUENCE; |
394 | } | 394 | } |
395 | 395 | ||
396 | return !!( isReject ^ isWhitespace ); | 396 | return !!( isReject ^ isWhitespace ); |
diff --git a/sources/core/dom/window.js b/sources/core/dom/window.js index 123c981a..edfeb84e 100644 --- a/sources/core/dom/window.js +++ b/sources/core/dom/window.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/dtd.js b/sources/core/dtd.js index 9ef4fa7c..d6dc5a67 100644 --- a/sources/core/dtd.js +++ b/sources/core/dtd.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/editable.js b/sources/core/editable.js index 4c941cd3..b9b0270b 100644 --- a/sources/core/editable.js +++ b/sources/core/editable.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/editor.js b/sources/core/editor.js index f29be63f..31188d24 100644 --- a/sources/core/editor.js +++ b/sources/core/editor.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
@@ -654,6 +654,47 @@ | |||
654 | return editor.blockless ? CKEDITOR.ENTER_BR : enterMode; | 654 | return editor.blockless ? CKEDITOR.ENTER_BR : enterMode; |
655 | } | 655 | } |
656 | 656 | ||
657 | // Create DocumentFragment from specified ranges. For now it handles only tables in Firefox | ||
658 | // and returns DocumentFragment from the 1. range for other cases. (#13884) | ||
659 | function createDocumentFragmentFromRanges( ranges, editable ) { | ||
660 | var docFragment = new CKEDITOR.dom.documentFragment(), | ||
661 | tableClone, | ||
662 | currentRow, | ||
663 | currentRowClone; | ||
664 | |||
665 | for ( var i = 0; i < ranges.length; i++ ) { | ||
666 | var range = ranges[ i ], | ||
667 | container = range.startContainer; | ||
668 | |||
669 | if ( container.getName && container.getName() == 'tr' ) { | ||
670 | if ( !tableClone ) { | ||
671 | tableClone = container.getAscendant( 'table' ).clone(); | ||
672 | tableClone.append( container.getAscendant( 'tbody' ).clone() ); | ||
673 | docFragment.append( tableClone ); | ||
674 | tableClone = tableClone.findOne( 'tbody' ); | ||
675 | } | ||
676 | |||
677 | if ( !( currentRow && currentRow.equals( container ) ) ) { | ||
678 | currentRow = container; | ||
679 | currentRowClone = container.clone(); | ||
680 | tableClone.append( currentRowClone ); | ||
681 | } | ||
682 | |||
683 | currentRowClone.append( range.cloneContents() ); | ||
684 | } else { | ||
685 | // If there was something else copied with table, | ||
686 | // append it to DocumentFragment. | ||
687 | docFragment.append( range.cloneContents() ); | ||
688 | } | ||
689 | } | ||
690 | |||
691 | if ( !tableClone ) { | ||
692 | return editable.getHtmlFromRange( ranges[ 0 ] ); | ||
693 | } | ||
694 | |||
695 | return docFragment; | ||
696 | } | ||
697 | |||
657 | CKEDITOR.tools.extend( CKEDITOR.editor.prototype, { | 698 | CKEDITOR.tools.extend( CKEDITOR.editor.prototype, { |
658 | /** | 699 | /** |
659 | * Adds a command definition to the editor instance. Commands added with | 700 | * Adds a command definition to the editor instance. Commands added with |
@@ -1133,7 +1174,7 @@ | |||
1133 | return null; | 1174 | return null; |
1134 | } | 1175 | } |
1135 | 1176 | ||
1136 | var docFragment = editable.getHtmlFromRange( ranges[ 0 ] ); | 1177 | var docFragment = createDocumentFragmentFromRanges( ranges, editable ); |
1137 | 1178 | ||
1138 | return toString ? docFragment.getHtml() : docFragment; | 1179 | return toString ? docFragment.getHtml() : docFragment; |
1139 | }, | 1180 | }, |
diff --git a/sources/core/editor_basic.js b/sources/core/editor_basic.js index f81efb35..14f34460 100644 --- a/sources/core/editor_basic.js +++ b/sources/core/editor_basic.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/env.js b/sources/core/env.js index 1659071f..4410ce93 100644 --- a/sources/core/env.js +++ b/sources/core/env.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/event.js b/sources/core/event.js index a660f34b..0dd1f412 100644 --- a/sources/core/event.js +++ b/sources/core/event.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/eventInfo.js b/sources/core/eventInfo.js index db0ee390..e1cd65a3 100644 --- a/sources/core/eventInfo.js +++ b/sources/core/eventInfo.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/filter.js b/sources/core/filter.js index c85b6beb..e9d5a374 100644 --- a/sources/core/filter.js +++ b/sources/core/filter.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/focusmanager.js b/sources/core/focusmanager.js index b9c779bf..ee1bc39f 100644 --- a/sources/core/focusmanager.js +++ b/sources/core/focusmanager.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/htmldataprocessor.js b/sources/core/htmldataprocessor.js index 9bc9ef0b..d079e4d4 100644 --- a/sources/core/htmldataprocessor.js +++ b/sources/core/htmldataprocessor.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/htmlparser.js b/sources/core/htmlparser.js index 078fc3a9..dffde95e 100644 --- a/sources/core/htmlparser.js +++ b/sources/core/htmlparser.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/htmlparser/basicwriter.js b/sources/core/htmlparser/basicwriter.js index 705a4ac6..62a97ef1 100644 --- a/sources/core/htmlparser/basicwriter.js +++ b/sources/core/htmlparser/basicwriter.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/htmlparser/cdata.js b/sources/core/htmlparser/cdata.js index 2acba74f..4ece2b7e 100644 --- a/sources/core/htmlparser/cdata.js +++ b/sources/core/htmlparser/cdata.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/htmlparser/comment.js b/sources/core/htmlparser/comment.js index 1508d71a..171c62e4 100644 --- a/sources/core/htmlparser/comment.js +++ b/sources/core/htmlparser/comment.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/htmlparser/element.js b/sources/core/htmlparser/element.js index c4497dab..3654322a 100644 --- a/sources/core/htmlparser/element.js +++ b/sources/core/htmlparser/element.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/htmlparser/filter.js b/sources/core/htmlparser/filter.js index 06550641..72767b59 100644 --- a/sources/core/htmlparser/filter.js +++ b/sources/core/htmlparser/filter.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/htmlparser/fragment.js b/sources/core/htmlparser/fragment.js index 00e87909..c0629865 100644 --- a/sources/core/htmlparser/fragment.js +++ b/sources/core/htmlparser/fragment.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/htmlparser/node.js b/sources/core/htmlparser/node.js index a70dede1..0f1b3075 100644 --- a/sources/core/htmlparser/node.js +++ b/sources/core/htmlparser/node.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/htmlparser/text.js b/sources/core/htmlparser/text.js index d7b0d321..07cb8658 100644 --- a/sources/core/htmlparser/text.js +++ b/sources/core/htmlparser/text.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/keystrokehandler.js b/sources/core/keystrokehandler.js index 8d8b443b..e2a6bcdb 100644 --- a/sources/core/keystrokehandler.js +++ b/sources/core/keystrokehandler.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/lang.js b/sources/core/lang.js index f2417e8a..3519923a 100644 --- a/sources/core/lang.js +++ b/sources/core/lang.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
@@ -17,7 +17,7 @@ | |||
17 | * alert( CKEDITOR.lang.languages.en ); // 1 | 17 | * alert( CKEDITOR.lang.languages.en ); // 1 |
18 | */ | 18 | */ |
19 | languages: { | 19 | languages: { |
20 | af: 1, ar: 1, bg: 1, bn: 1, bs: 1, ca: 1, cs: 1, cy: 1, da: 1, de: 1, el: 1, | 20 | af: 1, ar: 1, bg: 1, bn: 1, bs: 1, ca: 1, cs: 1, cy: 1, da: 1, de: 1, 'de-ch': 1, el: 1, |
21 | 'en-au': 1, 'en-ca': 1, 'en-gb': 1, en: 1, eo: 1, es: 1, et: 1, eu: 1, fa: 1, fi: 1, fo: 1, | 21 | 'en-au': 1, 'en-ca': 1, 'en-gb': 1, en: 1, eo: 1, es: 1, et: 1, eu: 1, fa: 1, fi: 1, fo: 1, |
22 | 'fr-ca': 1, fr: 1, gl: 1, gu: 1, he: 1, hi: 1, hr: 1, hu: 1, id: 1, is: 1, it: 1, ja: 1, ka: 1, | 22 | 'fr-ca': 1, fr: 1, gl: 1, gu: 1, he: 1, hi: 1, hr: 1, hu: 1, id: 1, is: 1, it: 1, ja: 1, ka: 1, |
23 | km: 1, ko: 1, ku: 1, lt: 1, lv: 1, mk: 1, mn: 1, ms: 1, nb: 1, nl: 1, no: 1, pl: 1, 'pt-br': 1, | 23 | km: 1, ko: 1, ku: 1, lt: 1, lv: 1, mk: 1, mn: 1, ms: 1, nb: 1, nl: 1, no: 1, pl: 1, 'pt-br': 1, |
diff --git a/sources/core/loader.js b/sources/core/loader.js index 298106a6..5a108dff 100644 --- a/sources/core/loader.js +++ b/sources/core/loader.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/log.js b/sources/core/log.js index 8461021d..69816128 100644 --- a/sources/core/log.js +++ b/sources/core/log.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/plugindefinition.js b/sources/core/plugindefinition.js index 4d8b1139..caff9575 100644 --- a/sources/core/plugindefinition.js +++ b/sources/core/plugindefinition.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/plugins.js b/sources/core/plugins.js index 66f500d1..8e6c9528 100644 --- a/sources/core/plugins.js +++ b/sources/core/plugins.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/resourcemanager.js b/sources/core/resourcemanager.js index af7d12e0..7ba88a8f 100644 --- a/sources/core/resourcemanager.js +++ b/sources/core/resourcemanager.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/scriptloader.js b/sources/core/scriptloader.js index a6bcbd2b..9ad536e5 100644 --- a/sources/core/scriptloader.js +++ b/sources/core/scriptloader.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/selection.js b/sources/core/selection.js index fec3b7fc..573b890e 100644 --- a/sources/core/selection.js +++ b/sources/core/selection.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
@@ -138,72 +138,81 @@ | |||
138 | return false; | 138 | return false; |
139 | } | 139 | } |
140 | 140 | ||
141 | function createFillingChar( element ) { | 141 | function createFillingCharSequenceNode( editable ) { |
142 | removeFillingChar( element, false ); | 142 | removeFillingCharSequenceNode( editable, false ); |
143 | 143 | ||
144 | var fillingChar = element.getDocument().createText( '\u200B' ); | 144 | var fillingChar = editable.getDocument().createText( fillingCharSequence ); |
145 | element.setCustomData( 'cke-fillingChar', fillingChar ); | 145 | editable.setCustomData( 'cke-fillingChar', fillingChar ); |
146 | 146 | ||
147 | return fillingChar; | 147 | return fillingChar; |
148 | } | 148 | } |
149 | 149 | ||
150 | function getFillingChar( element ) { | ||
151 | return element.getCustomData( 'cke-fillingChar' ); | ||
152 | } | ||
153 | |||
154 | // Checks if a filling char has been used, eventualy removing it (#1272). | 150 | // Checks if a filling char has been used, eventualy removing it (#1272). |
155 | function checkFillingChar( element ) { | 151 | function checkFillingCharSequenceNodeReady( editable ) { |
156 | var fillingChar = getFillingChar( element ); | 152 | var fillingChar = editable.getCustomData( 'cke-fillingChar' ); |
153 | |||
157 | if ( fillingChar ) { | 154 | if ( fillingChar ) { |
158 | // Use this flag to avoid removing the filling char right after | 155 | // Use this flag to avoid removing the filling char right after |
159 | // creating it. | 156 | // creating it. |
160 | if ( fillingChar.getCustomData( 'ready' ) ) | 157 | if ( fillingChar.getCustomData( 'ready' ) ) { |
161 | removeFillingChar( element ); | 158 | removeFillingCharSequenceNode( editable ); |
162 | else | 159 | } else { |
163 | fillingChar.setCustomData( 'ready', 1 ); | 160 | fillingChar.setCustomData( 'ready', 1 ); |
161 | } | ||
164 | } | 162 | } |
165 | } | 163 | } |
166 | 164 | ||
167 | function removeFillingChar( element, keepSelection ) { | 165 | function removeFillingCharSequenceNode( editable, keepSelection ) { |
168 | var fillingChar = element && element.removeCustomData( 'cke-fillingChar' ); | 166 | var fillingChar = editable && editable.removeCustomData( 'cke-fillingChar' ); |
169 | if ( fillingChar ) { | ||
170 | 167 | ||
168 | if ( fillingChar ) { | ||
171 | // Text selection position might get mangled by | 169 | // Text selection position might get mangled by |
172 | // subsequent dom modification, save it now for restoring. (#8617) | 170 | // subsequent dom modification, save it now for restoring. (#8617) |
173 | if ( keepSelection !== false ) { | 171 | if ( keepSelection !== false ) { |
174 | var bm, | 172 | var sel = editable.getDocument().getSelection().getNative(), |
175 | sel = element.getDocument().getSelection().getNative(), | ||
176 | // Be error proof. | 173 | // Be error proof. |
177 | range = sel && sel.type != 'None' && sel.getRangeAt( 0 ); | 174 | range = sel && sel.type != 'None' && sel.getRangeAt( 0 ), |
175 | fillingCharSeqLength = fillingCharSequence.length; | ||
178 | 176 | ||
179 | if ( fillingChar.getLength() > 1 && range && range.intersectsNode( fillingChar.$ ) ) { | 177 | // If there's some text other than the sequence in the FC text node and the range |
180 | bm = createNativeSelectionBookmark( sel ); | 178 | // intersects with that node... |
179 | if ( fillingChar.getLength() > fillingCharSeqLength && range && range.intersectsNode( fillingChar.$ ) ) { | ||
180 | var bm = createNativeSelectionBookmark( sel ); | ||
181 | |||
182 | // Correct start offset anticipating the removal of FC. | ||
183 | if ( sel.anchorNode == fillingChar.$ && sel.anchorOffset > fillingCharSeqLength ) { | ||
184 | bm[ 0 ].offset -= fillingCharSeqLength; | ||
185 | } | ||
181 | 186 | ||
182 | // Anticipate the offset change brought by the removed char. | 187 | // Correct end offset anticipating the removal of FC. |
183 | var startAffected = sel.anchorNode == fillingChar.$ && sel.anchorOffset > 0, | 188 | if ( sel.focusNode == fillingChar.$ && sel.focusOffset > fillingCharSeqLength ) { |
184 | endAffected = sel.focusNode == fillingChar.$ && sel.focusOffset > 0; | 189 | bm[ 1 ].offset -= fillingCharSeqLength; |
185 | startAffected && bm[ 0 ].offset--; | 190 | } |
186 | endAffected && bm[ 1 ].offset--; | ||
187 | } | 191 | } |
188 | } | 192 | } |
189 | 193 | ||
190 | // We can't simply remove the filling node because the user | 194 | // We can't simply remove the filling node because the user |
191 | // will actually enlarge it when typing, so we just remove the | 195 | // will actually enlarge it when typing, so we just remove the |
192 | // invisible char from it. | 196 | // invisible char from it. |
193 | fillingChar.setText( replaceFillingChar( fillingChar.getText() ) ); | 197 | fillingChar.setText( removeFillingCharSequenceString( fillingChar.getText(), 1 ) ); |
194 | 198 | ||
195 | // Restore the bookmark preserving selection's direction. | 199 | // Restore the bookmark preserving selection's direction. |
196 | if ( bm ) { | 200 | if ( bm ) { |
197 | moveNativeSelectionToBookmark( element.getDocument().$, bm ); | 201 | moveNativeSelectionToBookmark( editable.getDocument().$, bm ); |
198 | } | 202 | } |
199 | } | 203 | } |
200 | } | 204 | } |
201 | 205 | ||
202 | function replaceFillingChar( html ) { | 206 | // #13816 |
203 | return html.replace( /\u200B( )?/g, function( match ) { | 207 | function removeFillingCharSequenceString( str, nbspAware ) { |
204 | // #10291 if filling char is followed by a space replace it with nbsp. | 208 | if ( nbspAware ) { |
205 | return match[ 1 ] ? '\xa0' : ''; | 209 | return str.replace( fillingCharSequenceRegExp, function( m, p ) { |
206 | } ); | 210 | // #10291 if filling char is followed by a space replace it with NBSP. |
211 | return p ? '\xa0' : ''; | ||
212 | } ); | ||
213 | } else { | ||
214 | return str.replace( fillingCharSequence, '' ); | ||
215 | } | ||
207 | } | 216 | } |
208 | 217 | ||
209 | function createNativeSelectionBookmark( sel ) { | 218 | function createNativeSelectionBookmark( sel ) { |
@@ -724,7 +733,7 @@ | |||
724 | case 8: // BACKSPACE | 733 | case 8: // BACKSPACE |
725 | case 45: // INS | 734 | case 45: // INS |
726 | case 46: // DEl | 735 | case 46: // DEl |
727 | removeFillingChar( editable ); | 736 | removeFillingCharSequenceNode( editable ); |
728 | } | 737 | } |
729 | 738 | ||
730 | }, null, null, -1 ); | 739 | }, null, null, -1 ); |
@@ -839,65 +848,39 @@ | |||
839 | } | 848 | } |
840 | } ); | 849 | } ); |
841 | 850 | ||
842 | CKEDITOR.on( 'instanceReady', function( evt ) { | 851 | // On WebKit only, we need a special "filling" char on some situations |
843 | var editor = evt.editor, | 852 | // (#1272). Here we set the events that should invalidate that char. |
844 | fillingCharBefore, | 853 | if ( CKEDITOR.env.webkit ) { |
845 | selectionBookmark; | 854 | CKEDITOR.on( 'instanceReady', function( evt ) { |
855 | var editor = evt.editor; | ||
846 | 856 | ||
847 | // On WebKit only, we need a special "filling" char on some situations | ||
848 | // (#1272). Here we set the events that should invalidate that char. | ||
849 | if ( CKEDITOR.env.webkit ) { | ||
850 | editor.on( 'selectionChange', function() { | 857 | editor.on( 'selectionChange', function() { |
851 | checkFillingChar( editor.editable() ); | 858 | checkFillingCharSequenceNodeReady( editor.editable() ); |
852 | }, null, null, -1 ); | 859 | }, null, null, -1 ); |
860 | |||
853 | editor.on( 'beforeSetMode', function() { | 861 | editor.on( 'beforeSetMode', function() { |
854 | removeFillingChar( editor.editable() ); | 862 | removeFillingCharSequenceNode( editor.editable() ); |
855 | }, null, null, -1 ); | 863 | }, null, null, -1 ); |
856 | 864 | ||
857 | editor.on( 'beforeUndoImage', beforeData ); | 865 | // Filter Undo snapshot's HTML to get rid of Filling Char Sequence. |
858 | editor.on( 'afterUndoImage', afterData ); | 866 | // Note: CKEDITOR.dom.range.createBookmark2() normalizes snapshot's |
859 | editor.on( 'beforeGetData', beforeData, null, null, 0 ); | 867 | // bookmarks to anticipate the removal of FCSeq from the snapshot's HTML (#13816). |
860 | editor.on( 'getData', afterData ); | 868 | editor.on( 'getSnapshot', function( evt ) { |
861 | } | 869 | if ( evt.data ) { |
862 | 870 | evt.data = removeFillingCharSequenceString( evt.data ); | |
863 | function beforeData() { | ||
864 | var editable = editor.editable(); | ||
865 | if ( !editable ) | ||
866 | return; | ||
867 | |||
868 | var fillingChar = getFillingChar( editable ); | ||
869 | |||
870 | if ( fillingChar ) { | ||
871 | // If the selection's focus or anchor is located in the filling char's text node, | ||
872 | // we need to restore the selection in afterData, because it will be lost | ||
873 | // when setting text. Selection's direction must be preserved. | ||
874 | // (#7437, #12489, #12491 comment:3) | ||
875 | var sel = editor.document.$.getSelection(); | ||
876 | if ( sel.type != 'None' && ( sel.anchorNode == fillingChar.$ || sel.focusNode == fillingChar.$ ) ) | ||
877 | selectionBookmark = createNativeSelectionBookmark( sel ); | ||
878 | |||
879 | fillingCharBefore = fillingChar.getText(); | ||
880 | fillingChar.setText( replaceFillingChar( fillingCharBefore ) ); | ||
881 | } | ||
882 | } | ||
883 | |||
884 | function afterData() { | ||
885 | var editable = editor.editable(); | ||
886 | if ( !editable ) | ||
887 | return; | ||
888 | |||
889 | var fillingChar = getFillingChar( editable ); | ||
890 | |||
891 | if ( fillingChar ) { | ||
892 | fillingChar.setText( fillingCharBefore ); | ||
893 | |||
894 | if ( selectionBookmark ) { | ||
895 | moveNativeSelectionToBookmark( editor.document.$, selectionBookmark ); | ||
896 | selectionBookmark = null; | ||
897 | } | 871 | } |
898 | } | 872 | }, editor, null, 20 ); |
899 | } | 873 | |
900 | } ); | 874 | // Filter data to get rid of Filling Char Sequence. Filter on #toDataFormat |
875 | // instead of #getData because once removed, FCSeq may leave an empty element, | ||
876 | // which should be pruned by the dataProcessor (#13816). | ||
877 | // Note: Used low priority to filter when dataProcessor works on strings, | ||
878 | // not pseudo–DOM. | ||
879 | editor.on( 'toDataFormat', function( evt ) { | ||
880 | evt.data.dataValue = removeFillingCharSequenceString( evt.data.dataValue ); | ||
881 | }, null, null, 0 ); | ||
882 | } ); | ||
883 | } | ||
901 | 884 | ||
902 | /** | 885 | /** |
903 | * Check the selection change in editor and potentially fires | 886 | * Check the selection change in editor and potentially fires |
@@ -1159,6 +1142,25 @@ | |||
1159 | var styleObjectElements = { img: 1, hr: 1, li: 1, table: 1, tr: 1, td: 1, th: 1, embed: 1, object: 1, ol: 1, ul: 1, | 1142 | var styleObjectElements = { img: 1, hr: 1, li: 1, table: 1, tr: 1, td: 1, th: 1, embed: 1, object: 1, ol: 1, ul: 1, |
1160 | a: 1, input: 1, form: 1, select: 1, textarea: 1, button: 1, fieldset: 1, thead: 1, tfoot: 1 }; | 1143 | a: 1, input: 1, form: 1, select: 1, textarea: 1, button: 1, fieldset: 1, thead: 1, tfoot: 1 }; |
1161 | 1144 | ||
1145 | // #13816 | ||
1146 | var fillingCharSequence = CKEDITOR.tools.repeat( '\u200b', 7 ), | ||
1147 | fillingCharSequenceRegExp = new RegExp( fillingCharSequence + '( )?', 'g' ); | ||
1148 | |||
1149 | CKEDITOR.tools.extend( CKEDITOR.dom.selection, { | ||
1150 | _removeFillingCharSequenceString: removeFillingCharSequenceString, | ||
1151 | _createFillingCharSequenceNode: createFillingCharSequenceNode, | ||
1152 | |||
1153 | /** | ||
1154 | * The sequence used in a WebKit-based browser to create a Filling Character. By default it is | ||
1155 | * a string of 7 zero-width space characters (U+200B). | ||
1156 | * | ||
1157 | * @since 4.5.7 | ||
1158 | * @readonly | ||
1159 | * @property {String} | ||
1160 | */ | ||
1161 | FILLING_CHAR_SEQUENCE: fillingCharSequence | ||
1162 | } ); | ||
1163 | |||
1162 | CKEDITOR.dom.selection.prototype = { | 1164 | CKEDITOR.dom.selection.prototype = { |
1163 | /** | 1165 | /** |
1164 | * Gets the native selection object from the browser. | 1166 | * Gets the native selection object from the browser. |
@@ -1899,7 +1901,7 @@ | |||
1899 | if ( range.collapsed && CKEDITOR.env.webkit && rangeRequiresFix( range ) ) { | 1901 | if ( range.collapsed && CKEDITOR.env.webkit && rangeRequiresFix( range ) ) { |
1900 | // Append a zero-width space so WebKit will not try to | 1902 | // Append a zero-width space so WebKit will not try to |
1901 | // move the selection by itself (#1272). | 1903 | // move the selection by itself (#1272). |
1902 | var fillingChar = createFillingChar( this.root ); | 1904 | var fillingChar = createFillingCharSequenceNode( this.root ); |
1903 | range.insertNode( fillingChar ); | 1905 | range.insertNode( fillingChar ); |
1904 | 1906 | ||
1905 | next = fillingChar.getNext(); | 1907 | next = fillingChar.getNext(); |
@@ -1908,7 +1910,7 @@ | |||
1908 | // having something before it, it'll not blink. | 1910 | // having something before it, it'll not blink. |
1909 | // Let's remove it in this case. | 1911 | // Let's remove it in this case. |
1910 | if ( next && !fillingChar.getPrevious() && next.type == CKEDITOR.NODE_ELEMENT && next.getName() == 'br' ) { | 1912 | if ( next && !fillingChar.getPrevious() && next.type == CKEDITOR.NODE_ELEMENT && next.getName() == 'br' ) { |
1911 | removeFillingChar( this.root ); | 1913 | removeFillingCharSequenceNode( this.root ); |
1912 | range.moveToPosition( next, CKEDITOR.POSITION_BEFORE_START ); | 1914 | range.moveToPosition( next, CKEDITOR.POSITION_BEFORE_START ); |
1913 | } else { | 1915 | } else { |
1914 | range.moveToPosition( fillingChar, CKEDITOR.POSITION_AFTER_END ); | 1916 | range.moveToPosition( fillingChar, CKEDITOR.POSITION_AFTER_END ); |
diff --git a/sources/core/skin.js b/sources/core/skin.js index 143a7346..98b85361 100644 --- a/sources/core/skin.js +++ b/sources/core/skin.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/style.js b/sources/core/style.js index 619358b5..09b117ba 100644 --- a/sources/core/style.js +++ b/sources/core/style.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/template.js b/sources/core/template.js index d3fe0b90..a3fe55b5 100644 --- a/sources/core/template.js +++ b/sources/core/template.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/tools.js b/sources/core/tools.js index 0cf824f9..ae5b4d0f 100644 --- a/sources/core/tools.js +++ b/sources/core/tools.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||
diff --git a/sources/core/ui.js b/sources/core/ui.js index 985a4f82..29ab0adb 100644 --- a/sources/core/ui.js +++ b/sources/core/ui.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, 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 | ||