Files
archived-orca/src/shared/clipboard-link-html.ts
Kelvin Amoaba 6c31d92522 fix(native-chat): keep links when pasting rich text into the composer (#39213)
Rich-text pastes now keep their hyperlinks as Markdown links, and pasting a
URL over selected words links them, as other message editors do.

Fixes #39153
Fixes #39150
2026-11-08 23:38:26 +00:00

8 lines
372 B
TypeScript

/** Bounds the HTML a composer paste parses for links; larger copies paste as plain text. */
const CLIPBOARD_LINK_HTML_MAX_LENGTH = 1024 * 1024
/** Cheap pre-parse check: only HTML with an anchor can add links to a paste. */
export function clipboardHtmlMayHaveLinks(html: string): boolean {
return html.length <= CLIPBOARD_LINK_HTML_MAX_LENGTH && /<a\s/i.test(html)
}