diff --git a/manifest.json b/manifest.json index 91d14e3..47704f3 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-excalidraw-plugin", "name": "Excalidraw", - "version": "1.6.22", + "version": "1.6.23", "minAppVersion": "0.12.16", "description": "An Obsidian plugin to edit and view Excalidraw drawings", "author": "Zsolt Viczian", diff --git a/src/ExcalidrawData.ts b/src/ExcalidrawData.ts index 25fa297..116b08b 100644 --- a/src/ExcalidrawData.ts +++ b/src/ExcalidrawData.ts @@ -30,6 +30,7 @@ import { hasExportTheme, isObsidianThemeDark, LinkParts, + log, wrapText, } from "./Utils"; import { @@ -286,6 +287,58 @@ export class ExcalidrawData { //https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/497 if(el.fontSize===null) el.fontSize=20; } + + //https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/569 + try { + //Fix text elements that point to a container, but the container does not point back + const textElWithOneWayLinkToContainer = elements.filter((textEl:any) => + textEl.type === "text" && + textEl.containerId && + elements.some((container:any) => + container.id === textEl.containerId && + container.boundElements.length > 0 && + container.boundElements.some((boundEl:any) => + boundEl.type === "text" && + boundEl.id !== textEl.id && + boundEl.id.length > 8 + ) + ) + ); + //if(textElWithOneWayLinkToContainer.length>0) log({message: "cleanup", textElWithOneWayLinkToContainer}); + textElWithOneWayLinkToContainer.forEach((textEl:any) => { + try { + const container = elements.filter((container:any) => + container.id === textEl.containerId)[0]; + const boundEl = container.boundElements.filter((boundEl:any) => + !(boundEl.type === "text" && + !elements.some((el:any) => el.id === boundEl.id)) + ); + container.boundElements = [{id: textEl.id, type:"text"}].concat(boundEl); + } catch(e) {} + }); + + //Remove from bound elements references that do not exist in the scene + const containers = elements.filter((container:any) => + container.boundElements && + container.boundElements.length > 0 + ); + containers.forEach((container:any) => { + const filteredBoundElements = container.boundElements.filter((boundEl:any) => + elements.some((el:any) => el.id === boundEl.id) + ) + if(filteredBoundElements.length !== container.boundElements.length) { + //log({message: "cleanup",oldBound: container.boundElements, newBound: filteredBoundElements}); + container.boundElements = filteredBoundElements; + } + }) + + //Clear the containerId for textElements if the referenced container does not exist in the scene + elements.filter((textEl:any) => + textEl.type === "text" && + textEl.containerId && + !elements.some((container:any) => container.id === textEl.containerId) + ).forEach((textEl:any) => {textEl.containerId = null;});// log({message:"cleanup",textEl})}); + } catch {} } /** diff --git a/src/Messages.ts b/src/Messages.ts index f5a8dc4..dec743e 100644 --- a/src/Messages.ts +++ b/src/Messages.ts @@ -17,6 +17,16 @@ I develop this plugin as a hobby, spending most of my free time doing this. If y
`, +"1.6.23": ` +## Fixed: +- I have received some user feedback about cases where the text separated from the sticky note. This version comes with a cleanup algorithm that will try to automatically resolve these issues. +- Autosave did not notice changes in a very obscure case, when you opened a drawing, resized an element, and without deselecting the element you immediately closed the drawing. ([565](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/565)) +- CTRL+Enter to create a task did not work in hover-editor when opened from Excalidraw. Now it does! Thanks @pjeby! ([567](https://github.com/zsviczian/obsidian-excalidraw-plugin/pull/567)) + +## New Features +- If you have the [Obsidian-Latex](https://github.com/xldenis/obsidian-latex) plugin installed, from now Excalidraw will also process the ${String.fromCharCode(96)}preambles.sty${String.fromCharCode(96)} file. ( [563](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/563)) +- I added a new setting ${String.fromCharCode(96)}Embed & Export >> If found, use the already exported image for preview${String.fromCharCode(96)}. This setting works in conjunction with the ${String.fromCharCode(96)}Auto-export SVG/PNG${String.fromCharCode(96)} settings. If an exported image that matches the file name of the drawing is available, use that image instead of generating a preview image on the fly. This will result in faster previews especially when you have many embedded objects in the drawing, however, it may happen that your latest changes are not displayed and that the image will not automatically match your Obsidian theme in case you have changed the Obsidian theme since the export was created. This setting only applies to embedding images into markdown documents. For a number of reasons, the same approach cannot be used to expedite the loading of drawings with many embedded objects. See release notes for a [demo video](https://github.com/zsviczian/obsidian-excalidraw-plugin/releases/tag/1.6.22). +`, "1.6.22": ` ## Fixed: - "Create a new drawing - IN THE CURRENT ACTIVE PANE - and embed into active document" did not work as intended when an Excalidraw pane was already open. [#559](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/559) diff --git a/src/lang/locale/en.ts b/src/lang/locale/en.ts index f732080..d382e3e 100644 --- a/src/lang/locale/en.ts +++ b/src/lang/locale/en.ts @@ -276,7 +276,7 @@ export default { "is available, use that image instead of generating a preview image on the fly. This will result in faster previews especially when you have many embedded objects in the drawing, however, "+ "it may happen that your latest changes are not displayed and that the image will not automatically match your Obsidian theme in case you have changed the "+ "Obsidian theme since the export was created. This setting only applies to embedding images into markdown documents. " + - "For a number of reasons, the same approach cannot be used to expedite the loading of drawings with many embedded objects. See demonstration here.", + "For a number of reasons, the same approach cannot be used to expedite the loading of drawings with many embedded objects. See demonstration here.", EMBED_PREVIEW_SVG_NAME: "Display SVG in markdown preview", EMBED_PREVIEW_SVG_DESC: "The default is to display drawings as SVG images in the markdown preview. Turning this feature off, the markdown preview will display the drawing as an embedded PNG image.", diff --git a/versions.json b/versions.json index d2a46b0..75ba270 100644 --- a/versions.json +++ b/versions.json @@ -1,4 +1,4 @@ { - "1.6.22": "0.12.16", + "1.6.23": "0.12.16", "1.4.2": "0.11.13" }