Skip to content
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

undo just reverts what setMolecule did #12

Open
yuleicul opened this issue Aug 15, 2023 · 0 comments
Open

undo just reverts what setMolecule did #12

yuleicul opened this issue Aug 15, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@yuleicul
Copy link
Owner

This is also related to the boundary case, that multiple tabs sharing the same file. In this case, when one tab calls save(), the
_check flag in setViewData() of other tabs will be false. So through wrapping render KetcherReact, we can retain the editor, and just refresh the data.

With this specific case I found another problem. If we assign the view data through ketcher.setMolecule(), and the undo operation would just revert what the funcion did.

When we have two tabs, drawing on Tab A and updating Tab B automatically, the undo stack of Tab B behaves weird. For obsidian-ketcher v0.1.2, after refreshing the editor, undo will leave a blank canvas on Tab B, because we re-render the editor, and then assign the data value to the tab. For the proposed change, undo will revert save() operation, and we will get the previous state since we retained the editor and pervious data.

If there's a way to interact with the undo stack of ketcher editor, we can even keep it on the page (init in the constructor of KetView), and just update the data. (Update: code here https://github.com/Acylation/obsidian-ketcher/tree/single-editor-instance)

Originally posted by @Acylation in #10 (comment)

@yuleicul yuleicul added the bug Something isn't working label Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant