Skip to content

fix(editor): copy and paste properties carry bold, italic and underline runs - #495

Merged
kgoedecke merged 2 commits into
mainfrom
fix/copy-properties-text-runs
Nov 10, 2026
Merged

kgoedecke merged 2 commits into
mainfrom
fix/copy-properties-text-runs

Conversation

@kgoedecke

Copy link
Copy Markdown
Collaborator

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 setting font-weight on the layer, so:

  • Copy read the layer's own computed style (400) and missed the bold on the run.
  • Paste set the type on the layer, where inner <b> / <i> / <u> runs kept overriding it.

Fix

  • computedStyles(..., { fromTextRun: true }) reads type properties off the layer's first text run (firstTextRun in the frame runtime); visual properties still come from the layer.
  • styleElement(..., { uniformText: true }) makes the pasted type the whole layer's: clearTextRuns drops 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).
  • The pasted type list moves to LAYER_TEXT_PROPERTIES in src/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

…ne runs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[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

  1. P1 Copied underlines disappear ▶

Summary

The PR copies text styles from the first text run and clears existing run formatting when pasting properties.

  • Copied text styles now replace matching formatting across pasted text layers.

Reviews (1) · Last reviewed commit: "fix(editor): copy and paste properties c..." · Reviewed by Greptile

Comment thread src/lib/frameRuntime.ts Outdated
var values = null
if (computedEl) {
var cs = getComputedStyle(computedEl)
var cs = getComputedStyle(d.fromTextRun === true ? firstTextRun(computedEl) : computedEl)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Copied underlines disappear

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@kgoedecke
kgoedecke merged commit 4bcb548 into main Nov 10, 2026
10 checks passed
kgoedecke added a commit that referenced this pull request Nov 16, 2026
…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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant