From 6bdaf050c50c8dabdca28e518e89b5c12d8dc759 Mon Sep 17 00:00:00 2001 From: Tom <7283497+thfrei@users.noreply.github.com> Date: Tue, 19 Apr 2022 14:39:53 +0200 Subject: [PATCH] replace excalidraw.com asset in svg with EXCALIDRAW_ASSET_PATH, clean up code --- .../app/services/note_content_renderer.js | 5 +- .../app/widgets/type_widgets/canvas_note.js | 94 +++++++------------ 2 files changed, 37 insertions(+), 62 deletions(-) diff --git a/src/public/app/services/note_content_renderer.js b/src/public/app/services/note_content_renderer.js index 6ce23fd8a..12c094cf4 100644 --- a/src/public/app/services/note_content_renderer.js +++ b/src/public/app/services/note_content_renderer.js @@ -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($("