Skip to content

Commit

Permalink
Merge branch 't/13460'
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinmar committed Jul 7, 2015
2 parents 9f81178 + 57b437b commit e561d84
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -10,6 +10,7 @@ Fixed Issues:
* [#13129](http://dev.ckeditor.com/ticket/13129) Fixed: Block widget blurred after drop followed by undo.
* [#13468](http://dev.ckeditor.com/ticket/13468): [IE] Fixed: Binding drag&drop `dataTransfer` does not work if `text` data was set in the meantime.
* [#13419](http://dev.ckeditor.com/ticket/13419): Fixed: [Auto Link](http://ckeditor.com/addon/autolink) plugin does not encode double quotes in URLs.
* [#13460](http://dev.ckeditor.com/ticket/13460): [IE8] Fixed: Copying inline widgets is broken when the Advanced Content Filter is disabled.

## CKEditor 4.5.1

Expand Down
4 changes: 3 additions & 1 deletion plugins/widget/plugin.js
Expand Up @@ -2334,7 +2334,9 @@
'<span [^>]*data-cke-copybin-start="1"[^>]*>.?</span>([\\s\\S]+)<span [^>]*data-cke-copybin-end="1"[^>]*>.?</span>' +
'(?:</(?:div|span)>)?' +
'(?:</(?:div|span)>)?' +
'$'
'$',
// IE8 prefers uppercase when browsers stick to lowercase HTML (#13460).
'i'
);

function pasteReplaceFn( match, wrapperHtml ) {
Expand Down
42 changes: 41 additions & 1 deletion tests/plugins/widget/widgetsintegration.js
@@ -1,4 +1,4 @@
/* bender-tags: widgetcore */
/* bender-tags: widgetcore, 13460 */
/* bender-include: _helpers/tools.js */
/* global widgetTestsTools */

Expand Down Expand Up @@ -668,6 +668,46 @@
} );
},

// #13460
'test pasting a widget with lots of extra markup and mixed HTML case': function() {
var editor = this.editor;

this.editorBot.setData( '<p id="p1">A<span data-widget="test2" id="w1">A</span>B</p>', function() {
var widget = getWidgetById( editor, 'w1' ),
html = widget.wrapper.getOuterHtml();

editor.widgets.del( widget );

editor.focus();

var range = editor.createRange();
range.setStartAt( editor.document.getById( 'p1' ), CKEDITOR.POSITION_BEFORE_END );
range.collapse( true );
range.select();

editor.once( 'afterPaste', function() {
resume( function() {
var widget = getWidgetById( editor, 'w1' );

assert.isTrue( !!widget, 'widget was pasted' );
assert.areSame( '<p id="p1">AB<span data-widget="test2" id="w1">A</span></p>', editor.getData() );
assert.areSame( widget, editor.widgets.focused, 'widget is selected' );
} );
} );

// Ensure async.
wait( function() {
editor.execCommand( 'paste',
'<SPAN style="POSITION: absolute; WIDTH: 1px; HEIGHT: 1px; OVERFLOW: hidden; LEFT: -5000px">' +
'<SPAN data-cke-copybin-start="1" foo="1">\u200b</SPAN>' +
html +
'<SPAN data-cke-copybin-end="1">\u200b</SPAN>' +
'</SPAN>'
);
} );
} );
},

'test copying widget with context': function() {
var editor = this.editor;

Expand Down

0 comments on commit e561d84

Please sign in to comment.