You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A void block (a block with no content, self-closing), when pasted, is not converted to a block (at least in macOS Chrome). The root cause is that ClipboardData#getData considers the comment-only markup as plain-text, not HTML. This could be considered a browser bug, though it has the practical impact of preventing blocks from being converted correctly.
Example void block:
<!-- wp:latest-posts /-->
To Reproduce
Steps to reproduce the behavior:
Copy the block markup above
Navigate to Posts > Add New
Click on the writing prompt
Paste the block markup
Expected behavior
The pasted text is converted into a Latest Posts block.
Alternatively, if it was interpreted as plain-text, the plain text of the markup should be inserted into the paragraph.
Actual behavior
Nothing happens.
Desktop:
OS: macOS Mojave Version 10.14.3 (18D109)
Browser: Chrome Version 73.0.3683.75 (Official Build) (64-bit)
Additional context
Both HTML and plain text data are retrieved from the clipboard and passed to clipboardData.
For this reason, if it's not possible to have the browser consider the comment markup as HTML, an alternative to consider may be to update the following condition to consider plainText, in addition to HTML:
Describe the bug
A void block (a block with no content, self-closing), when pasted, is not converted to a block (at least in macOS Chrome). The root cause is that
ClipboardData#getData
considers the comment-only markup as plain-text, not HTML. This could be considered a browser bug, though it has the practical impact of preventing blocks from being converted correctly.Example void block:
<!-- wp:latest-posts /-->
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The pasted text is converted into a Latest Posts block.
Alternatively, if it was interpreted as plain-text, the plain text of the markup should be inserted into the paragraph.
Actual behavior
Nothing happens.
Desktop:
Additional context
Both HTML and plain text data are retrieved from the clipboard and passed to
clipboardData
.gutenberg/packages/block-editor/src/components/rich-text/index.js
Lines 236 to 237 in 27c0d00
For this reason, if it's not possible to have the browser consider the comment markup as HTML, an alternative to consider may be to update the following condition to consider
plainText
, in addition toHTML
:gutenberg/packages/blocks/src/api/raw-handling/paste-handler.js
Lines 130 to 133 in 27c0d00
cc @ellatrix
The text was updated successfully, but these errors were encountered: