diff --git a/src/css/tailwind.css b/src/css/tailwind.css
index b51df0f6..8fbce19d 100644
--- a/src/css/tailwind.css
+++ b/src/css/tailwind.css
@@ -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;
+}
diff --git a/src/editor/AlignCenter.tsx b/src/editor/AlignCenter.tsx
new file mode 100644
index 00000000..b8dd1d80
--- /dev/null
+++ b/src/editor/AlignCenter.tsx
@@ -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}" })
+ },
+}
diff --git a/src/editor/AlignRight.tsx b/src/editor/AlignRight.tsx
new file mode 100644
index 00000000..d18a28bb
--- /dev/null
+++ b/src/editor/AlignRight.tsx
@@ -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}" })
+ },
+}
diff --git a/src/editor/Formula.tsx b/src/editor/Formula.tsx
new file mode 100644
index 00000000..34d79d71
--- /dev/null
+++ b/src/editor/Formula.tsx
@@ -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: " $$" })
+ },
+}
diff --git a/src/editor/index.tsx b/src/editor/index.tsx
index f9fe5f36..459a1c51 100644
--- a/src/editor/index.tsx
+++ b/src/editor/index.tsx
@@ -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,
diff --git a/src/lib/i18n/locales/zh-TW/dashboard.json b/src/lib/i18n/locales/zh-TW/dashboard.json
index 2f0c9f16..3534dc40 100644
--- a/src/lib/i18n/locales/zh-TW/dashboard.json
+++ b/src/lib/i18n/locales/zh-TW/dashboard.json
@@ -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}}「{{toTitle}}」",
- "{{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": "公式"
}
\ No newline at end of file
diff --git a/src/lib/i18n/locales/zh/dashboard.json b/src/lib/i18n/locales/zh/dashboard.json
index 31750ee3..8bf7edac 100644
--- a/src/lib/i18n/locales/zh/dashboard.json
+++ b/src/lib/i18n/locales/zh/dashboard.json
@@ -203,5 +203,8 @@
"comment on your" : "评论了你的{{type}}「{{toTitle}}」",
"{{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": "公式"
}
\ No newline at end of file