| | 271 | var editorCheckDirty = CKEDITOR.editor.prototype; |
| | 272 | |
| | 273 | // Override editor.checkDirty method avoid CK checkDirty functionality to fix SCAYT issues with incorrect checkDirty behavior. |
| | 274 | editorCheckDirty.checkDirty = CKEDITOR.tools.override(editorCheckDirty.checkDirty, function( org ) |
| | 275 | { |
| | 276 | return function() |
| | 277 | { |
| | 278 | var retval = null, |
| | 279 | scayt_instance = plugin.getScayt( editor ); |
| | 280 | |
| | 281 | if ( scayt_instance && plugin.isScaytReady( editor ) ) |
| | 282 | { |
| | 283 | // save property state |
| | 284 | var saveGetSnapshot = editor.getSnapshot, |
| | 285 | savePreviousValue = editor._.previousValue; |
| | 286 | |
| | 287 | // override property state |
| | 288 | editor.getSnapshot = function() |
| | 289 | { |
| | 290 | return scayt_instance.reset( saveGetSnapshot.apply( this, arguments ) ); |
| | 291 | } |
| | 292 | |
| | 293 | editor._.previousValue = scayt_instance.reset(editor._.previousValue); |
| | 294 | |
| | 295 | // run real checkDirty method |
| | 296 | retval = org.apply( this, arguments ); |
| | 297 | |
| | 298 | // restore changed property |
| | 299 | editor.getSnapshot = saveGetSnapshot; |
| | 300 | editor._.previousValue = savePreviousValue; |
| | 301 | } |
| | 302 | else |
| | 303 | { |
| | 304 | retval = org.apply(this); |
| | 305 | } |
| | 306 | |
| | 307 | return retval; |
| | 308 | } |
| | 309 | }); |
| | 310 | |