wrap delete note in setTimeout

This commit is contained in:
IdanL 2024-12-11 23:04:25 +02:00
parent dd4989d8cd
commit 6f34effaf5
2 changed files with 5 additions and 3 deletions

View file

@ -41,7 +41,7 @@ export default class RedirectSettingsTab extends PluginSettingTab {
});
new Setting(containerEl)
.setName("Delete the _forwards Folder")
.setName("Delete the _forwards folder")
.setDesc(
"Before uninstalling the plugin, manually delete the `_forwards` folder to remove unnecessary files. This cannot be undone."
)

View file

@ -137,7 +137,9 @@ export default class RedirectPlugin extends Plugin {
this.app.workspace.on("file-open", this.redirectRef);
}
await this.deleteNote(redirectingNote);
setTimeout(async () => {
await this.deleteNote(redirectingNote);
}, 500);
} catch (error) {
console.error(error);
}
@ -169,7 +171,7 @@ export default class RedirectPlugin extends Plugin {
this.addCommand({
id: "paste-redirect-syntax",
name: "Paste Redirect Syntax onto Selection",
name: "Paste redirect syntax onto selection",
editorCallback: (editor, view) => {
const selection = editor.getSelection();
editor.replaceSelection(`::>[[${selection}]]`);