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/16685

Vanessa8db86ce6ca00
diff --git a/app/src/constants.ts b/app/src/constants.ts
index d14997e76b..f1241320b0 100644
--- a/app/src/constants.ts
+++ b/app/src/constants.ts
@@ -67,7 +67,7 @@ export abstract class Constants {
// size
public static readonly SIZE_DATABASE_MAZ_SIZE: number = 102400;
- public static readonly SIZE_UPLOAD_TIP_SIZE: number = 256 * 1024 * 1024;
+ public static readonly SIZE_UPLOAD_TIP_SIZE: number = 268435456; // 256 M
public static readonly SIZE_SCROLL_TB: number = 24;
public static readonly SIZE_SCROLL_STEP: number = 256;
public static readonly SIZE_LINK_TEXT_MAX: number = 64;
diff --git a/app/src/protyle/method.ts b/app/src/protyle/method.ts
index e9804fa053..c19b361da7 100644
--- a/app/src/protyle/method.ts
+++ b/app/src/protyle/method.ts
@@ -8,7 +8,6 @@ import { abcRender } from "./render/abcRender";
import { htmlRender } from "./render/htmlRender";
import { mindmapRender } from "./render/mindmapRender";
import { plantumlRender } from "./render/plantumlRender";
-import { avRender } from "./render/av/render";
import "../assets/scss/export.scss";
class Protyle {
@@ -30,7 +29,7 @@ class Protyle {
public static mindmapRender = mindmapRender;
/** UML 渲染 */
public static plantumlRender = plantumlRender;
- public static avRender = avRender;
+ /** html 块渲染 */
public static htmlRender = htmlRender;
}
diff --git a/app/src/protyle/render/highlightRender.ts b/app/src/protyle/render/highlightRender.ts
index 6385099d9d..9da6206bbc 100644
--- a/app/src/protyle/render/highlightRender.ts
+++ b/app/src/protyle/render/highlightRender.ts
@@ -1,7 +1,7 @@
import {addScript} from "../util/addScript";
import {Constants} from "../../constants";
import {focusByOffset} from "../util/selection";
-import {setCodeTheme} from "../../util/assets";
+import {setCodeTheme} from "./util";
export const highlightRender = (element: Element, cdn = Constants.PROTYLE_CDN, zoom = 1) => {
let codeElements: NodeListOf<Element>;
diff --git a/app/src/protyle/render/util.ts b/app/src/protyle/render/util.ts
index 358a115f7b..cc9de45a59 100644
--- a/app/src/protyle/render/util.ts
+++ b/app/src/protyle/render/util.ts
@@ -1,5 +1,6 @@
import {isInEmbedBlock} from "../util/hasClosest";
import {Constants} from "../../constants";
+import {addStyle} from "../util/addStyle";
export const genIconHTML = (element?: false | HTMLElement, actions = ["edit", "more"]) => {
let enable = true;
@@ -47,3 +48,26 @@ export const processClonePHElement = (item: Element) => {
});
return item;
};
+
+export const setCodeTheme = (cdn = Constants.PROTYLE_CDN) => {
+ const protyleHljsStyle = document.getElementById("protyleHljsStyle") as HTMLLinkElement;
+ let css;
+ if (window.siyuan.config.appearance.mode === 0) {
+ css = window.siyuan.config.appearance.codeBlockThemeLight;
+ if (!Constants.SIYUAN_CONFIG_APPEARANCE_LIGHT_CODE.includes(css)) {
+ css = "default";
+ }
+ } else {
+ css = window.siyuan.config.appearance.codeBlockThemeDark;
+ if (!Constants.SIYUAN_CONFIG_APPEARANCE_DARK_CODE.includes(css)) {
+ css = "github-dark";
+ }
+ }
+ const href = `${cdn}/js/highlight.js/styles/${css}.min.css?v=11.11.1`;
+ if (!protyleHljsStyle) {
+ addStyle(href, "protyleHljsStyle");
+ } else if (!protyleHljsStyle.href.includes(href)) {
+ protyleHljsStyle.remove();
+ addStyle(href, "protyleHljsStyle");
+ }
+};
diff --git a/app/src/util/assets.ts b/app/src/util/assets.ts
index 6cf9df87f9..5cfaefe833 100644
--- a/app/src/util/assets.ts
+++ b/app/src/util/assets.ts
@@ -7,6 +7,7 @@ import {exportLayout} from "../layout/util";
/// #endif
import {fetchPost} from "./fetch";
import {isInAndroid, isInHarmony, isInIOS, isIPad, isIPhone, isMac, isWin11} from "../protyle/util/compatibility";
+import {setCodeTheme} from "../protyle/render/util";
export const loadAssets = (data: Config.IAppearance) => {
const htmlElement = document.getElementsByTagName("html")[0];
@@ -319,29 +320,6 @@ export const setInlineStyle = async (set = true, servePath = "../../../") => {
return style;
};
-export const setCodeTheme = (cdn = Constants.PROTYLE_CDN) => {
- const protyleHljsStyle = document.getElementById("protyleHljsStyle") as HTMLLinkElement;
- let css;
- if (window.siyuan.config.appearance.mode === 0) {
- css = window.siyuan.config.appearance.codeBlockThemeLight;
- if (!Constants.SIYUAN_CONFIG_APPEARANCE_LIGHT_CODE.includes(css)) {
- css = "default";
- }
- } else {
- css = window.siyuan.config.appearance.codeBlockThemeDark;
- if (!Constants.SIYUAN_CONFIG_APPEARANCE_DARK_CODE.includes(css)) {
- css = "github-dark";
- }
- }
- const href = `${cdn}/js/highlight.js/styles/${css}.min.css?v=11.11.1`;
- if (!protyleHljsStyle) {
- addStyle(href, "protyleHljsStyle");
- } else if (!protyleHljsStyle.href.includes(href)) {
- protyleHljsStyle.remove();
- addStyle(href, "protyleHljsStyle");
- }
-};
-
export const setMode = (modeElementValue: number) => {
/// #if !MOBILE
let mode = modeElementValue;