We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm currently using the undo plugin. Is there any way to clear the undo history after I empty the editor using .val("")?
.val("")
If not, how can I implement something like
function clear() { undoStates = [] } sceditor.plugins.undo.clear = clear; }(sceditor));
The text was updated successfully, but these errors were encountered:
This should really be part of the undo plugin so I'll leave this issue open.
For now, adding a method to the editor in the undo plugin init should work. Something like:
editor.clearUndo = function () { undoStates = []; redoPosition = 0; storeState(); };
Full file: https://gist.github.com/samclarke/4a53460692a0d8ecc55eadca861dbd57
Can then be called with:
instance.clearUndo();
Sorry, something went wrong.
I suggest also to add support to undo/redo commands (the translations already contains those keywords even if not used..) I did it this way:
modify the toolbar icons image - add undo and redo image (to the end...)
modify the css - add icon definitions for the buttons: .sceditor-button-undo div{background-position:0 -659px} .sceditor-button-redo div{background-position:0 -675px}
.sceditor-button-undo div{background-position:0 -659px} .sceditor-button-redo div{background-position:0 -675px}
add this line to main plugin function: (just after "var base = this;") var utils = sceditor.utils;
var utils = sceditor.utils;
added this code to the plugin init method: ` var commands = this.commands;
commands.undo = utils.extend(commands.undo || {}, { state: function () { return redoPosition < undoStates.length - 1 ? 0 : -1; }, exec: function () { base.undo(); }, tooltip: 'Undo' }); commands.redo = utils.extend(commands.redo || {}, { state: function () { return redoPosition > 0 ? 0 : -1; }, exec: function () { base.redo(); }, tooltip: 'Redo' }); editor.resetUndo = function() { undoStates = []; redoPosition = 0; storeState(); }
`
No branches or pull requests
I'm currently using the undo plugin. Is there any way to clear the undo history after I empty the editor using
.val("")
?If not, how can I implement something like
The text was updated successfully, but these errors were encountered: