Browse Source

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

Vanessa 3 years ago
parent
commit
8a36f3a110
3 changed files with 7 additions and 23 deletions
  1. 3 0
      app/src/block/util.ts
  2. 4 21
      app/src/config/repos.ts
  3. 0 2
      app/src/protyle/wysiwyg/keydown.ts

+ 3 - 0
app/src/block/util.ts

@@ -73,6 +73,9 @@ export const insertEmptyBlock = (protyle: IProtyle, position: InsertPosition, id
             } else {
                 blockElement = selectElements[selectElements.length - 1];
             }
+            selectElements.forEach(item => {
+                item.classList.remove("protyle-wysiwyg--select");
+            });
         } else {
             blockElement = hasClosestBlock(range.startContainer) as HTMLElement;
             blockElement = getTopAloneElement(blockElement);

+ 4 - 21
app/src/config/repos.ts

@@ -240,27 +240,10 @@ export const repos = {
                             });
                             break;
                         case "selectCloud":
-                            if (target.parentElement.getAttribute("disabled") !== "disabled") {
-                                target.parentElement.setAttribute("disabled", "disabled");
-                                fetchPost("/api/sync/getSyncDirection", {name: target.getAttribute("data-name")}, (response) => {
-                                    target.parentElement.removeAttribute("disabled");
-                                    const name = target.getAttribute("data-name");
-                                    if (40 == response.code) { // 使用数据仓库同步不需要对比同步方向
-                                        fetchPost("/api/sync/setCloudSyncDir", {name}, () => {
-                                            window.siyuan.config.sync.cloudName = name;
-                                            getCloudList(true);
-                                        });
-                                        return;
-                                    }
-
-                                    confirmDialog(window.siyuan.languages.confirm, response.msg, () => {
-                                        fetchPost("/api/sync/setCloudSyncDir", {name}, () => {
-                                            window.siyuan.config.sync.cloudName = name;
-                                            getCloudList(true);
-                                        });
-                                    });
-                                });
-                            }
+                            fetchPost("/api/sync/setCloudSyncDir", {name: target.getAttribute("data-name")}, () => {
+                                window.siyuan.config.sync.cloudName = target.getAttribute("data-name");
+                                getCloudList(true);
+                            });
                             break;
                     }
                     event.preventDefault();

+ 0 - 2
app/src/protyle/wysiwyg/keydown.ts

@@ -89,7 +89,6 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
                 setTimeout(() => {
                     insertEmptyBlock(protyle, "afterend");
                 }, 100);
-                nodeElement.classList.remove("protyle-wysiwyg--select");
                 return false;
             } else if (event.key.toLowerCase() === "b") {
                 event.stopPropagation();
@@ -98,7 +97,6 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
                 setTimeout(() => {
                     insertEmptyBlock(protyle, "beforebegin");
                 }, 100);
-                nodeElement.classList.remove("protyle-wysiwyg--select");
                 return false;
             }
         }