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

Pasting HTML with Strong and List Separated by Newline Places the Strong Content within the List #3812

Open
chadrschroeder opened this issue Jun 26, 2023 · 4 comments

Comments

@chadrschroeder
Copy link

Steps for Reproduction

  1. Copy HTML from a page that includes this:
<strong>one</strong>
<ol>
  <li>two</li>
  <li>three</li>
</ol>
  1. Paste it into the Quill Playground.

Expected behavior:

The editor should show:

one

  1. two
  2. three

Actual behavior:

The editor displays this instead:

  1. onetwo
  2. three

This happens if there is a newline between the <strong> element and the <ol>. For example, it works if the newline isn't there:

// Good
quill.clipboard.dangerouslyPasteHTML('<strong>one</strong><ol><li>two</li><li>three</li></ol>')
<p><strong>one</strong></p><ol><li>two</li><li>three</li></ol>

But the position of the <strong> shifts into the <ol> when there's a newline:

// Bad
quill.clipboard.dangerouslyPasteHTML('<strong>one</strong>\n<ol><li>two</li><li>three</li></ol>')
<ol><li><strong>one</strong>two</li><li>three</li></ol>

Pasting the example works fine in other WYSIWYG editors like Trix.

Platforms: Chrome, macOS
Version: 1.3.7

@Shubhdeep12
Copy link

Hey @luin is it a valid bug? if yes can I try fixing this?

@luin
Copy link
Member

luin commented Feb 3, 2024

@Shubhdeep12 Yeah looks like a bug.

@Shubhdeep12
Copy link

Ok thanks for the confirmation @luin , i'll push a fix for this.

@Shubhdeep12
Copy link

Hi @luin added a PR with fix.
Thanks
cc @benbro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants