diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.ts index 2676089a6..74bc8d98f 100644 --- a/app/src/protyle/render/av/render.ts +++ b/app/src/protyle/render/av/render.ts @@ -233,6 +233,17 @@ ${cell.color ? `color:${cell.color};` : ""}">${text}`; let lastParentID: string; let lastElement: HTMLElement; export const refreshAV = (protyle: IProtyle, operation: IOperation) => { + if (operation.action === "setAttrViewName") { + Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${operation.id}"]`)).forEach((item: HTMLElement) => { + const titleElement = item.querySelector(".av__title") as HTMLElement; + if (!titleElement) { + return; + } + titleElement.textContent = operation.data; + titleElement.dataset.title = operation.data; + item.querySelector(".layout-tab-bar .item__text").textContent = operation.data; + }); + } if (lastParentID === operation.parentID && protyle.contentElement.isSameNode(lastElement)) { return; } @@ -249,16 +260,6 @@ export const refreshAV = (protyle: IProtyle, operation: IOperation) => { (rowItem.querySelector(`[data-col-id="${operation.id}"]`) as HTMLElement).style.width = operation.data; }); }); - } else if (operation.action === "setAttrViewName") { - Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${operation.id}"]`)).forEach((item: HTMLElement) => { - const titleElement = item.querySelector(".av__title") as HTMLElement; - if (!titleElement) { - return; - } - titleElement.textContent = operation.data; - titleElement.dataset.title = operation.data; - item.querySelector(".layout-tab-bar .item__text").textContent = operation.data; - }); } else { Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${avId}"]`)).forEach((item: HTMLElement) => { item.removeAttribute("data-render");