Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Setting content from HTML results in unwanted paragraphs #795

Closed
jonnyandrew opened this issue Sep 1, 2023 · 0 comments · Fixed by #820
Closed

Setting content from HTML results in unwanted paragraphs #795

jonnyandrew opened this issue Sep 1, 2023 · 0 comments · Fixed by #820

Comments

@jonnyandrew
Copy link
Contributor

jonnyandrew commented Sep 1, 2023

Summary

Setting content from HTML results in extra unwanted paragraphs being inserted into the content.

Steps to reproduce

  • Initialise the composer with HTML containing paragraphs and newlines, for example:
<p>
  paragraph 1
</p>
<p>
  paragraph 2
</p>
  • Get the composer content as HTML.

Expected

Output is the same as the input.

Actual

Output contains an extra paragraph:

<p>
  paragraph 1
</p>
<p>
</p>
<p>
  paragraph 2
</p>

Failing test

#[test]
fn set_content_from_html_paragraphs() {
    let mut model = cm("|");
    model
        .set_content_from_html(&utf16(
            "<p>\nparagraph 1\n</p>\n<p>\nparagraph 2\n</p>",
        ))
        .unwrap();
    assert_eq!(
        tx(&model),
        "<p>\nparagraph 1\n</p>\n<p>\nparagraph 2\n</p>|"
    );
}

Related issues

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

Successfully merging a pull request may close this issue.

1 participant