Ticket #5546: 5546_2.patch
File 5546_2.patch, 4.1 KB (added by , 14 years ago) |
---|
-
_source/plugins/scayt/plugin.js
141 141 } 142 142 } 143 143 }); 144 144 editor.on( 'afterCommandExec', function( ev ) 145 { 146 147 if ( !plugin.isScaytEnabled(editor) ) 148 return; 149 150 if ( ev.data.name == 'undo' || ev.data.name == 'redo' && editor.mode == 'wysiwyg' ) 151 { 152 window.setTimeout( function(){ plugin.getScayt( editor ).refresh(); }, 10 ); 153 } 154 155 }); 145 156 editor.on( 'destroy', function( ev ) 146 157 { 147 158 var editor = ev.editor, … … 220 231 } 221 232 ); 222 233 } 234 235 // Override Image.equals method avoid CK snapshot module to add SCAYT markup to snapshots ( 5546 ticket ) 236 var undoImagePrototype = CKEDITOR.plugins.undo.Image.prototype; 237 undoImagePrototype.equals = CKEDITOR.tools.override( undoImagePrototype.equals, function( org ) 238 { 239 return function( otherImage ) 240 { 241 var thisContents = this.contents, 242 otherContents = otherImage.contents; 243 var scayt_instance = plugin.getScayt( this.editor ); 244 // Making the comparison based on content without SCAYT word markers. 245 if ( scayt_instance && plugin.isScaytReady( this.editor ) ) 246 { 247 this.contents = scayt_instance.reset( thisContents ); 248 otherImage.contents = scayt_instance.reset( otherContents ); 249 } 250 251 var retval = org.apply( this, arguments ); 223 252 253 this.contents = thisContents; 254 otherImage.contents = otherContents; 255 return retval; 256 } 257 }); 258 224 259 if ( editor.document ) 225 260 createInstance(); 226 261 }; -
_source/plugins/undo/plugin.js
117 117 } 118 118 }); 119 119 120 // Gets a snapshot image which represent the current document status. 121 function Image( editor ) 120 CKEDITOR.plugins.undo = {}; 121 122 /** 123 * Undo snapshot which represents the current document status. 124 * @name CKEDITOR.plugins.undo.Image 125 * @param editor The editor instance on which the image is created. 126 */ 127 var Image = CKEDITOR.plugins.undo.Image = function( editor ) 122 128 { 129 this.editor = editor; 123 130 var contents = editor.getSnapshot(), 124 131 selection = contents && editor.getSelection(); 125 132 126 133 // In IE, we need to remove the expando attributes. 127 134 CKEDITOR.env.ie && contents && ( contents = contents.replace( /\s+_cke_expando=".*?"/g, '' ) ); 128 135 129 136 this.contents = contents; 130 137 this.bookmarks = selection && selection.createBookmarks2( true ); 131 } 138 }; 132 139 133 140 // Attributes that browser may changing them when setting via innerHTML. 134 141 var protectedAttrs = /\b(?:href|src|name)="[^"]*?"/gi; … … 137 144 { 138 145 equals : function( otherImage, contentOnly ) 139 146 { 147 140 148 var thisContents = this.contents, 141 otherContents = otherImage.contents; 149 otherContents = otherImage.contents, 150 // Registered filters makes Image to respond correct on service markup of SCAYT and any other plugins 151 // The editor object is absent in context of Image by default, 152 // so for prototyping we use hardcoded editor name "editor1" 153 thisEqualsFilters = CKEDITOR.instances.editor1._.imageEqualsFilters, 154 i,err; 142 155 143 156 // For IE6/7 : Comparing only the protected attribute values but not the original ones.(#4522) 144 157 if ( CKEDITOR.env.ie && ( CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat ) ) … … 146 159 thisContents = thisContents.replace( protectedAttrs, '' ); 147 160 otherContents = otherContents.replace( protectedAttrs, '' ); 148 161 } 149 162 163 164 // Run custom filters 165 if (thisEqualsFilters && thisEqualsFilters.length) 166 for ( i in thisEqualsFilters ) 167 try{ 168 filteredContents = thisEqualsFilters[i].apply(null,[thisContents,otherContents]); 169 thisContents = filteredContents[0]; 170 otherContents = filteredContents[1]; 171 }catch (err){} 172 173 150 174 if ( thisContents != otherContents ) 151 175 return false; 152 176