Skip to content

Commit

Permalink
fix: when compositionend after InlineEmbed element, selection do not …
Browse files Browse the repository at this point in the history
…update
  • Loading branch information
wpj-wpj-wpj committed Mar 20, 2024
1 parent 6a27454 commit f147b37
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/quill/src/blots/embed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,18 @@ class Embed extends EmbedBlot {
}

update(mutations: MutationRecord[], context: Record<string, unknown>) {
mutations.forEach((mutation) => {
if (
const mutation = mutations.find((mutation) => {
return (
mutation.type === 'characterData' &&
(mutation.target === this.leftGuard ||
mutation.target === this.rightGuard)
) {
const range = this.restore(mutation.target as Text);
if (range) context.range = range;
}
);
});

if (mutation) {
const range = this.restore(mutation.target as Text);
if (range) context.range = range;
}
}
}

Expand Down

0 comments on commit f147b37

Please sign in to comment.