-
Notifications
You must be signed in to change notification settings - Fork 2
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: Auto save #10
Conversation
`setViewData(data, false)` will be called by `save()` when we have more than one split/tab holding the same file. If we only have one split/tab of the file, then `setViewData()` won't be called.
Sorry for the delay upon my declaration, the API is confusing. Here's the explanation of the second change. This is also related to the boundary case, that multiple tabs sharing the same file. In this case, when one tab calls With this specific case I found another problem. If we assign the view data through When we have two tabs, drawing on 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 |
Update: code in #11 An alter would be, call
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @Acylation for your contribution!
- In terms of
setInterval
andrequestSave
, I thinkrequestSave
would be better - As for the "undo" problem, I created a new issue for that
undo
just reverts whatsetMolecule
did #12. A new PR is welcomed 😀
Sorry for the late reply, thank you again, and I got something new from your code. Please feel free to discuss any questions you may have.
In latest updates, I migrated to |
); | ||
// If clear is set, then it means we're opening a completely different file. | ||
if (_clear) { | ||
this.ketcher?.editor.unsubscribe("change", this.subscriber); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid calling unsubscribe()
before editor initialize. (Will happen only when we open a new ketcher view)
Closes #2
Changes
KetcherReact
insetViewData()
, 6da45a3onClose()
, 17ecb34Boundary case
If we have multiple tabs holding the same file, on proposed, these tabs will each have an interval, and they will run together, calling
save()
more frequently then expected.Notice that, the
setViewData()
function would only be called bysave()
if there's any change on file data, and the user may probably can't operate multiple editors at the same time, so here's what we'll get:Tab A (changed) | Tab B
→save()
by Tab A →setViewData()
called →Tab A (changed) | Tab B (changed)
Tab A (changed) | Tab B
→save()
by Tab B →setViewData()
won't be called →Tab A (changed) | Tab B
->save()
by Tab A ...And that's a pseudo-sync maybe.