X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fpastetext%2Fplugin.js;h=d09f4982e39f8534642ecb08851379cd2da41c37;hb=3fe9cac293e090ea459a3ee10d78cbe9e1dd0e03;hp=a523549ad514fde822c20af637fe8071ab166133;hpb=48b1db88210b4160dce439c6e3e32e14af8c106b;p=ckeditor.git diff --git a/_source/plugins/pastetext/plugin.js b/_source/plugins/pastetext/plugin.js index a523549..d09f498 100644 --- a/_source/plugins/pastetext/plugin.js +++ b/_source/plugins/pastetext/plugin.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -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