GO-6868 Fix paste destroying styled block style#3046
Draft
GO-6868 Fix paste destroying styled block style#3046
Conversation
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>
Coverage provided by https://github.com/seriousben/go-patch-cover-action |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
intoBlockpath: disable style copying when target block has a non-Paragraph style, so single-block paste preserves the target's stylesingleRangepath: when a styled block becomes empty afterRangeSplit(all text selected + replaced), preserve it by merging the first paste text content into it instead of deleting the blockLinear
GO-6868
Test plan
TestPasteIntoEmptyStyledBlocktests pass (5 cases)TestPasteIntoNonEmptyStyledBlocktests pass (5 cases: single/multi-block paste into Callout, Toggle, Checkbox with all text selected)go test ./core/block/editor/clipboard/...)🤖 Generated with Claude Code