mirror of
https://github.com/zsviczian/obsidian-excalidraw-plugin.git
synced 2025-08-06 05:46:28 +00:00
Compare commits
4 Commits
2.4.0-rc-2
...
window-onb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
23d1ad0da6 | ||
|
|
49173dc766 | ||
|
|
03a563856d | ||
|
|
c3809c409d |
@@ -838,6 +838,7 @@ export default class ExcalidrawView extends TextFileView {
|
||||
if(triggerReload) {
|
||||
this.reload(true, this.file);
|
||||
}
|
||||
this.resetAutosaveTimer(); //next autosave period starts after save
|
||||
}
|
||||
|
||||
// get the new file content
|
||||
@@ -1534,7 +1535,7 @@ export default class ExcalidrawView extends TextFileView {
|
||||
}
|
||||
};
|
||||
|
||||
const onMouseLeave = () => {
|
||||
const onBlurOrLeave = () => {
|
||||
if(!this.excalidrawAPI || !this.excalidrawData.loaded || !this.isDirty()) {
|
||||
return;
|
||||
}
|
||||
@@ -1543,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();
|
||||
@@ -1736,7 +1738,7 @@ export default class ExcalidrawView extends TextFileView {
|
||||
this.semaphores.autosaving = true;
|
||||
//changed from await to then to avoid lag during saving of large file
|
||||
this.save().then(()=>this.semaphores.autosaving = false);
|
||||
}
|
||||
}
|
||||
this.autosaveTimer = window.setTimeout(
|
||||
timer,
|
||||
this.autosaveInterval,
|
||||
@@ -1770,7 +1772,6 @@ export default class ExcalidrawView extends TextFileView {
|
||||
this.autosaveFunction,
|
||||
this.autosaveInterval,
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
unload(): void {
|
||||
@@ -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");
|
||||
|
||||
@@ -224,8 +224,8 @@ export const DEFAULT_SETTINGS: ExcalidrawSettings = {
|
||||
onceOffCompressFlagReset: false,
|
||||
onceOffGPTVersionReset: false,
|
||||
autosave: true,
|
||||
autosaveIntervalDesktop: 15000,
|
||||
autosaveIntervalMobile: 10000,
|
||||
autosaveIntervalDesktop: 30000,
|
||||
autosaveIntervalMobile: 20000,
|
||||
drawingFilenamePrefix: "Drawing ",
|
||||
drawingEmbedPrefixWithFilename: true,
|
||||
drawingFilnameEmbedPostfix: " ",
|
||||
@@ -762,7 +762,8 @@ export class ExcalidrawSettingTab extends PluginSettingTab {
|
||||
.setDesc(fragWithHTML(t("AUTOSAVE_INTERVAL_DESKTOP_DESC")))
|
||||
.addDropdown((dropdown) =>
|
||||
dropdown
|
||||
.addOption("15000", "Frequent (every 15 seconds)")
|
||||
.addOption("15000", "Very frequent (every 15 seconds)")
|
||||
.addOption("30000", "Frequent (every 30 seconds)")
|
||||
.addOption("60000", "Moderate (every 60 seconds)")
|
||||
.addOption("300000", "Rare (every 5 minutes)")
|
||||
.addOption("900000", "Practically never (every 15 minutes)")
|
||||
@@ -778,7 +779,8 @@ export class ExcalidrawSettingTab extends PluginSettingTab {
|
||||
.setDesc(fragWithHTML(t("AUTOSAVE_INTERVAL_MOBILE_DESC")))
|
||||
.addDropdown((dropdown) =>
|
||||
dropdown
|
||||
.addOption("10000", "Frequent (every 10 seconds)")
|
||||
.addOption("10000", "Very frequent (every 10 seconds)")
|
||||
.addOption("20000", "Frequent (every 20 seconds)")
|
||||
.addOption("30000", "Moderate (every 30 seconds)")
|
||||
.addOption("60000", "Rare (every 1 minute)")
|
||||
.addOption("300000", "Practically never (every 5 minutes)")
|
||||
|
||||
Reference in New Issue
Block a user