mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
save scroll and zoom in canvas
This commit is contained in:
parent
48248224f8
commit
aaad858395
@ -176,10 +176,6 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
|
|||||||
await sleep(200);
|
await sleep(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
const appState = {
|
|
||||||
theme: this.themeStyle
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* new and empty note - make sure that canvas is empty.
|
* new and empty note - make sure that canvas is empty.
|
||||||
* If we do not set it manually, we occasionally get some "bleeding" from another
|
* If we do not set it manually, we occasionally get some "bleeding" from another
|
||||||
@ -189,7 +185,9 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
|
|||||||
if (!blob.content?.trim()) {
|
if (!blob.content?.trim()) {
|
||||||
const sceneData = {
|
const sceneData = {
|
||||||
elements: [],
|
elements: [],
|
||||||
appState,
|
appState: {
|
||||||
|
theme: this.themeStyle
|
||||||
|
},
|
||||||
collaborators: []
|
collaborators: []
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -207,10 +205,13 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
|
|||||||
content = {
|
content = {
|
||||||
elements: [],
|
elements: [],
|
||||||
files: [],
|
files: [],
|
||||||
|
appState: {}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const {elements, files} = content;
|
const {elements, files, appState} = content;
|
||||||
|
|
||||||
|
appState.theme = this.themeStyle;
|
||||||
|
|
||||||
const boundingClientRect = this.excalidrawWrapperRef.current.getBoundingClientRect();
|
const boundingClientRect = this.excalidrawWrapperRef.current.getBoundingClientRect();
|
||||||
appState.width = boundingClientRect.width;
|
appState.width = boundingClientRect.width;
|
||||||
@ -289,13 +290,18 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
|
|||||||
if (element.fileId) {
|
if (element.fileId) {
|
||||||
activeFiles[element.fileId] = files[element.fileId];
|
activeFiles[element.fileId] = files[element.fileId];
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
const content = {
|
const content = {
|
||||||
type: "excalidraw",
|
type: "excalidraw",
|
||||||
version: 2,
|
version: 2,
|
||||||
elements,
|
elements,
|
||||||
files: activeFiles
|
files: activeFiles,
|
||||||
|
appState: {
|
||||||
|
scrollX: appState.scrollX,
|
||||||
|
scrollY: appState.scrollY,
|
||||||
|
zoom: appState.zoom
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const attachments = [
|
const attachments = [
|
||||||
@ -325,7 +331,7 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
content: JSON.stringify(content),
|
content: JSON.stringify(content),
|
||||||
attachments: attachments
|
attachments
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user