feat: AlignCenter AlignRight Formula editor button
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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}" })
|
||||
},
|
||||
}
|
||||
@@ -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}" })
|
||||
},
|
||||
}
|
||||
@@ -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: " $$" })
|
||||
},
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
@@ -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": "公式"
|
||||
}
|
||||
@@ -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": "公式"
|
||||
}
|
||||
Reference in New Issue
Block a user