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

Convert newlines between inline elements to a space #3983

Merged
merged 1 commit into from Jan 31, 2024
Merged

Conversation

luin
Copy link
Member

@luin luin commented Jan 31, 2024

At the moment, if you paste the following HTML, the newline between the <span> elements is incorrectly discarded.

<span>foo</span>
<span>bar</span>

This will currently insert foobar into Quill, when we'd expect foo bar, since newlines should treated as spaces between inline elements (such as <span>).

This change updates the matchText() clipboard matcher to check if the text node is between inline elements or not before early-returning.

At the moment, if you paste the following HTML, the newline between the
`<span>` elements is incorrectly discarded.

```html
<span>foo</span>
<span>bar</span>
```

This will currently insert `foobar` into Quill, when we'd expect
`foo bar`, since newlines should [treated as spaces][1] between inline
elements (such as `<span>`).

This change updates the `matchText()` clipboard matcher to check if the
text node is between inline elements or not before early-returning.

[1]: https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Whitespace
@luin luin merged commit ca934d8 into develop Jan 31, 2024
5 checks passed
@luin luin deleted the clipboard-inline branch January 31, 2024 07:35
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.

None yet

2 participants