@@ -2,7 +2,6 @@ import libraryLoader from '../../services/library_loader.js';
2
2
import TypeWidget from './type_widget.js' ;
3
3
import utils from '../../services/utils.js' ;
4
4
import linkService from '../../services/link.js' ;
5
- import debounce from '../../services/debounce.js' ;
6
5
7
6
const TPL = `
8
7
<div class="canvas-widget note-detail-canvas note-detail-printable note-detail">
@@ -103,8 +102,6 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
103
102
this . SCENE_VERSION_INITIAL = - 1 ; // -1 indicates that it is fresh. excalidraw scene version is always >0
104
103
this . SCENE_VERSION_ERROR = - 2 ; // -2 indicates error
105
104
106
- // config
107
- this . DEBOUNCE_TIME_ONCHANGEHANDLER = 750 ; // ms
108
105
// ensure that assets are loaded from trilium
109
106
window . EXCALIDRAW_ASSET_PATH = `${ window . location . origin } /node_modules/@excalidraw/excalidraw/dist/` ;
110
107
@@ -117,11 +114,6 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
117
114
this . $widget ;
118
115
this . reactHandlers ; // used to control react state
119
116
120
- // binds
121
- this . createExcalidrawReactApp = this . createExcalidrawReactApp . bind ( this ) ;
122
- this . onChangeHandler = this . onChangeHandler . bind ( this ) ;
123
- this . isNewSceneVersion = this . isNewSceneVersion . bind ( this ) ;
124
-
125
117
this . libraryChanged = false ;
126
118
}
127
119
@@ -153,7 +145,7 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
153
145
154
146
ReactDOM . unmountComponentAtNode ( renderElement ) ;
155
147
const root = ReactDOM . createRoot ( renderElement ) ;
156
- root . render ( React . createElement ( this . createExcalidrawReactApp ) ) ;
148
+ root . render ( React . createElement ( ( ) => this . createExcalidrawReactApp ( ) ) ) ;
157
149
} ) ;
158
150
159
151
return this . $widget ;
@@ -445,7 +437,7 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
445
437
446
438
this . saveData ( ) ;
447
439
} ,
448
- onChange : debounce ( this . onChangeHandler , this . DEBOUNCE_TIME_ONCHANGEHANDLER ) ,
440
+ onChange : ( ) => this . onChangeHandler ( ) ,
449
441
viewModeEnabled : false ,
450
442
zenModeEnabled : false ,
451
443
gridModeEnabled : false ,
0 commit comments