X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fplugins%2Fclipboard%2Fplugin.js;h=ebfb1f81c606f1d24c0c8b858d3a00b1dc31bc41;hp=51f53e970b08f8c2976d30b292f7020fa48fa5d7;hb=1056598c95187351dc58f4991d331e2258d038b5;hpb=4e90e78dc97789709ee7404359a5517540c27553 diff --git a/_source/plugins/clipboard/plugin.js b/_source/plugins/clipboard/plugin.js index 51f53e9..ebfb1f8 100644 --- a/_source/plugins/clipboard/plugin.js +++ b/_source/plugins/clipboard/plugin.js @@ -214,17 +214,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license // Turn off design mode temporarily before give focus to the paste bin. if ( mode == 'text' ) - { - if ( CKEDITOR.env.ie ) - { - var ieRange = doc.getBody().$.createTextRange(); - ieRange.moveToElementText( pastebin.$ ); - ieRange.execCommand( 'Paste' ); - evt.data.preventDefault(); - } - else - pastebin.$.focus(); - } + pastebin.$.focus(); else { range.setStartAt( pastebin, CKEDITOR.POSITION_AFTER_START ); @@ -377,29 +367,31 @@ For licensing, see LICENSE.html or http://ckeditor.com/license editor.on( 'key', onKey, editor ); - var mode = editor.config.forcePasteAsPlainText ? 'text' : 'html'; - // We'll be catching all pasted content in one line, regardless of whether the // it's introduced by a document command execution (e.g. toolbar buttons) or // user paste behaviors. (e.g. Ctrl-V) editor.on( 'contentDom', function() { var body = editor.document.getBody(); - body.on( ( ( mode == 'text' && CKEDITOR.env.ie ) || CKEDITOR.env.webkit ) ? 'paste' : 'beforepaste', - function( evt ) + body.on( CKEDITOR.env.webkit ? 'paste' : 'beforepaste', function( evt ) { if ( depressBeforeEvent ) return; - getClipboardData.call( editor, evt, mode, function ( data ) + // Fire 'beforePaste' event so clipboard flavor get customized + // by other plugins. + var eventData = { mode : 'html' }; + editor.fire( 'beforePaste', eventData ); + + getClipboardData.call( editor, evt, eventData.mode, function ( data ) { // The very last guard to make sure the // paste has successfully happened. - if ( !CKEDITOR.tools.trim( data.toLowerCase().replace( /]+data-cke-bookmark[^<]*?<\/span>/g,'' ) ) ) + if ( !( data = CKEDITOR.tools.trim( data.replace( /]+data-cke-bookmark[^<]*?<\/span>/ig,'' ) ) ) ) return; var dataTransfer = {}; - dataTransfer[ mode ] = data; + dataTransfer[ eventData.mode ] = data; editor.fire( 'paste', dataTransfer ); } ); });