Skip to content

Commit

Permalink
toolbar button behaviour changed (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
lkiThakur authored Oct 27, 2022
1 parent 4f7d64c commit 1b49277
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,23 @@ joplin.plugins.register({
resolve(1);
}),
});
await joplin.commands.register({
name: "openElseSetHomenote",
label: "open or set as Homenote",
iconName: "fas fa-home",
execute: () =>
new Promise((resolve, reject) => {
if (localStorage.getItem("homeNoteId")) {
joplin.commands.execute("openHomenote");
return;
}
joplin.views.dialogs.setHtml(
regiteredHomenoteDialog,
`<p>Homenote Set. <br/> Go to tools → set as Homenote to change Homenote</p>`
);
joplin.commands.execute("setHomenote");
}),
});
await joplin.commands.register({
name: "openHomenote",
label: "Open the Homenote",
Expand All @@ -40,7 +57,7 @@ joplin.plugins.register({
await joplin.commands.execute("openHomenote");
await joplin.views.toolbarButtons.create(
"idHomenote",
"setHomenote",
"openElseSetHomenote",
ToolbarButtonLocation.EditorToolbar
);

Expand Down

0 comments on commit 1b49277

Please sign in to comment.