From 95fe7bbd1612ef3f9ef5ade3f8a0cfe1a1937318 Mon Sep 17 00:00:00 2001 From: John Lindquist Date: Fri, 29 Nov 2024 13:46:20 -0700 Subject: [PATCH] fix(scriptlet): use temple submit in main menu. Clipboard history fixes --- src/main/clipboard-history.ts | 9 +++------ src/main/scriptlet.ts | 13 ++++++++++++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/main/clipboard-history.ts b/src/main/clipboard-history.ts index 722050a5..a1744d8f 100644 --- a/src/main/clipboard-history.ts +++ b/src/main/clipboard-history.ts @@ -17,7 +17,7 @@ let createPreview = (item, input) => { let content = escapeHTML(item.value) if (item?.type === "image") { - return `
` + return `
` } let previewContent = @@ -191,18 +191,15 @@ if (text) { await sendWait(Channel.TOGGLE_WATCHER) } else if (text === "__authorize-clipboard__") { exit() - } else { - await removeClipboardItem(id) - if (isImage) { + } else if (isImage) { + await removeClipboardItem(id) await clipboard.writeImage(await readFile(text)) await hide() - await sendWait(Channel.KEYBOARD_PASTE) } else { await setSelectedText(text) exit() } - } } export {} diff --git a/src/main/scriptlet.ts b/src/main/scriptlet.ts index d7f7a5a0..504fb620 100644 --- a/src/main/scriptlet.ts +++ b/src/main/scriptlet.ts @@ -122,7 +122,18 @@ await setSelectedText(result)` return await run(quickPath) } case "template": { - const result = await template(formattedScriptlet) + const result = await template(formattedScriptlet, { + shortcuts: [ + { + name: "Submit", + key: `${cmd}+s`, + bar: "right", + onPress: (input) => { + submit(input) + } + } + ] + }); await setSelectedText(result) process.exit(0) break