diff --git a/components/Settings.ts b/components/Settings.ts index afe4009..c180b02 100644 --- a/components/Settings.ts +++ b/components/Settings.ts @@ -52,11 +52,11 @@ export default class RedirectSettingsTab extends PluginSettingTab { new Setting(containerEl) .setName("Delete Redirects Folder") .setDesc( - "Before uninstalling the plugin, manually delete the `_redirects` folder to remove unnecessary files." + "Before uninstalling the plugin, manually delete the `_redirects` folder to remove unnecessary files. This cannot be undone." ) .addButton((button) => { button.setButtonText("Delete"); - button.setTooltip("Delete the Redirects folder."); + button.setTooltip("Delete the Redirects folder.", { delay: 0 }); button.setWarning(); button.onClick((evt) => { const redirectsFolder = diff --git a/main.ts b/main.ts index 46dd7b3..333508b 100644 --- a/main.ts +++ b/main.ts @@ -200,6 +200,13 @@ export default class RedirectPlugin extends Plugin { editorCallback: (editor, view) => { const selection = editor.getSelection(); editor.replaceSelection(`::>[[${selection}]]`); + const { ch, line } = editor.getCursor(); + if (!selection) { + editor.setCursor({ + ch: ch - 2, + line: line, + }); + } }, }); }