Ver código fonte

:lipstick: 加载更多和 resize 时需要调整数据库视图表头和尾

Vanessa 1 ano atrás
pai
commit
2e63c1f0c8

+ 1 - 0
app/src/protyle/render/av/action.ts

@@ -128,6 +128,7 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
             event.stopPropagation();
             return true;
         } else if (type === "av-load-more") {
+            (blockElement.querySelector(".av__row--footer") as HTMLElement).style.transform = "";
             blockElement.removeAttribute("data-render");
             blockElement.dataset.pageSize = (parseInt(blockElement.dataset.pageSize) + parseInt(blockElement.querySelector('[data-type="set-page-size"]').getAttribute("data-size"))).toString();
             avRender(blockElement, protyle);

+ 9 - 0
app/src/protyle/util/resize.ts

@@ -3,6 +3,7 @@ import {setPadding} from "../ui/initUI";
 import {hasClosestBlock} from "./hasClosest";
 import {Constants} from "../../constants";
 import {lineNumberRender} from "../render/highlightRender";
+import {stickyRow} from "../render/av/row";
 
 export const resize = (protyle: IProtyle) => {
     hideElements(["gutter"], protyle);
@@ -10,6 +11,14 @@ export const resize = (protyle: IProtyle) => {
     const MIN_ABS = 4;
     // 不能 clearTimeout,否则 split 时左侧无法 resize
     setTimeout(() => {
+        if(!protyle.disabled) {
+            const contentRect = protyle.contentElement.getBoundingClientRect();
+            protyle.wysiwyg.element.querySelectorAll(".av").forEach((item: HTMLElement) => {
+                if (item.querySelector(".av__title")) {
+                    stickyRow(item, contentRect, "all");
+                }
+            });
+        }
         if (abs.width > MIN_ABS || isNaN(abs.width)) {
             if (typeof window.echarts !== "undefined") {
                 protyle.wysiwyg.element.querySelectorAll('[data-subtype="echarts"], [data-subtype="mindmap"]').forEach((chartItem: HTMLElement) => {