@4399ywkf/editor 0.13.1 → 0.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DocView-MGCNDQLF.js → DocView-K6PKSJII.js} +3 -3
- package/dist/{DocView-MGCNDQLF.js.map → DocView-K6PKSJII.js.map} +1 -1
- package/dist/{chunk-ZULVQ2KX.js → chunk-I4FESO5C.js} +18 -38
- package/dist/chunk-I4FESO5C.js.map +1 -0
- package/dist/doc-standalone.js +29 -49
- package/dist/doc-standalone.js.map +1 -1
- package/dist/doc.js +2 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-ZULVQ2KX.js.map +0 -1
package/dist/doc-standalone.js
CHANGED
|
@@ -46524,14 +46524,14 @@ function getOverflowAncestors(node, list, traverseIframes) {
|
|
|
46524
46524
|
if (traverseIframes === void 0) {
|
|
46525
46525
|
traverseIframes = true;
|
|
46526
46526
|
}
|
|
46527
|
-
const
|
|
46528
|
-
const isBody =
|
|
46529
|
-
const win = getWindow(
|
|
46527
|
+
const scrollableAncestor2 = getNearestOverflowAncestor(node);
|
|
46528
|
+
const isBody = scrollableAncestor2 === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
46529
|
+
const win = getWindow(scrollableAncestor2);
|
|
46530
46530
|
if (isBody) {
|
|
46531
46531
|
const frameElement = getFrameElement(win);
|
|
46532
|
-
return list.concat(win, win.visualViewport || [], isOverflowElement(
|
|
46532
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor2) ? scrollableAncestor2 : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
46533
46533
|
} else {
|
|
46534
|
-
return list.concat(
|
|
46534
|
+
return list.concat(scrollableAncestor2, getOverflowAncestors(scrollableAncestor2, [], traverseIframes));
|
|
46535
46535
|
}
|
|
46536
46536
|
}
|
|
46537
46537
|
function getFrameElement(win) {
|
|
@@ -71875,8 +71875,8 @@ var TableOfContents = Extension.create({
|
|
|
71875
71875
|
if (!this.options.scrollParent) {
|
|
71876
71876
|
return;
|
|
71877
71877
|
}
|
|
71878
|
-
const
|
|
71879
|
-
const scrollPosition =
|
|
71878
|
+
const scrollParent2 = typeof this.options.scrollParent === "function" ? this.options.scrollParent() : this.options.scrollParent;
|
|
71879
|
+
const scrollPosition = scrollParent2 instanceof HTMLElement ? scrollParent2.scrollTop : scrollParent2.scrollY;
|
|
71880
71880
|
this.storage.scrollPosition = scrollPosition || 0;
|
|
71881
71881
|
const updatedItems = addTocActiveStatesAndGetItems(this.storage.content, {
|
|
71882
71882
|
editor: this.editor,
|
|
@@ -71889,18 +71889,18 @@ var TableOfContents = Extension.create({
|
|
|
71889
71889
|
if (!this.options.scrollParent) {
|
|
71890
71890
|
return;
|
|
71891
71891
|
}
|
|
71892
|
-
const
|
|
71893
|
-
if (
|
|
71894
|
-
|
|
71892
|
+
const scrollParent = typeof this.options.scrollParent === "function" ? this.options.scrollParent() : this.options.scrollParent;
|
|
71893
|
+
if (scrollParent) {
|
|
71894
|
+
scrollParent.addEventListener("scroll", this.storage.scrollHandler);
|
|
71895
71895
|
}
|
|
71896
71896
|
},
|
|
71897
71897
|
onDestroy() {
|
|
71898
71898
|
if (!this.options.scrollParent) {
|
|
71899
71899
|
return;
|
|
71900
71900
|
}
|
|
71901
|
-
const
|
|
71902
|
-
if (
|
|
71903
|
-
|
|
71901
|
+
const scrollParent = typeof this.options.scrollParent === "function" ? this.options.scrollParent() : this.options.scrollParent;
|
|
71902
|
+
if (scrollParent) {
|
|
71903
|
+
scrollParent.removeEventListener("scroll", this.storage.scrollHandler);
|
|
71904
71904
|
}
|
|
71905
71905
|
},
|
|
71906
71906
|
addProseMirrorPlugins() {
|
|
@@ -76714,6 +76714,18 @@ var BlockSpacing = Extension.create({
|
|
|
76714
76714
|
};
|
|
76715
76715
|
}
|
|
76716
76716
|
});
|
|
76717
|
+
|
|
76718
|
+
// src/lib/scroll-parent.ts
|
|
76719
|
+
function scrollableAncestor(el, styleOf = (node) => getComputedStyle(node)) {
|
|
76720
|
+
const { body, documentElement } = el.ownerDocument;
|
|
76721
|
+
for (let p = el.parentElement; p && p !== documentElement; p = p.parentElement) {
|
|
76722
|
+
if (p === body && styleOf(documentElement).overflowY === "visible") return null;
|
|
76723
|
+
const { overflowY } = styleOf(p);
|
|
76724
|
+
if ((overflowY === "auto" || overflowY === "scroll") && p.scrollHeight > p.clientHeight)
|
|
76725
|
+
return p;
|
|
76726
|
+
}
|
|
76727
|
+
return null;
|
|
76728
|
+
}
|
|
76717
76729
|
function withOrder(item) {
|
|
76718
76730
|
const order = item.editor && typeof item.pos === "number" ? headingOrderTextAt(item.editor.state, item.pos) : null;
|
|
76719
76731
|
return order ? `${order} ${item.textContent}` : item.textContent;
|
|
@@ -76738,17 +76750,7 @@ function normalizeHeadingDepths(items) {
|
|
|
76738
76750
|
}
|
|
76739
76751
|
return depths;
|
|
76740
76752
|
}
|
|
76741
|
-
var getScrollableAncestor = (element) =>
|
|
76742
|
-
let parent = element.parentElement;
|
|
76743
|
-
while (parent) {
|
|
76744
|
-
const { overflowY } = getComputedStyle(parent);
|
|
76745
|
-
if ((overflowY === "auto" || overflowY === "scroll") && parent.scrollHeight > parent.clientHeight) {
|
|
76746
|
-
return parent;
|
|
76747
|
-
}
|
|
76748
|
-
parent = parent.parentElement;
|
|
76749
|
-
}
|
|
76750
|
-
return window;
|
|
76751
|
-
};
|
|
76753
|
+
var getScrollableAncestor = (element) => scrollableAncestor(element) ?? window;
|
|
76752
76754
|
var isElementVisible = (element, topOffset) => {
|
|
76753
76755
|
const rect = element.getBoundingClientRect();
|
|
76754
76756
|
const viewportHeight = window.innerHeight || document.documentElement.clientHeight;
|
|
@@ -83195,13 +83197,6 @@ function leafTextFor(editor) {
|
|
|
83195
83197
|
}
|
|
83196
83198
|
};
|
|
83197
83199
|
}
|
|
83198
|
-
function scrollParent(el) {
|
|
83199
|
-
for (let p = el.parentElement; p; p = p.parentElement) {
|
|
83200
|
-
const { overflowY } = getComputedStyle(p);
|
|
83201
|
-
if ((overflowY === "auto" || overflowY === "scroll") && p.scrollHeight > p.clientHeight) return p;
|
|
83202
|
-
}
|
|
83203
|
-
return null;
|
|
83204
|
-
}
|
|
83205
83200
|
function scrollToMatch(view, from2) {
|
|
83206
83201
|
let rect;
|
|
83207
83202
|
try {
|
|
@@ -83209,7 +83204,7 @@ function scrollToMatch(view, from2) {
|
|
|
83209
83204
|
} catch {
|
|
83210
83205
|
return;
|
|
83211
83206
|
}
|
|
83212
|
-
const container =
|
|
83207
|
+
const container = scrollableAncestor(view.dom);
|
|
83213
83208
|
const top = container ? container.getBoundingClientRect().top : 0;
|
|
83214
83209
|
const bottom = container ? container.getBoundingClientRect().bottom : window.innerHeight;
|
|
83215
83210
|
if (rect.top > top + REVEAL_TOP && rect.bottom < bottom) return;
|
|
@@ -99757,15 +99752,7 @@ function stickyShift(m) {
|
|
|
99757
99752
|
return Math.round(Math.min(shift6, max3));
|
|
99758
99753
|
}
|
|
99759
99754
|
function scrollParentTop(el) {
|
|
99760
|
-
|
|
99761
|
-
while (p) {
|
|
99762
|
-
const { overflowY } = getComputedStyle(p);
|
|
99763
|
-
if ((overflowY === "auto" || overflowY === "scroll") && p.scrollHeight > p.clientHeight) {
|
|
99764
|
-
return p.getBoundingClientRect().top;
|
|
99765
|
-
}
|
|
99766
|
-
p = p.parentElement;
|
|
99767
|
-
}
|
|
99768
|
-
return 0;
|
|
99755
|
+
return scrollableAncestor(el)?.getBoundingClientRect().top ?? 0;
|
|
99769
99756
|
}
|
|
99770
99757
|
function defaultTopOffset() {
|
|
99771
99758
|
const header = document.querySelector(".notion-like-editor-header");
|
|
@@ -119512,13 +119499,6 @@ function showSelectAllTip() {
|
|
|
119512
119499
|
}
|
|
119513
119500
|
});
|
|
119514
119501
|
}
|
|
119515
|
-
function scrollParent2(el) {
|
|
119516
|
-
for (let cur = el.parentElement; cur; cur = cur.parentElement) {
|
|
119517
|
-
const { overflowY } = getComputedStyle(cur);
|
|
119518
|
-
if ((overflowY === "auto" || overflowY === "scroll") && cur.scrollHeight > cur.clientHeight) return cur;
|
|
119519
|
-
}
|
|
119520
|
-
return null;
|
|
119521
|
-
}
|
|
119522
119502
|
function marqueeView(view) {
|
|
119523
119503
|
const boundary = view.dom.closest(".notion-like-editor-wrapper") ?? view.dom.parentElement ?? view.dom;
|
|
119524
119504
|
let start = null;
|
|
@@ -119606,7 +119586,7 @@ function marqueeView(view) {
|
|
|
119606
119586
|
if (!view.editable || e.button !== 0 || e.shiftKey || isMac6() && e.ctrlKey) return;
|
|
119607
119587
|
if (!isMargin(e)) return;
|
|
119608
119588
|
e.preventDefault();
|
|
119609
|
-
scroller =
|
|
119589
|
+
scroller = scrollableAncestor(view.dom);
|
|
119610
119590
|
start = { x: e.clientX, y: e.clientY, scrollTop: scrollTop() };
|
|
119611
119591
|
pointer = { x: e.clientX, y: e.clientY };
|
|
119612
119592
|
document.addEventListener("mousemove", onMove);
|