From e7168175a7a465597aea5f40573d7768816453fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20Reinmar=20Koszuli=C5=84ski?= Date: Tue, 20 Aug 2013 14:22:02 +0200 Subject: [PATCH 1/3] Removed outdated code stripping anchors pasted from MSWord. --- plugins/pastefromword/filter/default.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/plugins/pastefromword/filter/default.js b/plugins/pastefromword/filter/default.js index 02b1d0a892d..d34500a303d 100644 --- a/plugins/pastefromword/filter/default.js +++ b/plugins/pastefromword/filter/default.js @@ -952,21 +952,20 @@ }, // Migrate basic style formats to editor configured ones. - 'b': elementMigrateFilter( config[ 'coreStyles_bold' ] ), - 'i': elementMigrateFilter( config[ 'coreStyles_italic' ] ), - 'u': elementMigrateFilter( config[ 'coreStyles_underline' ] ), - 's': elementMigrateFilter( config[ 'coreStyles_strike' ] ), - 'sup': elementMigrateFilter( config[ 'coreStyles_superscript' ] ), - 'sub': elementMigrateFilter( config[ 'coreStyles_subscript' ] ), - // Editor doesn't support anchor with content currently (#3582), - // drop such anchors with content preserved. - 'a': function( element ) { + b: elementMigrateFilter( config[ 'coreStyles_bold' ] ), + i: elementMigrateFilter( config[ 'coreStyles_italic' ] ), + u: elementMigrateFilter( config[ 'coreStyles_underline' ] ), + s: elementMigrateFilter( config[ 'coreStyles_strike' ] ), + sup: elementMigrateFilter( config[ 'coreStyles_superscript' ] ), + sub: elementMigrateFilter( config[ 'coreStyles_subscript' ] ), + + // Remove full paths from links to anchors. + a: function( element ) { var attrs = element.attributes; - if ( attrs && !attrs.href && attrs.name ) - delete element.name; - else if ( CKEDITOR.env.webkit && attrs.href && attrs.href.match( /file:\/\/\/[\S]+#/i ) ) + if ( CKEDITOR.env.webkit && attrs.href && attrs.href.match( /file:\/\/\/[\S]+#/i ) ) attrs.href = attrs.href.replace( /file:\/\/\/[^#]+/i, '' ); }, + 'cke:listbullet': function( element ) { if ( element.getAncestor( /h\d/ ) && !config.pasteFromWordNumberedHeadingToList ) delete element.name; From b48acfa07134ec66693781854fbd6ba123be0e07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20Reinmar=20Koszuli=C5=84ski?= Date: Tue, 20 Aug 2013 14:24:41 +0200 Subject: [PATCH 2/3] Promoted links to anchors fix to all browsers, because IEs paste full paths too. --- plugins/pastefromword/filter/default.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/pastefromword/filter/default.js b/plugins/pastefromword/filter/default.js index d34500a303d..643815e48b9 100644 --- a/plugins/pastefromword/filter/default.js +++ b/plugins/pastefromword/filter/default.js @@ -962,8 +962,8 @@ // Remove full paths from links to anchors. a: function( element ) { var attrs = element.attributes; - if ( CKEDITOR.env.webkit && attrs.href && attrs.href.match( /file:\/\/\/[\S]+#/i ) ) - attrs.href = attrs.href.replace( /file:\/\/\/[^#]+/i, '' ); + if ( attrs.href && attrs.href.match( /^file:\/\/\/[\S]+#/i ) ) + attrs.href = attrs.href.replace( /^file:\/\/\/[^#]+/i, '' ); }, 'cke:listbullet': function( element ) { From cbc0fa27851a3293c5f651a3aab8e243aec36869 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20Reinmar=20Koszuli=C5=84ski?= Date: Tue, 27 Aug 2013 14:08:12 +0200 Subject: [PATCH 3/3] Changelog entry. --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 31ca36b6b65..9f2d24d57c0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,7 @@ CKEditor 4 Changelog ## CKEditor 4.2.1 +* [#9330](http://dev.ckeditor.com/ticket/9330): Fixed pasting anchors from MS Word. * [#8103](http://dev.ckeditor.com/ticket/8103): Fixed pasting nested lists from MS Word. * [#10662](http://dev.ckeditor.com/ticket/10662): Fixed styles from Styles drop-down list not registered to the ACF in case when [Shared Spaces plugin](http://ckeditor.com/addon/sharedspace) is used. * [#9654](http://dev.ckeditor.com/ticket/9654): Problems with IE10 Quirks mode.