This commit is contained in:
Zsolt Viczian
2021-08-29 10:31:35 +02:00
parent c6339b28ac
commit b19e1b6dcb
4 changed files with 5 additions and 12 deletions

View File

@@ -1,7 +1,7 @@
{
"id": "obsidian-excalidraw-plugin",
"name": "Excalidraw",
"version": "1.2.21",
"version": "1.2.22",
"minAppVersion": "0.12.0",
"description": "An Obsidian plugin to edit and view Excalidraw drawings",
"author": "Zsolt Viczian",

View File

@@ -310,7 +310,7 @@ export class ExcalidrawData {
if(isParagraphRef) {
let para = blocks.filter((block:any)=>block.node.id == id)[0]?.node;
if(!para) return text;
if(para.type=="blockquote") para = para.children[0]; //blockquotes are special, they have one child, which has the paragraph
if(["blockquote","listItem"].includes(para.type)) para = para.children[0]; //blockquotes are special, they have one child, which has the paragraph
const startPos = para.position.start.offset;
const endPos = para.children[para.children.length-1]?.position.start.offset-1; //alternative: filter((c:any)=>c.type=="blockid")[0]
return contents.substr(startPos,endPos-startPos)

View File

@@ -663,7 +663,6 @@ export default class ExcalidrawView extends TextFileView {
//variables used to handle click events in view mode
let selectedTextElement:{id:string,text:string} = null;
let timestamp = 0;
let blockOnCtrlKeyDown = false;
let blockOnMouseButtonDown = false;
const getTextElementAtPointer = (pointer:any) => {
@@ -703,10 +702,7 @@ export default class ExcalidrawView extends TextFileView {
this.ctrlKeyDown = e.ctrlKey;
this.shiftKeyDown = e.shiftKey;
this.altKeyDown = e.altKey;
if(!blockOnCtrlKeyDown && e.ctrlKey) {
blockOnCtrlKeyDown = true;
clearHoverPreview();
};
if(e.ctrlKey && !e.shiftKey && !e.altKey && !e.metaKey) {
const selectedElement = getTextElementAtPointer(currentPosition);
if(!selectedElement) return;
@@ -722,9 +718,6 @@ export default class ExcalidrawView extends TextFileView {
let linktext = REGEX_LINK.getLink(parts); //parts.value[2] ? parts.value[2]:parts.value[6];
if(linktext.match(REG_LINKINDEX_HYPERLINK)) return;
if(linktext.search("#")>-1) linktext = linktext.substring(0,linktext.search("#"));
const file = this.app.metadataCache.getFirstLinkpathDest(linktext,this.file.path);
if (!file) return;
this.plugin.hover.linkText = linktext;
this.plugin.hover.sourcePath = this.file.path;
@@ -735,6 +728,7 @@ export default class ExcalidrawView extends TextFileView {
hoverParent: hoverPreviewTarget,
targetEl: hoverPreviewTarget,
linktext: this.plugin.hover.linkText,
sourcePath: this.plugin.hover.sourcePath
});
hoverPoint = currentPosition;
if(document.fullscreenElement === this.contentEl) {
@@ -747,7 +741,6 @@ export default class ExcalidrawView extends TextFileView {
}
},
onKeyUp: (e:any) => {
blockOnCtrlKeyDown = e.ctrlKey;
this.ctrlKeyDown = e.ctrlKey;
this.shiftKeyDown = e.shiftKey;
this.altKeyDown = e.altKey;

View File

@@ -1,3 +1,3 @@
{
"1.2.21": "0.11.13"
"1.2.22": "0.11.13"
}