Vanessa 2023-11-29 16:41:47 +08:00
parent 27ffdc45d7
commit 03546a8b1e
3 changed files with 9 additions and 10 deletions

View File

@ -63,7 +63,11 @@
&__gutters {
@extend .protyle-gutters;
display: none;
position: fixed;
top: 0;
left: -44px;
opacity: 0;
display: flex;
z-index: 2;
svg {
@ -105,7 +109,7 @@
}
.av__gutters {
display: flex;
opacity: 1;
}
}

View File

@ -70,7 +70,7 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
}
const gutterElement = hasClosestByClassName(event.target, "av__gutter");
if (gutterElement && gutterElement.parentElement.classList.contains("av__gutters")) {
if (gutterElement) {
const rowElement = hasClosestByClassName(gutterElement, "av__row");
if (!rowElement) {
return;

View File

@ -1459,13 +1459,8 @@ export class WYSIWYG {
// database 行块标
const rowElement = hasClosestByClassName(event.target, "av__row");
if (rowElement && rowElement.dataset.id) {
const scrollElement = hasClosestByClassName(rowElement, "av__scroll");
const guttersElement = rowElement.querySelector<HTMLElement>(".av__gutters");
if (scrollElement && guttersElement) {
const width = guttersElement.offsetWidth;
guttersElement.style.top = `${rowElement.getBoundingClientRect().top}px`;
guttersElement.style.left = `${scrollElement.getBoundingClientRect().left - width}px`;
}
const guttersElement = rowElement.querySelector(".av__gutters");
guttersElement.setAttribute("style", `left:${rowElement.parentElement.parentElement.getBoundingClientRect().left - guttersElement.clientWidth}px;top:${rowElement.getBoundingClientRect().top}px`);
}
protyle.gutter.render(protyle, nodeElement, this.element);
}