mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-03 15:28:49 +01:00
This commit is contained in:
parent
81f39961eb
commit
ec29bc7071
4 changed files with 21 additions and 30 deletions
|
|
@ -343,9 +343,7 @@ export const editor = {
|
|||
}
|
||||
window.siyuan.config.editor = editorData;
|
||||
getAllModels().editor.forEach((item) => {
|
||||
if (!changeReadonly) {
|
||||
reloadProtyle(item.editor.protyle, false);
|
||||
}
|
||||
reloadProtyle(item.editor.protyle, false);
|
||||
let isFullWidth = item.editor.protyle.wysiwyg.element.getAttribute(Constants.CUSTOM_SY_FULLWIDTH);
|
||||
if (!isFullWidth) {
|
||||
isFullWidth = window.siyuan.config.editor.fullWidth ? "true" : "false";
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import {zoomOut} from "../../menus/protyle";
|
|||
import {processRender} from "../../protyle/util/processCode";
|
||||
import {highlightRender} from "../../protyle/render/highlightRender";
|
||||
import {blockRender} from "../../protyle/render/blockRender";
|
||||
import {disabledForeverProtyle, disabledProtyle, enableProtyle} from "../../protyle/util/onGet";
|
||||
import {disabledForeverProtyle, setReadonlyByConfig} from "../../protyle/util/onGet";
|
||||
import {setStorageVal} from "../../protyle/util/compatibility";
|
||||
import {closePanel} from "./closePanel";
|
||||
import {showMessage} from "../../dialog/message";
|
||||
|
|
@ -92,18 +92,7 @@ const focusStack = (backStack: IBackStack) => {
|
|||
if (getResponse.data.isSyncing) {
|
||||
disabledForeverProtyle(protyle);
|
||||
} else {
|
||||
let readOnly = window.siyuan.config.readonly ? "true" : "false";
|
||||
if (readOnly === "false") {
|
||||
readOnly = window.siyuan.config.editor.readOnly ? "true" : "false";
|
||||
if (readOnly === "false") {
|
||||
readOnly = protyle.wysiwyg.element.getAttribute(Constants.CUSTOM_SY_READONLY);
|
||||
}
|
||||
}
|
||||
if (readOnly === "true") {
|
||||
disabledProtyle(protyle);
|
||||
} else {
|
||||
enableProtyle(protyle);
|
||||
}
|
||||
setReadonlyByConfig(protyle);
|
||||
}
|
||||
protyle.contentElement.scrollTop = backStack.scrollTop;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import {updatePanelByEditor} from "../editor/util";
|
|||
import {setPanelFocus} from "../layout/util";
|
||||
/// #endif
|
||||
import {Background} from "./header/Background";
|
||||
import {onGet} from "./util/onGet";
|
||||
import {onGet, setReadonlyByConfig} from "./util/onGet";
|
||||
import {reloadProtyle} from "./util/reload";
|
||||
import {renderBacklink} from "./wysiwyg/renderBacklink";
|
||||
import {setEmpty} from "../mobile/util/setEmpty";
|
||||
|
|
@ -132,7 +132,7 @@ export class Protyle {
|
|||
break;
|
||||
case "readonly":
|
||||
window.siyuan.config.editor.readOnly = data.data;
|
||||
reloadProtyle(this.protyle, false);
|
||||
setReadonlyByConfig(this.protyle);
|
||||
break;
|
||||
case "heading2doc":
|
||||
case "li2doc":
|
||||
|
|
|
|||
|
|
@ -240,18 +240,7 @@ const setHTML = (options: {
|
|||
protyle.breadcrumb.element.nextElementSibling.textContent = "";
|
||||
}
|
||||
protyle.element.removeAttribute("disabled-forever");
|
||||
let readOnly = window.siyuan.config.readonly ? "true" : "false";
|
||||
if (readOnly === "false") {
|
||||
readOnly = window.siyuan.config.editor.readOnly ? "true" : "false";
|
||||
if (readOnly === "false") {
|
||||
readOnly = protyle.wysiwyg.element.getAttribute(Constants.CUSTOM_SY_READONLY);
|
||||
}
|
||||
}
|
||||
if (readOnly === "true") {
|
||||
disabledProtyle(protyle);
|
||||
} else {
|
||||
enableProtyle(protyle);
|
||||
}
|
||||
setReadonlyByConfig(protyle);
|
||||
}
|
||||
if (options.action.includes(Constants.CB_GET_SETID)) {
|
||||
// 点击大纲后,如果需要动态加载,在定位后,需要重置 block.id https://github.com/siyuan-note/siyuan/issues/4487
|
||||
|
|
@ -411,3 +400,18 @@ const focusElementById = (protyle: IProtyle, action: string[]) => {
|
|||
/// #endif
|
||||
}
|
||||
};
|
||||
|
||||
export const setReadonlyByConfig = (protyle: IProtyle) => {
|
||||
let readOnly = window.siyuan.config.readonly ? "true" : "false";
|
||||
if (readOnly === "false") {
|
||||
readOnly = window.siyuan.config.editor.readOnly ? "true" : "false";
|
||||
if (readOnly === "false") {
|
||||
readOnly = protyle.wysiwyg.element.getAttribute(Constants.CUSTOM_SY_READONLY);
|
||||
}
|
||||
}
|
||||
if (readOnly === "true") {
|
||||
disabledProtyle(protyle);
|
||||
} else {
|
||||
enableProtyle(protyle);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue