mirror of
https://github.com/zadam/trilium.git
synced 2025-11-12 16:25:51 +01:00
feat(slash): insert date/time
This commit is contained in:
@@ -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")
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user