Ticket #5530: 5530_3.patch

File 5530_3.patch, 2.8 KB (added by Garry Yao, 14 years ago)
  • _source/plugins/pagebreak/plugin.js

     
    8484
    8585                var ranges = editor.getSelection().getRanges();
    8686
     87                editor.fire( 'saveSnapshot' );
     88
    8789                for ( var range, i = 0 ; i < ranges.length ; i++ )
    8890                {
    8991                        range = ranges[ i ];
     
    99101                                range.select();
    100102                        }
    101103                }
     104
     105                editor.fire( 'saveSnapshot' );
    102106        }
    103107};
  • _source/plugins/wysiwygarea/plugin.js

     
    191191                         && blockLimit.getName() == 'body'
    192192                         && !path.block )
    193193                {
     194                        editor.fire( 'updateSnapshot' );
    194195                        restoreDirty( editor );
    195196                        CKEDITOR.env.ie && restoreSelection( selection );
    196197
     
    245246
    246247                if ( walker.previous() )
    247248                {
     249                        editor.fire( 'updateSnapshot' );
    248250                        restoreDirty( editor );
    249251                        CKEDITOR.env.ie && restoreSelection( selection );
    250252
  • _source/plugins/undo/plugin.js

     
    114114                                // Create the first image.
    115115                                editor.fire( 'saveSnapshot' );
    116116                        };
     117
     118                        /**
     119                         * Update the undo stacks with any subsequent DOM changes after this call.
     120                         * @name CKEDITOR.editor#updateUndo
     121                         * @example
     122                         * function()
     123                         * {
     124                         * editor.fire( 'updateSnapshot' );
     125                         * ...
     126                         *  // Ask to include subsequent (in this call stack) DOM changes to be
     127                         * // considered as part of the latest snapshot.
     128                         *      editor.fire( 'updateSnapshot' );
     129                         *      editor.document.body.append(...);
     130                         * ...
     131                         * }
     132                         */
     133                        editor.on( 'updateSnapshot', function()
     134                        {
     135                                var editorImage = new Image( editor );
     136                                if ( undoManager.currentImage && editorImage.equals( undoManager.currentImage ) )
     137                                        setTimeout( function () { undoManager.update( editorImage ); }, 0 );
     138                        });
    117139                }
    118140        });
    119141
     
    397419                        // Update current image with the actual editor
    398420                        // content, since actualy content may differ from
    399421                        // the original snapshot due to dom change. (#4622)
    400                         this.snapshots.splice( this.index, 1, ( this.currentImage =  new Image( this.editor ) ) );
    401 
     422                        this.update();
    402423                        this.fireChange();
    403424                },
    404425
     
    497518                        }
    498519
    499520                        return false;
     521                },
     522
     523                /**
     524                 * Update the last snapshot of the undo stack with the current editor content.
     525                 * @param {Image} newImg
     526                 */
     527                update : function( newImg )
     528                {
     529                        this.snapshots.splice( this.index, 1, ( this.currentImage = newImg ) );
    500530                }
    501531        };
    502532})();
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy