1.3.7 kanban support, onDrop fix

This commit is contained in:
Zsolt Viczian
2021-09-12 17:16:50 +02:00
parent 784a7cb6bf
commit ec3e9fd5b7
4 changed files with 28 additions and 14 deletions

View File

@@ -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",

View File

@@ -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

View File

@@ -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);

View File

@@ -1,3 +1,3 @@
{
"1.3.6": "0.11.13"
"1.3.7": "0.11.13"
}