@@ -2,7 +2,6 @@ import libraryLoader from '../../services/library_loader.js';
22import TypeWidget from './type_widget.js' ;
33import utils from '../../services/utils.js' ;
44import linkService from '../../services/link.js' ;
5- import debounce from '../../services/debounce.js' ;
65
76const TPL = `
87 <div class="canvas-widget note-detail-canvas note-detail-printable note-detail">
@@ -103,8 +102,6 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
103102 this . SCENE_VERSION_INITIAL = - 1 ; // -1 indicates that it is fresh. excalidraw scene version is always >0
104103 this . SCENE_VERSION_ERROR = - 2 ; // -2 indicates error
105104
106- // config
107- this . DEBOUNCE_TIME_ONCHANGEHANDLER = 750 ; // ms
108105 // ensure that assets are loaded from trilium
109106 window . EXCALIDRAW_ASSET_PATH = `${ window . location . origin } /node_modules/@excalidraw/excalidraw/dist/` ;
110107
@@ -117,11 +114,6 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
117114 this . $widget ;
118115 this . reactHandlers ; // used to control react state
119116
120- // binds
121- this . createExcalidrawReactApp = this . createExcalidrawReactApp . bind ( this ) ;
122- this . onChangeHandler = this . onChangeHandler . bind ( this ) ;
123- this . isNewSceneVersion = this . isNewSceneVersion . bind ( this ) ;
124-
125117 this . libraryChanged = false ;
126118 }
127119
@@ -153,7 +145,7 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
153145
154146 ReactDOM . unmountComponentAtNode ( renderElement ) ;
155147 const root = ReactDOM . createRoot ( renderElement ) ;
156- root . render ( React . createElement ( this . createExcalidrawReactApp ) ) ;
148+ root . render ( React . createElement ( ( ) => this . createExcalidrawReactApp ( ) ) ) ;
157149 } ) ;
158150
159151 return this . $widget ;
@@ -445,7 +437,7 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
445437
446438 this . saveData ( ) ;
447439 } ,
448- onChange : debounce ( this . onChangeHandler , this . DEBOUNCE_TIME_ONCHANGEHANDLER ) ,
440+ onChange : ( ) => this . onChangeHandler ( ) ,
449441 viewModeEnabled : false ,
450442 zenModeEnabled : false ,
451443 gridModeEnabled : false ,
0 commit comments