mirror of
https://github.com/stablyai/orca.git
synced 2026-11-19 04:23:57 +00:00
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
8 lines
372 B
TypeScript
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)
|
|
}
|