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/10517

Vanessa1848f5aae018
diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.ts
index 8b3fae01e6..6f0574fd53 100644
--- a/app/src/protyle/render/av/render.ts
+++ b/app/src/protyle/render/av/render.ts
@@ -8,6 +8,7 @@ import {hasClosestBlock, hasClosestByClassName} from "../../util/hasClosest";
import {stickyRow} from "./row";
import {getCalcValue} from "./calc";
import {renderAVAttribute} from "./blockAttr";
+import {showMessage} from "../../../dialog/message";
export const avRender = (element: Element, protyle: IProtyle, cb?: () => void, viewID?: string) => {
let avElements: Element[] = [];
@@ -301,11 +302,17 @@ export const refreshAV = (protyle: IProtyle, operation: IOperation) => {
} else {
Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${operation.avID}"]`)).forEach((item: HTMLElement) => {
item.removeAttribute("data-render");
+ const updateRow = item.querySelector('.av__row[data-need-update="true"]');
avRender(item, protyle, () => {
const attrElement = document.querySelector(`.b3-dialog--open[data-key="${Constants.DIALOG_ATTR}"] div[data-av-id="${operation.avID}"]`) as HTMLElement;
if (attrElement) {
// 更新属性面板
renderAVAttribute(attrElement.parentElement, attrElement.dataset.nodeId, protyle);
+ } else {
+ if (operation.action === "insertAttrViewBlock" && updateRow && !item.querySelector(`.av__row[data-id="${updateRow.getAttribute("data-id")}"]`)) {
+ showMessage(window.siyuan.languages.insertRowTip);
+ document.querySelector(".av__mask")?.remove();
+ }
}
});
});
diff --git a/app/src/protyle/render/av/row.ts b/app/src/protyle/render/av/row.ts
index 4ace7760e5..30ccac842e 100644
--- a/app/src/protyle/render/av/row.ts
+++ b/app/src/protyle/render/av/row.ts
@@ -112,7 +112,7 @@ ${(item.getAttribute("data-block-id") || item.dataset.dtype === "block") ? ' dat
});
let html = "";
srcIDs.forEach((id) => {
- html += `<div class="av__row" data-id="${id}" data-avid="${avId}" data-previous-id="${previousId}">
+ html += `<div class="av__row" data-type="ghost" data-id="${id}" data-avid="${avId}" data-previous-id="${previousId}">
${colHTML}
</div>`;
});
@@ -128,10 +128,14 @@ ${(item.getAttribute("data-block-id") || item.dataset.dtype === "block") ? ' dat
let hideTextCell = false;
response.data.filters.find((item: IAVFilter) => {
const headerElement = blockElement.querySelector(`.av__cell--header[data-col-id="${item.column}"]`);
- if (headerElement && ["relation", "rollup", "template", "created", "updated"].includes(headerElement.getAttribute("data-dtype"))) {
+ const filterType = headerElement.getAttribute("data-dtype")
+ if (headerElement && ["relation", "rollup", "template"].includes(filterType)) {
hideTextCell = true;
return true;
}
+ if (["created", "updated"].includes(filterType)) {
+ currentRow.setAttribute("data-need-update", "true");
+ }
if (sideRow.classList.contains("av__row")) {
const sideRowCellElement = sideRow.querySelector(`.av__cell[data-col-id="${item.column}"]`) as HTMLElement;
const cellElement = currentRow.querySelector(`.av__cell[data-col-id="${item.column}"]`);