Skip to content

Build your personal knowledge base with Trilium Notes

feat(slash): insert math

Elian Doranc09a9aa7d35e
diff --git a/packages/ckeditor5-math/src/index.ts b/packages/ckeditor5-math/src/index.ts
index 781f074327..f33a906208 100644
--- a/packages/ckeditor5-math/src/index.ts
+++ b/packages/ckeditor5-math/src/index.ts
@@ -3,6 +3,7 @@ import './augmentation.js';
import "../theme/mathform.css";
export { default as Math } from './math.js';
+export { default as MathUI } from './mathui.js';
export { default as AutoformatMath } from './autoformatmath.js';
export const icons = {
diff --git a/packages/ckeditor5/src/extra_slash_commands.ts b/packages/ckeditor5/src/extra_slash_commands.ts
index 4f941cad34..f9caf3d0da 100644
--- a/packages/ckeditor5/src/extra_slash_commands.ts
+++ b/packages/ckeditor5/src/extra_slash_commands.ts
@@ -7,6 +7,7 @@ import { COMMAND_NAME as INTERNAL_LINK_COMMAND } from './plugins/internallink';
import { ADMONITION_TYPES, type AdmonitionType } from '@triliumnext/ckeditor5-admonition';
import dateTimeIcon from './icons/date-time.svg?raw';
import internalLinkIcon from './icons/trilium.svg?raw';
+import { icons as mathIcons, MathUI } from '@triliumnext/ckeditor5-math';
type SlashCommandDefinition = SlashCommandEditorConfig["extraCommands"][number];
@@ -33,6 +34,13 @@ export default function buildExtraCommands(): SlashCommandDefinition[] {
description: "Insert a link to another Trilium note",
icon: internalLinkIcon,
commandName: INTERNAL_LINK_COMMAND
+ },
+ {
+ id: "math",
+ title: "Math equation",
+ description: "Insert a math equation",
+ icon: mathIcons.ckeditor,
+ execute: (editor: Editor) => editor.plugins.get(MathUI)._showUI()
}
];
}