X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fpastetext%2Fplugin.js;h=42dbf5dd9c19433906fcfba1200d0f9e813399cd;hb=refs%2Ftags%2Fv3.5.4;hp=a523549ad514fde822c20af637fe8071ab166133;hpb=4e90e78dc97789709ee7404359a5517540c27553;p=ckeditor.git diff --git a/_source/plugins/pastetext/plugin.js b/_source/plugins/pastetext/plugin.js index a523549..42dbf5d 100644 --- a/_source/plugins/pastetext/plugin.js +++ b/_source/plugins/pastetext/plugin.js @@ -58,12 +58,19 @@ For licensing, see LICENSE.html or http://ckeditor.com/license // Intercept the default pasting process. editor.on( 'beforeCommandExec', function ( evt ) { - if ( evt.data.name == 'paste' ) + var mode = evt.data.commandData; + // Do NOT overwrite if HTML format is explicitly requested. + if ( evt.data.name == 'paste' && mode != 'html' ) { editor.execCommand( 'pastetext' ); evt.cancel(); } }, null, null, 0 ); + + editor.on( 'beforePaste', function( evt ) + { + evt.data.mode = 'text'; + }); } editor.on( 'pasteState', function( evt ) @@ -82,6 +89,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license * Whether to force all pasting operations to insert on plain text into the * editor, loosing any formatting information possibly available in the source * text. + * Note: paste from word is not affected by this configuration. * @name CKEDITOR.config.forcePasteAsPlainText * @type Boolean * @default false