Skip to content

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

:bug: Prevent table controls from interrupting cell selection https://github.com/siyuan-note/siyuan/issues/18489

Daniel261ed1458789
diff --git a/app/src/protyle/util/tableControl.ts b/app/src/protyle/util/tableControl.ts
index 1be5590a03..0e4daf0e0b 100644
--- a/app/src/protyle/util/tableControl.ts
+++ b/app/src/protyle/util/tableControl.ts
@@ -382,6 +382,10 @@ export class TableControl {
this.scheduleRender();
}
+ public setHidden(hidden: boolean) {
+ this.element.classList.toggle("fn__none", hidden);
+ }
+
private bindEvents() {
const signal = this.abortController.signal;
this.wysiwygElement.addEventListener("pointermove", event => this.handleTablePointerMove(event, false), {signal});
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index fdade9770d..b417c49b9c 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -1914,6 +1914,11 @@ export class WYSIWYG {
// table cell select
if (tableBlockElement &&
!hasClosestByClassName(tableBlockElement, "protyle-wysiwyg__embed")) {
+ this.tableControl?.setHidden(true);
+ const tableControlElement = hasClosestByClassName(moveTarget, "protyle-table-control");
+ if (tableControlElement) {
+ moveTarget = document.elementFromPoint(moveEvent.clientX, moveEvent.clientY) as HTMLElement;
+ }
if (tableBlockElement.contains(moveTarget)) {
if (hasLeftTableBlock) {
clearDragSelectBlocks();
@@ -2211,6 +2216,7 @@ export class WYSIWYG {
// 多选块后 shift+左 选中的文字无法显示选中背景,因此需移除
protyle.wysiwyg.element.classList.remove("protyle-wysiwyg--hiderange");
this.element.classList.remove("fn__pointer-none");
+ this.tableControl?.setHidden(false);
if (startsFromPadding) {
if (avDragSelectMode !== undefined) {
getSelection().removeAllRanges();