-
Notifications
You must be signed in to change notification settings - Fork 350
New issue
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
[Feature request] Clear undo/redo history #792
Comments
I have implemented this as an event that is fired externally
|
Thanks @ulfw, unfortunately, this doesn't work always in my case: When I set the editor value via editor.value, clear the stack, change the editors text to another value and clear the stack again, the undo button still appears, but doesn't do anything. |
@AgentSmith0 editor.events.on('editor.clearHistory', () => {
editor.observer.clear();
}); |
@xdan Hm, still the same problem... |
I had the same problem when reloading page with cleared history, but clicking into the editor window disabled the undo/redo buttons. Maybe setting focus to th editor again will solve? |
@AgentSmith0 @ulfw The Observer module is asynchronous, i.e. it does not process the change immediately, but only processes the last one in n milliseconds. This is done so that, for example, words when you enter them get into the history of changes, and not every letter. const editor = Jodit.make({
observer: {
timeout: 100
}
});
editor.value = 'test';
editor.async.setTimeout(() => {
editor.observer.clear();
}, 150); |
Maybe when called editor.value = 'test1';
editor.value = 'test2'; the history handler must be called immediately |
…of changes will be process immediately, without a timeout. Issue: #792
@ulfw @AgentSmith0 |
I seems to fail only when a specific string is set as value before... |
@AgentSmith0 Can you show this specific string? |
Sorry, I tested again and the string value is not the problem. It seems to be still a timing problem... I will test this behaviour. |
I tried again with version 3.16.1 and it works fine now... |
Jodit Version: 3.15.2
Browser: All
OS: All
Is React App: False
Is there any way to clear the undo/redo history? If not, is it possible to implement this feature?
The text was updated successfully, but these errors were encountered: