mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-04 15:58:49 +01:00
🎨 数据库列修改名字后点击编辑,需要更新名字
This commit is contained in:
parent
2e1394a01b
commit
23fd11ae12
2 changed files with 18 additions and 3 deletions
|
|
@ -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();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue