Skip to content

Commit 3cf50a4

Browse files
authored
Check editor disposed before executing function when on blur (#2994)
* fixes
1 parent 928bac4 commit 3cf50a4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/roosterjs-content-model-plugins/lib/imageEdit/ImageEditPlugin.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export class ImageEditPlugin implements ImageEditor, EditorPlugin {
104104
this.disposer = editor.attachDomEvent({
105105
blur: {
106106
beforeDispatch: () => {
107-
if (this.editor) {
107+
if (this.isEditing && this.editor && !this.editor.isDisposed()) {
108108
this.applyFormatWithContentModel(
109109
this.editor,
110110
this.isCropMode,
@@ -142,13 +142,13 @@ export class ImageEditPlugin implements ImageEditor, EditorPlugin {
142142
* called, plugin should not call to any editor method since it will result in error.
143143
*/
144144
dispose() {
145-
this.editor = null;
146-
this.isEditing = false;
147-
this.cleanInfo();
148145
if (this.disposer) {
149146
this.disposer();
150147
this.disposer = null;
151148
}
149+
this.isEditing = false;
150+
this.cleanInfo();
151+
this.editor = null;
152152
}
153153

154154
/**

0 commit comments

Comments
 (0)