mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
feat(slash): insert footnote command
This commit is contained in:
parent
3a0b616800
commit
43eff08004
@ -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")
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user