diff --git a/src/main/ts/components/Editor.tsx b/src/main/ts/components/Editor.tsx index b9d3876d..cbae534b 100644 --- a/src/main/ts/components/Editor.tsx +++ b/src/main/ts/components/Editor.tsx @@ -146,6 +146,7 @@ export class Editor extends React.Component { private id: string; private elementRef: React.RefObject; + private latestUpdate: string | null = null; private inline: boolean; private currentContent?: string; private boundHandlers: Record) => unknown>; @@ -403,7 +404,15 @@ export class Editor extends React.Component { if (newContent !== this.currentContent) { this.currentContent = newContent; if (isFunction(this.props.onEditorChange)) { - this.props.onEditorChange(newContent, editor); + if (this.latestUpdate === null) { + setTimeout(() => { + if (this.props.onEditorChange && this.latestUpdate !== null) { + this.props.onEditorChange(this.latestUpdate, editor); + this.latestUpdate = null; + } + }); + } + this.latestUpdate = newContent; } } }