-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Excalidraw file modified by MetaEdit while drawing causes loss of data #50
Comments
Hey @zsviczian, thank you very much for reporting this! This I've made a fix, but it depends on metadata in Excalidraw files. Does Excalidraw files always have a metadata key with const metadata = await this.app.metadataCache.getFileCache(outfile);
const keys = Object.keys(metadata?.frontmatter);
if (keys && keys.some(key => key.toLowerCase().contains("excalidraw"))) {
return;
} |
yes
…On Wed, Jan 19, 2022, 14:54 Christian Bager Bach Houmann < ***@***.***> wrote:
Hey @zsviczian <https://github.com/zsviczian>, thank you very much for
reporting this!
This onFileModify function helps facilitate a queue, and by rejecting the
active pane rather than the file that the event regards, possible issues
can occur.
I've made a fix, but it depends on metadata in Excalidraw files. Does
Excalidraw files always have a metadata key with Excalidraw in the name?
const metadata = await this.app.metadataCache.getFileCache(outfile);const keys = Object.keys(metadata?.frontmatter);if (keys && keys.some(key => key.toLowerCase().contains("excalidraw"))) {
return;}
—
Reply to this email directly, view it on GitHub
<#50 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADNRO6XJ4LB6HN3PFEVILL3UW27BTANCNFSM5J2UAW4A>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I'm encountering an exception attributed to this code change here. Looks like when OnFileModifyAutomatorManager.onFileModify is called, the object returned from |
It seems metachache is updated asynchronously. This is my isExcalidraw() function. I do check if frontmatter exists... on a related note, I have a separate event handler to monitor metachache changes and to maintain a list of Excalidraw drawings: |
Please see this issue raised by @zhl111 for Excalidraw #296.
@zhl111 singled out MetaEdit as the root cause of the data loss by way of elimination... i.e. turning off plugins one-by-one until only MetaEdit was left.
I haven't done detailed testing, however, my assumptions are the following:
I recommend adding the following logic to onFileModify() (and potentially other relevant functions) avoid this issue:
if (app.workspace.activeLeaf.view.getViewType()==="excalidraw") return;
The text was updated successfully, but these errors were encountered: