From 23fd11ae12a467b247de787d73ffc2c3d2a25235 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sat, 30 Dec 2023 11:26:52 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E6=95=B0=E6=8D=AE=E5=BA=93=E5=88=97?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=8D=E5=AD=97=E5=90=8E=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E7=BC=96=E8=BE=91=EF=BC=8C=E9=9C=80=E8=A6=81=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=90=8D=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/protyle/render/av/col.ts | 16 ++++++++++++++-- app/src/protyle/render/av/rollup.ts | 5 ++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app/src/protyle/render/av/col.ts b/app/src/protyle/render/av/col.ts index 0d068ee33..695b24ebd 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 8447310f0..e4b0858a4 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?: () ${escapeHtml(item.name || window.siyuan.languages.title)} `; }); - element.innerHTML = html; + element.innerHTML = html || `
${window.siyuan.languages.emptyContent}
`; if (cb) { cb(); }