remove obsolete code, update doc

This commit is contained in:
Tom Free 2022-07-17 14:09:58 +02:00
parent 4ca59dcc5c
commit 3e7aa3d762
2 changed files with 5 additions and 30 deletions

View file

@ -45,8 +45,8 @@ const TPL = `
*
* Functionality:
* 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
* for displaying any canvas note inside of a text note as an image.
* export the SVG from the canvas on every update. The SVG is also saved in the note. It is used when
* calling api/images and makes referencing very easy.
*
* Paths not taken.
* - excalidraw-to-svg (node.js) could be used to avoid storing the svg in the backend.
@ -65,7 +65,6 @@ const TPL = `
* has.
*
* 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
* when requiring svg.
*
@ -262,11 +261,6 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
});
const svgString = svg.outerHTML;
/**
* workaround until https://github.com/excalidraw/excalidraw/pull/5065 is merged and published
*/
const svgSafeString = this.replaceExternalAssets(svgString);
const activeFiles = {};
elements.forEach((element) => {
if (element.fileId) {
@ -279,7 +273,7 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
elements, // excalidraw
appState, // 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);
@ -429,20 +423,4 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
updateSceneVersion() {
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;
}
}

View file

@ -37,10 +37,7 @@ const App = () => {
};
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);
}, [excalidrawWrapperRef]);
@ -53,7 +50,7 @@ const App = () => {
className: "excalidraw-wrapper",
ref: excalidrawWrapperRef
},
React.createElement(Excalidraw.default, {
React.createElement(ExcalidrawLib.Excalidraw, {
ref: excalidrawRef,
width: dimensions.width,
height: dimensions.height,