Skip to content

Commit

Permalink
2.9.0-beta-1, 0.18.0-1, fixed group references in live preview due to…
Browse files Browse the repository at this point in the history
… Obsidian 1.8.9 language changes
  • Loading branch information
zsviczian committed Mar 9, 2025
1 parent 99a7e74 commit 858ae11
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion manifest-beta.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "obsidian-excalidraw-plugin",
"name": "Excalidraw",
"version": "2.8.3",
"version": "2.9.0-beta-1",
"minAppVersion": "1.1.6",
"description": "An Obsidian plugin to edit and view Excalidraw drawings",
"author": "Zsolt Viczian",
Expand Down
10 changes: 7 additions & 3 deletions src/core/managers/MarkdownPostProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -802,10 +802,14 @@ const tmpObsidianWYSIWYG = async (
el.empty();
} else {
//Obsidian changed this at some point from h3 to h5 and also the text...
const warningEl = el.querySelector("div>*[data-heading^='Unable to find ");
let warningEl = el.querySelector("div>*[data-heading^='Unable to find ");
if(!warningEl) {
//changed in Obsidian 1.8.9
warningEl = el.querySelector("div > *[data-heading]");
}
if(warningEl) {
const dataHeading = warningEl.getAttr("data-heading");
const ref = warningEl.getAttr("data-heading").match(/Unable to find[^^]+(\^(?:group=|area=|frame=|clippedframe=)[^ ]+)/)?.[1];
const ref = dataHeading.match(/.+(\^(?:group=|area=|frame=|clippedframe=)[A-Za-z0-9_-]{8,21})/)?.[1];
if(ref) {
attr.fname = file.path + "#" +ref;
areaPreview = true;
Expand Down Expand Up @@ -926,7 +930,7 @@ export const markdownPostProcessor = async (
if(docIDs.has(ctx.docId) && !el.hasChildNodes()) {
docIDs.delete(ctx.docId);
}
const isAreaGroupFrameRef = el.querySelectorAll('[data-heading^="Unable to find"]').length === 1;
const isAreaGroupFrameRef = el.querySelectorAll('div > *[data-heading]').length === 1;
if(!isAreaGroupFrameRef) {
return;
}
Expand Down

0 comments on commit 858ae11

Please sign in to comment.