add set cursor upon paste

This commit is contained in:
IdanL 2024-10-28 21:45:15 +02:00
parent c306f13dc8
commit aaab6790d8
2 changed files with 9 additions and 2 deletions

View file

@ -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 =

View file

@ -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,
});
}
},
});
}