Skip to content

Commit

Permalink
feat(shortcut): add keyboard shortcut for gpt-block (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
xxchan authored Jan 13, 2023
1 parent 61f1cdb commit 4a6a03b
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 39 deletions.
76 changes: 38 additions & 38 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 13 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ const settingsSchema: SettingSchemaDesc[] = [
description:
"Size of the image to generate. Can be 256, 512, or 1024. Smaller images are faster to generate.",
},
{
key: "shortcutBlock",
type: "string",
default: "mod+j",
title: "Keyboard Shortcut for /gpt-block",
description: ""
},
];

interface PluginOptions extends OpenAIOptions {
Expand Down Expand Up @@ -242,7 +249,12 @@ async function main() {
logseq.Editor.registerSlashCommand("dalle", runDalleBlock);
logseq.Editor.registerBlockContextMenuItem("dalle", runDalleBlock);


if (logseq.settings!["shortcutBlock"]) {
logseq.App.registerCommandShortcut(
{ "binding": logseq.settings!["shortcutBlock"] },
runGptBlock
);
}
}

logseq.ready(main).catch(console.error);

0 comments on commit 4a6a03b

Please sign in to comment.