mirror of
https://github.com/zsviczian/obsidian-excalidraw-plugin.git
synced 2025-08-06 05:46:28 +00:00
2.7.1
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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 });
|
||||
}*/
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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;i<event.dataTransfer.files.length;i++) {
|
||||
const path = event.dataTransfer.files[i].path;
|
||||
if(!path) return true; //excalidarw to continue processing
|
||||
const files = Array.from(event.dataTransfer.files || []);
|
||||
|
||||
for(let i = 0; i < files.length; i++) {
|
||||
// Try multiple ways to get file path
|
||||
const file = files[i];
|
||||
let path = file?.path
|
||||
|
||||
if(!path && file && DEVICE.isDesktop) {
|
||||
//https://www.electronjs.org/docs/latest/breaking-changes#removed-filepath
|
||||
const { webUtils } = require('electron');
|
||||
if(webUtils && webUtils.getPathForFile) {
|
||||
path = webUtils.getPathForFile(file);
|
||||
}
|
||||
}
|
||||
if(!path) {
|
||||
new Notice(t("ERROR_CANT_READ_FILEPATH"),6000);
|
||||
return true; //excalidarw to continue processing
|
||||
}
|
||||
const link = getInternalLinkOrFileURLLink(path, this.plugin, event.dataTransfer.files[i].name, this.file);
|
||||
const {x,y} = this.currentPosition;
|
||||
const pos = {x:x+i*300, y:y+i*300};
|
||||
@@ -4470,7 +4494,6 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
if(link.file.extension === "pdf") {
|
||||
const insertPDFModal = new InsertPDFModal(this.plugin, this);
|
||||
insertPDFModal.open(link.file);
|
||||
//return false;
|
||||
}
|
||||
const ea = getEA(this) as ExcalidrawAutomate;
|
||||
insertImageToView(ea, pos, link.file).then(()=>ea.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;i<event.dataTransfer.files.length;i++) {
|
||||
const path = event.dataTransfer.files[i].path;
|
||||
const name = event.dataTransfer.files[i].name;
|
||||
if(!path || !name) return true; //excalidarw to continue processing
|
||||
const file = event.dataTransfer.files[i];
|
||||
let path = file?.path;
|
||||
const name = file?.name;
|
||||
if(!path && file && DEVICE.isDesktop) {
|
||||
//https://www.electronjs.org/docs/latest/breaking-changes#removed-filepath
|
||||
const { webUtils } = require('electron');
|
||||
if(webUtils && webUtils.getPathForFile) {
|
||||
path = webUtils.getPathForFile(file);
|
||||
}
|
||||
}
|
||||
if(!path || !name) {
|
||||
new Notice(t("ERROR_CANT_READ_FILEPATH"),6000);
|
||||
ea.destroy();
|
||||
return true; //excalidarw to continue processing
|
||||
}
|
||||
const link = getInternalLinkOrFileURLLink(path, this.plugin, name, this.file);
|
||||
const id = ea.addText(
|
||||
this.currentPosition.x+i*40,
|
||||
|
||||
@@ -17,6 +17,13 @@ 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://storage.ko-fi.com/cdn/kofi6.png?v=6" border="0" alt="Buy Me a Coffee at ko-fi.com" height=45></a></div>
|
||||
`,
|
||||
"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":
|
||||
|
||||
@@ -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)",
|
||||
};
|
||||
|
||||
@@ -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"),
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user