Skip to content

Commit

Permalink
improve
Browse files Browse the repository at this point in the history
  • Loading branch information
JiuqingSong committed Dec 18, 2024
1 parent 575643c commit df435da
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export class WatermarkPlugin implements EditorPlugin {
private format: WatermarkFormat;
private isShowing = false;
private darkTextColor: string | null = null;
private disposer: (() => void) | null = null;

/**
* Create an instance of Watermark plugin
Expand All @@ -43,7 +44,7 @@ export class WatermarkPlugin implements EditorPlugin {
*/
initialize(editor: IEditor) {
this.editor = editor;
this.editor.attachDomEvent({
this.disposer = this.editor.attachDomEvent({
compositionstart: {
beforeDispatch: this.onCompositionStart,
},
Expand All @@ -54,6 +55,9 @@ export class WatermarkPlugin implements EditorPlugin {
* Dispose this plugin
*/
dispose() {
this.disposer?.();
this.disposer = null;

this.editor = null;
}

Expand Down

0 comments on commit df435da

Please sign in to comment.