This commit is contained in:
parent
fec89a2038
commit
5c56c1c542
2 changed files with 21 additions and 4 deletions
|
@ -214,11 +214,22 @@ export const cellScrollIntoView = (blockElement: HTMLElement, cellElement: Eleme
|
|||
contentElement.scrollTop = contentElement.scrollTop + cellRect.top - avHeaderRect.bottom;
|
||||
}
|
||||
} else {
|
||||
const avFooterRect = blockElement.querySelector(".av__row--footer").getBoundingClientRect();
|
||||
if (avFooterRect.top < cellRect.bottom) {
|
||||
const footerElement = blockElement.querySelector(".av__row--footer")
|
||||
if (footerElement.querySelector(".av__calc--ashow")) {
|
||||
const avFooterRect = footerElement.getBoundingClientRect();
|
||||
if (avFooterRect.top < cellRect.bottom) {
|
||||
const contentElement = hasClosestByClassName(blockElement, "protyle-content", true);
|
||||
if (contentElement) {
|
||||
contentElement.scrollTop = contentElement.scrollTop + cellRect.bottom - avFooterRect.top;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const contentElement = hasClosestByClassName(blockElement, "protyle-content", true);
|
||||
if (contentElement) {
|
||||
contentElement.scrollTop = contentElement.scrollTop + cellRect.bottom - avFooterRect.top;
|
||||
const contentBottom = contentElement.getBoundingClientRect().bottom;
|
||||
if (cellRect.bottom > contentBottom) {
|
||||
contentElement.scrollTop = contentElement.scrollTop + (cellRect.bottom - contentBottom);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import {insertHTML} from "./insertHTML";
|
|||
import {scrollCenter} from "../../util/highlightById";
|
||||
import {hideElements} from "../ui/hideElements";
|
||||
import {avRender} from "../render/av/render";
|
||||
import {cellScrollIntoView} from "../render/av/cell";
|
||||
|
||||
export const pasteEscaped = async (protyle: IProtyle, nodeElement: Element) => {
|
||||
try {
|
||||
|
@ -366,5 +367,10 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
|
|||
highlightRender(protyle.wysiwyg.element);
|
||||
avRender(protyle.wysiwyg.element, protyle);
|
||||
}
|
||||
scrollCenter(protyle, undefined, false, "smooth");
|
||||
const selectCellElement = nodeElement.querySelector(".av__cell--select");
|
||||
if (nodeElement.classList.contains("av") && selectCellElement) {
|
||||
cellScrollIntoView(nodeElement, selectCellElement);
|
||||
} else {
|
||||
scrollCenter(protyle, undefined, false, "smooth");
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue