Vanessa 2023-10-13 23:50:31 +08:00
parent 49305b8911
commit 51f66879cc
2 changed files with 4 additions and 5 deletions

View file

@ -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) => {

View file

@ -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;