Ticket #6718: 6718_3.patch
File 6718_3.patch, 4.5 KB (added by , 12 years ago) |
---|
-
../3.6.x/_source/plugins/clipboard/plugin.js
214 214 215 215 // Turn off design mode temporarily before give focus to the paste bin. 216 216 if ( mode == 'text' ) 217 { 218 if ( CKEDITOR.env.ie ) 219 { 220 var ieRange = doc.getBody().$.createTextRange(); 221 ieRange.moveToElementText( pastebin.$ ); 222 ieRange.execCommand( 'Paste' ); 223 evt.data.preventDefault(); 224 } 225 else 226 pastebin.$.focus(); 227 } 217 pastebin.$.focus(); 228 218 else 229 219 { 230 220 range.setStartAt( pastebin, CKEDITOR.POSITION_AFTER_START ); … … 377 367 378 368 editor.on( 'key', onKey, editor ); 379 369 380 var mode = editor.config.forcePasteAsPlainText ? 'text' : 'html';381 382 370 // We'll be catching all pasted content in one line, regardless of whether the 383 371 // it's introduced by a document command execution (e.g. toolbar buttons) or 384 372 // user paste behaviors. (e.g. Ctrl-V) 385 373 editor.on( 'contentDom', function() 386 374 { 387 375 var body = editor.document.getBody(); 388 body.on( ( ( mode == 'text' && CKEDITOR.env.ie ) || CKEDITOR.env.webkit ) ? 'paste' : 'beforepaste', 389 function( evt ) 376 body.on( 'beforepaste', function( evt ) 390 377 { 391 378 if ( depressBeforeEvent ) 392 379 return; 393 380 394 getClipboardData.call( editor, evt, mode, function ( data ) 381 // Fire 'beforePaste' event so clipboard flavor get customized 382 // by other plugins. 383 var eventData = { mode : 'html' }; 384 editor.fire( 'beforePaste', eventData ); 385 386 getClipboardData.call( editor, evt, eventData.mode, function ( data ) 395 387 { 396 388 // The very last guard to make sure the 397 389 // paste has successfully happened. … … 399 391 return; 400 392 401 393 var dataTransfer = {}; 402 dataTransfer[ mode ] = data;394 dataTransfer[ eventData.mode ] = data; 403 395 editor.fire( 'paste', dataTransfer ); 404 396 } ); 405 397 }); -
../3.6.x/_source/plugins/pastetext/plugin.js
58 58 // Intercept the default pasting process. 59 59 editor.on( 'beforeCommandExec', function ( evt ) 60 60 { 61 if ( evt.data.name == 'paste' ) 61 var mode = evt.data.commandData; 62 // Do NOT overwrite if HTML format is explicitly requested. 63 if ( evt.data.name == 'paste' && mode != 'html' ) 62 64 { 63 65 editor.execCommand( 'pastetext' ); 64 66 evt.cancel(); 65 67 } 66 68 }, null, null, 0 ); 69 70 editor.on( 'beforePaste', function( evt ) 71 { 72 evt.data.mode = 'text'; 73 }); 67 74 } 68 75 69 76 editor.on( 'pasteState', function( evt ) … … 82 89 * Whether to force all pasting operations to insert on plain text into the 83 90 * editor, loosing any formatting information possibly available in the source 84 91 * text. 92 * <strong>Note:</strong> paste from word is not affected by this configuration. 85 93 * @name CKEDITOR.config.forcePasteAsPlainText 86 94 * @type Boolean 87 95 * @default false -
../3.6.x/_source/plugins/pastefromword/plugin.js
1 ?/*1 /* 2 2 Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. 3 3 For licensing, see LICENSE.html or http://ckeditor.com/license 4 4 */ 5 5 (function() 6 6 { 7 function forceHtmlMode( evt ) { evt.data.mode = 'html'; } 8 7 9 CKEDITOR.plugins.add( 'pastefromword', 8 10 { 9 11 init : function( editor ) … … 15 17 var resetFromWord = function( evt ) 16 18 { 17 19 evt && evt.removeListener(); 20 editor.removeListener( 'beforePaste', forceHtmlMode ); 18 21 forceFromWord && setTimeout( function() { forceFromWord = 0; }, 0 ); 19 22 }; 20 23 … … 27 30 canUndo : false, 28 31 exec : function() 29 32 { 33 // Ensure the received data format is HTML and apply content filtering. (#6718) 30 34 forceFromWord = 1; 31 if ( editor.execCommand( 'paste' ) === false ) 35 editor.on( 'beforePaste', forceHtmlMode ); 36 37 if ( editor.execCommand( 'paste', 'html' ) === false ) 32 38 { 33 39 editor.on( 'dialogShow', function ( evt ) 34 40 {