Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/5485

Vanessae1d8a609d0f2
diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts
index 29b3fc5dda..b61e99801b 100644
--- a/app/src/protyle/wysiwyg/keydown.ts
+++ b/app/src/protyle/wysiwyg/keydown.ts
@@ -1471,8 +1471,13 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
}
if (matchHotKey("⌘C", event) && selectText === "") {
+ const selectElements = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"));
+ if (selectElements.length === 0) {
+ nodeElement.classList.add("protyle-wysiwyg--select");
+ selectElements.push(nodeElement);
+ }
let html = "";
- protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select").forEach(item => {
+ selectElements.forEach(item => {
html += removeEmbed(item);
});
if (html !== "") {
diff --git a/app/src/protyle/wysiwyg/remove.ts b/app/src/protyle/wysiwyg/remove.ts
index 4b3cfd1d75..a813417afc 100644
--- a/app/src/protyle/wysiwyg/remove.ts
+++ b/app/src/protyle/wysiwyg/remove.ts
@@ -203,7 +203,7 @@ export const removeBlock = (protyle: IProtyle, blockElement: Element, range: Ran
action: "delete",
id,
});
- sideElement = getPreviousBlock(topElement) || getNextBlock(topElement) || topElement.parentElement || protyle.wysiwyg.element.firstElementChild;
+ sideElement = getNextBlock(topElement) || getPreviousBlock(topElement) || topElement.parentElement || protyle.wysiwyg.element.firstElementChild;
if (topElement.getAttribute("data-type") === "NodeHeading" && topElement.getAttribute("fold") === "1") {
// https://github.com/siyuan-note/siyuan/issues/2188
setFold(protyle, topElement, undefined, true);
@@ -268,8 +268,8 @@ export const removeBlock = (protyle: IProtyle, blockElement: Element, range: Ran
sideElement = undefined;
focusByWbr(emptyElement, range);
}
-
- focusBlock(sideElement, undefined, false);
+ // https://github.com/siyuan-note/siyuan/issues/5485
+ focusBlock(sideElement);
scrollCenter(protyle, sideElement);
if (listElement) {
inserts.push({