mirror of
https://github.com/zsviczian/obsidian-excalidraw-plugin.git
synced 2025-08-06 05:46:28 +00:00
2.2.2
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "obsidian-excalidraw-plugin",
|
||||
"name": "Excalidraw",
|
||||
"version": "2.2.1",
|
||||
"version": "2.2.2",
|
||||
"minAppVersion": "1.1.6",
|
||||
"description": "An Obsidian plugin to edit and view Excalidraw drawings",
|
||||
"author": "Zsolt Viczian",
|
||||
|
||||
@@ -973,7 +973,7 @@ export class ExcalidrawData {
|
||||
//update text in scene based on textElements Map
|
||||
//first get scene text elements
|
||||
const elementsMap = arrayToMap(this.scene.elements);
|
||||
const texts = this.scene.elements?.filter((el: any) => el.type === "text") as Mutable<ExcalidrawTextElement>[];
|
||||
const texts = this.scene.elements?.filter((el: any) => el.type === "text" && !el.isDeleted) as Mutable<ExcalidrawTextElement>[];
|
||||
for (const te of texts) {
|
||||
const container = getContainerElement(te, elementsMap);
|
||||
const originalText =
|
||||
|
||||
@@ -1309,7 +1309,11 @@ export default class ExcalidrawView extends TextFileView {
|
||||
this.app.workspace.onLayoutReady(async () => {
|
||||
debug(`ExcalidrawView.onload app.workspace.onLayoutReady, file: ${self.file?.name}, isActiveLeaf: ${self.app.workspace.activeLeaf === self.leaf}, is activeExcalidrawView set: ${Boolean(self.plugin.activeExcalidrawView)}`);
|
||||
//implemented to overcome issue that activeLeafChangeEventHandler is not called when view is initialized from a saved workspace, since Obsidian 1.6.0
|
||||
if (self.app.workspace.activeLeaf === self.leaf) {
|
||||
let counter = 0;
|
||||
while(counter++<50 && !Boolean(self.plugin.activeLeafChangeEventHandler)) {
|
||||
await(sleep(50));
|
||||
}
|
||||
if (Boolean(self.plugin.activeLeafChangeEventHandler) && (self.app.workspace.activeLeaf === self.leaf)) {
|
||||
self.plugin.activeLeafChangeEventHandler(self.leaf);
|
||||
}
|
||||
self.canvasNodeFactory.initialize();
|
||||
@@ -2318,17 +2322,25 @@ export default class ExcalidrawView extends TextFileView {
|
||||
}
|
||||
}
|
||||
|
||||
public initializeToolsIconPanelAfterLoading() {
|
||||
public async initializeToolsIconPanelAfterLoading() {
|
||||
if(this.semaphores.viewunload) return;
|
||||
const api = this.excalidrawAPI;
|
||||
if (!api) {
|
||||
return;
|
||||
}
|
||||
const st = api.getAppState();
|
||||
//since Obsidian 1.6.0 onLayoutReady calls happen asynchronously compared to starting Excalidraw view
|
||||
//these validations are just to make sure that initialization is complete
|
||||
let counter = 0;
|
||||
while(!this.plugin.scriptEngine && counter++<50) {
|
||||
sleep(50);
|
||||
}
|
||||
|
||||
const panel = this.toolsPanelRef?.current;
|
||||
if (!panel) {
|
||||
if (!panel || !this.plugin.scriptEngine) {
|
||||
return;
|
||||
}
|
||||
|
||||
panel.setTheme(st.theme);
|
||||
panel.setExcalidrawViewMode(st.viewModeEnabled);
|
||||
panel.setPreviewMode(
|
||||
@@ -2817,7 +2829,7 @@ export default class ExcalidrawView extends TextFileView {
|
||||
//@ts-ignore
|
||||
textElement.link = link;
|
||||
}
|
||||
if (this.textMode == TextMode.parsed) {
|
||||
if (this.textMode === TextMode.parsed && !textElement?.isDeleted) {
|
||||
const {text, x, y, width, height} = refreshTextDimensions(
|
||||
textElement,null,elementsMap,parseResult
|
||||
);
|
||||
@@ -4021,6 +4033,7 @@ export default class ExcalidrawView extends TextFileView {
|
||||
if(el.length === 1) {
|
||||
const container = getContainerElement(el[0],elementsMap);
|
||||
const clone = cloneElement(el[0]);
|
||||
if(!el[0]?.isDeleted) {
|
||||
const {text, x, y, width, height} = refreshTextDimensions(el[0], container, elementsMap, parsedText);
|
||||
|
||||
clone.x = x;
|
||||
@@ -4029,6 +4042,7 @@ export default class ExcalidrawView extends TextFileView {
|
||||
clone.height = height;
|
||||
clone.originalText = parsedText;
|
||||
clone.text = text;
|
||||
}
|
||||
|
||||
elements[elements.indexOf(el[0])] = clone;
|
||||
this.updateScene({elements});
|
||||
|
||||
@@ -17,6 +17,12 @@ I develop this plugin as a hobby, spending my free time doing this. If you find
|
||||
|
||||
<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>
|
||||
`,
|
||||
"2.2.2":`
|
||||
## Fixed
|
||||
- ExcaliBrain stopped working with 2.2.0
|
||||
|
||||

|
||||
`,
|
||||
"2.2.1":`
|
||||
## Fixed
|
||||
- Text height becomes unreadable after 2.2.0 update [#1784](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/1784)
|
||||
|
||||
Reference in New Issue
Block a user