Skip to content

GO-6868 Fix paste destroying styled block style#3046

Draft
KirillSto wants to merge 1 commit intodevelopfrom
go-6868-fix-paste-destroying-styled-block-style
Draft

GO-6868 Fix paste destroying styled block style#3046
KirillSto wants to merge 1 commit intodevelopfrom
go-6868-fix-paste-destroying-styled-block-style

Conversation

@KirillSto
Copy link
Copy Markdown
Member

Summary

  • Prevent paste from overwriting the style of non-Paragraph blocks (Callout, Toggle, Bullet, Checkbox, Highlight, etc.)
  • Fix intoBlock path: disable style copying when target block has a non-Paragraph style, so single-block paste preserves the target's style
  • Fix singleRange path: when a styled block becomes empty after RangeSplit (all text selected + replaced), preserve it by merging the first paste text content into it instead of deleting the block

Linear

GO-6868

Test plan

  • Existing TestPasteIntoEmptyStyledBlock tests pass (5 cases)
  • New TestPasteIntoNonEmptyStyledBlock tests pass (5 cases: single/multi-block paste into Callout, Toggle, Checkbox with all text selected)
  • Full clipboard test suite passes (go test ./core/block/editor/clipboard/...)

🤖 Generated with Claude Code

Prevent paste from overwriting the style of non-Paragraph blocks
(Callout, Toggle, Bullet, Checkbox, etc.) in two code paths:

1. intoBlock: disable style copying when target has a non-Paragraph style
2. singleRange: preserve styled blocks that become empty after split by
   merging first paste text content into them instead of deleting them

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@KirillSto KirillSto self-assigned this Mar 24, 2026
@KirillSto KirillSto marked this pull request as draft March 24, 2026 21:39
@github-actions
Copy link
Copy Markdown

New Coverage 46.6% of statements
Patch Coverage 100.0% of changed statements (11/11)

Coverage provided by https://github.com/seriousben/go-patch-cover-action

@KirillSto KirillSto marked this pull request as ready for review April 3, 2026 13:40
@KirillSto KirillSto marked this pull request as draft April 3, 2026 13:40
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