mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
remove obsolete code, update doc
This commit is contained in:
parent
4ca59dcc5c
commit
3e7aa3d762
@ -45,8 +45,8 @@ const TPL = `
|
|||||||
*
|
*
|
||||||
* Functionality:
|
* Functionality:
|
||||||
* We store the excalidraw assets (elements, appState, files) in the note. In addition to that, we
|
* We store the excalidraw assets (elements, appState, files) in the note. In addition to that, we
|
||||||
* export the SVG from the canvas on every update. The SVG is also saved in the note. It is used
|
* export the SVG from the canvas on every update. The SVG is also saved in the note. It is used when
|
||||||
* for displaying any canvas note inside of a text note as an image.
|
* calling api/images and makes referencing very easy.
|
||||||
*
|
*
|
||||||
* Paths not taken.
|
* Paths not taken.
|
||||||
* - excalidraw-to-svg (node.js) could be used to avoid storing the svg in the backend.
|
* - excalidraw-to-svg (node.js) could be used to avoid storing the svg in the backend.
|
||||||
@ -65,7 +65,6 @@ const TPL = `
|
|||||||
* has.
|
* has.
|
||||||
*
|
*
|
||||||
* Known issues:
|
* Known issues:
|
||||||
* - v0.11.0 of excalidraw does not render freedraw backgrounds in the svg
|
|
||||||
* - the 3 excalidraw fonts should be included in the share and everywhere, so that it is shown
|
* - the 3 excalidraw fonts should be included in the share and everywhere, so that it is shown
|
||||||
* when requiring svg.
|
* when requiring svg.
|
||||||
*
|
*
|
||||||
@ -262,11 +261,6 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
|
|||||||
});
|
});
|
||||||
const svgString = svg.outerHTML;
|
const svgString = svg.outerHTML;
|
||||||
|
|
||||||
/**
|
|
||||||
* workaround until https://github.com/excalidraw/excalidraw/pull/5065 is merged and published
|
|
||||||
*/
|
|
||||||
const svgSafeString = this.replaceExternalAssets(svgString);
|
|
||||||
|
|
||||||
const activeFiles = {};
|
const activeFiles = {};
|
||||||
elements.forEach((element) => {
|
elements.forEach((element) => {
|
||||||
if (element.fileId) {
|
if (element.fileId) {
|
||||||
@ -279,7 +273,7 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
|
|||||||
elements, // excalidraw
|
elements, // excalidraw
|
||||||
appState, // excalidraw
|
appState, // excalidraw
|
||||||
files: activeFiles, // excalidraw
|
files: activeFiles, // excalidraw
|
||||||
svg: svgSafeString, // not needed for excalidraw, used for note_short, content, and image api
|
svg: svgString, // not needed for excalidraw, used for note_short, content, and image api
|
||||||
};
|
};
|
||||||
|
|
||||||
return JSON.stringify(content);
|
return JSON.stringify(content);
|
||||||
@ -429,20 +423,4 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
|
|||||||
updateSceneVersion() {
|
updateSceneVersion() {
|
||||||
this.currentSceneVersion = this.getSceneVersion();
|
this.currentSceneVersion = this.getSceneVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* replaces exlicraw.com with own assets
|
|
||||||
*
|
|
||||||
* workaround until https://github.com/excalidraw/excalidraw/pull/5065 is merged and published
|
|
||||||
* needed for v0.11.0
|
|
||||||
*
|
|
||||||
* @param {string} string
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
replaceExternalAssets = (string) => {
|
|
||||||
let result = string;
|
|
||||||
// exlidraw.com asset in react usage
|
|
||||||
result = result.replaceAll("https://excalidraw.com/", window.EXCALIDRAW_ASSET_PATH+"excalidraw-assets/");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -37,9 +37,6 @@ const App = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
window.addEventListener("resize", onResize);
|
window.addEventListener("resize", onResize);
|
||||||
// ensure that resize is also called for split creation and deletion
|
|
||||||
// not really the problem. problem is saved appState!
|
|
||||||
// self.$renderElement.addEventListener("resize", onResize);
|
|
||||||
|
|
||||||
return () => window.removeEventListener("resize", onResize);
|
return () => window.removeEventListener("resize", onResize);
|
||||||
}, [excalidrawWrapperRef]);
|
}, [excalidrawWrapperRef]);
|
||||||
@ -53,7 +50,7 @@ const App = () => {
|
|||||||
className: "excalidraw-wrapper",
|
className: "excalidraw-wrapper",
|
||||||
ref: excalidrawWrapperRef
|
ref: excalidrawWrapperRef
|
||||||
},
|
},
|
||||||
React.createElement(Excalidraw.default, {
|
React.createElement(ExcalidrawLib.Excalidraw, {
|
||||||
ref: excalidrawRef,
|
ref: excalidrawRef,
|
||||||
width: dimensions.width,
|
width: dimensions.width,
|
||||||
height: dimensions.height,
|
height: dimensions.height,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user