Vanessa 2025-06-11 11:04:12 +08:00
parent 472be34bdf
commit 312e84b025
3 changed files with 6 additions and 4 deletions

View file

@ -179,7 +179,7 @@ export const bindLayoutEvent = (options: {
}; };
export const updateLayout = (options: { export const updateLayout = (options: {
view: IAVGallery data: IAV
nodeElement: Element, nodeElement: Element,
protyle: IProtyle, protyle: IProtyle,
target: HTMLElement target: HTMLElement
@ -199,9 +199,8 @@ export const updateLayout = (options: {
action: "changeAttrViewLayout", action: "changeAttrViewLayout",
avID, avID,
blockID, blockID,
layout: options.view.type layout: options.data.viewType
}]); }]);
options.nodeElement.setAttribute("data-view-type", layout);
options.target.parentElement.querySelector(".av__layout-item--select").classList.remove("av__layout-item--select"); options.target.parentElement.querySelector(".av__layout-item--select").classList.remove("av__layout-item--select");
options.target.classList.add("av__layout-item--select"); options.target.classList.add("av__layout-item--select");
}; };

View file

@ -1386,7 +1386,7 @@ export const openMenuPanel = (options: {
target, target,
protyle: options.protyle, protyle: options.protyle,
nodeElement: options.blockElement, nodeElement: options.blockElement,
view: data.view as IAVGallery data: data
}); });
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();

View file

@ -488,6 +488,9 @@ export const refreshAV = (protyle: IProtyle, operation: IOperation) => {
if (operation.action === "removeAttrViewView") { if (operation.action === "removeAttrViewView") {
item.setAttribute("data-av-type", operation.retData); item.setAttribute("data-av-type", operation.retData);
} }
if (operation.action === "changeAttrViewLayout") {
item.setAttribute("data-av-type", operation.layout);
}
avRender(item, protyle, () => { avRender(item, protyle, () => {
const attrElement = document.querySelector(`.b3-dialog--open[data-key="${Constants.DIALOG_ATTR}"] div[data-av-id="${avID}"]`) as HTMLElement; const attrElement = document.querySelector(`.b3-dialog--open[data-key="${Constants.DIALOG_ATTR}"] div[data-av-id="${avID}"]`) as HTMLElement;
if (attrElement) { if (attrElement) {