Skip to content

Instantly share code, notes, and snippets.

@pilotmoon
Created May 14, 2024 18:23
Show Gist options
  • Save pilotmoon/4ea2419c88ce4cbfa3e674f9ed9c7950 to your computer and use it in GitHub Desktop.
Save pilotmoon/4ea2419c88ce4cbfa3e674f9ed9c7950 to your computer and use it in GitHub Desktop.
// #popclip
// name: Freeform
// identifier: com.pilotmoon.popclip.extension.freeform
// description: Send the selected text to Freeform.
// icon: iconify:ph:shapes-light
// popclip version: 4586
// captureHtml: true
// captureRtf: true
export function action(input: Input) {
let item: string | RichString | { url: string };
if (popclip.input.isUrl) {
item = { url: input.data.urls[0] };
} else if (input.content["public.rtf"]) {
item = new RichString(input.rtf, { format: "rtf" });
} else if (popclip.input.content["public.html"]) {
item = new RichString(input.html, { format: "html" });
} else {
item = input.text;
}
popclip.share("com.apple.freeform.sharingextension", [item]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment