From 43eff080047656c047a43cdc33d0a115ad91787c Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Mon, 16 Jun 2025 20:20:33 +0300 Subject: [PATCH] feat(slash): insert footnote command --- packages/ckeditor5/src/extra_slash_commands.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/ckeditor5/src/extra_slash_commands.ts b/packages/ckeditor5/src/extra_slash_commands.ts index 96d5e8171..f0bf93582 100644 --- a/packages/ckeditor5/src/extra_slash_commands.ts +++ b/packages/ckeditor5/src/extra_slash_commands.ts @@ -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") + } + ]; +}