feat(slash): insert footnote command

This commit is contained in:
Elian Doran 2025-06-16 20:20:33 +03:00
parent 3a0b616800
commit 43eff08004
No known key found for this signature in database

View File

@ -1,13 +1,15 @@
import type { Editor } from 'ckeditor5'; import type { Editor } from 'ckeditor5';
import type { SlashCommandEditorConfig } from 'ckeditor5-premium-features'; import type { SlashCommandEditorConfig } from 'ckeditor5-premium-features';
import { icons as admonitionIcons } from '@triliumnext/ckeditor5-admonition'; 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'; import { ADMONITION_TYPES, type AdmonitionType } from '@triliumnext/ckeditor5-admonition';
type SlashCommandDefinition = SlashCommandEditorConfig["extraCommands"][number]; type SlashCommandDefinition = SlashCommandEditorConfig["extraCommands"][number];
export default function buildExtraCommands(): SlashCommandDefinition[] { export default function buildExtraCommands(): SlashCommandDefinition[] {
return [ return [
...buildAdmonitionExtraCommands() ...buildAdmonitionExtraCommands(),
...buildFootnoteExtraCommands()
]; ];
} }
@ -23,3 +25,15 @@ function buildAdmonitionExtraCommands(): SlashCommandDefinition[] {
} }
return commands; 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")
}
];
}