diff --git a/docs/src/docPages/api/events.md b/docs/src/docPages/api/events.md index e6f1f6374..fb4a00f3d 100644 --- a/docs/src/docPages/api/events.md +++ b/docs/src/docPages/api/events.md @@ -28,9 +28,6 @@ const editor = new Editor({ onBlur({ editor, event }) { // The editor isn’t focused anymore. }, - onResize({ editor, event }) { - // The editor view has resized. - }, onDestroy() { // The editor is being destroyed. }, @@ -66,10 +63,6 @@ editor.on('blur', ({ editor, event }) => { // The editor isn’t focused anymore. } -editor.on('resize', ({ editor, event }) => { - // The editor view has resized. -} - editor.on('destroy', () => { // The editor is being destroyed. } @@ -115,9 +108,6 @@ const CustomExtension = Extension.create({ onBlur({ editor, event }) { // The editor isn’t focused anymore. }, - onResize({ editor, event }) { - // The editor view has resized. - }, onDestroy() { // The editor is being destroyed. }, diff --git a/packages/core/src/Editor.ts b/packages/core/src/Editor.ts index 0c1f06511..5ce939a48 100644 --- a/packages/core/src/Editor.ts +++ b/packages/core/src/Editor.ts @@ -44,8 +44,6 @@ export class Editor extends EventEmitter { public isFocused = false - private resizeObserver!: ResizeObserver - public options: EditorOptions = { element: document.createElement('div'), content: '', @@ -64,7 +62,6 @@ export class Editor extends EventEmitter { onTransaction: () => null, onFocus: () => null, onBlur: () => null, - onResize: () => null, onDestroy: () => null, } @@ -89,13 +86,6 @@ export class Editor extends EventEmitter { window.setTimeout(() => { this.commands.focus(this.options.autofocus) this.emit('create', { editor: this }) - - if (window.ResizeObserver) { - this.resizeObserver = new ResizeObserver(() => { - this.emit('resize', { editor: this }) - }) - this.resizeObserver.observe(this.view.dom) - } }, 0) } @@ -416,8 +406,6 @@ export class Editor extends EventEmitter { * Destroy the editor. */ public destroy(): void { - this.resizeObserver?.unobserve(this.view.dom) - this.emit('destroy') if (this.view) { diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index 210e6434c..074f38d2e 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -57,7 +57,6 @@ export interface EditorOptions { onTransaction: (props: { editor: Editor, transaction: Transaction }) => void, onFocus: (props: { editor: Editor, event: FocusEvent }) => void, onBlur: (props: { editor: Editor, event: FocusEvent }) => void, - onResize: (props: { editor: Editor }) => void, onDestroy: () => void, }