An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: Keep the frozen column after inserting columns on its left https://github.com/siyuan-note/siyuan/issues/12100
Daniel34bbd3b9db0c
diff --git a/app/src/assets/scss/business/_av.scss b/app/src/assets/scss/business/_av.scssindex df1e3a1f50..892e9bae8c 100644--- a/app/src/assets/scss/business/_av.scss+++ b/app/src/assets/scss/business/_av.scss@@ -1126,7 +1126,7 @@display: flex;background-color: var(--b3-parent-background);- &:has(> .av__cell, > .av__calc) {+ &--freeze {box-shadow: inset -1px 0 0 var(--b3-border-color);}}diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.tsindex 163e330c0f..cf5d221893 100644--- a/app/src/protyle/render/av/render.ts+++ b/app/src/protyle/render/av/render.ts@@ -176,32 +176,19 @@ export const genTabHeaderHTML = (data: IAV, showSearch: boolean, editable: boole};const getTableHTMLs = (data: IAVTable, e: HTMLElement, virtualData: IAVVirtualData) => {- e.dataset.freezeWidth = Math.round(e.clientWidth).toString();const freezeDragHTML = `<div class="av__freeze-drag ariaLabel" data-position="east" aria-label="${escapeAttr(window.siyuan.languages.freezeDrag)}"></div>`;let calcHTML = "";let contentHTML = `<div class="av__row av__row--header"><div class="av__colsticky"><div class="av__firstcol"><svg><use xlink:href="#iconUncheck"></use></svg></div>${freezeDragHTML}</div>`;let freezeIndex = -1;- let pinMaxIndex = -1;- let indexWidth = 0;- const eWidth = e.clientWidth;data.columns.forEach((item, index) => {- if (!item.hidden) {- if (item.pin) {- freezeIndex = index;- }- if (indexWidth < eWidth - 200) {- indexWidth += parseInt(item.width) || 200;- pinMaxIndex = index;- }+ if (!item.hidden && item.pin) {+ freezeIndex = index;}});- if (eWidth === 0) {- pinMaxIndex = freezeIndex;- }- const pinIndex = Math.min(freezeIndex, pinMaxIndex);+ const pinIndex = freezeIndex;if (pinIndex > -1) {- contentHTML = '<div class="av__row av__row--header"><div class="av__colsticky"><div class="av__firstcol"><svg><use xlink:href="#iconUncheck"></use></svg></div>';- calcHTML = '<div class="av__colsticky">';+ contentHTML = '<div class="av__row av__row--header"><div class="av__colsticky av__colsticky--freeze"><div class="av__firstcol"><svg><use xlink:href="#iconUncheck"></use></svg></div>';+ calcHTML = '<div class="av__colsticky av__colsticky--freeze">';}let hasCalc = false;data.columns.forEach((column: IAVColumn, index: number) => {diff --git a/app/src/protyle/render/av/row.ts b/app/src/protyle/render/av/row.tsindex 0ff2e5058c..deea19d8c7 100644--- a/app/src/protyle/render/av/row.ts+++ b/app/src/protyle/render/av/row.ts@@ -200,7 +200,7 @@ ${cell.color ? `color:${cell.color};` : ""}">${renderCell(cell.value, options.rohtml = `<div class="av__row" data-index="${options.rowIndex}" data-id="${tableRow.id}">`;if (options.pinIndex > -1) {- html += '<div class="av__colsticky"><div class="av__firstcol"><svg><use xlink:href="#iconUncheck"></use></svg></div>';+ html += '<div class="av__colsticky av__colsticky--freeze"><div class="av__firstcol"><svg><use xlink:href="#iconUncheck"></use></svg></div>';} else {html += '<div class="av__colsticky"><div class="av__firstcol"><svg><use xlink:href="#iconUncheck"></use></svg></div></div>';}@@ -418,7 +418,7 @@ export const insertAttrViewBlockAnimation = (options: {let cellsHTML = '<div class="av__colsticky"><div class="av__firstcol"><svg><use xlink:href="#iconUncheck"></use></svg></div></div>';const pinIndex = previousElement.querySelectorAll(".av__colsticky .av__cell").length - 1;if (pinIndex > -1) {- cellsHTML = '<div class="av__colsticky"><div class="av__firstcol"><svg><use xlink:href="#iconUncheck"></use></svg></div>';+ cellsHTML = '<div class="av__colsticky av__colsticky--freeze"><div class="av__firstcol"><svg><use xlink:href="#iconUncheck"></use></svg></div>';}previousElement.querySelectorAll(".av__cell").forEach((item: HTMLElement, index) => {let lineNumber = 1;diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.tsindex cacb5ce7d3..2b4cc525c2 100644--- a/app/src/protyle/wysiwyg/index.ts+++ b/app/src/protyle/wysiwyg/index.ts@@ -148,7 +148,6 @@ import {hideTooltip} from "../../dialog/tooltip";import {openGalleryItemMenu} from "../render/av/gallery/util";import {clearSelect} from "../util/clear";import {chartRender} from "../render/chartRender";-import {avRender} from "../render/av/render";import {reloadProtyle} from "../util/reload";import {updateCalloutType} from "./callout";import {nbsp2space, removeZWJ} from "../util/normalizeText";@@ -2765,16 +2764,6 @@ export class WYSIWYG {// 编辑器尺寸或内容变化时,重新计算数据库视图栏和表头、表尾位置protyle.observer = new ResizeObserver(() => {protyle.wysiwyg.element.querySelectorAll(".av").forEach((item: HTMLElement) => {- if (item.querySelector(".av__scroll")) {- const width = Math.round(item.clientWidth);- if (item.querySelector('[data-freeze="true"]') &&- parseInt(item.dataset.freezeWidth) !== width) {- item.dataset.freezeWidth = width.toString();- item.removeAttribute("data-render");- avRender(item, protyle);- return;- }- }stickyRow(item, protyle.contentElement, "all");});});diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.tsindex b9a40602a0..53e67d2055 100644--- a/app/src/protyle/wysiwyg/transaction.ts+++ b/app/src/protyle/wysiwyg/transaction.ts@@ -471,6 +471,13 @@ const promiseTransaction = (options: {if (operation.action === "setAttrs") {syncFoldAndStyleAttrs(protyle.wysiwyg.element, operation);}+ // 冻结范围依赖列的 DOM 分组,新增列事务落盘后使用完整数据重建分组。+ if (operation.action === "addAttrViewCol" &&+ protyle.wysiwyg.element.querySelector(+ `.av[data-av-id="${operation.avID}"] [data-freeze="true"]`+ )) {+ refreshAV(protyle, operation);+ }});}// 事务提交后再渲染嵌入块,避免其查询请求早于写入到达内核而拿到旧数据