mirror of
https://github.com/zadam/trilium.git
synced 2025-10-06 05:25:37 +08:00
feat(slash): insert footnote command
This commit is contained in:
parent
3a0b616800
commit
43eff08004
1 changed files with 15 additions and 1 deletions
|
@ -1,13 +1,15 @@
|
|||
import type { Editor } from 'ckeditor5';
|
||||
import type { SlashCommandEditorConfig } from 'ckeditor5-premium-features';
|
||||
import { icons as admonitionIcons } from '@triliumnext/ckeditor5-admonition';
|
||||
import { icons as footnoteIcons } from '@triliumnext/ckeditor5-footnotes';
|
||||
import { ADMONITION_TYPES, type AdmonitionType } from '@triliumnext/ckeditor5-admonition';
|
||||
|
||||
type SlashCommandDefinition = SlashCommandEditorConfig["extraCommands"][number];
|
||||
|
||||
export default function buildExtraCommands(): SlashCommandDefinition[] {
|
||||
return [
|
||||
...buildAdmonitionExtraCommands()
|
||||
...buildAdmonitionExtraCommands(),
|
||||
...buildFootnoteExtraCommands()
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -23,3 +25,15 @@ function buildAdmonitionExtraCommands(): SlashCommandDefinition[] {
|
|||
}
|
||||
return commands;
|
||||
}
|
||||
|
||||
function buildFootnoteExtraCommands(): SlashCommandDefinition[] {
|
||||
return [
|
||||
{
|
||||
id: 'footnote',
|
||||
title: 'Footnote',
|
||||
description: 'Create a new footnote and reference it here',
|
||||
icon: footnoteIcons.insertFootnoteIcon,
|
||||
execute: (editor: Editor) => editor.execute("InsertFootnote")
|
||||
}
|
||||
];
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue