mirror of
https://github.com/lostpaul/obsidian-folder-notes.git
synced 2026-07-22 07:40:24 +00:00
Insert folder overview command
This commit is contained in:
parent
d414b8bb41
commit
5e582e66b6
1 changed files with 7 additions and 0 deletions
|
|
@ -12,6 +12,13 @@ export class Commands {
|
|||
registerCommands() {
|
||||
this.plugin.registerEvent(this.plugin.app.workspace.on('editor-menu', (menu: Menu, editor: Editor, view: MarkdownView) => {
|
||||
const text = editor.getSelection().trim();
|
||||
menu.addItem((item) => {
|
||||
item.setTitle('Create folder overview')
|
||||
.setIcon('edit')
|
||||
.onClick(() => {
|
||||
editor.replaceSelection('```folder-overview\n```\n');
|
||||
});
|
||||
});
|
||||
if (!text || text.trim() === '') return;
|
||||
menu.addItem((item) => {
|
||||
item.setTitle('Create folder note')
|
||||
|
|
|
|||
Loading…
Reference in a new issue