Skip to content
Permalink
Browse files

Merge branch 't/10887' into major

  • Loading branch information...
Reinmar committed Nov 7, 2013
2 parents dd70588 + 517dc15 commit 1a7833ed8c661d5dc9224b6a013462f3712497ad
Showing with 55 additions and 14 deletions.
  1. +1 −0 CHANGES.md
  2. +5 −1 core/htmldataprocessor.js
  3. +4 −1 plugins/clipboard/plugin.js
  4. +6 −4 plugins/forms/plugin.js
  5. +1 −1 plugins/image2/plugin.js
  6. +38 −7 plugins/widget/plugin.js
@@ -48,6 +48,7 @@ Fixed Issues:
* [#10911](http://dev.ckeditor.com/ticket/10911): Browser alt hotkeys will no longer be blocked while widget is focused.
* [#11082](http://dev.ckeditor.com/ticket/11082): Selected widget is not copied/cut when using toolbar buttons or context menu.
* [#11083](http://dev.ckeditor.com/ticket/11083): Fixed lists and divs application to block widgets.
* [#10887](http://dev.ckeditor.com/ticket/10887): Internet Explorer 8 compatibility issues related to the Widget System.

## CKEditor 4.3 Beta

@@ -545,7 +545,11 @@
attributeNames: [
// Event attributes (onXYZ) must not be directly set. They can become
// active in the editing area (IE|WebKit).
[ ( /^on/ ), 'data-cke-pa-on' ]
[ ( /^on/ ), 'data-cke-pa-on' ],

// Don't let some old expando enter editor. Concerns only IE8,
// but for consistency remove on all browsers.
[ ( /^data-cke-expando$/ ), '' ]
]
};

@@ -683,7 +683,10 @@
var pastebin = new CKEDITOR.dom.element(
( CKEDITOR.env.webkit || editable.is( 'body' ) ) && !( CKEDITOR.env.ie || CKEDITOR.env.opera ) ? 'body' : 'div', doc );

pastebin.setAttribute( 'id', 'cke_pastebin' );
pastebin.setAttributes( {
id: 'cke_pastebin',
'data-cke-temp': '1'
} );

// Append bogus to prevent Opera from doing this. (#9522)
if ( CKEDITOR.env.opera )
@@ -242,8 +242,10 @@ CKEDITOR.plugins.add( 'forms', {
dataFilter = dataProcessor && dataProcessor.dataFilter;

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

if ( dataFilter ) {
dataFilter.addRules({
dataFilter.addRules( {
elements: {
input: function( element ) {
if ( element.attributes.type == 'hidden' )
return editor.createFakeParserElement( element, 'cke_hidden', 'hiddenfield' );
}
}
});
}, { applyToAll: true } );
}
}
});
@@ -597,7 +597,7 @@
if ( childName != 'img' && !( childName == 'figure' && child.hasClass( 'caption' ) ) )
return false;

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

// Centering wrapper got to be... centering.
if ( styles[ 'text-align' ] == 'center' )
@@ -293,7 +293,9 @@
for ( i = 0, count = wrappers.count(); i < count; i++ ) {
wrapper = wrappers.getItem( i );

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

// Finds a first parent that matches query.
//
// @param {CKEDITOR.dom.element} element
// @param {Function} query
function findParent( element, query ) {
var parent = element;

while ( ( parent = parent.getParent() ) ) {
if ( query( parent ) )
return true;
}
return false;
}

// Gets nested editable if node is its descendant or the editable itself.
//
// @param {CKEDITOR.dom.element} guard Stop ancestor search on this node (usually editor's editable).
@@ -1639,6 +1655,11 @@
return node.type == CKEDITOR.NODE_ELEMENT && node.hasAttribute( 'data-cke-widget-editable' );
}

// @param {CKEDITOR.dom.element}
function isTemp2( element ) {
return element.hasAttribute( 'data-cke-temp' );
}

function moveSelectionToDropPosition( editor, dropEvt ) {
var $evt = dropEvt.data.$,
$range,
@@ -1770,14 +1791,20 @@
// * We use spans on IE and blockless editors, but divs in other cases.
var pasteReplaceRegex = new RegExp(
'^' +
'(?:<(?:div|span)(?: id="cke_copybin")?>)?' +
'(?:<(?:div|span)(?: data-cke-temp="1")?(?: id="cke_copybin")?(?: data-cke-temp="1")?>)?' +
'(?:<(?:div|span)(?: style="[^"]+")?>)?' +
'<span [^>]*data-cke-copybin-start="1"[^>]*>.?</span>([\\s\\S]+)<span [^>]*data-cke-copybin-end="1"[^>]*>.?</span>' +
'(?:</(?:div|span)>)?' +
'(?:</(?:div|span)>)?' +
'$'
);

function pasteReplaceFn( match, wrapperHtml ) {
// Avoid polluting pasted data with any whitspaces,
// what's going to break check whether only one widget was pasted.
return CKEDITOR.tools.trim( wrapperHtml );
}

// Set up data processing like:
// * toHtml/toDataFormat,
// * pasting handling,
@@ -1794,10 +1821,7 @@

// Handle pasted single widget.
editor.on( 'paste', function( evt ) {
evt.data.dataValue = evt.data.dataValue.replace(
pasteReplaceRegex,
'$1'
);
evt.data.dataValue = evt.data.dataValue.replace( pasteReplaceRegex, pasteReplaceFn );
} );
}

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

// #10887 Clicking scrollbar in IE8 will invoke event with empty target object.
if ( !target.type )
return false;

widget = widgetsRepo.getByElement( target );
mouseDownOnDragHandler = 0; // Reset.

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

copybinContainer.setAttribute( 'id', 'cke_copybin' );
copybinContainer.setAttributes( {
id: 'cke_copybin',
'data-cke-temp': '1'
} );

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

0 comments on commit 1a7833e

Please sign in to comment.
You can’t perform that action at this time.