Skip to content

Commit

Permalink
fix(scriptlet): use temple submit in main menu. Clipboard history fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
johnlindquist committed Nov 29, 2024
1 parent e1c3b6b commit 95fe7bb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
9 changes: 3 additions & 6 deletions src/main/clipboard-history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let createPreview = (item, input) => {
let content = escapeHTML(item.value)

if (item?.type === "image") {
return `<div class="p-4 flex justify-center"><img src="${content}" /></div>`
return `<div class="p-4 flex justify-center"><img src="file://${content}" /></div>`
}

let previewContent =
Expand Down Expand Up @@ -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 {}
13 changes: 12 additions & 1 deletion src/main/scriptlet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 95fe7bb

Please sign in to comment.