|
@@ -135,14 +135,14 @@ export class Gutter {
|
|
|
return;
|
|
|
}
|
|
|
if (protyle.disabled) {
|
|
|
- confirmDialog(window.siyuan.languages["_kernel"]["34"], window.siyuan.languages.foldTip, () => {
|
|
|
- if (isMobile()) {
|
|
|
+ if (isMobile()) {
|
|
|
+ confirmDialog(window.siyuan.languages["_kernel"]["34"], window.siyuan.languages.foldTip, () => {
|
|
|
(document.getElementById("toolbarName") as HTMLInputElement).readOnly = false;
|
|
|
document.querySelector("#toolbarEdit use").setAttribute("xlink:href", "#iconPreview");
|
|
|
- }
|
|
|
- enableProtyle(protyle);
|
|
|
- gutterFold();
|
|
|
- });
|
|
|
+ enableProtyle(protyle);
|
|
|
+ gutterFold();
|
|
|
+ })
|
|
|
+ }
|
|
|
} else {
|
|
|
gutterFold();
|
|
|
}
|
|
@@ -420,7 +420,7 @@ export class Gutter {
|
|
|
return true;
|
|
|
}
|
|
|
});
|
|
|
- if (!isList && !window.siyuan.config.readonly) {
|
|
|
+ if (!isList && !window.siyuan.config.readonly && !window.siyuan.config.editor.readOnly) {
|
|
|
const turnIntoSubmenu: IMenu[] = [];
|
|
|
if (isContinue) {
|
|
|
turnIntoSubmenu.push(this.turnsIntoOne({
|
|
@@ -599,7 +599,7 @@ export class Gutter {
|
|
|
writeText(protyle.lute.BlockDOM2HTML(html));
|
|
|
}
|
|
|
}).element);
|
|
|
- if (window.siyuan.config.readonly) {
|
|
|
+ if (window.siyuan.config.readonly || window.siyuan.config.editor.readOnly) {
|
|
|
return;
|
|
|
}
|
|
|
window.siyuan.menus.menu.append(new MenuItem({
|
|
@@ -689,7 +689,7 @@ export class Gutter {
|
|
|
nodeElement.classList.add("protyle-wysiwyg--select");
|
|
|
countBlockWord([id], protyle.block.rootID);
|
|
|
// "heading1-6", "list", "ordered-list", "check", "quote", "code", "table", "line", "math", "paragraph"
|
|
|
- if (type === "NodeParagraph" && !window.siyuan.config.readonly) {
|
|
|
+ if (type === "NodeParagraph" && !window.siyuan.config.readonly && !window.siyuan.config.editor.readOnly) {
|
|
|
turnIntoSubmenu.push(this.turnsIntoOne({
|
|
|
icon: "iconList",
|
|
|
label: window.siyuan.languages.list,
|
|
@@ -772,7 +772,7 @@ export class Gutter {
|
|
|
level: 6,
|
|
|
type: "Blocks2Hs",
|
|
|
}));
|
|
|
- } else if (type === "NodeHeading" && !window.siyuan.config.readonly) {
|
|
|
+ } else if (type === "NodeHeading" && !window.siyuan.config.readonly && !window.siyuan.config.editor.readOnly) {
|
|
|
turnIntoSubmenu.push(this.turnsInto({
|
|
|
icon: "iconParagraph",
|
|
|
label: window.siyuan.languages.paragraph,
|
|
@@ -848,7 +848,7 @@ export class Gutter {
|
|
|
type: "Blocks2Hs",
|
|
|
}));
|
|
|
}
|
|
|
- } else if (type === "NodeList" && !window.siyuan.config.readonly) {
|
|
|
+ } else if (type === "NodeList" && !window.siyuan.config.readonly && !window.siyuan.config.editor.readOnly) {
|
|
|
turnIntoSubmenu.push(this.turnsOneInto({
|
|
|
icon: "iconParagraph",
|
|
|
label: window.siyuan.languages.paragraph,
|
|
@@ -909,7 +909,7 @@ export class Gutter {
|
|
|
type: "OL2TL"
|
|
|
}));
|
|
|
}
|
|
|
- } else if (type === "NodeBlockquote" && !window.siyuan.config.readonly) {
|
|
|
+ } else if (type === "NodeBlockquote" && !window.siyuan.config.readonly && !window.siyuan.config.editor.readOnly) {
|
|
|
turnIntoSubmenu.push(this.turnsOneInto({
|
|
|
icon: "iconParagraph",
|
|
|
label: window.siyuan.languages.paragraph,
|
|
@@ -919,7 +919,7 @@ export class Gutter {
|
|
|
type: "CancelBlockquote"
|
|
|
}));
|
|
|
}
|
|
|
- if (turnIntoSubmenu.length > 0 && !window.siyuan.config.readonly) {
|
|
|
+ if (turnIntoSubmenu.length > 0 && !window.siyuan.config.readonly && !window.siyuan.config.editor.readOnly) {
|
|
|
window.siyuan.menus.menu.append(new MenuItem({
|
|
|
icon: "iconRefresh",
|
|
|
label: window.siyuan.languages.turnInto,
|
|
@@ -963,7 +963,7 @@ export class Gutter {
|
|
|
}
|
|
|
}, {
|
|
|
label: window.siyuan.languages.duplicate,
|
|
|
- disabled: window.siyuan.config.readonly,
|
|
|
+ disabled: window.siyuan.config.readonly || window.siyuan.config.editor.readOnly,
|
|
|
click() {
|
|
|
const tempElement = nodeElement.cloneNode(true) as HTMLElement;
|
|
|
const newId = Lute.NewNodeID();
|
|
@@ -986,7 +986,7 @@ export class Gutter {
|
|
|
}
|
|
|
}])
|
|
|
}).element);
|
|
|
- if (!window.siyuan.config.readonly) {
|
|
|
+ if (!window.siyuan.config.readonly && !window.siyuan.config.editor.readOnly) {
|
|
|
window.siyuan.menus.menu.append(new MenuItem({
|
|
|
label: window.siyuan.languages.cut,
|
|
|
accelerator: "⌘X",
|
|
@@ -1020,7 +1020,7 @@ export class Gutter {
|
|
|
}
|
|
|
}).element);
|
|
|
}
|
|
|
- if (type === "NodeSuperBlock" && !window.siyuan.config.readonly) {
|
|
|
+ if (type === "NodeSuperBlock" && !window.siyuan.config.readonly && !window.siyuan.config.editor.readOnly) {
|
|
|
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
|
|
window.siyuan.menus.menu.append(new MenuItem({
|
|
|
label: window.siyuan.languages.cancel + " " + window.siyuan.languages.superBlock,
|
|
@@ -1031,7 +1031,7 @@ export class Gutter {
|
|
|
hideElements(["gutter"], protyle);
|
|
|
}
|
|
|
}).element);
|
|
|
- } else if (type === "NodeCodeBlock" && !window.siyuan.config.readonly && !nodeElement.getAttribute("data-subtype")) {
|
|
|
+ } else if (type === "NodeCodeBlock" && !window.siyuan.config.readonly && !window.siyuan.config.editor.readOnly && !nodeElement.getAttribute("data-subtype")) {
|
|
|
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
|
|
const linewrap = nodeElement.getAttribute("linewrap");
|
|
|
const ligatures = nodeElement.getAttribute("ligatures");
|
|
@@ -1100,7 +1100,7 @@ export class Gutter {
|
|
|
}
|
|
|
}]
|
|
|
}).element);
|
|
|
- } else if (type === "NodeCodeBlock" && !window.siyuan.config.readonly && ["echarts", "mindmap"].includes(nodeElement.getAttribute("data-subtype"))) {
|
|
|
+ } else if (type === "NodeCodeBlock" && !window.siyuan.config.readonly && !window.siyuan.config.editor.readOnly && ["echarts", "mindmap"].includes(nodeElement.getAttribute("data-subtype"))) {
|
|
|
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
|
|
const height = (nodeElement as HTMLElement).style.height;
|
|
|
let html = nodeElement.outerHTML;
|
|
@@ -1132,7 +1132,7 @@ export class Gutter {
|
|
|
}
|
|
|
}]
|
|
|
}).element);
|
|
|
- } else if (type === "NodeTable" && !window.siyuan.config.readonly) {
|
|
|
+ } else if (type === "NodeTable" && !window.siyuan.config.readonly && !window.siyuan.config.editor.readOnly) {
|
|
|
let range = getEditorRange(nodeElement);
|
|
|
const tableElement = nodeElement.querySelector("table");
|
|
|
if (!tableElement.contains(range.startContainer)) {
|
|
@@ -1148,7 +1148,7 @@ export class Gutter {
|
|
|
submenu: tableMenu(protyle, nodeElement, cellElement as HTMLTableCellElement, range) as IMenu[]
|
|
|
}).element);
|
|
|
}
|
|
|
- } else if ((type === "NodeVideo" || type === "NodeAudio") && !window.siyuan.config.readonly) {
|
|
|
+ } else if ((type === "NodeVideo" || type === "NodeAudio") && !window.siyuan.config.readonly && !window.siyuan.config.editor.readOnly) {
|
|
|
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
|
|
window.siyuan.menus.menu.append(new MenuItem({
|
|
|
id: "assetSubMenu",
|
|
@@ -1157,7 +1157,7 @@ export class Gutter {
|
|
|
label: window.siyuan.languages.assets,
|
|
|
submenu: videoMenu(protyle, nodeElement, type)
|
|
|
}).element);
|
|
|
- } else if (type === "NodeIFrame" && !window.siyuan.config.readonly) {
|
|
|
+ } else if (type === "NodeIFrame" && !window.siyuan.config.readonly && !window.siyuan.config.editor.readOnly) {
|
|
|
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
|
|
window.siyuan.menus.menu.append(new MenuItem({
|
|
|
id: "assetSubMenu",
|
|
@@ -1166,7 +1166,7 @@ export class Gutter {
|
|
|
label: window.siyuan.languages.assets,
|
|
|
submenu: iframeMenu(protyle, nodeElement)
|
|
|
}).element);
|
|
|
- } else if (type === "NodeHTMLBlock" && !window.siyuan.config.readonly) {
|
|
|
+ } else if (type === "NodeHTMLBlock" && !window.siyuan.config.readonly && !window.siyuan.config.editor.readOnly) {
|
|
|
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
|
|
window.siyuan.menus.menu.append(new MenuItem({
|
|
|
icon: "iconHTML5",
|
|
@@ -1175,7 +1175,7 @@ export class Gutter {
|
|
|
protyle.toolbar.showRender(protyle, nodeElement);
|
|
|
}
|
|
|
}).element);
|
|
|
- } else if (type === "NodeBlockQueryEmbed" && !window.siyuan.config.readonly) {
|
|
|
+ } else if (type === "NodeBlockQueryEmbed" && !window.siyuan.config.readonly && !window.siyuan.config.editor.readOnly) {
|
|
|
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
|
|
window.siyuan.menus.menu.append(new MenuItem({
|
|
|
id: "assetSubMenu",
|
|
@@ -1197,7 +1197,7 @@ export class Gutter {
|
|
|
}
|
|
|
}]
|
|
|
}).element);
|
|
|
- } else if (type === "NodeHeading" && !window.siyuan.config.readonly) {
|
|
|
+ } else if (type === "NodeHeading" && !window.siyuan.config.readonly && !window.siyuan.config.editor.readOnly) {
|
|
|
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
|
|
const headingSubMenu = [];
|
|
|
if (subType !== "h1") {
|
|
@@ -1298,7 +1298,7 @@ export class Gutter {
|
|
|
}
|
|
|
}
|
|
|
}).element);
|
|
|
- if (!window.siyuan.config.readonly) {
|
|
|
+ if (!window.siyuan.config.readonly && !window.siyuan.config.editor.readOnly) {
|
|
|
window.siyuan.menus.menu.append(new MenuItem({
|
|
|
icon: "iconBefore",
|
|
|
label: window.siyuan.languages["insert-before"],
|
|
@@ -1675,7 +1675,7 @@ export class Gutter {
|
|
|
}
|
|
|
index += 1;
|
|
|
if (isShow) {
|
|
|
- html = `<button ${window.siyuan.config.readonly ? "" : 'draggable="true"'} data-type="${type}" data-subtype="${nodeElement.getAttribute("data-subtype")}" data-node-id="${nodeElement.getAttribute("data-node-id")}"><svg><use xlink:href="#${getIconByType(type, nodeElement.getAttribute("data-subtype"))}"></use></svg></button>` + html;
|
|
|
+ html = `<button ${(window.siyuan.config.readonly || window.siyuan.config.editor.readOnly) ? "" : 'draggable="true"'} data-type="${type}" data-subtype="${nodeElement.getAttribute("data-subtype")}" data-node-id="${nodeElement.getAttribute("data-node-id")}"><svg><use xlink:href="#${getIconByType(type, nodeElement.getAttribute("data-subtype"))}"></use></svg></button>` + html;
|
|
|
}
|
|
|
let foldHTML = "";
|
|
|
if (type === "NodeListItem" && nodeElement.childElementCount > 3 || type === "NodeHeading") {
|
|
@@ -1685,7 +1685,7 @@ export class Gutter {
|
|
|
if (type === "NodeListItem" || type === "NodeList") {
|
|
|
listItem = nodeElement;
|
|
|
if (type === "NodeListItem" && nodeElement.childElementCount > 3) {
|
|
|
- html = `<button ${window.siyuan.config.readonly ? "" : 'draggable="true"'} data-type="${type}" data-subtype="${nodeElement.getAttribute("data-subtype")}" data-node-id="${nodeElement.getAttribute("data-node-id")}"><svg><use xlink:href="#${getIconByType(type, nodeElement.getAttribute("data-subtype"))}"></use></svg></button>${foldHTML}`;
|
|
|
+ html = `<button ${(window.siyuan.config.readonly || window.siyuan.config.editor.readOnly) ? "" : 'draggable="true"'} data-type="${type}" data-subtype="${nodeElement.getAttribute("data-subtype")}" data-node-id="${nodeElement.getAttribute("data-node-id")}"><svg><use xlink:href="#${getIconByType(type, nodeElement.getAttribute("data-subtype"))}"></use></svg></button>${foldHTML}`;
|
|
|
}
|
|
|
}
|
|
|
if (type === "NodeHeading") {
|