Skip to content

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

:bug: Refine table edge controls and click handling https://github.com/siyuan-note/siyuan/issues/18537

Danielde7bfb2038b5
diff --git a/app/src/assets/scss/protyle/_protyle.scss b/app/src/assets/scss/protyle/_protyle.scss
index a3c822fb38..183101f71f 100644
--- a/app/src/assets/scss/protyle/_protyle.scss
+++ b/app/src/assets/scss/protyle/_protyle.scss
@@ -901,7 +901,9 @@ table + .protyle-action__table {
&--row,
&--column {
- background-color: var(--b3-table-even-background);
+ background-color: var(--b3-parent-background);
+ border-color: var(--b3-theme-surface-lighter);
+ box-shadow: none;
}
svg {
@@ -917,6 +919,8 @@ table + .protyle-action__table {
&--row:hover,
&--column:hover {
color: var(--b3-theme-on-surface);
+ background-color: var(--b3-table-even-background);
+ background-image: none;
}
&--active,
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index 8f2723ac54..5afafb708b 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -908,6 +908,31 @@ export class WYSIWYG {
documentSelf.onmouseup = null;
let target = event.target as HTMLElement;
let nodeElement = hasClosestBlock(target) as HTMLElement;
+ let clickedTableNode = nodeElement && nodeElement.dataset.type === "NodeTable" ? nodeElement : undefined;
+ if (!nodeElement) {
+ clickedTableNode = Array.from(this.element.querySelectorAll<HTMLElement>(
+ '[data-type="NodeTable"]')).find(item => {
+ const table = item.querySelector("table");
+ if (!table) {
+ return false;
+ }
+ const tableRect = table.getBoundingClientRect();
+ const nodeRect = item.getBoundingClientRect();
+ return event.clientX > tableRect.right &&
+ event.clientY >= nodeRect.top && event.clientY <= nodeRect.bottom;
+ });
+ }
+ const clickedTableElement = clickedTableNode?.querySelector("table");
+ if (clickedTableElement) {
+ const tableRect = clickedTableElement.getBoundingClientRect();
+ const nodeRect = clickedTableNode.getBoundingClientRect();
+ if (event.clientX > tableRect.right &&
+ event.clientY >= nodeRect.top && event.clientY <= nodeRect.bottom) {
+ event.preventDefault();
+ event.stopPropagation();
+ return;
+ }
+ }
if (hasClosestByClassName(target, "av__selection-toolbar")) {
event.preventDefault();
event.stopPropagation();