Parcourir la source

:art: fix https://github.com/siyuan-note/siyuan/issues/6177

Vanessa il y a 2 ans
Parent
commit
c04a518383

+ 0 - 1
app/appearance/langs/en_US.json

@@ -92,7 +92,6 @@
   "trafficStat": "Traffic Statistics",
   "hideHeadingBelowBlocks": "Hide blocks below heading",
   "matchDiacritics": "Match Diacritics",
-  "foldTip": "Are you sure to change to edit mode and record the fold state?",
   "copyHPath": "Copy readable path",
   "justify": "Justify",
   "height": "Height",

+ 0 - 1
app/appearance/langs/es_ES.json

@@ -92,7 +92,6 @@
   "trafficStat": "Estadísticas de tráfico",
   "hideHeadingBelowBlocks": "Ocultar bloques por debajo del encabezamiento",
   "matchDiacritics": " Hacer coincidir los diacríticos",
-  "foldTip": "¿Seguro que se cambia al modo de edición y se registra el estado de plegado?",
   "copyHPath": "Copiar ruta legible",
   "justify": "Justificar",
   "height": "Altura",

+ 0 - 1
app/appearance/langs/fr_FR.json

@@ -92,7 +92,6 @@
   "trafficStat": "Statistiques de trafic",
   "hideHeadingBelowBlocks": "Masquer les blocs sous l'en-tête",
   "matchDiacritics": "Respecter les accents et diacritiques",
-  "foldTip": "Êtes-vous sûr de passer en mode édition et d'enregistrer l'état du pli ?",
   "copyHPath": "Copier le chemin lisible",
   "justify": "Justifier",
   "height": "haut",

+ 0 - 1
app/appearance/langs/zh_CHT.json

@@ -92,7 +92,6 @@
   "trafficStat": "流量統計",
   "hideHeadingBelowBlocks": "隱藏標題下方的塊",
   "matchDiacritics": "符合變音符號",
-  "foldTip": "確定修改為編輯模式並記錄折疊狀態?",
   "copyHPath": "複製可讀路徑",
   "justify": "兩側對齊",
   "height": "高度",

+ 0 - 1
app/appearance/langs/zh_CN.json

@@ -92,7 +92,6 @@
   "trafficStat": "流量统计",
   "hideHeadingBelowBlocks": "隐藏标题下方的块",
   "matchDiacritics": "匹配变音符号",
-  "foldTip": "确定修改为编辑模式并记录折叠状态?",
   "copyHPath": "复制可读路径",
   "justify": "两侧对齐",
   "height": "高度",

+ 23 - 29
app/src/protyle/gutter/index.ts

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