Skip to content

Commit b41a964

Browse files
committed
feat: add help option in menu
1 parent 4ebd718 commit b41a964

3 files changed

Lines changed: 50 additions & 1 deletion

File tree

package-lock.json

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
"keywords": [
1212
"joplin-plugin"
1313
],
14+
"browser": {
15+
"child_process": false,
16+
"fs": false
17+
},
1418
"devDependencies": {
1519
"@types/node": "^14.0.14",
1620
"@typescript-eslint/eslint-plugin": "^4.26.0",
@@ -32,6 +36,7 @@
3236
"front-matter": "^4.0.2",
3337
"handlebars": "^4.7.7",
3438
"html-entities": "^2.3.2",
35-
"moment": "^2.29.1"
39+
"moment": "^2.29.1",
40+
"open": "^8.2.1"
3641
}
3742
}

src/index.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ import { getTemplateFromId, getUserTemplateSelection, Note } from "./utils/templ
66
import { setDefaultTemplatesView } from "./views/defaultTemplates";
77
import { JoplinCommand } from "./types";
88
import { loadLegacyTemplates } from "./legacyTemplates";
9+
import * as open from "open";
10+
11+
const DOCUMENTATION_URL = "https://github.com/joplin/plugin-templates#readme";
912

1013
joplin.plugins.register({
1114
onStart: async function() {
@@ -142,6 +145,14 @@ joplin.plugins.register({
142145
}
143146
});
144147

148+
await joplin.commands.register({
149+
name: "showPluginDocumentation",
150+
label: "Help",
151+
execute: async () => {
152+
open(DOCUMENTATION_URL);
153+
}
154+
});
155+
145156

146157
// Create templates menu
147158
await joplin.views.menus.create("templates", "Templates", [
@@ -176,6 +187,9 @@ joplin.plugins.register({
176187
accelerator: "Alt+Shift+T"
177188
}
178189
]
190+
},
191+
{
192+
commandName: "showPluginDocumentation"
179193
}
180194
]);
181195
},

0 commit comments

Comments
 (0)