Skip to content

fix(Clipboard): copying no longer includes unrelated ancestor nodes#1020

Merged
d3m1d0v merged 1 commit intomainfrom
copy-fix
Mar 23, 2026
Merged

fix(Clipboard): copying no longer includes unrelated ancestor nodes#1020
d3m1d0v merged 1 commit intomainfrom
copy-fix

Conversation

@d3m1d0v
Copy link
Copy Markdown
Member

@d3m1d0v d3m1d0v commented Mar 23, 2026

Summary

When copying nested content (e.g. list items inside a blockquote or table cell), the clipboard incorrectly included outer container nodes. Now getSelectionContent finds the nearest complex: 'root' ancestor and slices from there, preserving only the meaningful structure.

Before / After

Copying list items inside a blockquote:

- > - item 1        ← blockquote leaked into clipboard
- > - item 2
+ - item 1           ← only the list is copied
+ - item 2

Changes

  • Extracted getSelectionContent into selection-content.ts
  • Fixed slicing logic to exclude unrelated outer containers
  • Added unit tests for lists, blockquotes, tables, yfm-tables

@gravity-ui
Copy link
Copy Markdown

gravity-ui Bot commented Mar 23, 2026

Storybook Deployed

@gravity-ui
Copy link
Copy Markdown

gravity-ui Bot commented Mar 23, 2026

🎭 Playwright Report

@d3m1d0v d3m1d0v marked this pull request as ready for review March 23, 2026 14:05
@d3m1d0v d3m1d0v requested a review from makhnatkin as a code owner March 23, 2026 14:05
@d3m1d0v d3m1d0v merged commit da0544e into main Mar 23, 2026
9 of 10 checks passed
@d3m1d0v d3m1d0v deleted the copy-fix branch March 23, 2026 15:33
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.

2 participants