mirror of
https://github.com/miro0o/miniWorldMap.git
synced 2026-07-22 07:46:00 +00:00
obsidian publication fix
This commit is contained in:
parent
21d3f1a97e
commit
b70ff03e07
4 changed files with 52 additions and 12 deletions
10
.github/workflows/release.yml
vendored
10
.github/workflows/release.yml
vendored
|
|
@ -10,6 +10,8 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
id-token: write
|
||||
attestations: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
|
|
@ -20,6 +22,14 @@ jobs:
|
|||
test -f styles.css
|
||||
node -e "JSON.parse(require('fs').readFileSync('manifest.json', 'utf8'))"
|
||||
|
||||
- name: Attest release assets
|
||||
uses: actions/attest-build-provenance@v2
|
||||
with:
|
||||
subject-path: |
|
||||
main.js
|
||||
manifest.json
|
||||
styles.css
|
||||
|
||||
- name: Create draft release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Mini World Map
|
||||
|
||||
Mini World Map visualizes an Obsidian vault as a hierarchy-first world map with internal links layered on top.
|
||||
Mini World Map visualizes your vault as a hierarchy-first world map with internal links layered on top.
|
||||
|
||||
## Features
|
||||
|
||||
|
|
|
|||
50
main.js
50
main.js
|
|
@ -155,7 +155,6 @@ class MiniWorldMapPlugin extends Plugin {
|
|||
|
||||
this.app.workspace.onLayoutReady(() => {
|
||||
this.loadNativeGraphSettings();
|
||||
this.rebuildIndex("startup");
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -179,6 +178,7 @@ class MiniWorldMapPlugin extends Plugin {
|
|||
}
|
||||
|
||||
scheduleRebuild(reason) {
|
||||
if (!this.index.ready && !this.hasOpenMapView()) return;
|
||||
if (this.rebuildTimer) window.clearTimeout(this.rebuildTimer);
|
||||
this.rebuildTimer = window.setTimeout(() => {
|
||||
this.rebuildTimer = null;
|
||||
|
|
@ -186,6 +186,10 @@ class MiniWorldMapPlugin extends Plugin {
|
|||
}, 900);
|
||||
}
|
||||
|
||||
hasOpenMapView() {
|
||||
return this.app.workspace.getLeavesOfType(VIEW_TYPE_MINI_WORLD_MAP).length > 0;
|
||||
}
|
||||
|
||||
async rebuildIndex(reason) {
|
||||
try {
|
||||
const started = performance.now();
|
||||
|
|
@ -292,17 +296,12 @@ class WorldMapIndex {
|
|||
descendantCount: 0
|
||||
});
|
||||
|
||||
const loaded = typeof this.app.vault.getAllLoadedFiles === "function"
|
||||
? this.app.vault.getAllLoadedFiles()
|
||||
: [];
|
||||
const markdownFiles = typeof this.app.vault.getMarkdownFiles === "function"
|
||||
? this.app.vault.getMarkdownFiles()
|
||||
: [];
|
||||
this.stats.loadedEntries = loaded.length;
|
||||
const { folders, markdownFiles, totalEntries } = this.collectVaultEntries();
|
||||
this.stats.loadedEntries = totalEntries;
|
||||
this.stats.scannedMarkdown = markdownFiles.length;
|
||||
|
||||
for (const entry of loaded) {
|
||||
if (entry instanceof TFolder) this.addFolder(entry);
|
||||
for (const folder of folders) {
|
||||
this.addFolder(folder);
|
||||
}
|
||||
|
||||
for (const file of markdownFiles) {
|
||||
|
|
@ -317,6 +316,36 @@ class WorldMapIndex {
|
|||
this.ready = true;
|
||||
}
|
||||
|
||||
collectVaultEntries() {
|
||||
const folders = [];
|
||||
const markdownFiles = [];
|
||||
let totalEntries = 0;
|
||||
const root = typeof this.app.vault.getRoot === "function"
|
||||
? this.app.vault.getRoot()
|
||||
: null;
|
||||
const stack = root && Array.isArray(root.children)
|
||||
? root.children.slice()
|
||||
: [];
|
||||
|
||||
while (stack.length) {
|
||||
const entry = stack.pop();
|
||||
totalEntries += 1;
|
||||
|
||||
if (entry instanceof TFolder) {
|
||||
folders.push(entry);
|
||||
if (Array.isArray(entry.children)) {
|
||||
for (let index = entry.children.length - 1; index >= 0; index -= 1) {
|
||||
stack.push(entry.children[index]);
|
||||
}
|
||||
}
|
||||
} else if (entry instanceof TFile && entry.extension === "md") {
|
||||
markdownFiles.push(entry);
|
||||
}
|
||||
}
|
||||
|
||||
return { folders, markdownFiles, totalEntries };
|
||||
}
|
||||
|
||||
addFolder(folder) {
|
||||
this.ensureFolderPath(normalizeVaultPath(folder.path));
|
||||
}
|
||||
|
|
@ -1118,6 +1147,7 @@ class MiniWorldMapView extends ItemView {
|
|||
this.contentEl.addClass("mini-world-map-view");
|
||||
this.syncColorSchemeClass();
|
||||
this.renderShell();
|
||||
if (!this.plugin.index.ready) await this.plugin.rebuildIndex("open");
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
"name": "Mini World Map",
|
||||
"version": "0.1.1",
|
||||
"minAppVersion": "1.5.0",
|
||||
"description": "Visualize an Obsidian vault as a hierarchy-first world map with internal links layered on top.",
|
||||
"description": "Visualize your vault as a hierarchy-first world map with internal links layered on top.",
|
||||
"author": "Miro0o and Codex",
|
||||
"authorUrl": "https://github.com/Miro0o",
|
||||
"isDesktopOnly": false
|
||||
|
|
|
|||
Loading…
Reference in a new issue