remove unnecessary debounce which caused missed changes

This commit is contained in:
zadam 2024-05-30 06:55:45 +02:00
parent a64a0e52ec
commit 82a437f2a8
2 changed files with 4 additions and 12 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "trilium", "name": "trilium",
"version": "0.63.5", "version": "0.63.6",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "trilium", "name": "trilium",
"version": "0.63.5", "version": "0.63.6",
"hasInstallScript": true, "hasInstallScript": true,
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
"dependencies": { "dependencies": {

View File

@ -2,7 +2,6 @@ import libraryLoader from '../../services/library_loader.js';
import TypeWidget from './type_widget.js'; import TypeWidget from './type_widget.js';
import utils from '../../services/utils.js'; import utils from '../../services/utils.js';
import linkService from '../../services/link.js'; import linkService from '../../services/link.js';
import debounce from '../../services/debounce.js';
const TPL = ` const TPL = `
<div class="canvas-widget note-detail-canvas note-detail-printable note-detail"> <div class="canvas-widget note-detail-canvas note-detail-printable note-detail">
@ -103,8 +102,6 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
this.SCENE_VERSION_INITIAL = -1; // -1 indicates that it is fresh. excalidraw scene version is always >0 this.SCENE_VERSION_INITIAL = -1; // -1 indicates that it is fresh. excalidraw scene version is always >0
this.SCENE_VERSION_ERROR = -2; // -2 indicates error this.SCENE_VERSION_ERROR = -2; // -2 indicates error
// config
this.DEBOUNCE_TIME_ONCHANGEHANDLER = 750; // ms
// ensure that assets are loaded from trilium // ensure that assets are loaded from trilium
window.EXCALIDRAW_ASSET_PATH = `${window.location.origin}/node_modules/@excalidraw/excalidraw/dist/`; window.EXCALIDRAW_ASSET_PATH = `${window.location.origin}/node_modules/@excalidraw/excalidraw/dist/`;
@ -117,11 +114,6 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
this.$widget; this.$widget;
this.reactHandlers; // used to control react state this.reactHandlers; // used to control react state
// binds
this.createExcalidrawReactApp = this.createExcalidrawReactApp.bind(this);
this.onChangeHandler = this.onChangeHandler.bind(this);
this.isNewSceneVersion = this.isNewSceneVersion.bind(this);
this.libraryChanged = false; this.libraryChanged = false;
} }
@ -153,7 +145,7 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
ReactDOM.unmountComponentAtNode(renderElement); ReactDOM.unmountComponentAtNode(renderElement);
const root = ReactDOM.createRoot(renderElement); const root = ReactDOM.createRoot(renderElement);
root.render(React.createElement(this.createExcalidrawReactApp)); root.render(React.createElement(() => this.createExcalidrawReactApp()));
}); });
return this.$widget; return this.$widget;
@ -445,7 +437,7 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
this.saveData(); this.saveData();
}, },
onChange: debounce(this.onChangeHandler, this.DEBOUNCE_TIME_ONCHANGEHANDLER), onChange: () => this.onChangeHandler(),
viewModeEnabled: false, viewModeEnabled: false,
zenModeEnabled: false, zenModeEnabled: false,
gridModeEnabled: false, gridModeEnabled: false,