This commit is contained in:
Vanessa 2023-12-02 20:42:18 +08:00
parent 6d72ce0e18
commit 14b22d6bf8
8 changed files with 155 additions and 125 deletions

View file

@ -98,7 +98,7 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
event.stopPropagation();
return true;
} else if (type === "av-add") {
addView(protyle, blockElement)
addView(protyle, blockElement);
event.preventDefault();
event.stopPropagation();
return true;

View file

@ -231,11 +231,11 @@ export const openMenuPanel = (options: {
previousID: sourceElement.previousElementSibling?.getAttribute("data-id")
}]);
if (isTop) {
targetElement.before(sourceElement)
targetElement.classList.remove("dragover__top")
targetElement.before(sourceElement);
targetElement.classList.remove("dragover__top");
} else {
targetElement.after(sourceElement)
targetElement.classList.remove("dragover__bottom")
targetElement.after(sourceElement);
targetElement.classList.remove("dragover__bottom");
}
return;
}
@ -953,8 +953,8 @@ export const openMenuPanel = (options: {
blockElement: options.blockElement as HTMLElement,
element: target.parentElement
});
avPanelElement.querySelector(".b3-chip--primary").classList.remove("b3-chip--primary")
target.parentElement.querySelector(".b3-chip").classList.add("b3-chip--primary")
avPanelElement.querySelector(".b3-chip--primary").classList.remove("b3-chip--primary");
target.parentElement.querySelector(".b3-chip").classList.add("b3-chip--primary");
}, target.parentElement.dataset.id);
}
event.preventDefault();

View file

@ -153,7 +153,7 @@ export const getViewHTML = (data: IAVTable) => {
};
export const getSwitcherHTML = (views: IAVView[], viewId: string) => {
let html = ""
let html = "";
views.forEach((item) => {
html += `<button draggable="true" class="b3-menu__item" data-id="${item.id}">
<svg class="b3-menu__icon"><use xlink:href="#iconDrag"></use></svg>
@ -173,8 +173,8 @@ export const getSwitcherHTML = (views: IAVView[], viewId: string) => {
</button>
<button class="b3-menu__separator"></button>
${html}
</div>`
}
</div>`;
};
export const addView = (protyle: IProtyle, blockElement: Element) => {
const id = Lute.NewNodeID();
@ -188,4 +188,4 @@ export const addView = (protyle: IProtyle, blockElement: Element) => {
avID,
id
}]);
}
};