Skip to content

Commit 1a7833e

Browse files
committed
Merge branch 't/10887' into major
2 parents dd70588 + 517dc15 commit 1a7833e

File tree

6 files changed

+55
-14
lines changed

6 files changed

+55
-14
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Fixed Issues:
4848
* [#10911](http://dev.ckeditor.com/ticket/10911): Browser alt hotkeys will no longer be blocked while widget is focused.
4949
* [#11082](http://dev.ckeditor.com/ticket/11082): Selected widget is not copied/cut when using toolbar buttons or context menu.
5050
* [#11083](http://dev.ckeditor.com/ticket/11083): Fixed lists and divs application to block widgets.
51+
* [#10887](http://dev.ckeditor.com/ticket/10887): Internet Explorer 8 compatibility issues related to the Widget System.
5152

5253
## CKEditor 4.3 Beta
5354

core/htmldataprocessor.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,11 @@
545545
attributeNames: [
546546
// Event attributes (onXYZ) must not be directly set. They can become
547547
// active in the editing area (IE|WebKit).
548-
[ ( /^on/ ), 'data-cke-pa-on' ]
548+
[ ( /^on/ ), 'data-cke-pa-on' ],
549+
550+
// Don't let some old expando enter editor. Concerns only IE8,
551+
// but for consistency remove on all browsers.
552+
[ ( /^data-cke-expando$/ ), '' ]
549553
]
550554
};
551555

plugins/clipboard/plugin.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,10 @@
683683
var pastebin = new CKEDITOR.dom.element(
684684
( CKEDITOR.env.webkit || editable.is( 'body' ) ) && !( CKEDITOR.env.ie || CKEDITOR.env.opera ) ? 'body' : 'div', doc );
685685

686-
pastebin.setAttribute( 'id', 'cke_pastebin' );
686+
pastebin.setAttributes( {
687+
id: 'cke_pastebin',
688+
'data-cke-temp': '1'
689+
} );
687690

688691
// Append bogus to prevent Opera from doing this. (#9522)
689692
if ( CKEDITOR.env.opera )

plugins/forms/plugin.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,10 @@ CKEDITOR.plugins.add( 'forms', {
242242
dataFilter = dataProcessor && dataProcessor.dataFilter;
243243

244244
// Cleanup certain IE form elements default values.
245+
// Note: Inputs are marked with contenteditable=false flags, so filters for them
246+
// need to be applied to non-editable content as well.
245247
if ( CKEDITOR.env.ie ) {
246-
htmlFilter && htmlFilter.addRules({
248+
htmlFilter && htmlFilter.addRules( {
247249
elements: {
248250
input: function( input ) {
249251
var attrs = input.attributes,
@@ -255,18 +257,18 @@ CKEDITOR.plugins.add( 'forms', {
255257
attrs.value == 'on' && delete attrs.value;
256258
}
257259
}
258-
});
260+
}, { applyToAll: true } );
259261
}
260262

261263
if ( dataFilter ) {
262-
dataFilter.addRules({
264+
dataFilter.addRules( {
263265
elements: {
264266
input: function( element ) {
265267
if ( element.attributes.type == 'hidden' )
266268
return editor.createFakeParserElement( element, 'cke_hidden', 'hiddenfield' );
267269
}
268270
}
269-
});
271+
}, { applyToAll: true } );
270272
}
271273
}
272274
});

plugins/image2/plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@
597597
if ( childName != 'img' && !( childName == 'figure' && child.hasClass( 'caption' ) ) )
598598
return false;
599599

600-
var styles = CKEDITOR.tools.parseCssText( el.attributes.style || '' );
600+
var styles = CKEDITOR.tools.parseCssText( el.attributes.style || '', true );
601601

602602
// Centering wrapper got to be... centering.
603603
if ( styles[ 'text-align' ] == 'center' )

plugins/widget/plugin.js

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,9 @@
293293
for ( i = 0, count = wrappers.count(); i < count; i++ ) {
294294
wrapper = wrappers.getItem( i );
295295

296-
if ( !this.getByElement( wrapper, true ) ) {
296+
// Check if there's no instance for this widget and that
297+
// wrapper is not inside some temporary element like copybin (#11088).
298+
if ( !this.getByElement( wrapper, true ) && !findParent( wrapper, isTemp2 ) ) {
297299
// Add cke_widget_new class because otherwise
298300
// widget will not be created on such wrapper.
299301
wrapper.addClass( 'cke_widget_new' );
@@ -1542,6 +1544,20 @@
15421544
return filter;
15431545
}
15441546

1547+
// Finds a first parent that matches query.
1548+
//
1549+
// @param {CKEDITOR.dom.element} element
1550+
// @param {Function} query
1551+
function findParent( element, query ) {
1552+
var parent = element;
1553+
1554+
while ( ( parent = parent.getParent() ) ) {
1555+
if ( query( parent ) )
1556+
return true;
1557+
}
1558+
return false;
1559+
}
1560+
15451561
// Gets nested editable if node is its descendant or the editable itself.
15461562
//
15471563
// @param {CKEDITOR.dom.element} guard Stop ancestor search on this node (usually editor's editable).
@@ -1639,6 +1655,11 @@
16391655
return node.type == CKEDITOR.NODE_ELEMENT && node.hasAttribute( 'data-cke-widget-editable' );
16401656
}
16411657

1658+
// @param {CKEDITOR.dom.element}
1659+
function isTemp2( element ) {
1660+
return element.hasAttribute( 'data-cke-temp' );
1661+
}
1662+
16421663
function moveSelectionToDropPosition( editor, dropEvt ) {
16431664
var $evt = dropEvt.data.$,
16441665
$range,
@@ -1770,14 +1791,20 @@
17701791
// * We use spans on IE and blockless editors, but divs in other cases.
17711792
var pasteReplaceRegex = new RegExp(
17721793
'^' +
1773-
'(?:<(?:div|span)(?: id="cke_copybin")?>)?' +
1794+
'(?:<(?:div|span)(?: data-cke-temp="1")?(?: id="cke_copybin")?(?: data-cke-temp="1")?>)?' +
17741795
'(?:<(?:div|span)(?: style="[^"]+")?>)?' +
17751796
'<span [^>]*data-cke-copybin-start="1"[^>]*>.?</span>([\\s\\S]+)<span [^>]*data-cke-copybin-end="1"[^>]*>.?</span>' +
17761797
'(?:</(?:div|span)>)?' +
17771798
'(?:</(?:div|span)>)?' +
17781799
'$'
17791800
);
17801801

1802+
function pasteReplaceFn( match, wrapperHtml ) {
1803+
// Avoid polluting pasted data with any whitspaces,
1804+
// what's going to break check whether only one widget was pasted.
1805+
return CKEDITOR.tools.trim( wrapperHtml );
1806+
}
1807+
17811808
// Set up data processing like:
17821809
// * toHtml/toDataFormat,
17831810
// * pasting handling,
@@ -1794,10 +1821,7 @@
17941821

17951822
// Handle pasted single widget.
17961823
editor.on( 'paste', function( evt ) {
1797-
evt.data.dataValue = evt.data.dataValue.replace(
1798-
pasteReplaceRegex,
1799-
'$1'
1800-
);
1824+
evt.data.dataValue = evt.data.dataValue.replace( pasteReplaceRegex, pasteReplaceFn );
18011825
} );
18021826
}
18031827

@@ -1980,6 +2004,10 @@
19802004
editable.attachListener( evtRoot, 'mousedown', function( evt ) {
19812005
var target = evt.data.getTarget();
19822006

2007+
// #10887 Clicking scrollbar in IE8 will invoke event with empty target object.
2008+
if ( !target.type )
2009+
return false;
2010+
19832011
widget = widgetsRepo.getByElement( target );
19842012
mouseDownOnDragHandler = 0; // Reset.
19852013

@@ -2359,7 +2387,10 @@
23592387
// IE8 always jumps to the end of document.
23602388
needsScrollHack = CKEDITOR.env.ie && CKEDITOR.env.version < 9;
23612389

2362-
copybinContainer.setAttribute( 'id', 'cke_copybin' );
2390+
copybinContainer.setAttributes( {
2391+
id: 'cke_copybin',
2392+
'data-cke-temp': '1'
2393+
} );
23632394

23642395
// Position copybin element outside current viewport.
23652396
copybin.setStyles( {

0 commit comments

Comments
 (0)