Add Tree Selector

This commit is contained in:
2026-04-23 14:02:41 +02:00
parent c6a292754f
commit 8b13938290
8 changed files with 567 additions and 23 deletions
+17
View File
@@ -70,6 +70,23 @@
codeblock: function () { wrap('```\n', '\n```', 'code'); },
quote: function () { linePrefix('> '); },
link: function () { wrap('[', '](url)', 'link text'); },
wikilink: function () {
var sel = textarea.value.slice(textarea.selectionStart, textarea.selectionEnd);
openTreePicker({
title: 'Insert link',
mode: 'any',
initialPath: '/',
confirmLabel: 'INSERT',
onSelect: function (path, kind) {
if (kind === 'folder') {
insertAtCursor(sel ? '[[' + path + '|' + sel + ']]' : '[[' + path + ']]');
} else {
var name = path.split('/').pop();
insertAtCursor('[' + (sel || name) + '](' + path + ')');
}
}
});
},
ul: function () { linePrefix('- '); },
ol: function () { linePrefix('1. '); },
hr: function () { wrap('\n\n---\n\n', '', ''); },