Skip to content

Commit

Permalink
Fix incorrect handling of change events
Browse files Browse the repository at this point in the history
  • Loading branch information
zenoamaro committed Apr 11, 2020
1 parent 024827c commit 4c25ab2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ class ReactQuill extends React.Component<ReactQuillProps, ReactQuillState> {
// Expose the editor on change events via a weaker, unprivileged proxy
// object that does not allow accidentally modifying editor state.
this.unprivilegedEditor = this.makeUnprivilegedEditor(editor);
// Using `editor-change` allows picking up silent updates, like selection
// changes on typing.
editor.on('editor-change', this.onEditorChange);
}

Expand Down Expand Up @@ -500,8 +502,7 @@ class ReactQuill extends React.Component<ReactQuillProps, ReactQuillState> {
source,
this.unprivilegedEditor!
);
}
if (eventName === 'text-change' || eventName === 'selection-change') {
} else if (eventName === 'selection-change') {
this.onEditorChangeSelection?.(
rangeOrDelta as RangeStatic,
source,
Expand Down

0 comments on commit 4c25ab2

Please sign in to comment.