Skip to content

Commit

Permalink
Merge branch 't/9534'
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinmar committed Nov 7, 2012
2 parents 47064ec + 7a786a7 commit 3cbf8af
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion plugins/clipboard/plugin.js
Expand Up @@ -93,11 +93,11 @@

CKEDITOR.dialog.add( 'paste', CKEDITOR.getUrl( this.path + 'dialogs/paste.js' ) );

// Filter webkit garbage.
editor.on( 'paste', function( evt ) {
var data = evt.data.dataValue,
blockElements = CKEDITOR.dtd.$block;

// Filter webkit garbage.
if ( data.indexOf( 'Apple-' ) > -1 ) {
// Replace special webkit's   with simple space, because webkit
// produces them even for normal spaces.
Expand All @@ -123,6 +123,17 @@
data = data.replace( /(<[^>]+) class="Apple-[^"]*"/gi, '$1' );
}

// Strip editable that was copied from inside. (#9534)
if ( data.match( /^<[^<]+cke_editable/i ) ) {
var header, wrapper = new CKEDITOR.dom.element( 'div' );

wrapper.setHtml( data );
// Verify for sure.
if ( wrapper.getChildCount() == 1 && ( header = wrapper.getFirst() ).hasClass( 'cke_editable' ) )
// Strip editable and bogus <br> (added on FF).
data = header.getHtml().replace( /<br>$/i, '' );
}

if ( CKEDITOR.env.ie ) {
// &nbsp; <p> -> <p> (br.cke-pasted-remove will be removed later)
data = data.replace( /^&nbsp;(?: |\r\n)?<(\w+)/g, function( match, elementName ) {
Expand Down

0 comments on commit 3cbf8af

Please sign in to comment.