-
-
Notifications
You must be signed in to change notification settings - Fork 309
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: make it possible to clear changed status after SetContents #161
Comments
Hi, |
Hi, const editor = suneditor.create(..);
editor.setContents('html');
editor.core.history.reset(); // history stack reset Thank you. |
History clear works fine but setContents seem still to trigger an onChange event and the save button is still enabled (as if there is something unsaved). Anyway to avoid this? The event I can work around but would be nice if the save button could be disabled somehow. |
Hi, const editor = suneditor.create(..);
editor.setContents('html');
editor.core.history.reset(); // history stack reset
// ** disalbed save button **
editor.core.context.tool.save.disabled = true; Thank you. |
Great - got it working with your workaround and by ignoring first onChange event. |
You can declare the onChange event after setContents. const editor = suneditor.create(..);
editor.setContents('html');
editor.core.history.reset(); // history stack reset
// ** disalbed save button **
editor.core.context.tool.save.disabled = true;
// onChange
editor.onChange = function... |
Yes - works great. |
Hi, again The v2.23.1 version has been updated. You can use it like this: const editor = suneditor.create(..);
editor.setContents('html');
editor.core.history.reset(true); Thank you. |
Again, thanks for making Suneditor!
It seems as if setContents() causes editor to assume a change to contents has been made (and save button is enabled).
It would be nice to be able to clear this changed status (and disable save button) so that contents look unedited until user edit contents (or contents is appended/changed otherwise). I would suggest a function call which can clear the changed status (not sure about history though).
Any workaround would also work out for me!
The text was updated successfully, but these errors were encountered: