Ticket #8222: 8222_3.patch

File 8222_3.patch, 3.3 KB (added by Garry Yao, 13 years ago)
  • _source/plugins/wysiwygarea/plugin.js

     
    398398                                        && !pathBlock.is( 'pre' )
    399399                                        && !pathBlock.getBogus() )
    400400                        {
    401                                 editor.fire( 'updateSnapshot' );
    402                                 restoreDirty( editor );
    403401                                pathBlock.appendBogus();
    404402                        }
    405403                }
     
    412410                                && blockLimit.getName() == 'body'
    413411                                && !path.block )
    414412                {
    415                         editor.fire( 'updateSnapshot' );
    416                         restoreDirty( editor );
    417                         CKEDITOR.env.ie && restoreSelection( selection );
    418 
    419413                        var fixedBlock = range.fixBlock( true,
    420414                                        editor.config.enterMode == CKEDITOR.ENTER_DIV ? 'div' : 'p'  );
    421415
     
    464458                var testPath = new CKEDITOR.dom.elementPath( testRange.startContainer );
    465459                if ( !testPath.blockLimit.is( 'body') )
    466460                {
    467                         editor.fire( 'updateSnapshot' );
    468                         restoreDirty( editor );
    469                         CKEDITOR.env.ie && restoreSelection( selection );
    470 
    471461                        var paddingBlock;
    472462                        if ( enterMode != CKEDITOR.ENTER_BR )
    473463                                paddingBlock = body.append( editor.document.createElement( enterMode == CKEDITOR.ENTER_P ? 'p' : 'div' ) );
     
    11251115                                        editor.on( 'insertElement', onInsert( doInsertElement ), null, null, 20 );
    11261116                                        editor.on( 'insertText', onInsert( doInsertText ), null, null, 20 );
    11271117                                        // Auto fixing on some document structure weakness to enhance usabilities. (#3190 and #3189)
    1128                                         editor.on( 'selectionChange', onSelectionChangeFixBody, null, null, 1 );
     1118                                        editor.on( 'selectionChange', function()
     1119                                        {
     1120                                                var sel = editor.getSelection();
     1121                                                // Do it only when selection is not locked. (#8222)
     1122                                                if ( sel && !sel.isLocked )
     1123                                                {
     1124                                                        var isDirty = editor.checkDirty();
     1125                                                        onSelectionChangeFixBody.apply( this, arguments );
     1126                                                        editor.fire( 'updateSnapshot' );
     1127                                                        !isDirty && editor.resetDirty();
     1128                                                }
     1129                                        }, null, null, 1 );
    11291130                                });
    11301131
    11311132                        var titleBackup;
  • _source/plugins/undo/plugin.js

     
    116116                        };
    117117
    118118                        /**
    119                          * Update the undo stacks with any subsequent DOM changes after this call.
     119                         * Amend the top of undo stack (last undo image) with the current DOM changes.
    120120                         * @name CKEDITOR.editor#updateUndo
    121121                         * @example
    122122                         * function()
    123123                         * {
    124                          * editor.fire( 'updateSnapshot' );
     124                         *  editor.fire( 'saveSnapshot' );
     125                         *      editor.document.body.append(...);
     126                         *  // Make new changes following the last undo snapshot part of it.
     127                         *      editor.fire( 'updateSnapshot' );
    125128                         * ...
    126                          *  // Ask to include subsequent (in this call stack) DOM changes to be
    127                          * // considered as part of the first snapshot.
    128                          *      editor.fire( 'updateSnapshot' );
    129                          *      editor.document.body.append(...);
    130                          * ...
    131129                         * }
    132130                         */
    133131                        editor.on( 'updateSnapshot', function()
    134132                        {
    135                                 if ( undoManager.currentImage && new Image( editor ).equals( undoManager.currentImage ) )
    136                                         setTimeout( function() { undoManager.update(); }, 0 );
     133                                if ( undoManager.currentImage )
     134                                        undoManager.update();
    137135                        });
    138136                }
    139137        });
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy