mirror of
https://github.com/TriliumNext/Trilium.git
synced 2025-12-10 03:53:37 -06:00
fix(canvas): error when trying to save due to uninitialized API
This commit is contained in:
parent
3f562332c7
commit
2be9d71659
@ -357,6 +357,9 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
|
||||
if (options.is("databaseReadonly")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.canvasInstance.isInitialized()) return;
|
||||
|
||||
// changeHandler is called upon any tiny change in excalidraw. button clicked, hover, etc.
|
||||
// make sure only when a new element is added, we actually save something.
|
||||
const isNewSceneVersion = this.canvasInstance.isNewSceneVersion();
|
||||
|
||||
@ -76,6 +76,10 @@ export default class Canvas {
|
||||
return this.currentSceneVersion === SCENE_VERSION_INITIAL;
|
||||
}
|
||||
|
||||
isInitialized() {
|
||||
return !!this.excalidrawApi;
|
||||
}
|
||||
|
||||
resetScene(theme: Theme) {
|
||||
this.excalidrawApi.updateScene({
|
||||
elements: [],
|
||||
@ -194,4 +198,4 @@ function CanvasElement(opts: ExcalidrawProps) {
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user