|
@@ -134,23 +134,14 @@ export class Gutter {
|
|
if (buttonElement.getAttribute("disabled")) {
|
|
if (buttonElement.getAttribute("disabled")) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- if (protyle.disabled) {
|
|
|
|
- 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();
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
|
|
+ if (!window.siyuan.config.readonly) {
|
|
gutterFold();
|
|
gutterFold();
|
|
}
|
|
}
|
|
hideElements(["select"], protyle);
|
|
hideElements(["select"], protyle);
|
|
window.siyuan.menus.menu.remove();
|
|
window.siyuan.menus.menu.remove();
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- if (protyle.disabled) {
|
|
|
|
|
|
+ if (window.siyuan.config.readonly) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
if (window.siyuan.ctrlIsPressed) {
|
|
if (window.siyuan.ctrlIsPressed) {
|
|
@@ -193,7 +184,7 @@ export class Gutter {
|
|
setFold(protyle, foldElement);
|
|
setFold(protyle, foldElement);
|
|
}
|
|
}
|
|
foldElement.classList.remove("protyle-wysiwyg--hl");
|
|
foldElement.classList.remove("protyle-wysiwyg--hl");
|
|
- } else if (window.siyuan.shiftIsPressed) {
|
|
|
|
|
|
+ } else if (window.siyuan.shiftIsPressed && !protyle.disabled) {
|
|
openAttr(protyle.wysiwyg.element.querySelector(`[data-node-id="${id}"]`), protyle);
|
|
openAttr(protyle.wysiwyg.element.querySelector(`[data-node-id="${id}"]`), protyle);
|
|
} else {
|
|
} else {
|
|
this.renderMenu(protyle, buttonElement);
|
|
this.renderMenu(protyle, buttonElement);
|
|
@@ -207,7 +198,7 @@ export class Gutter {
|
|
});
|
|
});
|
|
this.element.addEventListener("contextmenu", (event: MouseEvent & { target: HTMLInputElement }) => {
|
|
this.element.addEventListener("contextmenu", (event: MouseEvent & { target: HTMLInputElement }) => {
|
|
const buttonElement = hasClosestByTag(event.target, "BUTTON");
|
|
const buttonElement = hasClosestByTag(event.target, "BUTTON");
|
|
- if (!buttonElement || protyle.disabled || buttonElement.getAttribute("data-type") === "fold") {
|
|
|
|
|
|
+ if (!buttonElement || window.siyuan.config.readonly || buttonElement.getAttribute("data-type") === "fold") {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
if (!window.siyuan.ctrlIsPressed && !window.siyuan.altIsPressed && !window.siyuan.shiftIsPressed) {
|
|
if (!window.siyuan.ctrlIsPressed && !window.siyuan.altIsPressed && !window.siyuan.shiftIsPressed) {
|
|
@@ -1319,25 +1310,27 @@ export class Gutter {
|
|
insertEmptyBlock(protyle, "afterend", id);
|
|
insertEmptyBlock(protyle, "afterend", id);
|
|
}
|
|
}
|
|
}).element);
|
|
}).element);
|
|
|
|
+ }
|
|
|
|
+ window.siyuan.menus.menu.append(new MenuItem({
|
|
|
|
+ label: window.siyuan.languages.jumpToParentNext,
|
|
|
|
+ accelerator: window.siyuan.config.keymap.editor.general.jumpToParentNext.custom,
|
|
|
|
+ click() {
|
|
|
|
+ nodeElement.classList.remove("protyle-wysiwyg--select");
|
|
|
|
+ jumpToParentNext(protyle, nodeElement);
|
|
|
|
+ }
|
|
|
|
+ }).element);
|
|
|
|
+ window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
|
|
|
+
|
|
|
|
+ if (type !== "NodeThematicBreak") {
|
|
window.siyuan.menus.menu.append(new MenuItem({
|
|
window.siyuan.menus.menu.append(new MenuItem({
|
|
- label: window.siyuan.languages.jumpToParentNext,
|
|
|
|
- accelerator: window.siyuan.config.keymap.editor.general.jumpToParentNext.custom,
|
|
|
|
|
|
+ label: window.siyuan.languages.fold,
|
|
|
|
+ accelerator: `${updateHotkeyTip(window.siyuan.config.keymap.editor.general.collapse.custom)}/${updateHotkeyTip("⌥Click")}`,
|
|
click() {
|
|
click() {
|
|
- nodeElement.classList.remove("protyle-wysiwyg--select");
|
|
|
|
- jumpToParentNext(protyle, nodeElement);
|
|
|
|
|
|
+ setFold(protyle, nodeElement);
|
|
|
|
+ focusBlock(nodeElement);
|
|
}
|
|
}
|
|
}).element);
|
|
}).element);
|
|
- window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
|
|
|
-
|
|
|
|
- if (type !== "NodeThematicBreak") {
|
|
|
|
- window.siyuan.menus.menu.append(new MenuItem({
|
|
|
|
- label: window.siyuan.languages.fold,
|
|
|
|
- accelerator: `${updateHotkeyTip(window.siyuan.config.keymap.editor.general.collapse.custom)}/${updateHotkeyTip("⌥Click")}`,
|
|
|
|
- click() {
|
|
|
|
- setFold(protyle, nodeElement);
|
|
|
|
- focusBlock(nodeElement);
|
|
|
|
- }
|
|
|
|
- }).element);
|
|
|
|
|
|
+ if (!window.siyuan.config.readonly && !window.siyuan.config.editor.readOnly) {
|
|
window.siyuan.menus.menu.append(new MenuItem({
|
|
window.siyuan.menus.menu.append(new MenuItem({
|
|
label: window.siyuan.languages.attr,
|
|
label: window.siyuan.languages.attr,
|
|
accelerator: window.siyuan.config.keymap.editor.general.attr.custom + "/" + updateHotkeyTip("⇧Click"),
|
|
accelerator: window.siyuan.config.keymap.editor.general.attr.custom + "/" + updateHotkeyTip("⇧Click"),
|
|
@@ -1346,7 +1339,8 @@ export class Gutter {
|
|
}
|
|
}
|
|
}).element);
|
|
}).element);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ }
|
|
|
|
+ if (!window.siyuan.config.readonly && !window.siyuan.config.editor.readOnly) {
|
|
const appearanceElement = new MenuItem({
|
|
const appearanceElement = new MenuItem({
|
|
label: window.siyuan.languages.appearance,
|
|
label: window.siyuan.languages.appearance,
|
|
submenu: this.genCardStyle([nodeElement], protyle).concat(this.genFontStyle([nodeElement], protyle)).concat(this.genBGStyle([nodeElement], protyle))
|
|
submenu: this.genCardStyle([nodeElement], protyle).concat(this.genFontStyle([nodeElement], protyle)).concat(this.genBGStyle([nodeElement], protyle))
|