mirror of
https://github.com/zadam/trilium.git
synced 2025-11-03 11:56:01 +01:00
handle note.type changing
This commit is contained in:
@@ -159,8 +159,19 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
|
||||
* load saved content into excalidraw canvas
|
||||
*/
|
||||
else if (this.excalidrawRef.current && noteComplement.content) {
|
||||
let content ={
|
||||
elements: [],
|
||||
appState: [],
|
||||
files: [],
|
||||
};
|
||||
|
||||
try {
|
||||
const content = JSON.parse(noteComplement.content || "");
|
||||
content = JSON.parse(noteComplement.content || "");
|
||||
} catch(err) {
|
||||
console.error("Error parsing content. Probably note.type changed",
|
||||
"Starting with empty canvas"
|
||||
, note, noteComplement, err);
|
||||
}
|
||||
|
||||
const {elements, appState, files} = content;
|
||||
|
||||
@@ -197,9 +208,6 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
|
||||
|
||||
this.excalidrawRef.current.updateScene(sceneData);
|
||||
this.excalidrawRef.current.addFiles(fileArray);
|
||||
} catch(err) {
|
||||
console.error("Error (note, noteComplement, err)", note, noteComplement, err);
|
||||
}
|
||||
}
|
||||
|
||||
// set initial scene version
|
||||
|
||||
Reference in New Issue
Block a user