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
+9
View File
@@ -499,3 +499,12 @@ textarea.input {
/* The underline */
@apply after:left-2 after:right-2 after:bg-accent;
}
/* For users to use within posts */
.center {
@apply flex justify-center;
}
.right {
@apply flex justify-end;
}
+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,
+6 -2
View File
@@ -61,7 +61,6 @@
"Link": "連結",
"Image": "圖片",
"Upload Image": "上傳圖片",
"Help: Markdown syntax and components used by xLog": "幫助:xLog 使用的 Markdown 語法和組件",
"Preview": "預覽",
"Publish": "發布",
"Update": "更新",
@@ -195,5 +194,10 @@
"You can subscribe to comments through an RSS reader to receive timely reminders.": "你可以通過 RSS 閱讀器訂閱留言,以便及時收到通知。",
"Subscription address:": "訂閱地址:",
"comment on your": "回覆了你的 {{type}}「<tolink>{{toTitle}}</tolink>」",
"{{newCount}} new comments": "{{newCount}} 條新留言"
"{{newCount}} new comments": "{{newCount}} 條新留言",
"Upload All Images to IPFS": "上傳所有圖片到 IPFS",
"Help: Markdown syntax and components used by xLog": "幫助:xLog 使用的 Markdown 語法和組件",
"Align Center": "居中",
"Align Right": "靠右",
"Formula": "公式"
}
+4 -1
View File
@@ -203,5 +203,8 @@
"comment on your" : "评论了你的{{type}}「<tolink>{{toTitle}}</tolink>」",
"{{newCount}} new comments" : "{{newCount}} 条新评论",
"Upload All Images to IPFS": "上传所有图片到 IPFS",
"Help: Markdown syntax and components used by xLog": "帮助:xLog 使用的 Markdown 语法和组件"
"Help: Markdown syntax and components used by xLog": "帮助:xLog 使用的 Markdown 语法和组件",
"Align Center": "居中对齐",
"Align Right": "右对齐",
"Formula": "公式"
}