Skip to content

Commit

Permalink
fix: when input(not IME) after inline embed element, selection do not…
Browse files Browse the repository at this point in the history
… update
  • Loading branch information
wangpengju committed Mar 20, 2024
1 parent 6a27454 commit c6750e9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 8 additions & 2 deletions packages/quill/src/blots/scroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,15 @@ class Scroll extends ScrollBlot {
if (mutations.length > 0) {
this.emitter.emit(Emitter.events.SCROLL_BEFORE_UPDATE, source, mutations);
}
super.update(mutations.concat([])); // pass copy
const context = {};
super.update(mutations.concat([]), context); // pass copy
if (mutations.length > 0) {
this.emitter.emit(Emitter.events.SCROLL_UPDATE, source, mutations);
this.emitter.emit(
Emitter.events.SCROLL_UPDATE,
source,
mutations,
context,
);
}
}

Expand Down
3 changes: 2 additions & 1 deletion packages/quill/src/core/selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ class Selection {
if (native.start.node === this.cursor.textNode) return; // cursor.restore() will handle
this.emitter.once(
Emitter.events.SCROLL_UPDATE,
(source, mutations: MutationRecord[]) => {
(source, mutations: MutationRecord[], context) => {
try {
if (
!context.range && // context.range exists means SCROLL_OPTIMIZE listener has handled range
this.root.contains(native.start.node) &&
this.root.contains(native.end.node)
) {
Expand Down

0 comments on commit c6750e9

Please sign in to comment.