import { textInput, takeSelection, insertText } from "../../takker/scrapbox-userscript-std/dom.ts"; import { convert, hasURL } from "../../takker/URLを外部リンク記法に変換するUserScript_(TamperMonkeyなし)/mod.ts"; textInput()!.addEventListener("keydown", async (e) => { if (!(e.key === "v" && e.ctrlKey && !e.shiftKey && !e.altKey && !e.metaKey)) return; const text = takeSelection().getSelectedText(); if (!hasURL(text)) return; e.preventDefault(); e.stopPropagation(); const newText = await convert(text); if (newText === text) return; await insertText(newText); });