diff --git a/package.json b/package.json index 47a4407..737c1d2 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,15 @@ { "title": "Gitmoji Code", "value": "code" } ], "default": "emoji" + }, + { + "name": "directPaste", + "title": "Direct Paste", + "description": "Paste the gitmoji directly into the focused app instead of copying to the clipboard.", + "required": false, + "type": "checkbox", + "label": "Paste directly into the focused app", + "default": false } ], "scripts": { diff --git a/src/gitmoji.tsx b/src/gitmoji.tsx index abbdc99..31d7edf 100644 --- a/src/gitmoji.tsx +++ b/src/gitmoji.tsx @@ -20,6 +20,7 @@ type CopyFormat = "emoji" | "code"; type GitmojiPreferences = { copyFormat?: CopyFormat; + directPaste?: boolean; }; const gitmojis = gitmojisData.gitmojis as Gitmoji[]; @@ -30,10 +31,11 @@ const contentFor = (gitmoji: Gitmoji, format: CopyFormat) => format === "code" ? gitmoji.code : gitmoji.emoji; export default function GitmojiList() { - const { copyFormat } = getPreferenceValues(); + const { copyFormat, directPaste } = getPreferenceValues(); const primaryFormat: CopyFormat = copyFormat === "code" ? "code" : "emoji"; const secondaryFormat: CopyFormat = primaryFormat === "code" ? "emoji" : "code"; + const preferPaste = directPaste === true; return ( @@ -47,17 +49,27 @@ export default function GitmojiList() { keywords={[gitmoji.name]} actions={ - - showToast( - Toast.Style.Success, - "Copied to clipboard", - String(content), - ) - } - /> + {preferPaste ? ( + + showToast(Toast.Style.Success, "Pasted", String(content)) + } + /> + ) : ( + + showToast( + Toast.Style.Success, + "Copied to clipboard", + String(content), + ) + } + /> + )}