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/16179 先移除,否则表格第一次无法选中

Vanessac11b12934171
diff --git a/app/src/layout/util.ts b/app/src/layout/util.ts
index bb2e169c1b..ed33c417fb 100644
--- a/app/src/layout/util.ts
+++ b/app/src/layout/util.ts
@@ -65,13 +65,6 @@ export const setPanelFocus = (element: Element, isSaveLayout = true) => {
return true;
}
});
- const blockElement = hasClosestBlock(document.activeElement);
- if (blockElement) {
- const editElement = getContenteditableElement(blockElement) as HTMLElement;
- if (editElement) {
- editElement.blur();
- }
- }
}
};
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index 5cdffa4247..55f40ae3de 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -3036,7 +3036,7 @@ export class WYSIWYG {
let newRange = getEditorRange(this.element);
// 点击两侧或间隙导致光标跳转到开头 https://github.com/siyuan-note/siyuan/issues/16179
if (hasClosestBlock(event.target) !== hasClosestBlock(newRange.startContainer) &&
- this.element.firstElementChild.contains(newRange.startContainer)) {
+ this.element.querySelector('[data-node-id]')?.contains(newRange.startContainer)) {
const rect = this.element.getBoundingClientRect();
let rangeElement = document.elementFromPoint(rect.left + rect.width / 2, event.clientY);
if (rangeElement === this.element) {
@@ -3044,7 +3044,7 @@ export class WYSIWYG {
}
let blockElement = hasClosestBlock(rangeElement);
if (blockElement) {
- const embedElement = isInEmbedBlock(blockElement)
+ const embedElement = isInEmbedBlock(blockElement);
if (embedElement) {
blockElement = embedElement;
}
@@ -3078,7 +3078,8 @@ export class WYSIWYG {
countSelectWord(newRange, protyle.block.rootID);
}
if (getSelection().rangeCount === 0 && !mobileBlur) {
- // TODO https://github.com/siyuan-note/siyuan/issues/14589 点击 video 也可以测试一下 https://github.com/siyuan-note/siyuan/issues/14569
+ // https://github.com/siyuan-note/siyuan/issues/14589
+ // https://github.com/siyuan-note/siyuan/issues/14569
// https://github.com/siyuan-note/siyuan/issues/5901
focusByRange(newRange);
}