mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
handle note.type changing
This commit is contained in:
parent
c85f70e197
commit
3491e71084
@ -159,8 +159,19 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
|
|||||||
* load saved content into excalidraw canvas
|
* load saved content into excalidraw canvas
|
||||||
*/
|
*/
|
||||||
else if (this.excalidrawRef.current && noteComplement.content) {
|
else if (this.excalidrawRef.current && noteComplement.content) {
|
||||||
|
let content ={
|
||||||
|
elements: [],
|
||||||
|
appState: [],
|
||||||
|
files: [],
|
||||||
|
};
|
||||||
|
|
||||||
try {
|
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;
|
const {elements, appState, files} = content;
|
||||||
|
|
||||||
@ -197,9 +208,6 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
|
|||||||
|
|
||||||
this.excalidrawRef.current.updateScene(sceneData);
|
this.excalidrawRef.current.updateScene(sceneData);
|
||||||
this.excalidrawRef.current.addFiles(fileArray);
|
this.excalidrawRef.current.addFiles(fileArray);
|
||||||
} catch(err) {
|
|
||||||
console.error("Error (note, noteComplement, err)", note, noteComplement, err);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// set initial scene version
|
// set initial scene version
|
||||||
|
Loading…
x
Reference in New Issue
Block a user