feat: AlignCenter AlignRight Formula editor button

This commit is contained in:
DIYgod
2023-05-16 16:00:12 +01:00
parent ef946681f0
commit 30e7dd4cbc
7 changed files with 55 additions and 3 deletions
+10
View File
@@ -0,0 +1,10 @@
import { ICommand, wrapExecute } from "."
export const AlignCenter: ICommand = {
name: "align center",
label: "Align Center",
icon: "icon-[mingcute--align-center-line]",
execute: ({ view }) => {
wrapExecute({ view, prepend: ":p[", append: "]{.center}" })
},
}
+10
View File
@@ -0,0 +1,10 @@
import { ICommand, wrapExecute } from "."
export const AlignRight: ICommand = {
name: "align right",
label: "Align Right",
icon: "icon-[mingcute--align-right-line]",
execute: ({ view }) => {
wrapExecute({ view, prepend: ":p[", append: "]{.right}" })
},
}
+10
View File
@@ -0,0 +1,10 @@
import { ICommand, wrapExecute } from "."
export const Formula: ICommand = {
name: "formula",
label: "Formula",
icon: "icon-[mingcute--formula-line]",
execute: ({ view }) => {
wrapExecute({ view, prepend: "$$ ", append: " $$" })
},
}
+6
View File
@@ -3,11 +3,14 @@ import { Dispatch, SetStateAction } from "react"
import { EditorSelection } from "@codemirror/state"
import { EditorView } from "@codemirror/view"
import { AlignCenter } from "./AlignCenter"
import { AlignRight } from "./AlignRight"
import { Bold } from "./Bold"
import { Cloud } from "./Cloud"
import { Code } from "./Code"
import { CodeBlock } from "./CodeBlock"
import { Emoji } from "./Emoji"
import { Formula } from "./Formula"
import { Heading } from "./Heading"
import { Help } from "./Help"
import { Image } from "./Image"
@@ -135,6 +138,8 @@ export const toolbars: ICommand[] = [
Strikethrough,
Underline,
Quote,
AlignCenter,
AlignRight,
Code,
CodeBlock,
ListUnordered,
@@ -142,6 +147,7 @@ export const toolbars: ICommand[] = [
Link,
Image,
Mention,
Formula,
Emoji,
Cloud,
Help,