Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/8064

Vanessa5c14d38dfd02
diff --git a/app/src/protyle/ui/initUI.ts b/app/src/protyle/ui/initUI.ts
index f97588043e..d0768e09a0 100644
--- a/app/src/protyle/ui/initUI.ts
+++ b/app/src/protyle/ui/initUI.ts
@@ -4,6 +4,9 @@ import {scrollEvent} from "../scroll/event";
import {isMobile} from "../../util/functions";
import {Constants} from "../../constants";
import {hasClosestByAttribute, hasClosestByClassName} from "../util/hasClosest";
+import {isMac} from "../util/compatibility";
+import {setInlineStyle} from "../../util/assets";
+import {fetchPost} from "../../util/fetch";
export const initUI = (protyle: IProtyle) => {
protyle.contentElement = document.createElement("div");
@@ -70,6 +73,33 @@ export const initUI = (protyle: IProtyle) => {
embedBlockElement.firstElementChild.classList.toggle("protyle-icons--show");
}
});
+ let wheelTimeout: number
+ const isMacOS = isMac()
+ protyle.contentElement.addEventListener("mousewheel", (event: WheelEvent) => {
+ if ((isMacOS && !event.metaKey) || (!isMacOS && !event.ctrlKey) || event.deltaX !== 0) {
+ return;
+ }
+ event.preventDefault();
+ event.stopPropagation();
+ if (event.deltaY < 0) {
+ if (window.siyuan.config.editor.fontSize < 72) {
+ window.siyuan.config.editor.fontSize++;
+ } else {
+ return;
+ }
+ } else if (event.deltaY > 0) {
+ if (window.siyuan.config.editor.fontSize > 9) {
+ window.siyuan.config.editor.fontSize--
+ } else {
+ return;
+ }
+ }
+ setInlineStyle();
+ clearTimeout(wheelTimeout);
+ wheelTimeout = window.setTimeout(() => {
+ fetchPost("/api/setting/setEditor", window.siyuan.config.editor);
+ }, Constants.TIMEOUT_LOAD);
+ }, {passive: false});
};
export const addLoading = (protyle: IProtyle) => {