diff --git a/CHANGES.md b/CHANGES.md index 53a3ec5685a..42729e416ce 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -21,6 +21,7 @@ Fixed Issues: * [#862](https://github.com/ckeditor/ckeditor-dev/issues/862): Fixed: "Object Styles" group in [Styles Combo](https://ckeditor.com/addon/stylescombo) plugin is visible only if whole element is selected. * [#994](https://github.com/ckeditor/ckeditor-dev/pull/994): Fixed: Typo in [`CKEDITOR.focusManager.focus`](https://docs.ckeditor.com/#!/api/CKEDITOR.focusManager-method-focus) API documentation. Thanks to [benjy](https://github.com/benjy)! * [#1014](https://github.com/ckeditor/ckeditor-dev/issues/1014): Fixed: [Table Tools](https://ckeditor.com/addon/tabletools) cell properties dialog is now [ACF](http://docs.ckeditor.com/#!/guide/dev_acf) aware - it not possible to change cell width/height if corresponding styles are disabled. +* [#877](https://github.com/ckeditor/ckeditor-dev/issues/877): Fixed: Lists with custom bullets with exotic characters crashes editor when [pasted from Word](http://ckeditor.com/addon/pastefromword). Other Changes: diff --git a/plugins/pastefromword/filter/default.js b/plugins/pastefromword/filter/default.js index 0098728ff7e..05572c596c0 100644 --- a/plugins/pastefromword/filter/default.js +++ b/plugins/pastefromword/filter/default.js @@ -1085,7 +1085,8 @@ symbol = element.attributes[ 'cke-symbol' ]; element.forEach( function( node ) { - if ( !removed && node.value.match( symbol.replace( ')', '\\)' ).replace( '(', '' ) ) ) { + // Since symbol may contains special characters we use `indexOf` (instead of RegExp) which is sufficient (#877). + if ( !removed && node.value.indexOf( symbol ) > -1 ) { node.value = node.value.replace( symbol, '' ); diff --git a/tests/plugins/pastefromword/generated/_fixtures/Unordered_list_special_char_bullet/Unordered_list_special_char_bullet.docx b/tests/plugins/pastefromword/generated/_fixtures/Unordered_list_special_char_bullet/Unordered_list_special_char_bullet.docx new file mode 100644 index 00000000000..6605e78bc27 Binary files /dev/null and b/tests/plugins/pastefromword/generated/_fixtures/Unordered_list_special_char_bullet/Unordered_list_special_char_bullet.docx differ diff --git a/tests/plugins/pastefromword/generated/_fixtures/Unordered_list_special_char_bullet/expected.html b/tests/plugins/pastefromword/generated/_fixtures/Unordered_list_special_char_bullet/expected.html new file mode 100644 index 00000000000..d34ecdb1e4e --- /dev/null +++ b/tests/plugins/pastefromword/generated/_fixtures/Unordered_list_special_char_bullet/expected.html @@ -0,0 +1,27 @@ + diff --git a/tests/plugins/pastefromword/generated/_fixtures/Unordered_list_special_char_bullet/word2013/chrome.html b/tests/plugins/pastefromword/generated/_fixtures/Unordered_list_special_char_bullet/word2013/chrome.html new file mode 100644 index 00000000000..a296a2aec58 --- /dev/null +++ b/tests/plugins/pastefromword/generated/_fixtures/Unordered_list_special_char_bullet/word2013/chrome.html @@ -0,0 +1,916 @@ + + + + + + + + + + + + + + + + + + + +

*      +One

+ +

+     +Two

+ +

?      +Three

+ + + + + diff --git a/tests/plugins/pastefromword/generated/_fixtures/Unordered_list_special_char_bullet/word2013/expected_ie11.html b/tests/plugins/pastefromword/generated/_fixtures/Unordered_list_special_char_bullet/word2013/expected_ie11.html new file mode 100644 index 00000000000..f489790ae45 --- /dev/null +++ b/tests/plugins/pastefromword/generated/_fixtures/Unordered_list_special_char_bullet/word2013/expected_ie11.html @@ -0,0 +1,33 @@ + diff --git a/tests/plugins/pastefromword/generated/_fixtures/Unordered_list_special_char_bullet/word2013/firefox.html b/tests/plugins/pastefromword/generated/_fixtures/Unordered_list_special_char_bullet/word2013/firefox.html new file mode 100644 index 00000000000..a296a2aec58 --- /dev/null +++ b/tests/plugins/pastefromword/generated/_fixtures/Unordered_list_special_char_bullet/word2013/firefox.html @@ -0,0 +1,916 @@ + + + + + + + + + + + + + + + + + + + +

*      +One

+ +

+     +Two

+ +

?      +Three

+ + + + + diff --git a/tests/plugins/pastefromword/generated/_fixtures/Unordered_list_special_char_bullet/word2013/ie11.html b/tests/plugins/pastefromword/generated/_fixtures/Unordered_list_special_char_bullet/word2013/ie11.html new file mode 100644 index 00000000000..0950599927a --- /dev/null +++ b/tests/plugins/pastefromword/generated/_fixtures/Unordered_list_special_char_bullet/word2013/ie11.html @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/tests/plugins/pastefromword/generated/generic.js b/tests/plugins/pastefromword/generated/generic.js index a5996dca024..376c97d2907 100644 --- a/tests/plugins/pastefromword/generated/generic.js +++ b/tests/plugins/pastefromword/generated/generic.js @@ -46,13 +46,16 @@ 'Text_alignment': true, 'Underline': true, 'Unordered_list': true, + 'Unordered_list_special_char_bullet': true, 'Table_alignment': true, 'Table_vertical_alignment': true }, testData: { _should: { ignore: { - 'test Object word2013 datatransfer': CKEDITOR.env.edge + 'test Object word2013 datatransfer': CKEDITOR.env.edge, + 'test Unordered_list_special_char_bullet word2013 chrome': CKEDITOR.env.edge, + 'test Unordered_list_special_char_bullet word2013 firefox': CKEDITOR.env.edge } } }, diff --git a/tests/plugins/pastefromword/manual/unorderedlistspecialchar.html b/tests/plugins/pastefromword/manual/unorderedlistspecialchar.html new file mode 100644 index 00000000000..cde2278b009 --- /dev/null +++ b/tests/plugins/pastefromword/manual/unorderedlistspecialchar.html @@ -0,0 +1,4 @@ + + diff --git a/tests/plugins/pastefromword/manual/unorderedlistspecialchar.md b/tests/plugins/pastefromword/manual/unorderedlistspecialchar.md new file mode 100644 index 00000000000..91dc916ee8d --- /dev/null +++ b/tests/plugins/pastefromword/manual/unorderedlistspecialchar.md @@ -0,0 +1,16 @@ +@bender-tags: bug, 4.8.0, 877, pastefromword +@bender-ui: collapsed +@bender-ckeditor-plugins: wysiwygarea, toolbar, undo, pastefromword, sourcearea, list + +---- +1. Open browser console. +1. Open [Unordered_list_special_char_bullet.docx](../generated/_fixtures/Unordered_list_special_char_bullet/Unordered_list_special_char_bullet.docx) in Word. +1. Select and copy whole content from Word. +1. Focus CKEditor. +1. Paste copied Word content into the editor. + +### Expected +List is pasted to the editor. + +### Unexpected +Error appears in browser console and list is not pasted to the editor.