diff --git a/app/src/constants.ts b/app/src/constants.ts index e06a57806..29b3f1308 100644 --- a/app/src/constants.ts +++ b/app/src/constants.ts @@ -250,6 +250,7 @@ export abstract class Constants { copyPlainText: {default: "", custom: ""}, copyID: {default: "", custom: ""}, netImg2LocalAsset: {default: "", custom: ""}, + optimizeTypography: {default: "", custom: ""}, hLayout: {default: "", custom: ""}, vLayout: {default: "", custom: ""}, refPopover: {default: "", custom: ""}, diff --git a/app/src/protyle/breadcrumb/index.ts b/app/src/protyle/breadcrumb/index.ts index 0f8b782f3..4cd38de9e 100644 --- a/app/src/protyle/breadcrumb/index.ts +++ b/app/src/protyle/breadcrumb/index.ts @@ -325,6 +325,7 @@ export class Breadcrumb { if (!protyle.disabled) { window.siyuan.menus.menu.append(new MenuItem({ label: window.siyuan.languages.optimizeTypography, + accelerator: window.siyuan.config.keymap.editor.general.optimizeTypography.custom, icon: "iconFormat", click: () => { hideElements(["toolbar"], protyle); diff --git a/app/src/protyle/wysiwyg/commonHotkey.ts b/app/src/protyle/wysiwyg/commonHotkey.ts index fb41cbffe..180e34484 100644 --- a/app/src/protyle/wysiwyg/commonHotkey.ts +++ b/app/src/protyle/wysiwyg/commonHotkey.ts @@ -41,6 +41,15 @@ export const commonHotkey = (protyle: IProtyle, event: KeyboardEvent) => { return true; } + if (matchHotKey(window.siyuan.config.keymap.editor.general.optimizeTypography.custom, event)) { + fetchPost("/api/format/autoSpace", { + id: protyle.block.rootID + }); + event.preventDefault(); + event.stopPropagation(); + return true; + } + if (matchHotKey(window.siyuan.config.keymap.editor.general.spaceRepetition.custom, event) || matchHotKey(window.siyuan.config.keymap.general.dailyNote.custom, event)) { // 阻止输入 https://ld246.com/article/1679618995926