mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-24 02:20:13 +01:00
🚨
This commit is contained in:
parent
5e6efbce4f
commit
2ccc988fb9
3 changed files with 10 additions and 10 deletions
|
|
@ -11,18 +11,18 @@ export const editor = {
|
|||
setMode: (readOnly?: boolean) => {
|
||||
const target = document.querySelector("#barReadonly");
|
||||
if (typeof readOnly === "undefined") {
|
||||
readOnly = target.getAttribute("aria-label") === `${window.siyuan.languages.use} ${window.siyuan.languages.editReadonly}`
|
||||
readOnly = target.getAttribute("aria-label") === `${window.siyuan.languages.use} ${window.siyuan.languages.editReadonly}`;
|
||||
}
|
||||
window.siyuan.config.editor.readOnly = readOnly;
|
||||
if (readOnly) {
|
||||
target.setAttribute("aria-label", `${window.siyuan.languages.use} ${window.siyuan.languages.editMode}`);
|
||||
target.querySelector('use').setAttribute("xlink:href", "#iconPreview");
|
||||
target.querySelector("use").setAttribute("xlink:href", "#iconPreview");
|
||||
} else {
|
||||
target.setAttribute("aria-label", `${window.siyuan.languages.use} ${window.siyuan.languages.editReadonly}`);
|
||||
target.querySelector('use').setAttribute("xlink:href", "#iconEdit");
|
||||
target.querySelector("use").setAttribute("xlink:href", "#iconEdit");
|
||||
}
|
||||
fetchPost("/api/setting/setEditor", window.siyuan.config.editor, () => {
|
||||
const allModels = getAllModels()
|
||||
const allModels = getAllModels();
|
||||
allModels.editor.forEach(editor => {
|
||||
if (readOnly) {
|
||||
disabledProtyle(editor.editor.protyle);
|
||||
|
|
@ -37,7 +37,7 @@ export const editor = {
|
|||
} else {
|
||||
enableProtyle(editor.protyle);
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
allModels.search.forEach(search => {
|
||||
if (readOnly) {
|
||||
|
|
@ -53,8 +53,8 @@ export const editor = {
|
|||
} else {
|
||||
enableProtyle(editor.protyle);
|
||||
}
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
genHTML: () => {
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ export class Gutter {
|
|||
document.querySelector("#toolbarEdit use").setAttribute("xlink:href", "#iconPreview");
|
||||
enableProtyle(protyle);
|
||||
gutterFold();
|
||||
})
|
||||
});
|
||||
}
|
||||
} else {
|
||||
gutterFold();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import {fetchPost} from "../../util/fetch";
|
||||
import {focusBlock, focusByRange, focusByWbr, focusSideBlock, getEditorRange} from "../util/selection";
|
||||
import {focusBlock, focusByWbr, focusSideBlock, getEditorRange} from "../util/selection";
|
||||
import {getTopAloneElement} from "./getBlock";
|
||||
import {Constants} from "../../constants";
|
||||
import {blockRender} from "../markdown/blockRender";
|
||||
|
|
@ -450,7 +450,7 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, focus: b
|
|||
let range;
|
||||
if (focus && getSelection().rangeCount > 0) {
|
||||
range = getSelection().getRangeAt(0);
|
||||
range.insertNode(document.createElement("wbr"))
|
||||
range.insertNode(document.createElement("wbr"));
|
||||
}
|
||||
/// #if !MOBILE
|
||||
if (updateElements.length === 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue