Skip to content

Commit

Permalink
'Feature parity' between panel and dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
FelisDiligens committed Feb 10, 2023
1 parent ae98cb3 commit 52243b2
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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": "",
Expand Down Expand Up @@ -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],
});
}
}
},
Expand Down

0 comments on commit 52243b2

Please sign in to comment.