Skip to content

Commit

Permalink
Fix settings not saved to data.json when rename/delete
Browse files Browse the repository at this point in the history
  • Loading branch information
RyotaUshio committed Nov 25, 2023
1 parent fb40ad6 commit d3cfddd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export class PreambleManager extends Component {
onRename(file: TAbstractFile, oldPath: string) {
if (file instanceof TFile) this.onFileRename(file, oldPath);
if (file instanceof TFolder) this.onFolderRename(file, oldPath);
this.plugin.saveSettings();
}

onFileRename(file: TFile, oldPath: string) {
Expand Down Expand Up @@ -138,6 +139,7 @@ export class PreambleManager extends Component {
onDelete(file: TAbstractFile) {
if (file instanceof TFile) this.onFileDelete(file);
if (file instanceof TFolder) this.onFolderDelete(file);
this.plugin.saveSettings();
}

onFileDelete(file: TFile) {
Expand Down
1 change: 1 addition & 0 deletions src/settings/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export class MathJaxPreamblePluginSettingTab extends PluginSettingTab {
}

async hide() {
super.hide();
if (this.serialized) await this.plugin.manager.deserialize(this.serialized);
this.plugin.rerender();
await this.plugin.saveSettings();
Expand Down

0 comments on commit d3cfddd

Please sign in to comment.