From 31ae51a4219ec03fa4a5bfdd2d1754e9fe6c2f11 Mon Sep 17 00:00:00 2001 From: Zsolt Viczian Date: Sun, 28 Aug 2022 13:05:58 +0200 Subject: [PATCH] 1.7.18 --- manifest.json | 2 +- src/ExcalidrawData.ts | 7 ++++++- src/ExcalidrawView.ts | 1 + src/dialogs/Messages.ts | 3 +++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index a3dc368..a38b020 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-excalidraw-plugin", "name": "Excalidraw", - "version": "1.7.17", + "version": "1.7.18", "minAppVersion": "0.15.6", "description": "An Obsidian plugin to edit and view Excalidraw drawings", "author": "Zsolt Viczian", diff --git a/src/ExcalidrawData.ts b/src/ExcalidrawData.ts index a30e5ee..ed951cf 100644 --- a/src/ExcalidrawData.ts +++ b/src/ExcalidrawData.ts @@ -702,7 +702,6 @@ export class ExcalidrawData { * @returns {boolean} - true if there were changes */ private findNewTextElementsInScene(selectedElementIds: {[key: string]: boolean} = {}): boolean { - return false; //console.log("Excalidraw.Data.findNewTextElementsInScene()"); //get scene text elements this.selectedElementIds = selectedElementIds; @@ -741,7 +740,13 @@ export class ExcalidrawData { this.textElements.set(id, { raw, parsed: null, wrapAt }); this.parseasync(id, raw, wrapAt); } + } else if (!this.textElements.has(te.id)) { + const raw = te.rawText && te.rawText !== "" ? te.rawText : te.text; //this is for compatibility with drawings created before the rawText change on ExcalidrawTextElement + const wrapAt = estimateMaxLineLen(te.text, te.originalText); + this.textElements.set(id, { raw, parsed: null, wrapAt }); + this.parseasync(id, raw, wrapAt); } + } if (dirty) { //reload scene json in case it has changed diff --git a/src/ExcalidrawView.ts b/src/ExcalidrawView.ts index 0beac3c..d108861 100644 --- a/src/ExcalidrawView.ts +++ b/src/ExcalidrawView.ts @@ -2432,6 +2432,7 @@ export default class ExcalidrawView extends TextFileView { }; this.refresh = () => { + if(this.contentEl.clientWidth === 0 || this.contentEl.clientHeight === 0) return; const api = this.excalidrawAPI; if (!excalidrawRef?.current || !api) { return; diff --git a/src/dialogs/Messages.ts b/src/dialogs/Messages.ts index 86db2be..2421ac8 100644 --- a/src/dialogs/Messages.ts +++ b/src/dialogs/Messages.ts @@ -17,6 +17,9 @@ I develop this plugin as a hobby, spending most of my free time doing this. If y
`, +"1.7.18":` +## Critical fix +- duplicating text elements, adding text elements from the library, and pasting excalidraw text elements results in a corrupted file!!`, "1.7.17":` ## Fixed - Block transclusions sometimes got lost when switching between RAW mode and PREVIEW mode. [#769](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/769)