Vanessa 2022-10-11 22:09:15 +08:00
parent f9f2252946
commit 41a7c5d63f
5 changed files with 15 additions and 18 deletions

View file

@ -18,6 +18,14 @@ export const editor = {
<span class="fn__space"></span>
<input class="b3-switch fn__flex-center" id="fullWidth" type="checkbox"${window.siyuan.config.editor.fullWidth ? " checked" : ""}/>
</label>
<label class="fn__flex b3-label">
<div class="fn__flex-1">
${window.siyuan.languages.editReadonly}
<div class="b3-label__text">${window.siyuan.languages.editReadonlyTip}</div>
</div>
<span class="fn__space"></span>
<input class="b3-switch fn__flex-center" id="readOnly" type="checkbox"${window.siyuan.config.editor.readOnly ? " checked" : ""}/>
</label>
<label class="fn__flex b3-label">
<div class="fn__flex-1">
${window.siyuan.languages.md12}
@ -162,6 +170,7 @@ export const editor = {
const setEditor = () => {
fetchPost("/api/setting/setEditor", {
fullWidth: (editor.element.querySelector("#fullWidth") as HTMLInputElement).checked,
readOnly: (editor.element.querySelector("#readOnly") as HTMLInputElement).checked,
displayBookmarkIcon: (editor.element.querySelector("#displayBookmarkIcon") as HTMLInputElement).checked,
displayNetImgMark: (editor.element.querySelector("#displayNetImgMark") as HTMLInputElement).checked,
codeSyntaxHighlightLineNum: (editor.element.querySelector("#codeSyntaxHighlightLineNum") as HTMLInputElement).checked,

View file

@ -14,7 +14,8 @@ export const initConfigSearch = (element: HTMLElement) => {
getLang(["config", "fullWidth",
"editor", "md2", "md3", "md12", "md16", "md27", "md28", "md29", "md30", "md31", "md32", "md33", "md34",
"md39", "md40", "fontSizeTip", "fontSize", "font", "font1", "generateHistory", "generateHistoryInterval",
"historyRetentionDays", "historyRetentionDaysTip", "clearHistory", "katexMacros", "katexMacrosTip"
"historyRetentionDays", "historyRetentionDaysTip", "clearHistory", "katexMacros", "katexMacrosTip",
"editReadonly", "editReadonlyTip"
]),
// 文档树

View file

@ -53,22 +53,8 @@ export const initAppearance = (modelElement: HTMLElement, modelMainElement: HTML
</div>`;
modelMainElement.querySelector(".b3-slider").addEventListener("input", (event: InputEvent & { target: HTMLInputElement }) => {
modelMainElement.querySelector("#fontSize").textContent = event.target.value + "px";
fetchPost("/api/setting/setEditor", {
displayBookmarkIcon: window.siyuan.config.editor.displayBookmarkIcon,
displayNetImgMark: window.siyuan.config.editor.displayNetImgMark,
codeLineWrap: window.siyuan.config.editor.codeLineWrap,
codeSyntaxHighlightLineNum: window.siyuan.config.editor.codeSyntaxHighlightLineNum,
virtualBlockRef: window.siyuan.config.editor.virtualBlockRef,
virtualBlockRefExclude: window.siyuan.config.editor.virtualBlockRefExclude,
blockRefDynamicAnchorTextMaxLen: window.siyuan.config.editor.blockRefDynamicAnchorTextMaxLen,
fontSize: parseInt((modelMainElement.querySelector(".b3-slider") as HTMLInputElement).value),
codeLigatures: window.siyuan.config.editor.codeLigatures,
codeTabSpaces: window.siyuan.config.editor.codeTabSpaces,
generateHistoryInterval: window.siyuan.config.editor.generateHistoryInterval,
historyRetentionDays: window.siyuan.config.editor.historyRetentionDays,
fontFamily: window.siyuan.config.editor.fontFamily,
emoji: window.siyuan.config.editor.emoji
}, (response) => {
window.siyuan.config.editor.fontSize = parseInt(event.target.value);
fetchPost("/api/setting/setEditor", window.siyuan.config.editor, (response) => {
window.siyuan.config.editor = response.data;
reloadProtyle(window.siyuan.mobileEditor.protyle);
setInlineStyle();

View file

@ -230,6 +230,7 @@ declare interface IExport {
}
declare interface IEditor {
readOnly: boolean;
katexMacros: string;
fullWidth: boolean;
fontSize: number;

View file

@ -173,7 +173,7 @@ const initBar = () => {
</div>
<div id="barHistory" class="toolbar__item b3-tooltips b3-tooltips__se" aria-label="${window.siyuan.languages.dataHistory} ${updateHotkeyTip(window.siyuan.config.keymap.general.dataHistory.custom)}">
<svg>
<use xlink:href="#iconVideo"></use>
<use xlink:href="#iconTrashcan"></use>
</svg>
</div>
<div id="barSetting" class="toolbar__item b3-tooltips b3-tooltips__se${window.siyuan.config.readonly ? " fn__none" : ""}" aria-label="${window.siyuan.languages.config} ${updateHotkeyTip(window.siyuan.config.keymap.general.config.custom)}">