* feat: Add mathematics extension and toolbar commands This commit introduces the mathematics extension for inline and block expressions. It also adds corresponding toolbar commands and updates the drag handle menu to include "Turn Into" and "Add Node" options. The placeholder styling and blockquote styles have also been refined. Co-authored-by: best <[email protected]> * Update Tiptap and KaTeX dependencies Co-authored-by: best <[email protected]> * Downgrade svelte-tiptap to v2.2.0 Co-authored-by: best <[email protected]> --------- Co-authored-by: Cursor Agent <[email protected]>
59 lines
1.3 KiB
TypeScript
59 lines
1.3 KiB
TypeScript
import type { Editor } from '@tiptap/core';
|
|
import type { EdraToolBarCommands } from '../../commands/types';
|
|
import Minus from '@lucide/svelte/icons/minus';
|
|
import Quote from '@lucide/svelte/icons/quote';
|
|
import SquareCode from '@lucide/svelte/icons/square-code';
|
|
import commands from '../../commands/toolbar-commands';
|
|
|
|
export interface Group {
|
|
name: string;
|
|
title: string;
|
|
actions: EdraToolBarCommands[];
|
|
}
|
|
|
|
export const GROUPS: Group[] = [
|
|
{
|
|
name: 'format',
|
|
title: 'Format',
|
|
actions: [
|
|
...commands.headings,
|
|
{
|
|
icon: Quote,
|
|
name: 'blockquote',
|
|
tooltip: 'Blockquote',
|
|
onClick: (editor: Editor) => {
|
|
editor.chain().focus().setBlockquote().run();
|
|
}
|
|
},
|
|
{
|
|
icon: SquareCode,
|
|
name: 'codeBlock',
|
|
tooltip: 'Code Block',
|
|
onClick: (editor: Editor) => {
|
|
editor.chain().focus().setCodeBlock().run();
|
|
}
|
|
},
|
|
...commands.lists
|
|
]
|
|
},
|
|
{
|
|
name: 'insert',
|
|
title: 'Insert',
|
|
actions: [
|
|
...commands.media,
|
|
...commands.table,
|
|
...commands.math,
|
|
{
|
|
icon: Minus,
|
|
name: 'horizontalRule',
|
|
tooltip: 'Horizontal Rule',
|
|
onClick: (editor: Editor) => {
|
|
editor.chain().focus().setHorizontalRule().run();
|
|
}
|
|
}
|
|
]
|
|
}
|
|
];
|
|
|
|
export default GROUPS;
|