Description
Description
Splitting it from here: #68554 (comment)
The behavior of the Copy (Cmd/Ctrl + C) and Cut (Cmd/Ctrl + X) actions varies depending on whether they are triggered via keyboard shortcuts or the block menu items.
I believe the above condition occurs because the content is set as both text/plain
and text/html
within the writing flow, and this change appears to be intentional.
gutenberg/packages/block-editor/src/components/writing-flow/utils.js
Lines 60 to 62 in 73b8e2c
However, the Block Menu Items
utilize the useCopyToClipboard
hook, which only sets the content as text/plain
(based on Clipboard.js
). Therefore, to be consistent, we should set the data as both plain text and HTML on the clipboard to resolve this inconsistency.
gutenberg/packages/compose/src/hooks/use-copy-to-clipboard/index.js
Lines 46 to 52 in 73b8e2c
Please feel free to close this issue if it happens to be a duplicate of an existing issue.
Step-by-step reproduction instructions
- Select one or more Paragraph blocks.
- Copy or Cut using the block menu items from the three-dot menu.
- Paste the clipboard content into a text editor.
3.1. Observe that the clipboard contains the full block markup. - Now, repeat steps 1-3 using the keyboard shortcuts (Cmd/Ctrl + C or Cmd/Ctrl + X).
- Observe that only the block content (not the full markup) is copied.
Screenshots, screen recording, code snippet
bug.mov
Environment info
- WordPress Version: 6.8-alpha-59361
- Gutenberg Version: Latest Trunk
- OS: macOS Sequoia
Please confirm that you have searched existing issues in the repo.
- Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
- Yes
Please confirm which theme type you used for testing.
- Block
- Classic
- Hybrid (e.g. classic with theme.json)
- Not sure