Skip to content

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

:art: 数据库列修改名字后点击编辑,需要更新名字

Vanessa23fd11ae12a4
diff --git a/app/src/protyle/render/av/col.ts b/app/src/protyle/render/av/col.ts
index 0d068ee332..695b24ebdc 100644
--- a/app/src/protyle/render/av/col.ts
+++ b/app/src/protyle/render/av/col.ts
@@ -472,7 +472,7 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
const avID = blockElement.getAttribute("data-av-id");
const oldValue = cellElement.querySelector(".av__celltext").textContent.trim();
const menu = new Menu("av-header-cell", () => {
- const newValue = (window.siyuan.menus.menu.element.querySelector(".b3-text-field") as HTMLInputElement).value;
+ const newValue = (menu.element.querySelector(".b3-text-field") as HTMLInputElement).value;
if (newValue === oldValue) {
return;
}
@@ -542,7 +542,19 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
icon: "iconEdit",
label: window.siyuan.languages.edit,
click() {
- openMenuPanel({protyle, blockElement, type: "edit", colId});
+ const colName = (menu.element.querySelector(".b3-text-field") as HTMLInputElement).value
+ openMenuPanel({
+ protyle,
+ blockElement,
+ type: "edit",
+ colId,
+ cb(avElement) {
+ // 修改名字后点击编辑,需要更新名字
+ const editNameElement = avElement.querySelector('.b3-text-field[data-type="name"]') as HTMLInputElement
+ editNameElement.value = colName;
+ editNameElement.select();
+ }
+ });
}
});
}
diff --git a/app/src/protyle/render/av/rollup.ts b/app/src/protyle/render/av/rollup.ts
index 8447310f09..e4b0858a49 100644
--- a/app/src/protyle/render/av/rollup.ts
+++ b/app/src/protyle/render/av/rollup.ts
@@ -9,6 +9,9 @@ import {unicode2Emoji} from "../../../emoji";
import {getColIconByType} from "./col";
const updateCol = (protyle: IProtyle, data: IAV, colId: string, itemElement: HTMLElement) => {
+ if (itemElement.classList.contains("b3-list--empty")) {
+ return
+ }
const colData = data.view.columns.find((item) => {
if (item.id === colId) {
return true;
@@ -44,7 +47,7 @@ const genSearchList = (element: Element, keyword: string, avId: string, cb?: ()
<span class="b3-list-item__text">${escapeHtml(item.name || window.siyuan.languages.title)}</span>
</div>`;
});
- element.innerHTML = html;
+ element.innerHTML = html || `<div class="b3-list--empty">${window.siyuan.languages.emptyContent}</div>`;
if (cb) {
cb();
}