Ticket #5170: 5170.patch
File 5170.patch, 2.9 KB (added by , 13 years ago) |
---|
-
_source/plugins/specialchar/dialogs/specialchar.js
23 23 { 24 24 target.removeClass( "cke_light_background" ); 25 25 dialog.hide(); 26 editor.insertHtml( value ); 26 27 // Firefox has some bug on insert html, so let's process it single (#5170) 28 if ( CKEDITOR.env.gecko ) 29 { 30 editor.fire( 'insertSpecialChar', value, editor ); 31 } 32 else { 33 editor.insertHtml( value ); 34 } 35 27 36 } 28 37 }; 29 38 -
_source/plugins/specialchar/plugin.js
2 2 Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. 3 3 For licensing, see LICENSE.html or http://ckeditor.com/license 4 4 */ 5 (function(){ 6 /** 7 * @file Special Character plugin 8 */ 9 10 CKEDITOR.plugins.add( 'specialchar', 11 { 12 init : function( editor ) 13 { 14 var pluginName = 'specialchar'; 15 16 // Register the dialog. 17 CKEDITOR.dialog.add( pluginName, this.path + 'dialogs/specialchar.js' ); 18 19 // Register the command. 20 editor.addCommand( pluginName, new CKEDITOR.dialogCommand( pluginName ) ); 21 22 // Register the toolbar button. 23 editor.ui.addButton( 'SpecialChar', 24 { 25 label : editor.lang.specialChar.toolbar, 26 command : pluginName 27 }); 28 29 // Register the handler for Firefox (#5170) 30 if ( CKEDITOR.env.gecko ) 31 { 32 editor.on( 'insertSpecialChar', function( event ) 33 { 34 var range = getRange( editor ); 35 36 if ( range ) 37 range.insertNode( editor.document.createText( event.data )); 38 else 39 editor.insertHtml( event.data ); 40 } 41 ); 42 } 43 } 44 } ); 5 45 6 /** 7 * @file Special Character plugin 8 */ 9 10 CKEDITOR.plugins.add( 'specialchar', 11 { 12 init : function( editor ) 46 function getRange( editor ) 13 47 { 14 var pluginName = 'specialchar'; 48 // Get the selection ranges. 49 var ranges = editor.getSelection().getRanges(); 15 50 16 // Register the dialog. 17 CKEDITOR.dialog.add( pluginName, this.path + 'dialogs/specialchar.js' ); 51 // Delete the contents of all ranges . 52 for ( var i = ranges.length - 1 ; i >= 0 ; i-- ) 53 { 54 ranges[ i ].deleteContents(); 55 } 18 56 19 // Register the command. 20 editor.addCommand( pluginName, new CKEDITOR.dialogCommand( pluginName ) ); 21 22 // Register the toolbar button. 23 editor.ui.addButton( 'SpecialChar', 24 { 25 label : editor.lang.specialChar.toolbar, 26 command : pluginName 27 }); 57 // Return the first range. 58 return ranges[ 0 ]; 28 59 } 29 } );60 })()