feat:resize image shortcut (#1461)

This commit is contained in:
Jesse Zhang 2024-02-22 02:38:53 +08:00 committed by GitHub
parent 3351d6d8f1
commit b740ae768d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,27 @@
import { type EditorView } from "@codemirror/view"
import { ICommand, wrapExecute } from "."
const action = (view: EditorView) => {
wrapExecute({
view,
prepend: ':::div{style="max=width: 300px"}\n',
append: "\n:::",
})
}
export const ResizeImage: ICommand = {
name: "image-size",
label: "Image Size",
icon: "i-mingcute-photo-album-2-fill",
execute: ({ view }) => {
action(view)
},
shortcut: {
key: "Mod-Shift-s",
run(view) {
action(view)
return true
},
},
}

View File

@ -21,6 +21,7 @@ import { ListUnordered } from "./ListUnordered"
import { Mention } from "./Mention"
import { Multimedia } from "./Multimedia"
import { Quote } from "./Quote"
import { ResizeImage } from "./ResizeImage"
import { Strikethrough } from "./Strikethrough"
import { Underline } from "./Underline"
@ -102,6 +103,7 @@ export const toolbars: ICommand[] = [
ListOrdered,
Link,
Multimedia,
ResizeImage,
Mention,
Formula,
Emoji,

View File

@ -110,6 +110,7 @@
"Link": "リンク",
"Image": "画像",
"Upload Image, Audio or Video": "画像、音声、動画をアップロード",
"ResizeImage": "画像のサイズを変更",
"Tip: xLog Flavored Markdown": "ヒントxLog 風のマークダウン",
"Preview": "プレビュー",
"Publish": "公開",

View File

@ -159,6 +159,7 @@
"Link": "連結",
"Image": "圖片",
"Upload Image, Audio or Video": "上傳圖片、音頻或視頻",
"ImageSize": "調整圖片大小",
"Preview": "預覽",
"Publish": "發布",
"Update": "更新",

View File

@ -174,6 +174,7 @@
"Link": "链接",
"Image": "图片",
"Upload Image, Audio or Video": "上传图片、音频或视频",
"ImageSize": "调整图像大小",
"Mention": "提及",
"Tip: xLog Flavored Markdown": "帮助xLog 风格的 Markdown",
"Preview": "预览",