Skip to content

Conversation

@BryanValverdeU
Copy link
Contributor

When there is no text in the clipboard data but here is html, get the text content of the root element and correctly set the text prop of the clipboard data,

Otherwise paste in this scenario would be no-op.
Fix 279830

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the clipboard text handling for plain text pasting by ensuring that when no text is present in the clipboard data, the text content of the root element is used instead.

  • Updated a test case to reflect the new behavior by expecting "HTML" instead of an empty string.
  • Modified the createPasteFragment function to derive clipboard text from the root element when necessary.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/roosterjs-content-model-core/test/command/paste/createPasteFragmentTest.ts Updated expected output for plain text pasting test
packages/roosterjs-content-model-core/lib/command/paste/createPasteFragment.ts Added condition to set clipboardData.text from root.textContent

…PasteFragment.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@BryanValverdeU BryanValverdeU merged commit d923479 into master Jun 4, 2025
7 checks passed
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.

3 participants