Vanessa 2023-07-11 23:13:19 +08:00
parent a8eea6de5e
commit cea83ad522
2 changed files with 8 additions and 5 deletions

View file

@ -81,8 +81,8 @@ ${cell.color ? `color:${cell.color};` : ""}">${text}</div>`;
tableHTML += "<div></div></div>";
});
let tabHTML = ""
response.data.views.forEach((item:IAVView) => {
tabHTML +=`<div class="item${item.id === response.data.viewID ? " item--focus" : ""}">
response.data.views.forEach((item: IAVView) => {
tabHTML += `<div data-id="${response.data.viewID}" class="item${item.id === response.data.viewID ? " item--focus" : ""}">
<svg class="item__graphic"><use xlink:href="#iconTable"></use></svg>
<span class="item__text">${item.name}</span>
</div>`
@ -141,7 +141,7 @@ export const refreshAV = (protyle: IProtyle, operation: IOperation) => {
}
lastElement = protyle.contentElement;
lastParentID = operation.parentID;
const avId = operation.avID;
const avId = operation.avID;
if (operation.action === "addAttrViewCol") {
Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${avId}"]`)).forEach((item: HTMLElement) => {
item.removeAttribute("data-render");

View file

@ -353,6 +353,7 @@ export class WYSIWYG {
return;
}
const avId = nodeElement.getAttribute("data-av-id");
const viewId = (nodeElement.querySelector(".item--focus") as HTMLElement).dataset.id;
const dragElement = target.parentElement;
const oldWidth = dragElement.clientWidth;
const dragColId = dragElement.getAttribute("data-col-id");
@ -373,12 +374,14 @@ export class WYSIWYG {
transaction(protyle, [{
action: "setAttrViewColWidth",
id: dragColId,
parentID: avId,
avID: avId,
viewID: viewId,
data: newWidth
}], [{
action: "setAttrViewColWidth",
id: dragColId,
parentID: avId,
avID: avId,
viewID: viewId,
data: oldWidth + "px"
}]);
};