An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:sparkles: Resize mobile table columns from any row https://github.com/siyuan-note/siyuan/issues/20635
Daniel3afccbb08b1f
diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-6yi0dv5/20200924101225-k254i8g.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-6yi0dv5/20200924101225-k254i8g.syindex 1c59ad05c7..9869dfa21c 100644--- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-6yi0dv5/20200924101225-k254i8g.sy+++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-6yi0dv5/20200924101225-k254i8g.sy@@ -6,7 +6,7 @@"id": "20200924101225-k254i8g","title": "Content Block Type","type": "doc",- "updated": "20261017170001"+ "updated": "20261017171205"},"Children": [{@@ -1474,7 +1474,7 @@"HeadingLevel": 2,"Properties": {"id": "20210104091538-a55chyw",- "updated": "20261017170001"+ "updated": "20261017171205"},"Children": [{@@ -1746,7 +1746,7 @@"HeadingLevel": 3,"Properties": {"id": "20210104091538-38bsz5r",- "updated": "20261017170001"+ "updated": "20261017171205"},"Children": [{@@ -1971,12 +1971,12 @@"Type": "NodeParagraph","Properties": {"id": "20261017142635-wrzqg7l",- "updated": "20261017170001"+ "updated": "20261017171205"},"Children": [{"Type": "NodeText",- "Data": "Tap a column divider in the top row to highlight it, then drag its top-row segment to change the width. Tap elsewhere to leave width adjustment. Select columns and use More to auto-fit their widths or distribute them evenly. Tap the plus controls at the table edges to add rows or columns, or drag the edge controls to add several at once or remove trailing empty rows and columns. Shrinking preserves nonempty content and merged cells."+ "Data": "Tap a column divider in any row to highlight it, then drag the highlighted line horizontally to change the width. Vertical swipes still scroll the table. Tap outside the line to leave width adjustment. Select columns and use More to auto-fit their widths or distribute them evenly. Tap the plus controls at the table edges to add rows or columns, or drag the edge controls to add several at once or remove trailing empty rows and columns. Shrinking preserves nonempty content and merged cells."}]},diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-fqgskfj/20200905090211-2vixtlf.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-fqgskfj/20200905090211-2vixtlf.syindex 1d15f5187e..be57dce794 100644--- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-fqgskfj/20200905090211-2vixtlf.sy+++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-fqgskfj/20200905090211-2vixtlf.sy@@ -6,7 +6,7 @@"id": "20200905090211-2vixtlf","title": "内容块类型","type": "doc",- "updated": "20261017170001"+ "updated": "20261017171205"},"Children": [{@@ -1507,7 +1507,7 @@"HeadingLevel": 2,"Properties": {"id": "20210104090624-9qgquxh",- "updated": "20261017170001"+ "updated": "20261017171205"},"Children": [{@@ -1782,7 +1782,7 @@"HeadingLevel": 3,"Properties": {"id": "20210104090624-erf17it",- "updated": "20261017170001"+ "updated": "20261017171205"},"Children": [{@@ -2011,12 +2011,12 @@"Type": "NodeParagraph","Properties": {"id": "20261017142635-oe1mo6v",- "updated": "20261017170001"+ "updated": "20261017171205"},"Children": [{"Type": "NodeText",- "Data": "点击表格顶部的列分隔线使其高亮,再拖动顶部的线段调整列宽;点击其他位置退出调整。选中列后可通过「更多」按内容自适应或均分列宽。点击表格边缘的加号可添加行列,拖动边缘控件可批量增加行列或移除末尾的空白行列。收缩表格时会保留非空内容和合并单元格。"+ "Data": "点击任意一行的列分隔线使其高亮,再横向拖动高亮线调整列宽;纵向滑动仍用于滚动表格,点击线外退出调整。选中列后可通过「更多」按内容自适应或均分列宽。点击表格边缘的加号可添加行列,拖动边缘控件可批量增加行列或移除末尾的空白行列。收缩表格时会保留非空内容和合并单元格。"}]},diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226115825-mhcslw2/20211226120147-ib6yy3i.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226115825-mhcslw2/20211226120147-ib6yy3i.syindex 1154943ad2..0533ca9810 100644--- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226115825-mhcslw2/20211226120147-ib6yy3i.sy+++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226115825-mhcslw2/20211226120147-ib6yy3i.sy@@ -6,7 +6,7 @@"id": "20211226120147-ib6yy3i","title": "內容區塊類型","type": "doc",- "updated": "20261017170001"+ "updated": "20261017171205"},"Children": [{@@ -1503,7 +1503,7 @@"HeadingLevel": 2,"Properties": {"id": "20211226120227-esm6f20",- "updated": "20261017170001"+ "updated": "20261017171205"},"Children": [{@@ -1767,7 +1767,7 @@"HeadingLevel": 3,"Properties": {"id": "20211226120227-fe8klj7",- "updated": "20261017170001"+ "updated": "20261017171205"},"Children": [{@@ -1998,12 +1998,12 @@"Type": "NodeParagraph","Properties": {"id": "20261017142635-5ds55er",- "updated": "20261017170001"+ "updated": "20261017171205"},"Children": [{"Type": "NodeText",- "Data": "點選表格頂端的欄分隔線使其醒目顯示,再拖曳頂端的線段調整欄寬;點選其他位置退出調整。選取欄後可透過「更多」依內容自動調整或平均分配欄寬。點選表格邊緣的加號可新增列欄,拖曳邊緣控制項可批次新增列欄或移除末尾的空白列欄。縮小表格時會保留非空內容和合併儲存格。"+ "Data": "點選任一列的欄分隔線使其醒目顯示,再橫向拖曳醒目顯示的線調整欄寬;縱向滑動仍用於捲動表格,點選線外退出調整。選取欄後可透過「更多」依內容自動調整或平均分配欄寬。點選表格邊緣的加號可新增列欄,拖曳邊緣控制項可批次新增列欄或移除末尾的空白列欄。縮小表格時會保留非空內容和合併儲存格。"}]},diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-gvtksyj/20240530101000-35bbvcx.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-gvtksyj/20240530101000-35bbvcx.syindex e3ec214f8b..03d643ee21 100644--- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-gvtksyj/20240530101000-35bbvcx.sy+++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-gvtksyj/20240530101000-35bbvcx.sy@@ -7,7 +7,7 @@"id": "20240530101000-35bbvcx","title": "コンテンツブロックの種類","type": "doc",- "updated": "20261017170001"+ "updated": "20261017171205"},"Children": [{@@ -1564,7 +1564,7 @@"Properties": {"ID": "20240530101000-rjjxxn8","id": "20240530101000-p035stn",- "updated": "20261017170001"+ "updated": "20261017171205"},"Children": [{@@ -1788,7 +1788,7 @@"HeadingLevel": 3,"Properties": {"id": "20240530101000-riwihza",- "updated": "20261017170001"+ "updated": "20261017171205"},"Children": [{@@ -2029,12 +2029,12 @@"Type": "NodeParagraph","Properties": {"id": "20261017142635-99sm3ym",- "updated": "20261017170001"+ "updated": "20261017171205"},"Children": [{"Type": "NodeText",- "Data": "表の先頭行にある列の区切り線をタップすると強調表示されます。その先頭行の線をドラッグして列幅を変更し、他の場所をタップすると調整を終了します。列を選択して「詳細」を開くと、内容に合わせて列幅を自動調整したり、均等に配分したりできます。表の端のプラスボタンをタップすると行や列を追加できます。端のコントロールをドラッグすると複数の行や列を追加したり、末尾の空の行や列を削除したりできます。表を縮めても、内容のあるセルや結合セルは保持されます。"+ "Data": "任意の行にある列の区切り線をタップすると強調表示されます。強調表示された線を横にドラッグして列幅を変更できます。縦にスワイプすると表がスクロールし、線の外をタップすると調整を終了します。列を選択して「詳細」を開くと、内容に合わせて列幅を自動調整したり、均等に配分したりできます。表の端のプラスボタンをタップすると行や列を追加できます。端のコントロールをドラッグすると複数の行や列を追加したり、末尾の空の行や列を削除したりできます。表を縮めても、内容のあるセルや結合セルは保持されます。"}]},diff --git a/app/src/assets/scss/protyle/_protyle.scss b/app/src/assets/scss/protyle/_protyle.scssindex 09db6f4bc4..1e45e4c119 100644--- a/app/src/assets/scss/protyle/_protyle.scss+++ b/app/src/assets/scss/protyle/_protyle.scss@@ -1450,7 +1450,7 @@ table + .protyle-action__table {&__width {width: 28px;cursor: col-resize;- touch-action: none;+ touch-action: pan-y;&::before {width: 2px;diff --git a/app/src/protyle/util/tableTouch.test.ts b/app/src/protyle/util/tableTouch.test.tsindex 9a803275ab..ccce799277 100644--- a/app/src/protyle/util/tableTouch.test.ts+++ b/app/src/protyle/util/tableTouch.test.ts@@ -313,6 +313,9 @@ const browserCases = async (sources: Record<string, string>) => {check.equal(f.core.hasTouchSelection(), false, "activating a divider does not select the column's cells");check.equal(width.querySelector("svg"), null);check.equal(width.getBoundingClientRect().left + width.getBoundingClientRect().width / 2, headerRect.right);+ check.equal(width.getBoundingClientRect().top, headerRect.top);+ check.equal(width.getBoundingClientRect().bottom, f.cell(3, 0).getBoundingClientRect().bottom,+ "the active divider spans all visible rows");const before = f.table.querySelector("col").getAttribute("style");const count = transactions.length;pointer(width, "pointerdown", 120, 60);@@ -336,7 +339,17 @@ const browserCases = async (sources: Record<string, string>) => {f.cell(1, 0).dispatchEvent(new MouseEvent("click", {bubbles: true,clientX: bodyRect.right, clientY: bodyRect.top + bodyRect.height / 2}));f.render();- check.equal(f.touch("[data-action='width']"), null, "body dividers remain available for editing and scrolling");+ const bodyWidth = f.touch("[data-action='width']");+ check.ok(bodyWidth, "body dividers can activate column width adjustment");+ const y = bodyRect.top + bodyRect.height / 2;+ check.equal(document.elementFromPoint(bodyRect.right, y)?.closest('[data-action="width"]'), bodyWidth,+ "the active divider receives pointer input in body rows");+ const bodyColumnWidth = f.table.querySelector("col").getBoundingClientRect().width;+ pointer(bodyWidth, "pointerdown", bodyRect.right, y);+ pointer(document, "pointermove", bodyRect.right + 30, y);+ pointer(document, "pointerup", bodyRect.right + 30, y);+ check.equal((f.table.querySelector("col") as HTMLElement).style.width, `${Math.round(bodyColumnWidth + 30)}px`);+ check.equal(transactions.length, count + 2, "dragging from a body row creates one width transaction");f.dispose();}for (const kind of ["merged", "no-header", "disabled", "block", "link"]) {@@ -359,7 +372,7 @@ const browserCases = async (sources: Record<string, string>) => {clientX: rect.right, clientY: rect.top + rect.height / 2}));f.render();check.equal(!!f.touch("[data-action='width']"), kind === "no-header",- `${kind} only exposes real, editable top-row dividers`);+ `${kind} only exposes real, editable cell dividers`);f.dispose();}{diff --git a/app/src/protyle/util/tableTouch.ts b/app/src/protyle/util/tableTouch.tsindex 15ad7e6e53..673268c057 100644--- a/app/src/protyle/util/tableTouch.ts+++ b/app/src/protyle/util/tableTouch.ts@@ -318,7 +318,7 @@ export class TableTouchControl {if (event.defaultPrevented || !this.actions.enabled() || event.button !== 0 ||event.ctrlKey || event.metaKey || event.altKey || event.shiftKey || target.closest(TABLE_TOUCH_INTERACTIVE_SELECTOR) ||!cell?.closest('[data-type="NodeTable"]') || cell.closest(".protyle-wysiwyg") !== editor ||- cell.parentElement !== table.rows[0]) {+ cell.closest(`tr[${TABLE_VIRTUAL_ROWS}]`)) {return false;}const columns = Array.from(table.querySelectorAll<HTMLTableColElement>(":scope > colgroup > col"));@@ -326,7 +326,7 @@ export class TableTouchControl {if (Math.min(Math.abs(rect.left - event.clientX), Math.abs(rect.right - event.clientX)) > 8) {return false;}- // 首次点按仅激活表头边界,正文中的滑动和点按继续用于滚动与编辑。+ // 点击可见的单元格分隔线后激活列宽调整,合并单元格内部没有分隔线的位置不响应。const index = columns.findIndex(column => Math.abs(column.getBoundingClientRect().right - event.clientX) <= 8);if (index < 0 || !this.actions.activate(cell)) {return false;@@ -344,9 +344,8 @@ export class TableTouchControl {const {table, viewport} = state;const column = table.querySelectorAll<HTMLTableColElement>(":scope > colgroup > col")[boundary.column];const edge = column?.getBoundingClientRect().right;- const header = boundary.cell.getBoundingClientRect();- const top = Math.max(header.top, viewport.top);- const bottom = Math.min(header.bottom, viewport.bottom);+ const top = viewport.top;+ const bottom = viewport.bottom;if (typeof edge !== "number" || edge <= viewport.left || edge > viewport.right + 1 || bottom <= top) {return;}