mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 00:50:13 +01:00
This commit is contained in:
parent
ac7f8d36df
commit
5e2910a4e6
1 changed files with 11 additions and 10 deletions
|
|
@ -233,6 +233,17 @@ ${cell.color ? `color:${cell.color};` : ""}">${text}</div>`;
|
|||
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");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue