mirror of
https://github.com/zsviczian/obsidian-excalidraw-plugin.git
synced 2025-08-06 05:46:28 +00:00
1.3.7 kanban support, onDrop fix
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "obsidian-excalidraw-plugin",
|
||||
"name": "Excalidraw",
|
||||
"version": "1.3.6",
|
||||
"version": "1.3.7",
|
||||
"minAppVersion": "0.12.0",
|
||||
"description": "An Obsidian plugin to edit and view Excalidraw drawings",
|
||||
"author": "Zsolt Viczian",
|
||||
|
||||
@@ -813,7 +813,6 @@ export default class ExcalidrawView extends TextFileView {
|
||||
},
|
||||
onMouseOver: (e:MouseEvent) => {
|
||||
clearHoverPreview();
|
||||
//console.log(e);
|
||||
},
|
||||
onDragOver: (e:any) => {
|
||||
const action = dropAction(e.dataTransfer);
|
||||
@@ -907,12 +906,6 @@ export default class ExcalidrawView extends TextFileView {
|
||||
const st: AppState = excalidrawRef.current.getAppState();
|
||||
currentPosition = viewportCoordsToSceneCoords({ clientX: event.clientX, clientY: event.clientY },st);
|
||||
|
||||
if (event.dataTransfer.types.includes("text/plain")) {
|
||||
const text:string = event.dataTransfer.getData("text");
|
||||
this.addText(text.replace(/(!\[\[.*#[^\]]*\]\])/g,"$1{40}"));
|
||||
return true;
|
||||
}
|
||||
|
||||
const draggable = (this.app as any).dragManager.draggable;
|
||||
switch(draggable?.type) {
|
||||
case "file":
|
||||
@@ -924,9 +917,14 @@ export default class ExcalidrawView extends TextFileView {
|
||||
currentPosition.y+=st.currentItemFontSize*2;
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
if (event.dataTransfer.types.includes("text/plain")) {
|
||||
const text:string = event.dataTransfer.getData("text");
|
||||
if(!text) return false;
|
||||
this.addText(text.replace(/(!\[\[.*#[^\]]*\]\])/g,"$1{40}"));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
onBeforeTextEdit: (textElement: ExcalidrawTextElement) => {
|
||||
if(this.autosaveTimer) { //stopping autosave to avoid autosave overwriting text while the user edits it
|
||||
|
||||
22
src/main.ts
22
src/main.ts
@@ -15,6 +15,7 @@ import {
|
||||
MarkdownRenderer,
|
||||
ViewState,
|
||||
Notice,
|
||||
request,
|
||||
} from "obsidian";
|
||||
|
||||
import {
|
||||
@@ -115,6 +116,21 @@ export default class ExcalidrawPlugin extends Plugin {
|
||||
if(electron.startsWith("8.")) {
|
||||
new Notice(`You are running an older version of the electron Browser (${electron}). If Excalidraw does not start up, please reinstall Obsidian with the latest installer and try again.`,10000);
|
||||
}
|
||||
this.switchToExcalidarwAfterLoad()
|
||||
}
|
||||
|
||||
private switchToExcalidarwAfterLoad() {
|
||||
const self = this;
|
||||
this.app.workspace.onLayoutReady(() => {
|
||||
let leaf: WorkspaceLeaf;
|
||||
for (leaf of self.app.workspace.getLeavesOfType("markdown")) {
|
||||
if ((leaf.view instanceof MarkdownView) && self.isExcalidrawFile(leaf.view.file)) {
|
||||
self.excalidrawFileModes[(leaf as any).id || leaf.view.file.path] =
|
||||
VIEW_TYPE_EXCALIDRAW;
|
||||
self.setExcalidrawView(leaf);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private migrationNotice(){
|
||||
@@ -220,10 +236,10 @@ export default class ExcalidrawPlugin extends Plugin {
|
||||
attr.fheight = parts[2];
|
||||
if(parts[3]!=attr.fname) attr.style = "excalidraw-svg" + (parts[3] ? "-" + parts[3] : "");
|
||||
}
|
||||
|
||||
|
||||
attr.fname = file?.path;
|
||||
div = createDiv(attr.style, async (el)=>{
|
||||
const img = await getIMG(attr);
|
||||
const img = await getIMG(attr);
|
||||
div = createDiv(attr.style, (el)=>{
|
||||
el.append(img);
|
||||
el.setAttribute("src",file.path);
|
||||
if(attr.fwidth) el.setAttribute("w",attr.fwidth);
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"1.3.6": "0.11.13"
|
||||
"1.3.7": "0.11.13"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user