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

Inserted inline embed inherits formats with applyDelta #3623

Closed
luin opened this issue Aug 6, 2022 · 0 comments · Fixed by #3783
Closed

Inserted inline embed inherits formats with applyDelta #3623

luin opened this issue Aug 6, 2022 · 0 comments · Fixed by #3783

Comments

@luin
Copy link
Member

luin commented Aug 6, 2022

When call updateContents() to insert an embed into the middle of a line, the inserted embed inherits the formats of the target position. If the insertion is a text, it won't inherit any formats.

Steps for Reproduction

The following test case fails:

    it('updateContents() insert text to the middle of formatted content', function() {
      const delta = new Delta()
        .retain(5)
        .insert({ image: '/assets/favicon.png' });
      this.quill.updateContents(delta);
      expect(this.quill.root).toEqualHTML(
        '<p>0123<em>4</em><img src="/assets/favicon.png"><em>5</em>67</p>',
      );
    });

Expected behavior:

<p>0123<em>4</em><img src="/assets/favicon.png"><em>5</em>67</p>

Actual behavior:

<p>0123<em>4<img src="/assets/favicon.png">5</em>67</p>

Platforms:

Chrome v103.

Version:

2.0.0-dev.4

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 a pull request may close this issue.

1 participant