Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2026-01-16 22:16:32 +08:00
commit 86e248749e
30 changed files with 308 additions and 34 deletions

View file

@ -305,6 +305,14 @@ export const editor = {
<textarea class="b3-text-field fn__block" id="katexMacros" spellcheck="false">${window.siyuan.config.editor.katexMacros}</textarea>
</div>
</div>
<label class="fn__flex b3-label">
<div class="fn__flex-1">
${window.siyuan.languages.allowSVGScript}
<div class="b3-label__text">${window.siyuan.languages.allowSVGScriptTip}</div>
</div>
<span class="fn__space"></span>
<input class="b3-switch fn__flex-center" id="allowSVGScript" type="checkbox"${window.siyuan.config.editor.allowSVGScript ? " checked" : ""}/>
</label>
<label class="fn__flex b3-label">
<div class="fn__flex-1">
${window.siyuan.languages.allowHTMLBLockScript}
@ -470,6 +478,7 @@ export const editor = {
inlineStrikethrough: (editor.element.querySelector("#editorMarkdownInlineStrikethrough") as HTMLInputElement).checked,
inlineMark: (editor.element.querySelector("#editorMarkdownInlineMark") as HTMLInputElement).checked
},
allowSVGScript: (editor.element.querySelector("#allowSVGScript") as HTMLInputElement).checked,
allowHTMLBLockScript: (editor.element.querySelector("#allowHTMLBLockScript") as HTMLInputElement).checked,
justify: (editor.element.querySelector("#justify") as HTMLInputElement).checked,
rtl: (editor.element.querySelector("#rtl") as HTMLInputElement).checked,

View file

@ -39,6 +39,14 @@ export const exportConfig = {
<span class="fn__space"></span>
<input class="b3-switch fn__flex-center" id="markdownYFM" type="checkbox"${window.siyuan.config.export.markdownYFM ? " checked" : ""}/>
</label>
<label class="fn__flex b3-label">
<div class="fn__flex-1">
${window.siyuan.languages.removeAssetsID}
<div class="b3-label__text">${window.siyuan.languages.removeAssetsIDTip}</div>
</div>
<span class="fn__space"></span>
<input class="b3-switch fn__flex-center" id="removeAssetsID" type="checkbox"${window.siyuan.config.export.removeAssetsID ? " checked" : ""}/>
</label>
<label class="fn__flex b3-label">
<div class="fn__flex-1">
${window.siyuan.languages.export31}
@ -207,6 +215,7 @@ export const exportConfig = {
fetchPost("/api/setting/setExport", {
paragraphBeginningSpace: (exportConfig.element.querySelector("#paragraphBeginningSpace") as HTMLInputElement).checked,
addTitle: (exportConfig.element.querySelector("#addTitle") as HTMLInputElement).checked,
removeAssetsID: (exportConfig.element.querySelector("#removeAssetsID") as HTMLInputElement).checked,
markdownYFM: (exportConfig.element.querySelector("#markdownYFM") as HTMLInputElement).checked,
inlineMemo: (exportConfig.element.querySelector("#inlineMemo") as HTMLInputElement).checked,
blockRefMode: parseInt((exportConfig.element.querySelector("#blockRefMode") as HTMLSelectElement).value, 10),

View file

@ -28,7 +28,7 @@ export const initConfigSearch = (element: HTMLElement, app: App) => {
"editorMarkdownInlineTag", "editorMarkdownInlineTagTip", "editorMarkdownInlineMath", "editorMarkdownInlineMathTip",
"editorMarkdownInlineStrikethrough", "editorMarkdownInlineStrikethroughTip", "editorMarkdownInlineMark", "editorMarkdownInlineMarkTip",
"allowHTMLBLockScript", "allowHTMLBLockScriptTip", "backlinkExpandTip", "backmentionExpandTip",
"backlinkContainChildren", "backlinkContainChildrenTip"
"backlinkContainChildren", "backlinkContainChildrenTip", "allowSVGScript", "allowSVGScriptTip"
]),
// 文档树
@ -56,7 +56,7 @@ export const initConfigSearch = (element: HTMLElement, app: App) => {
// 导出
getLang(["paragraphBeginningSpace", "md4", "export", "export1", "export2", "export5", "export11",
"export13", "export14", "export15", "export19", "export20", "ref", "blockEmbed", "export17", "export18",
"export23", "export24", "export25", "export26", "export27", "export28", "export29"]),
"export23", "export24", "export25", "export26", "export27", "export28", "export29", "removeAssetsID", "removeAssetsIDTip"]),
// 外观
getLang(["language", "language1", "appearance", "appearance1", "appearance2", "appearance3", "appearance4",

View file

@ -4,7 +4,7 @@ import {FileFilter, ipcRenderer} from "electron";
import * as path from "path";
/// #endif
import {MenuItem} from "./Menu";
import {getDisplayName, getNotebookName, getTopPaths, useShell, pathPosix} from "../util/pathName";
import {getDisplayName, getNotebookName, getTopPaths, pathPosix, useShell} from "../util/pathName";
import {hideMessage, showMessage} from "../dialog/message";
import {fetchPost, fetchSyncPost} from "../util/fetch";
import {onGetnotebookconf} from "./onGetnotebookconf";
@ -158,6 +158,19 @@ const initMultiMenu = (selectItemElements: NodeListOf<Element>, app: App) => {
type: "submenu",
icon: "iconUpload",
submenu: [{
id: "exportSiYuanZip",
label: "SiYuan .sy.zip",
icon: "iconSiYuan",
click: () => {
const msgId = showMessage(window.siyuan.languages.exporting, -1);
fetchPost("/api/export/exportSYs", {
ids: blockIDs,
}, response => {
hideMessage(msgId);
openByMobile(response.data.zip);
});
}
}, {
id: "exportMarkdown",
label: "Markdown .zip",
icon: "iconMarkdown",

View file

@ -24,6 +24,7 @@ const setEditor = (modelMainElement: Element) => {
inlineStrikethrough: (modelMainElement.querySelector("#editorMarkdownInlineStrikethrough") as HTMLInputElement).checked,
inlineMark: (modelMainElement.querySelector("#editorMarkdownInlineMark") as HTMLInputElement).checked
};
window.siyuan.config.editor.allowSVGScript = (modelMainElement.querySelector("#allowSVGScript") as HTMLInputElement).checked;
window.siyuan.config.editor.allowHTMLBLockScript = (modelMainElement.querySelector("#allowHTMLBLockScript") as HTMLInputElement).checked;
window.siyuan.config.editor.dynamicLoadBlocks = dynamicLoadBlocks;
window.siyuan.config.editor.justify = (modelMainElement.querySelector("#justify") as HTMLInputElement).checked;
@ -279,6 +280,14 @@ export const initEditor = () => {
<textarea class="b3-text-field fn__block" id="katexMacros">${window.siyuan.config.editor.katexMacros}</textarea>
<div class="b3-label__text">${window.siyuan.languages.katexMacrosTip}</div>
</div>
<label class="fn__flex b3-label">
<div class="fn__flex-1">
${window.siyuan.languages.allowSVGScript}
<div class="b3-label__text">${window.siyuan.languages.allowSVGScriptTip}</div>
</div>
<span class="fn__space"></span>
<input class="b3-switch fn__flex-center" id="allowSVGScript" type="checkbox"${window.siyuan.config.editor.allowSVGScript ? " checked" : ""}/>
</label>
<label class="fn__flex b3-label">
<div class="fn__flex-1">
${window.siyuan.languages.allowHTMLBLockScript}

View file

@ -509,6 +509,7 @@ ${getIconScript(servePath)}
config: {
appearance: { mode: 0, codeBlockThemeDark: "${window.siyuan.config.appearance.codeBlockThemeDark}", codeBlockThemeLight: "${window.siyuan.config.appearance.codeBlockThemeLight}" },
editor: {
allowSVGScriptTip: ${window.siyuan.config.editor.allowSVGScript},
allowHTMLBLockScript: ${window.siyuan.config.editor.allowHTMLBLockScript},
fontSize: ${window.siyuan.config.editor.fontSize},
codeLineWrap: true,

View file

@ -350,6 +350,11 @@ declare namespace Config {
*/
export interface IEditor {
/**
* Whether to allow to execute javascript in the SVG
*/
allowSVGScript: boolean;
/**
* Whether to allow to execute javascript in the HTML block
*/
@ -569,6 +574,10 @@ declare namespace Config {
* Whether to add YAML Front Matter when exporting to Markdown
*/
markdownYFM: boolean;
/**
* Whether to remove the asset ID when exporting to Markdown
*/
removeAssetsID: boolean;
/**
* Whether to export the inline memo
*/