From 52243b234e1830438ece56d1284f3e6660fd1c1c Mon Sep 17 00:00:00 2001 From: FelisDiligens <47528453+FelisDiligens@users.noreply.github.com> Date: Fri, 10 Feb 2023 08:50:13 +0100 Subject: [PATCH] 'Feature parity' between panel and dialog --- src/index.ts | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/index.ts b/src/index.ts index 1547765..aaedac2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -70,11 +70,13 @@ joplin.plugins.register({ await dialogSAR.create(); await dialogSAR.addScript("./webview_dialog.css"); await dialogSAR.setButtons([ - {id: "replaceNext", title: "Replace next"}, + {id: "findPrevious", title: "Find previous"}, + {id: "findNext", title: "Find next"}, + {id: "replace", title: "Replace"}, {id: "replaceAll", title: "Replace all"}, {id: "cancel"} ]); - dialogSAR.addPositiveIds("replaceNext", "replaceAll"); + dialogSAR.addPositiveIds("findNext", "findPrevious", "replace", "replaceAll"); dialogSAR.template = getDialogHTML(); dialogSAR.setDefaultFormData({ "pattern-txt": "", @@ -174,18 +176,10 @@ joplin.plugins.register({ }, } - switch (result.id) { - case "replaceNext": - return await joplin.commands.execute('editor.execCommand', { - name: "SARPlugin.replace", - args: [form], - }); - case "replaceAll": - return await joplin.commands.execute('editor.execCommand', { - name: "SARPlugin.replaceAll", - args: [form], - }); - } + await joplin.commands.execute('editor.execCommand', { + name: "SARPlugin." + result.id, + args: [form], + }); } } },