note-properties/src/components/scripts/noteProperties.inline.ts
saberzero1 107fe07c12
feat: implement note-properties plugin
Move frontmatter processing from core Quartz into a standalone plugin.
Parse YAML/TOML frontmatter, extract links from property values,
and render an Obsidian-like properties panel in the page.

Supports: includeAll/includedProperties/excludedProperties filtering,
hidePropertiesView mode, wikilink/markdown link resolution in values,
collapsible panel with client-side state persistence, i18n.
2026-02-22 23:40:23 +01:00

33 lines
706 B
TypeScript

// @ts-nocheck
const STORAGE_KEY = "note-properties-collapsed";
function init() {
const details = document.querySelector("details.note-properties");
if (!details) return;
const saved = localStorage.getItem(STORAGE_KEY);
if (saved !== null) {
const isCollapsed = saved === "true";
details.open = !isCollapsed;
}
function toggleHandler() {
localStorage.setItem(STORAGE_KEY, String(!details.open));
}
details.addEventListener("toggle", toggleHandler);
if (typeof window !== "undefined" && window.addCleanup) {
window.addCleanup(() => {
details.removeEventListener("toggle", toggleHandler);
});
}
}
document.addEventListener("nav", () => {
init();
});