From 8a36f3a110f8893b12f70540e181814f21af3c48 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 13 Jul 2022 21:38:31 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/5405 --- app/src/block/util.ts | 3 +++ app/src/config/repos.ts | 25 ++++--------------------- app/src/protyle/wysiwyg/keydown.ts | 2 -- 3 files changed, 7 insertions(+), 23 deletions(-) diff --git a/app/src/block/util.ts b/app/src/block/util.ts index e5dffb6cf..904151b18 100644 --- a/app/src/block/util.ts +++ b/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); diff --git a/app/src/config/repos.ts b/app/src/config/repos.ts index 09c95c471..3a52b9b43 100644 --- a/app/src/config/repos.ts +++ b/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(); diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts index 698993f42..4020f4b21 100644 --- a/app/src/protyle/wysiwyg/keydown.ts +++ b/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; } }