@quartz-community/obsidian-plugin-excalidraw 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.js +23 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- afc0c41: Drawings follow the site's publish rules (quartz-community/bases-page#11). A drawing stored as Markdown (`.excalidraw.md`) gets its page only when the site's filters publish its note, and the page carries the note's frontmatter (`publish`, `draft`, `password`, …), so with Quartz 5.1 explicit-publish, drafts and encrypted-pages treat it like a note. The plugin's own filter keeps the drawing pages it generates (Quartz 5.1 runs the filters on them). A `.excalidraw` (JSON) drawing has no frontmatter: with explicit-publish it is published when a published note links to it.
|
|
8
|
+
|
|
3
9
|
## 1.0.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -4787,19 +4787,28 @@ var ExcalidrawBody_default = ((userOpts) => {
|
|
|
4787
4787
|
var excalidrawMatcher = ({ fileData }) => {
|
|
4788
4788
|
return "excalidrawData" in fileData;
|
|
4789
4789
|
};
|
|
4790
|
+
var isDrawing = (path) => path.endsWith(".excalidraw.md") || path.endsWith(".excalidraw");
|
|
4791
|
+
var drawingNotesBuild;
|
|
4792
|
+
var drawingNotes = /* @__PURE__ */ new Map();
|
|
4793
|
+
function drawingNotesOf(ctx) {
|
|
4794
|
+
if (drawingNotesBuild !== ctx.buildId) {
|
|
4795
|
+
drawingNotesBuild = ctx.buildId;
|
|
4796
|
+
drawingNotes.clear();
|
|
4797
|
+
}
|
|
4798
|
+
return drawingNotes;
|
|
4799
|
+
}
|
|
4790
4800
|
var ExcalidrawPage = (opts) => ({
|
|
4791
4801
|
name: "ExcalidrawPage",
|
|
4792
4802
|
priority: 25,
|
|
4793
4803
|
fileExtensions: [".excalidraw.md", ".excalidraw"],
|
|
4794
4804
|
match: excalidrawMatcher,
|
|
4795
4805
|
generate({ ctx }) {
|
|
4796
|
-
const excalidrawFiles = ctx.allFiles.filter(
|
|
4797
|
-
(fp) => fp.endsWith(".excalidraw.md") || fp.endsWith(".excalidraw")
|
|
4798
|
-
);
|
|
4806
|
+
const excalidrawFiles = ctx.allFiles.filter(isDrawing);
|
|
4799
4807
|
const imageFiles = ctx.allFiles.filter(
|
|
4800
4808
|
(fp) => /\.(png|jpe?g|gif|svg|webp|avif|bmp|ico)$/i.test(fp)
|
|
4801
4809
|
);
|
|
4802
4810
|
const virtualPages = [];
|
|
4811
|
+
const notes = drawingNotesOf(ctx);
|
|
4803
4812
|
for (const filePath of excalidrawFiles) {
|
|
4804
4813
|
const fullPath = join(ctx.argv.directory, filePath);
|
|
4805
4814
|
let content;
|
|
@@ -4808,6 +4817,9 @@ var ExcalidrawPage = (opts) => ({
|
|
|
4808
4817
|
} catch {
|
|
4809
4818
|
continue;
|
|
4810
4819
|
}
|
|
4820
|
+
const isNote = filePath.endsWith(".md");
|
|
4821
|
+
const noteFrontmatter = isNote ? notes.get(filePath) : void 0;
|
|
4822
|
+
if (isNote && !noteFrontmatter) continue;
|
|
4811
4823
|
const data = parseExcalidraw(content, filePath);
|
|
4812
4824
|
if (!data) continue;
|
|
4813
4825
|
const resolvedImagePaths = {};
|
|
@@ -4836,7 +4848,7 @@ var ExcalidrawPage = (opts) => ({
|
|
|
4836
4848
|
// folder listings and the content index see its real path.
|
|
4837
4849
|
filePath: joinSegments(ctx.argv.directory, filePath),
|
|
4838
4850
|
relativePath: filePath,
|
|
4839
|
-
frontmatter: { title: baseName, tags: ["excalidraw"] },
|
|
4851
|
+
frontmatter: { ...noteFrontmatter, title: baseName, tags: ["excalidraw"] },
|
|
4840
4852
|
excalidrawData: data,
|
|
4841
4853
|
excalidrawOptions: opts,
|
|
4842
4854
|
excalidrawImagePaths: resolvedImagePaths
|
|
@@ -4845,12 +4857,13 @@ var ExcalidrawPage = (opts) => ({
|
|
|
4845
4857
|
}
|
|
4846
4858
|
return virtualPages;
|
|
4847
4859
|
},
|
|
4848
|
-
shouldPublish(
|
|
4849
|
-
const
|
|
4850
|
-
if (
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4860
|
+
shouldPublish(ctx, content) {
|
|
4861
|
+
const data = content[1].data;
|
|
4862
|
+
if ("excalidrawData" in data) return true;
|
|
4863
|
+
const relativePath = data.relativePath ?? "";
|
|
4864
|
+
if (!isDrawing(relativePath)) return true;
|
|
4865
|
+
drawingNotesOf(ctx).set(relativePath, { ...data.frontmatter ?? {} });
|
|
4866
|
+
return false;
|
|
4854
4867
|
},
|
|
4855
4868
|
layout: "excalidraw",
|
|
4856
4869
|
frame: "excalidraw",
|