This commit is contained in:
Zsolt Viczian
2022-04-03 21:36:08 +02:00
parent 58ed3f8e0a
commit fe9a9d6aa2
5 changed files with 66 additions and 3 deletions

View File

@@ -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",

View File

@@ -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 {}
}
/**

View File

@@ -17,6 +17,16 @@ I develop this plugin as a hobby, spending most of my free time doing this. If y
<div class="ex-coffee-div"><a href="https://ko-fi.com/zsolt"><img src="https://cdn.ko-fi.com/cdn/kofi3.png?v=3" height=45></a></div>
`,
"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)

View File

@@ -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 <a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/releases/tag/1.6.22' target='_blank'>here</a>.",
"For a number of reasons, the same approach cannot be used to expedite the loading of drawings with many embedded objects. See demonstration <a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/releases/tag/1.6.23' target='_blank'>here</a>.",
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.",

View File

@@ -1,4 +1,4 @@
{
"1.6.22": "0.12.16",
"1.6.23": "0.12.16",
"1.4.2": "0.11.13"
}