feat(slash): insert date/time

This commit is contained in:
Elian Doran
2025-06-16 20:42:55 +03:00
parent 6f386f50ff
commit 9bfff03cff
3 changed files with 43 additions and 23 deletions

View File

@@ -3,13 +3,27 @@ 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';
import dateTimeIcon from './icons/date-time.svg?raw';
type SlashCommandDefinition = SlashCommandEditorConfig["extraCommands"][number];
export default function buildExtraCommands(): SlashCommandDefinition[] {
return [
...buildAdmonitionExtraCommands(),
...buildFootnoteExtraCommands()
{
id: 'footnote',
title: 'Footnote',
description: 'Create a new footnote and reference it here',
icon: footnoteIcons.insertFootnoteIcon,
commandName: "InsertFootnote"
},
{
id: "datetime",
title: "Insert Date/Time",
description: "Insert the current date and time",
icon: dateTimeIcon,
commandName: "insertDateTimeToText"
}
];
}
@@ -27,14 +41,3 @@ 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")
}
];
}