mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-02-28 05:32:52 +00:00
🚨
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user