diff --git a/manifest-beta.json b/manifest-beta.json index 9e93f76..c950171 100644 --- a/manifest-beta.json +++ b/manifest-beta.json @@ -1,7 +1,7 @@ { "id": "obsidian-excalidraw-plugin", "name": "Excalidraw", - "version": "2.4.3-rc-2", + "version": "2.4.3", "minAppVersion": "1.1.6", "description": "An Obsidian plugin to edit and view Excalidraw drawings", "author": "Zsolt Viczian", diff --git a/manifest.json b/manifest.json index e63d03c..3fb3583 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-excalidraw-plugin", "name": "Excalidraw", - "version": "2.4.2", + "version": "2.4.3", "minAppVersion": "1.1.6", "description": "An Obsidian plugin to edit and view Excalidraw drawings", "author": "Zsolt Viczian", diff --git a/src/ExcalidrawView.ts b/src/ExcalidrawView.ts index f943680..5ed5404 100644 --- a/src/ExcalidrawView.ts +++ b/src/ExcalidrawView.ts @@ -763,6 +763,8 @@ export default class ExcalidrawView extends TextFileView { this.clearPreventReloadTimer(); this.semaphores.preventReload = preventReload; + await this.prepareGetViewData(); + //added this to avoid Electron crash when terminating a popout window and saving the drawing, need to check back //can likely be removed once this is resolved: https://github.com/electron/electron/issues/40607 if(this.semaphores?.viewunload) { @@ -774,10 +776,10 @@ export default class ExcalidrawView extends TextFileView { await plugin.app.vault.modify(file,d); await imageCache.addBAKToCache(file.path,d); },200) + this.semaphores.saving = false; return; } - await this.prepareGetViewData(); await super.save(); if (process.env.NODE_ENV === 'development') { if (DEBUGGING) { @@ -1548,7 +1550,7 @@ export default class ExcalidrawView extends TextFileView { this.registerDomEvent(this.ownerWindow, "keydown", onKeyDown, false); this.registerDomEvent(this.ownerWindow, "keyup", onKeyUp, false); - this.registerDomEvent(this.contentEl, "mouseleave", onBlurOrLeave, false); + //this.registerDomEvent(this.contentEl, "mouseleave", onBlurOrLeave, false); //https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2004 this.registerDomEvent(this.ownerWindow, "blur", onBlurOrLeave, false); }); @@ -1787,7 +1789,7 @@ export default class ExcalidrawView extends TextFileView { //deliberately not calling super.onUnloadFile() to avoid autosave (saved in unload) (process.env.NODE_ENV === 'development') && DEBUGGING && debug(this.onUnloadFile,`ExcalidrawView.onUnloadFile, file:${this.file?.name}`); let counter = 0; - while (this.semaphores.saving) { + while (this.semaphores.saving && (counter++ < 200)) { await sleep(50); //https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/1988 if(counter++ === 15) { new Notice(t("SAVE_IS_TAKING_LONG")); @@ -1796,6 +1798,10 @@ export default class ExcalidrawView extends TextFileView { new Notice(t("SAVE_IS_TAKING_VERY_LONG")); } } + if(counter >= 200) { + new Notice("Unknown error, save is taking too long"); + return; + } } private async forceSaveIfRequired():Promise { diff --git a/src/dialogs/Messages.ts b/src/dialogs/Messages.ts index bcb099a..d6cc6b5 100644 --- a/src/dialogs/Messages.ts +++ b/src/dialogs/Messages.ts @@ -17,6 +17,17 @@ I develop this plugin as a hobby, spending my free time doing this. If you find
`, +"2.4.3": ` +Check out the [Excalidraw Plugin's Community WIKI](https://excalidraw-obsidian.online/Hobbies/Excalidraw+Blog/WIKI/Welcome+to+the+WIKI) and help with your content contribution. + +## Fixed +- In some situations Excalidraw hangs indefinitely when opening a different file in the same tab +- Can't exit arrow tool on phone [#2006](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2006) +- Save is triggered every few seconds, leading to glitches in handwriting [#2004](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2004) +- Canvas shifts when editing text reaches right hand side of the canvas, especially at higher zoom values +- Minor styling tweaks to adapt to Obsidian 1.7.1 new stylesheet, in particular to scale Excalidraw properly in line with Obsidian Appearance Setting Font-Size value. +- Tweaked Compatibilty Setting description to mention Obsidian 1.7.1 Footnotes support +`, "2.4.2": ` This release addresses critical issues for all Obsidian Mobile users. diff --git a/src/dialogs/ScriptInstallPrompt.ts b/src/dialogs/ScriptInstallPrompt.ts index bb229d9..97613cf 100644 --- a/src/dialogs/ScriptInstallPrompt.ts +++ b/src/dialogs/ScriptInstallPrompt.ts @@ -22,7 +22,7 @@ export class ScriptInstallPrompt extends Modal { searchBar.type = "text"; searchBar.id = "search-bar"; searchBar.placeholder = "Search..."; - searchBar.style.width = "calc(100% - 120px)"; // space for the buttons and hit count + //searchBar.style.width = "calc(100% - 120px)"; // space for the buttons and hit count const nextButton = document.createElement("button"); nextButton.textContent = "→"; diff --git a/src/dialogs/SuggesterInfo.ts b/src/dialogs/SuggesterInfo.ts index cc324de..285e586 100644 --- a/src/dialogs/SuggesterInfo.ts +++ b/src/dialogs/SuggesterInfo.ts @@ -913,7 +913,7 @@ export const FRONTMATTER_KEYS_INFO: SuggesterInfo[] = [ after: ": 1", }, { - field: "excalidraw-export-embed-scene", + field: "export-embed-scene", code: null, desc: "If this key is present it will override the default excalidraw embed and export setting.", after: ": false", diff --git a/src/lang/locale/en.ts b/src/lang/locale/en.ts index b79ee64..cca6d92 100644 --- a/src/lang/locale/en.ts +++ b/src/lang/locale/en.ts @@ -653,7 +653,7 @@ FILENAME_HEAD: "Filename", "Use this setting if for good reasons you have decided to ignore my recommendation and configured linting of Excalidraw files.
" + "The ## Text Elements section is sensitive to empty lines. A common linting approach is to add an empty line after section headings. In case of Excalidraw this will break/change the first text element in your drawing. " + "To overcome this, you can enable this setting. When enabled, Excalidraw will add a dummy element to the beginning of ## Text Elements that the linter can safely modify." , - PRESERVE_TEXT_AFTER_DRAWING_NAME: "Zotero compatibility", + PRESERVE_TEXT_AFTER_DRAWING_NAME: "Zotero and Footnotes compatibility", PRESERVE_TEXT_AFTER_DRAWING_DESC: "Preserve text after the ## Drawing section of the markdown file. This may have a very slight performance impact when saving very large drawings.", DEBUGMODE_NAME: "Enable debug messages", DEBUGMODE_DESC: "I recommend restarting Obsidian after enabling/disabling this setting. This enable debug messages in the console. This is useful for troubleshooting issues. " + diff --git a/src/menu/ToolsPanel.tsx b/src/menu/ToolsPanel.tsx index 6bd7014..456f099 100644 --- a/src/menu/ToolsPanel.tsx +++ b/src/menu/ToolsPanel.tsx @@ -17,6 +17,7 @@ import { ExportDialog } from "src/dialogs/ExportDialog"; import { openExternalLink } from "src/utils/ExcalidrawViewUtils"; import { UniversalInsertFileModal } from "src/dialogs/UniversalInsertFileModal"; import { DEBUGGING, debug } from "src/utils/DebugHelper"; +import { REM_VALUE } from "src/utils/StylesManager"; declare const PLUGIN_VERSION:string; const dark = ' REM_VALUE * 14.2; export class ToolsPanel extends React.Component { pos1: number = 0; @@ -155,11 +156,11 @@ export class ToolsPanel extends React.Component { return { left: (this.containerRef.current.clientWidth - - TOOLS_PANEL_WIDTH - - (isMobileOrZen ? 0 : TOOLS_PANEL_WIDTH + 4)) / + TOOLS_PANEL_WIDTH() - + (isMobileOrZen ? 0 : TOOLS_PANEL_WIDTH() + 4)) / 2 + this.containerRef.current.parentElement.offsetLeft + - (isMobileOrZen ? 0 : TOOLS_PANEL_WIDTH + 4), + (isMobileOrZen ? 0 : TOOLS_PANEL_WIDTH() + 4), top: 64 + this.containerRef.current.parentElement.offsetTop, }; }); diff --git a/src/utils/StylesManager.ts b/src/utils/StylesManager.ts index 557e347..5903231 100644 --- a/src/utils/StylesManager.ts +++ b/src/utils/StylesManager.ts @@ -3,6 +3,8 @@ import ExcalidrawPlugin from "src/main"; import { getAllWindowDocuments } from "./ObsidianUtils"; import { DEBUGGING, debug } from "./DebugHelper"; +export let REM_VALUE = 16; + const STYLE_VARIABLES = [ "--background-modifier-cover", "--background-primary-alt", @@ -77,6 +79,11 @@ export class StylesManager { } private async harvestStyles() { + REM_VALUE = parseInt(window.getComputedStyle(document.body).getPropertyValue('--font-text-size').trim()); + if (isNaN(REM_VALUE)) { + REM_VALUE = 16; + } + const body = document.body; const iframe:HTMLIFrameElement = document.createElement("iframe"); iframe.style.display = "none"; diff --git a/styles.css b/styles.css index d08231c..faf754f 100644 --- a/styles.css +++ b/styles.css @@ -226,7 +226,7 @@ li[data-testid] { } .excalidraw .ToolIcon__icon img{ - height: 1em; + height: 1rem; } .excalidraw-scriptengine-install tbody>tr>td>div>img { @@ -394,23 +394,28 @@ div.excalidraw-draginfo { .modal-content.excalidraw-scriptengine-install .search-bar-wrapper { position: sticky; - top: 1em; - margin-right: 1em; + top: 1rem; + margin-right: 1rem; display: flex; align-items: center; gap: 5px; flex-wrap: nowrap; z-index: 10; background: var(--background-secondary); - padding: 0.5em; + padding: 0.5rem; border-bottom: 1px solid var(--background-modifier-border); float: right; - max-width: 28em; + max-width: 28rem; +} + +div.search-bar-wrapper input { + margin-right: -0.5rem; } .modal-content.excalidraw-scriptengine-install .hit-count { margin-left: 0.5em; white-space: nowrap; + font-size: smaller; } .modal-content.excalidraw-scriptengine-install .active-highlight {