mirror of
https://github.com/ninglg/light-mindmap.git
synced 2026-07-22 06:51:49 +00:00
update description
This commit is contained in:
parent
1ddd0ec595
commit
6a74c037c4
3 changed files with 20 additions and 7 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
**English** | [简体中文](#License)
|
||||
|
||||
Auto-renders markdown headings as a colorful, interactive mindmap — no extra syntax required.
|
||||
Feature-rich mindmap plugin — multiple layouts, themes, node shapes & line styles, wikilink support, node collapse, PNG export — all from plain markdown headings, no custom syntax needed.
|
||||
|
||||
## Preview
|
||||

|
||||
|
|
@ -214,7 +214,7 @@ MIT
|
|||
|
||||
[English](#light-mindmap) | **简体中文**
|
||||
|
||||
自动将 Markdown 标题渲染为色彩丰富、可交互的思维导图——无需额外语法。
|
||||
功能丰富的思维导图插件——多种布局、主题、节点形状与连线样式,支持双向链接、节点折叠、PNG 导出——基于纯 Markdown 标题渲染,无需任何自定义语法。
|
||||
|
||||
## 预览
|
||||
|
||||
|
|
|
|||
21
main.js
21
main.js
|
|
@ -92,6 +92,8 @@ const PLACEHOLDER = 'New Title';
|
|||
class LightMindMapPlugin extends obsidian.Plugin {
|
||||
async onload() {
|
||||
this._scan = obsidian.debounce(() => this._doScan(), 120);
|
||||
this._fileCache = null;
|
||||
this._fileCacheTime = 0;
|
||||
|
||||
this.registerEvent(this.app.workspace.on('file-open', () => this._scan()));
|
||||
this.registerEvent(this.app.workspace.on('active-leaf-change', () => this._scan()));
|
||||
|
|
@ -1034,13 +1036,18 @@ class LightMindMapPlugin extends obsidian.Plugin {
|
|||
const info = this._getMentionQuery(el);
|
||||
if (!info) { this._closeMentionPopup(overlay); return; }
|
||||
|
||||
const files = this.app.vault.getMarkdownFiles();
|
||||
const now = Date.now();
|
||||
if (!this._fileCache || now - this._fileCacheTime > 5000) {
|
||||
this._fileCache = this.app.vault.getMarkdownFiles();
|
||||
this._fileCacheTime = now;
|
||||
}
|
||||
const files = this._fileCache;
|
||||
const q = info.query.toLowerCase();
|
||||
let matches;
|
||||
if (q) {
|
||||
matches = files.filter(f => f.basename.toLowerCase().includes(q));
|
||||
matches = files.filter(f => f.basename.toLowerCase().includes(q)).slice(0, 30);
|
||||
} else {
|
||||
matches = [...files].sort((a, b) => b.stat.mtime - a.stat.mtime);
|
||||
matches = [...files].sort((a, b) => b.stat.mtime - a.stat.mtime).slice(0, 30);
|
||||
}
|
||||
if (matches.length === 0) { this._closeMentionPopup(overlay); return; }
|
||||
|
||||
|
|
@ -2229,6 +2236,13 @@ class LightMindMapPlugin extends obsidian.Plugin {
|
|||
async _saveWithDialog(file, arrayBuffer) {
|
||||
const uint8 = new Uint8Array(arrayBuffer);
|
||||
const defaultName = (file.basename || 'mindmap') + '.mindmap.png';
|
||||
|
||||
if (this.app.isMobile) {
|
||||
const filePath = (file.parent ? file.parent.path + '/' : '') + defaultName;
|
||||
await this.app.vault.adapter.writeBinary(filePath, uint8);
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
const electron = require('electron');
|
||||
const win = electron.remote.BrowserWindow.getFocusedWindow();
|
||||
|
|
@ -2241,7 +2255,6 @@ class LightMindMapPlugin extends obsidian.Plugin {
|
|||
require('fs').writeFileSync(result.filePath, Buffer.from(arrayBuffer));
|
||||
return true;
|
||||
} catch (e) {
|
||||
// Fallback: save directly into vault
|
||||
const filePath = (file.parent ? file.parent.path + '/' : '') + defaultName;
|
||||
await this.app.vault.adapter.writeBinary(filePath, uint8);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
"name": "Light Mindmap",
|
||||
"version": "1.4.0",
|
||||
"minAppVersion": "1.4.0",
|
||||
"description": "Auto-renders markdown headings as a colorful, interactive mindmap — no extra syntax required.",
|
||||
"description": "Feature-rich mindmap plugin — multiple layouts, themes, node shapes & line styles, wikilink support, node collapse, PNG export — all from plain markdown headings, no custom syntax needed.",
|
||||
"author": "Light Ning",
|
||||
"authorUrl": "https://github.com/ninglg",
|
||||
"isDesktopOnly": false
|
||||
|
|
|
|||
Loading…
Reference in a new issue