Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore whitespace between pasted empty paragraphs #3480

Closed
wants to merge 1 commit into from

Conversation

alecgibson
Copy link
Contributor

At the moment, when pasting HTML containing empty paragraphs with
whitespace between them, the whitespace is incorrectly rendered.

For example:

<p></p> <p></p>

will result in a Delta containing ' \n'

This happens because the clipboard's isLine() function assumes that
any element without children is an embed (which isn't true for things
like empty paragraphs).

This change updates the isLine() check to check the node against the
registry, and see if we have a matching EmbedBlot there.

At the moment, when pasting HTML containing empty paragraphs with
whitespace between them, the whitespace is incorrectly rendered.

For example:

```html
<p></p> <p></p>
```

will result in a Delta containing `' \n'`

This happens because the clipboard's `isLine()` function assumes that
any element without children is an embed (which isn't true for things
like empty paragraphs).

This change updates the `isLine()` check to check the node against the
registry, and see if we have a matching `EmbedBlot` there.
@luin
Copy link
Member

luin commented Feb 3, 2024

Thanks for the contribution! Had to reimplement it due to code conflicts.

@alecgibson alecgibson deleted the is-line-fix branch February 9, 2024 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants