Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: fix https://github.com/siyuan-note/siyuan/issues/8767

Vanessaa6da096f6669
diff --git a/app/src/constants.ts b/app/src/constants.ts
index e06a57806a..29b3f1308e 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 0f8b782f3d..4cd38de9e5 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 fb41cbffef..180e344849 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