replace excalidraw.com asset in svg with EXCALIDRAW_ASSET_PATH, clean up code

This commit is contained in:
Tom
2022-04-19 14:39:53 +02:00
parent 05c8c6cfaa
commit 6bdaf050c5
2 changed files with 37 additions and 62 deletions

View File

@@ -142,6 +142,9 @@ async function getRenderedContent(note, options = {}) {
$renderedContent.append($content);
}
else if (type === 'canvas-note') {
// make sure surrounding container has size of what is visible. Then image is shrinked to its boundaries
$renderedContent.css({height: "100%", width:"100%"});
const noteComplement = await froca.getNoteComplement(note.noteId);
const content = noteComplement.content || "";
@@ -153,7 +156,7 @@ async function getRenderedContent(note, options = {}) {
* maxWidth: size down to 100% (full) width of container but do not enlarge!
* height:auto to ensure that height scales with width
*/
$renderedContent.append($(svg).css({maxWidth: "100%", height: "auto"}));
$renderedContent.append($(svg).css({maxWidth: "100%", maxHeight: "100%", height: "auto", width: "auto"}));
} catch(err) {
console.error("error parsing content as JSON", content, err);
$renderedContent.append($("<div>").text("Error parsing content. Please check console.error() for more details."));