diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.ts index 190e9c126..407a889cf 100644 --- a/app/src/protyle/render/av/action.ts +++ b/app/src/protyle/render/av/action.ts @@ -337,8 +337,6 @@ export const updateAVName = (protyle: IProtyle, blockElement: Element) => { if (newData === nameElement.dataset.title.trim()) { return; } - const newUpdated = dayjs().format("YYYYMMDDHHmmss") - blockElement.setAttribute("updated", newUpdated); transaction(protyle, [{ action: "setAttrViewName", id: avId, @@ -346,17 +344,18 @@ export const updateAVName = (protyle: IProtyle, blockElement: Element) => { }, { action: "doUpdateUpdated", id, - data: newUpdated, + data: dayjs().format("YYYYMMDDHHmmss"), }], [{ action: "setAttrViewName", id: avId, - name: nameElement.dataset.title, + data: nameElement.dataset.title, }, { action: "doUpdateUpdated", id, data: blockElement.getAttribute("updated") }]); nameElement.dataset.title = newData; + blockElement.querySelector(".layout-tab-bar .item__text").textContent = newData; }; export const updateAttrViewCellAnimation = (cellElement: HTMLElement) => { diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.ts index 97520c724..c1506177c 100644 --- a/app/src/protyle/render/av/render.ts +++ b/app/src/protyle/render/av/render.ts @@ -254,7 +254,7 @@ export const refreshAV = (protyle: IProtyle, operation: IOperation) => { }); }); } else if (operation.action === "setAttrViewName") { - Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${avId}"]`)).forEach((item: HTMLElement) => { + Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${operation.id}"]`)).forEach((item: HTMLElement) => { const titleElement = item.querySelector(".av__title") as HTMLElement; if (!titleElement || titleElement.textContent.trim() === operation.data) { return;