ArthurClemens/JavaScript-Undo-Manager

How would one upgrade when using this version?

Closed this issue · 2 comments

This is the version that we had been using: https://github.com/Spreadsheets/jQuery.sheet/blob/3.x/plugins/undomanager.js

We switched to bower, and now it seems everything is broken, I'm sure we just need to adjust how we've implemented, starting here: https://github.com/Spreadsheets/jQuery.sheet/blob/master/jquery.sheet.js#L8364

Please note the internal reference to "jS.undo.manager" is the instantiated UndoManager. Thanks in advance!

The old interface:

manager.register(undoObj, undoFunc, undoParamsList, undoMsg, redoObj, redoFunc, redoParamsList, redoMsg)

Current interface:

manager.add({undo: undoFunction, redo: redoFunction})

So

manager.register(u, jS.undo.removeCells, [before, id], 'Remove Cells', u, jS.undo.createCells, [after, null, id], 'Create Cells')

would roughly change to:

manager.add({
    undo: function() {
        jS.undo.removeCells(before, id);
    },
    redo: function() {
        jS.undo.createCells(after, null, id);
    }
})

Sweet!

On Wed, Aug 20, 2014 at 5:46 PM, Arthur Clemens notifications@github.com
wrote:

The old interface:

manager.register(undoObj, undoFunc, undoParamsList, undoMsg, redoObj, redoFunc, redoParamsList, redoMsg)

Current interface:

manager.add({undo: undoFunction, redo: redoFunction})

So

manager.register(u, jS.undo.removeCells, [before, id], 'Remove Cells', u, jS.undo.createCells, [after, null, id], 'Create Cells')

would roughly change to:

manager.add({
undo: function() {
jS.undo.removeCells(before, id);
},
redo: function() {
jS.undo.createCells(after, null, id);
}
})


Reply to this email directly or view it on GitHub
#6 (comment)
.

Robert Plummer