diff --git a/manifest-beta.json b/manifest-beta.json index dd40b4e..659749a 100644 --- a/manifest-beta.json +++ b/manifest-beta.json @@ -1,7 +1,7 @@ { "id": "obsidian-excalidraw-plugin", "name": "Excalidraw", - "version": "2.7.0", + "version": "2.7.1", "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 9ad3848..e8039bb 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-excalidraw-plugin", "name": "Excalidraw", - "version": "2.7.0", + "version": "2.7.1", "minAppVersion": "1.1.6", "description": "An Obsidian plugin to edit and view Excalidraw drawings", "author": "Zsolt Viczian", diff --git a/src/EmbeddedFileLoader.ts b/src/EmbeddedFileLoader.ts index bf73610..53a8d12 100644 --- a/src/EmbeddedFileLoader.ts +++ b/src/EmbeddedFileLoader.ts @@ -635,12 +635,6 @@ export class EmbeddedFilesLoader { shouldScale: embeddedFile.shouldScale() }; files[batch].push(fileData); -/* try { - addFiles([fileData], this.isDark, false); - } - catch(e) { - errorlog({ where: "EmbeddedFileLoader.loadSceneFiles", error: e }); - }*/ } } else if (embeddedFile.isSVGwithBitmap && (depth !== 0 || isThemeChange)) { //this will reload the image in light/dark mode when switching themes @@ -654,12 +648,6 @@ export class EmbeddedFilesLoader { shouldScale: embeddedFile.shouldScale() }; files[batch].push(fileData); -/* try { - addFiles([fileData], this.isDark, false); - } - catch(e) { - errorlog({ where: "EmbeddedFileLoader.loadSceneFiles", error: e }); - }*/ } }); } diff --git a/src/ExcalidrawView.ts b/src/ExcalidrawView.ts index c4081e3..d2fef9a 100644 --- a/src/ExcalidrawView.ts +++ b/src/ExcalidrawView.ts @@ -2610,7 +2610,16 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{ sceneElementIds.splice(parentLayer+1,0,incomingElement.id); } } else if(sceneElement && incomingElement.type === "image") { //https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/632 - if(inData.getFile(incomingElement.fileId)) { + const incomingFile = inData.getFile(incomingElement.fileId); + const sceneFile = this.excalidrawData.getFile(incomingElement.fileId); + + const shouldUpdate = Boolean(incomingFile) && ( + ((sceneElement as ExcalidrawImageElement).fileId !== incomingElement.fileId) || + (incomingFile.file && (sceneFile.file !== incomingFile.file)) || + (incomingFile.hyperlink && (sceneFile.hyperlink !== incomingFile.hyperlink)) || + (incomingFile.linkParts?.original && (sceneFile.linkParts?.original !== incomingFile.linkParts?.original)) + ) + if(shouldUpdate) { this.excalidrawData.setFile( incomingElement.fileId, inData.getFile(incomingElement.fileId) @@ -4456,9 +4465,24 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{ } if (event.dataTransfer.types.length >= 1 && ["image-url","image-import","embeddable"].contains(localFileDragAction)) { - for(let i=0;iea.destroy()) ; @@ -4510,7 +4533,7 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{ const ea = getEA(this) as ExcalidrawAutomate; await insertImageToView(ea, pos, maybeFile); ea.destroy(); - return; + return false; } } const file = await this.app.vault.createBinary(filepath, fileToImport) @@ -4518,7 +4541,6 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{ await insertImageToView(ea, pos, file); ea.destroy(); })(); - //return false; } else if(extension === "excalidraw") { return true; //excalidarw to continue processing } else { @@ -4527,9 +4549,7 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{ const file = await this.app.vault.createBinary(filepath, await event.dataTransfer.files[i].arrayBuffer()); const modal = new UniversalInsertFileModal(this.plugin, this); modal.open(file, pos); - //insertEmbeddableToView(getEA(this), pos, file); })(); - //return false; } } else if(localFileDragAction === "embeddable" || !IMAGE_TYPES.contains(extension)) { @@ -4550,9 +4570,21 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{ if(event.dataTransfer.types.length >= 1 && localFileDragAction === "link") { const ea = getEA(this) as ExcalidrawAutomate; for(let i=0;iBuy Me a Coffee at ko-fi.com `, +"2.7.1":` +## Fixed +- Deleting excalidraw file from file system while it is open in fullscreen mode in Obsidian causes Obsidian to be stuck in full-screen view [#2161](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2161) +- Chinese fonts are not rendered in LaTeX statements [#2162](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2162) +- Since Electron 32 (newer Obsidian Desktop installers) drag and drop links from Finder or OS File Explorer did not work. [Electron breaking change](https://www.electronjs.org/docs/latest/breaking-changes#removed-filepath). This is now fixed +- Addressed unnecessary image reloads when changing windows in Obsidian +`, "2.7.0":` ## Fixed - Various Markdown embeddable "fuzziness": diff --git a/src/lang/locale/en.ts b/src/lang/locale/en.ts index e5df2cf..722ac90 100644 --- a/src/lang/locale/en.ts +++ b/src/lang/locale/en.ts @@ -110,6 +110,7 @@ export default { SELECT_LINK_TO_OPEN: "Select a link to open", //ExcalidrawView.ts + ERROR_CANT_READ_FILEPATH: "Error, can't read file path. Importing file instead", NO_SEARCH_RESULT: "Didn't find a matching element in the drawing", FORCE_SAVE_ABORTED: "Force Save aborted because saving is in progress", LINKLIST_SECOND_ORDER_LINK: "Second Order Link", @@ -973,4 +974,30 @@ FILENAME_HEAD: "Filename", //Utils.ts UPDATE_AVAILABLE: `A newer version of Excalidraw is available in Community Plugins.\n\nYou are using ${PLUGIN_VERSION}.\nThe latest is`, ERROR_PNG_TOO_LARGE: "Error exporting PNG - PNG too large, try a smaller resolution", + + //ModifierkeyHelper.ts + // WebBrowserDragAction + WEB_DRAG_IMPORT_IMAGE: "Import Image to Vault", + WEB_DRAG_IMAGE_URL: "Insert Image or YouTube Thumbnail with URL", + WEB_DRAG_LINK: "Insert Link", + WEB_DRAG_EMBEDDABLE: "Insert Interactive-Frame", + + // LocalFileDragAction + LOCAL_DRAG_IMPORT: "Import external file or reuse existing file if path is from the Vault", + LOCAL_DRAG_IMAGE: "Insert Image: with local URI or internal-link if from Vault", + LOCAL_DRAG_LINK: "Insert Link: local URI or internal-link if from Vault", + LOCAL_DRAG_EMBEDDABLE: "Insert Interactive-Frame: local URI or internal-link if from Vault", + + // InternalDragAction + INTERNAL_DRAG_IMAGE: "Insert Image", + INTERNAL_DRAG_IMAGE_FULL: "Insert Image @100%", + INTERNAL_DRAG_LINK: "Insert Link", + INTERNAL_DRAG_EMBEDDABLE: "Insert Interactive-Frame", + + // LinkClickAction + LINK_CLICK_ACTIVE: "Open in current active window", + LINK_CLICK_NEW_PANE: "Open in a new adjacent window", + LINK_CLICK_POPOUT: "Open in a popout window", + LINK_CLICK_NEW_TAB: "Open in a new tab", + LINK_CLICK_MD_PROPS: "Show the Markdown image-properties dialog (only relevant if you have embedded a markdown document as an image)", }; diff --git a/src/utils/ModifierkeyHelper.ts b/src/utils/ModifierkeyHelper.ts index 017c290..8ca155b 100644 --- a/src/utils/ModifierkeyHelper.ts +++ b/src/utils/ModifierkeyHelper.ts @@ -1,5 +1,6 @@ import { Modifier } from "obsidian"; import { DEVICE } from "src/constants/constants"; +import { t } from "src/lang/helpers"; import { ExcalidrawSettings } from "src/settings"; export type ModifierKeys = {shiftKey:boolean, ctrlKey: boolean, metaKey: boolean, altKey: boolean}; export type KeyEvent = PointerEvent | MouseEvent | KeyboardEvent | React.DragEvent | React.PointerEvent | React.MouseEvent | ModifierKeys; @@ -31,30 +32,29 @@ export type ModifierKeyTooltipMessages = Partial<{ export const modifierKeyTooltipMessages = ():ModifierKeyTooltipMessages => { return { WebBrowserDragAction: { - "image-import": "Import Image to Vault", - "image-url": `Insert Image or YouTube Thumbnail with URL`, - "link": "Insert Link", - "embeddable": "Insert Interactive-Frame", - // Add more messages for WebBrowserDragAction as needed + "image-import": t("WEB_DRAG_IMPORT_IMAGE"), + "image-url": t("WEB_DRAG_IMAGE_URL"), + "link": t("WEB_DRAG_LINK"), + "embeddable": t("WEB_DRAG_EMBEDDABLE"), }, LocalFileDragAction: { - "image-import": "Import external file or reuse existing file if path is from the Vault", - "image-url": `Insert Image: with local URI or internal-link if from Vault`, - "link": "Insert Link: local URI or internal-link if from Vault", - "embeddable": "Insert Interactive-Frame: local URI or internal-link if from Vault", + "image-import": t("LOCAL_DRAG_IMPORT"), + "image-url": t("LOCAL_DRAG_IMAGE"), + "link": t("LOCAL_DRAG_LINK"), + "embeddable": t("LOCAL_DRAG_EMBEDDABLE"), }, InternalDragAction: { - "image": "Insert Image", - "image-fullsize": "Insert Image @100%", - "link": `Insert Link`, - "embeddable": "Insert Interactive-Frame", + "image": t("INTERNAL_DRAG_IMAGE"), + "image-fullsize": t("INTERNAL_DRAG_IMAGE_FULL"), + "link": t("INTERNAL_DRAG_LINK"), + "embeddable": t("INTERNAL_DRAG_EMBEDDABLE"), }, LinkClickAction: { - "active-pane": "Open in current active window", - "new-pane": "Open in a new adjacent window", - "popout-window": "Open in a popout window", - "new-tab": "Open in a new tab", - "md-properties": "Show the Markdown image-properties dialog (only relevant if you have embedded a markdown document as an image)", + "active-pane": t("LINK_CLICK_ACTIVE"), + "new-pane": t("LINK_CLICK_NEW_PANE"), + "popout-window": t("LINK_CLICK_POPOUT"), + "new-tab": t("LINK_CLICK_NEW_TAB"), + "md-properties": t("LINK_CLICK_MD_PROPS"), }, } };