Changeset 4207
- Timestamp:
- 09/09/09 07:55:10 (4 years ago)
- Location:
- CKEditor/branches/features/pasting/_source
- Files:
-
- 7 edited
-
core/htmlparser/filter.js (modified) (1 diff)
-
plugins/clipboard/dialogs/paste.js (modified) (1 diff)
-
plugins/clipboard/plugin.js (modified) (4 diffs)
-
plugins/pastefromword/dialogs/pastefromword.js (modified) (1 diff)
-
plugins/pastefromword/plugin.js (modified) (2 diffs)
-
plugins/pastetext/dialogs/pastetext.js (modified) (1 diff)
-
plugins/pastetext/plugin.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
CKEditor/branches/features/pasting/_source/core/htmlparser/filter.js
r3309 r4207 112 112 113 113 return value; 114 }, 115 116 clone : function() 117 { 118 var clone = new CKEDITOR.htmlParser.filter(); 119 // Shallow copy all the rules. 120 clone._ = CKEDITOR.tools.clone( this._ ); 121 return clone; 114 122 } 115 123 } -
CKEditor/branches/features/pasting/_source/plugins/clipboard/dialogs/paste.js
r4174 r4207 119 119 120 120 setTimeout( function(){ 121 editor. insertHtml( html);121 editor.fire( 'paste', { 'html' : html } ); 122 122 }, 0 ); 123 123 -
CKEditor/branches/features/pasting/_source/plugins/clipboard/plugin.js
r4206 r4207 131 131 || CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 ) 132 132 editor.document.getBody().fire( 'paste' ); 133 134 setTimeout( function()135 {136 editor.fire( 'saveSnapshot' ); // Save after paste137 }, 0 );138 133 return; 139 134 … … 223 218 CKEDITOR.plugins.add( 'clipboard', 224 219 { 220 requires : [ 'htmldataprocessor' ], 225 221 init : function( editor ) 226 222 { 227 // Provide default 'html' paste handler. 223 // The paste processor here is just a reduced copy of html data processor. 224 CKEDITOR.pasteProcessor = function( editor ) 225 { 226 this.editor = editor; 227 this.dataFilter = this.editor.dataProcessor.dataFilter.clone(); 228 }; 229 CKEDITOR.pasteProcessor.prototype = 230 { 231 toHtml : CKEDITOR.htmlDataProcessor.prototype.toHtml 232 }; 233 234 // The very first handler which initialize the processor. 228 235 editor.on( 'paste', function( evt ) 229 236 { 230 editor.insertHtml( evt.data[ 'html' ] ); 231 } ); 237 // The processor is a transient instance life cycled to the 238 // 'paste' event since the processing rules will be added 239 // on demand accordingly to clipboard data flavor. 240 editor.pasteProcessor = new CKEDITOR.pasteProcessor( editor ); 241 242 }, null, null, 1 ); 243 244 // The very last handler which insert final data into the editor at the end of the chain. 245 editor.on( 'paste', function( evt ) 246 { 247 var data = evt.data; 248 249 if ( data[ 'html'] ) 250 editor.insertHtml(editor.pasteProcessor.toHtml(data[ 'html' ], false)); 251 else if ( data[ 'text'] ) 252 editor.insertText(data[ 'text' ]); 253 254 delete editor.pasteProcessor; 255 256 editor.fire( 'saveSnapshot' ); // Save after inserted. 257 258 }, null, null, 1000 ); 232 259 233 260 function addButtonCommand( buttonName, commandName, command, ctxMenuOrder ) … … 278 305 279 306 editor.fire( 'paste', dataTransfer ); 280 editor.fire( 'saveSnapshot' ); // Save after paste281 307 } ); 282 308 } ); … … 305 331 } 306 332 }); 333 334 307 335 })(); 308 336 -
CKEditor/branches/features/pasting/_source/plugins/pastefromword/dialogs/pastefromword.js
r4206 r4207 103 103 iframe = container.getElementsByTag( 'iframe' ).getItem( 0 ), 104 104 editor = this.getParentEditor(), 105 html = this.definition.cleanWord( editor, iframe.$.contentWindow.document.body.innerHTML, 106 this.getValueOf( 'general', 'ignoreFontFace' ), 107 this.getValueOf( 'general', 'removeStyle' ) ); 105 //TODO: Bring those dialog-based configs to the paste processor. 106 html = iframe.$.contentWindow.document.body.innerHTML; 108 107 109 108 // Insertion should happen after main document design mode turned on. 110 109 setTimeout( function(){ 111 editor. insertHtml( html);110 editor.fire( 'paste', { 'html' : html } ); 112 111 }, 0 ); 113 112 }, -
CKEditor/branches/features/pasting/_source/plugins/pastefromword/plugin.js
r4206 r4207 19 19 command : 'pastefromword' 20 20 } ); 21 21 22 22 var config = editor.config; 23 23 editor.on( 'paste', function( evt ) … … 28 28 && /(class=\"?Mso|style=\"[^\"]*\bmso\-|w:WordDocument)/.test( mswordHtml ) ) 29 29 { 30 // Perform cleaning with default configuration. 31 editor.insertHtml( 32 CKEDITOR.plugins.pastefromword.cleanWord( 33 editor, mswordHtml, 34 config.pasteFromWordIgnoreFontFace, 35 config.pasteFromWordRemoveStyle)); 30 var filter = editor.pasteProcessor.dataFilter; 31 // TODO: Migrate the 'CKEDITOR.plugins.pastefromword' to filter rules. 32 filter.addRules( 33 { 36 34 37 // Cancel other html paste handlers. 38 evt.cancel(); 35 } ); 39 36 } 40 } , null, null, 9);37 } ); 41 38 42 39 } -
CKEditor/branches/features/pasting/_source/plugins/pastetext/dialogs/pastetext.js
r3622 r4207 24 24 // Get the textarea value. 25 25 var text = this.getContentElement( 'general', 'content' ).getInputElement().getValue(); 26 27 // Inserts the text. 28 this.getParentEditor().insertText( text ); 26 this.getParentEditor().fire( 'paste', { 'text' : text } ); 29 27 }, 30 28 -
CKEditor/branches/features/pasting/_source/plugins/pastetext/plugin.js
r4036 r4207 23 23 } 24 24 25 editor. insertText( window.clipboardData.getData( 'Text' ));25 editor.fire( 'paste', { 'text' : window.clipboardData.getData( 'Text' ) } ); 26 26 } 27 27 };
Note: See TracChangeset
for help on using the changeset viewer.
