mirror of
https://github.com/PR0M3TH3AN/Artstr-Studio.git
synced 2026-11-04 04:30:40 +00:00
A new "Link URL (optional)" field in the text-layer panel attaches a hyperlink to a text layer. When set, every render path that goes through applyPreviewLayerTextStyle wraps the layer's text in a display:block <a href> covering the whole text box, so: - Editor / community / publish-modal previews show the text as a visible underlined link. - Deck PDF export passes the <a href> through Chrome's print engine, which converts it to a clickable PDF annotation. Verified end-to- end via headless Chrome + CDP: pdftohtml extracts the link from the generated PDF as href="https://...". Safety: - safeTextLinkHref() only accepts http / https / mailto / tel / nostr schemes. javascript: and data: URLs are stripped (verified in the same test by including a javascript:alert(1) layer that rendered as plain text with no PDF link emitted). - escAttr() escapes the href value before it lands in the rendered HTML attribute. - target="_blank" rel="noopener noreferrer" on the emitted anchor. The canvas editor's contenteditable render path (separate from the preview path) is untouched, so users can still edit the text inline without the <a> wrapper interfering with cursor / selection. The link only appears in preview / export contexts. Tested with a CDP harness driving the actual app: 1-slide deck with a legit link + a javascript: link, exported via Page.printToPDF. - PDF page count: correct. - pdftohtml -i: extracts only the legit https URL. - Visual render: legit link is underlined, javascript link plain. Co-Authored-By: Claude Opus 4.7 <[email protected]>