mirror of
https://github.com/zsviczian/obsidian-excalidraw-plugin.git
synced 2025-08-06 05:46:28 +00:00
Compare commits
3 Commits
autosave-t
...
window-onb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
23d1ad0da6 | ||
|
|
49173dc766 | ||
|
|
03a563856d |
@@ -1535,7 +1535,7 @@ export default class ExcalidrawView extends TextFileView {
|
||||
}
|
||||
};
|
||||
|
||||
const onMouseLeave = () => {
|
||||
const onBlurOrLeave = () => {
|
||||
if(!this.excalidrawAPI || !this.excalidrawData.loaded || !this.isDirty()) {
|
||||
return;
|
||||
}
|
||||
@@ -1544,7 +1544,8 @@ export default class ExcalidrawView extends TextFileView {
|
||||
|
||||
this.registerDomEvent(this.ownerWindow, "keydown", onKeyDown, false);
|
||||
this.registerDomEvent(this.ownerWindow, "keyup", onKeyUp, false);
|
||||
this.registerDomEvent(this.contentEl, "mouseleave", onMouseLeave, false);
|
||||
this.registerDomEvent(this.contentEl, "mouseleave", onBlurOrLeave, false);
|
||||
this.registerDomEvent(this.ownerWindow, "blur", onBlurOrLeave, false);
|
||||
});
|
||||
|
||||
this.setupAutosaveTimer();
|
||||
@@ -2619,6 +2620,10 @@ export default class ExcalidrawView extends TextFileView {
|
||||
|
||||
public setDirty(location?:number) {
|
||||
if(this.semaphores.saving) return; //do not set dirty if saving
|
||||
if(!this.isDirty()) {
|
||||
//the autosave timer should start when the first stroke was made... thus avoiding an immediate impact by saving right then
|
||||
this.resetAutosaveTimer();
|
||||
}
|
||||
(process.env.NODE_ENV === 'development') && DEBUGGING && debug(this.setDirty,`ExcalidrawView.setDirty, location:${location}`);
|
||||
this.semaphores.dirty = this.file?.path;
|
||||
this.actionButtons['save'].querySelector("svg").addClass("excalidraw-dirty");
|
||||
|
||||
Reference in New Issue
Block a user