Repository navigation
fix(editor): copy and paste properties carry bold, italic and underline runs - #495
Conversation
…ne runs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
[Medium impact] The changes affect the editor’s copy-and-paste styling workflow. Fix copied decorations before merging so underlined source text does not paste without its underline. Findings
SummaryThe PR copies text styles from the first text run and clears existing run formatting when pasting properties.
Reviews (1) · Last reviewed commit: "fix(editor): copy and paste properties c..." · Reviewed by Greptile |
| var values = null | ||
| if (computedEl) { | ||
| var cs = getComputedStyle(computedEl) | ||
| var cs = getComputedStyle(d.fromTextRun === true ? firstTextRun(computedEl) : computedEl) |
There was a problem hiding this comment.
Reading every text property from the innermost run misses underlines set on a parent. For example, <p style="text-decoration:underline"><b>Text</b></p> now copies text-decoration-line: none from the <b>, even though the text is visibly underlined. Unlike font-weight, this property is not inherited. Pasting then removes the target's underline instead of carrying the source's.
Read decorations along the run's parents and add a nested-formatting test.
There was a problem hiding this comment.
Fixed in 50e74f4: a copied run's text-decoration-line is now the union of every line set from the run up to the layer (runDecoration), and the test's source carries an underline on the paragraph with a strike on an inner run (copies line-through underline).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ds (#495) * feat(components): match the component section to the inspector's dense fields Instance props use PropertyRow fields, the section's spacing matches the sections below it, and image props open the image fill's popover (now a shared ImagePicker). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(components): read the frame after an image pick, let image props clear, gate scrub on disabled Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 37f7ea1d153fbf7fc3e4e70f5c39fd8f14fb3a67)
Problem
Copy properties (⌥⌘C) did not carry a bold text's weight. ⌘B on a whole text layer wraps its text in
<b>rather than settingfont-weighton the layer, so:<b>/<i>/<u>runs kept overriding it.Fix
computedStyles(..., { fromTextRun: true })reads type properties off the layer's first text run (firstTextRunin the frame runtime); visual properties still come from the layer.styleElement(..., { uniformText: true })makes the pasted type the whole layer's:clearTextRunsdrops the runs' own values for those properties and turns<b>/<strong>,<i>/<em>,<u>/<s>/<strike>into spans when weight, style or decoration is set (the Design panel already did this for weight).LAYER_TEXT_PROPERTIESinsrc/lib/richText.ts, shared by the editor and the runtime.Tests
New case in
tests/richTextBrowser.test.ts: copying from a<b><i>layer reports 700 / italic, and pasting over a layer with<b>and<u>runs makes them plain spans at the pasted weight.🤖 Generated with Claude Code