This commit is contained in:
Vanessa 2022-07-13 21:38:31 +08:00
parent 08cc3c8ac7
commit 8a36f3a110
3 changed files with 7 additions and 23 deletions

View file

@ -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);

View file

@ -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();

View file

@ -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;
}
}