reactjs-tiptap-editor 0.3.31 → 0.4.1
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/README.md +8 -2
- package/lib/{ActionMenuButton-BCgqJsST.cjs → ActionMenuButton-CYdM1xx5.cjs} +1 -1
- package/lib/{ActionMenuButton-D97K0UWT.js → ActionMenuButton-DKRF6oa0.js} +1 -1
- package/lib/Attachment.cjs +2 -2
- package/lib/Attachment.d.cts +25 -29
- package/lib/Attachment.d.ts +25 -29
- package/lib/Attachment.js +7 -6
- package/lib/BaseKit.cjs +3 -0
- package/lib/BaseKit.d.cts +481 -0
- package/lib/BaseKit.d.ts +481 -0
- package/lib/BaseKit.js +132 -0
- package/lib/Blockquote.cjs +5 -1
- package/lib/Blockquote.d.cts +25 -29
- package/lib/Blockquote.d.ts +25 -29
- package/lib/Blockquote.js +33 -17
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.d.cts +25 -29
- package/lib/Bold.d.ts +25 -29
- package/lib/Bold.js +23 -16
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.d.cts +26 -30
- package/lib/BulletList.d.ts +26 -30
- package/lib/BulletList.js +11 -57
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.d.cts +25 -29
- package/lib/Clear.d.ts +25 -29
- package/lib/Clear.js +4 -2
- package/lib/Code.cjs +1 -1
- package/lib/Code.d.cts +25 -29
- package/lib/Code.d.ts +25 -29
- package/lib/Code.js +29 -25
- package/lib/CodeBlock.cjs +2 -2
- package/lib/CodeBlock.d.cts +25 -29
- package/lib/CodeBlock.d.ts +25 -29
- package/lib/CodeBlock.js +3 -3
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.d.cts +25 -29
- package/lib/CodeView.d.ts +25 -29
- package/lib/CodeView.js +3 -2
- package/lib/Color.cjs +1 -1
- package/lib/Color.d.cts +26 -30
- package/lib/Color.d.ts +26 -30
- package/lib/Color.js +42 -74
- package/lib/Document.cjs +1 -1
- package/lib/Document.d.cts +25 -29
- package/lib/Document.d.ts +25 -29
- package/lib/Document.js +4 -8
- package/lib/{Drawer-BHkje8ys.js → Drawer-CaAfmqNo.js} +37 -35
- package/lib/{Drawer-5Q_-WRhc.cjs → Drawer-CdvCMSzN.cjs} +1 -1
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.d.cts +25 -29
- package/lib/Drawer.d.ts +25 -29
- package/lib/Drawer.js +4 -4
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.d.cts +28 -30
- package/lib/Emoji.d.ts +28 -30
- package/lib/Emoji.js +19795 -184
- package/lib/{Excalidraw-GUVW-IqC.cjs → Excalidraw-BbMQhNvs.cjs} +1 -1
- package/lib/{Excalidraw-CG498239.js → Excalidraw-CVWz2Vyn.js} +20 -20
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.d.cts +25 -29
- package/lib/Excalidraw.d.ts +25 -29
- package/lib/Excalidraw.js +3 -3
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.d.cts +25 -29
- package/lib/ExportPdf.d.ts +25 -29
- package/lib/ExportPdf.js +4 -2
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.d.cts +25 -29
- package/lib/ExportWord.d.ts +25 -29
- package/lib/ExportWord.js +22 -51
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.d.cts +26 -30
- package/lib/FontFamily.d.ts +26 -30
- package/lib/FontFamily.js +44 -73
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.d.cts +25 -29
- package/lib/FontSize.d.ts +25 -29
- package/lib/FontSize.js +7 -5
- package/lib/FormatPainter.cjs +1 -1
- package/lib/FormatPainter.d.cts +25 -29
- package/lib/FormatPainter.d.ts +25 -29
- package/lib/FormatPainter.js +4 -2
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.d.cts +25 -29
- package/lib/Heading.d.ts +25 -29
- package/lib/Heading.js +71 -60
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.d.cts +25 -29
- package/lib/Highlight.d.ts +25 -29
- package/lib/Highlight.js +5 -4
- package/lib/History.cjs +1 -1
- package/lib/History.d.cts +27 -31
- package/lib/History.d.ts +27 -31
- package/lib/History.js +39 -403
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.d.cts +25 -29
- package/lib/HorizontalRule.d.ts +25 -29
- package/lib/HorizontalRule.js +16 -65
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.d.cts +25 -29
- package/lib/Iframe.d.ts +25 -29
- package/lib/Iframe.js +4 -4
- package/lib/Image.cjs +1 -1
- package/lib/Image.d.cts +25 -29
- package/lib/Image.d.ts +25 -29
- package/lib/Image.js +3 -3
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.d.cts +25 -29
- package/lib/ImageGif.d.ts +25 -29
- package/lib/ImageGif.js +5 -5
- package/lib/ImportWord.cjs +72 -72
- package/lib/ImportWord.d.cts +25 -29
- package/lib/ImportWord.d.ts +25 -29
- package/lib/ImportWord.js +5652 -5615
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.d.cts +25 -29
- package/lib/Indent.d.ts +25 -29
- package/lib/Indent.js +4 -2
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.d.cts +25 -29
- package/lib/Italic.d.ts +25 -29
- package/lib/Italic.js +20 -14
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.d.cts +25 -29
- package/lib/Katex.d.ts +25 -29
- package/lib/Katex.js +12 -12
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.d.cts +25 -29
- package/lib/LineHeight.d.ts +25 -29
- package/lib/LineHeight.js +5 -3
- package/lib/Link.cjs +1 -1
- package/lib/Link.d.cts +25 -29
- package/lib/Link.d.ts +25 -29
- package/lib/Link.js +4 -4
- package/lib/ListItem.cjs +1 -1
- package/lib/ListItem.d.cts +30 -30
- package/lib/ListItem.d.ts +30 -30
- package/lib/ListItem.js +4 -30
- package/lib/Mention.cjs +1 -1
- package/lib/Mention.d.cts +25 -29
- package/lib/Mention.d.ts +25 -29
- package/lib/Mention.js +161 -132
- package/lib/Mermaid.cjs +2 -2
- package/lib/Mermaid.d.cts +25 -29
- package/lib/Mermaid.d.ts +25 -29
- package/lib/Mermaid.js +50 -48
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.d.cts +25 -29
- package/lib/MoreMark.d.ts +25 -29
- package/lib/MoreMark.js +5 -3
- package/lib/MultiColumn.cjs +1 -1
- package/lib/MultiColumn.d.cts +25 -29
- package/lib/MultiColumn.d.ts +25 -29
- package/lib/MultiColumn.js +2 -2
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.d.cts +26 -30
- package/lib/OrderedList.d.ts +26 -30
- package/lib/OrderedList.js +11 -75
- package/lib/RichTextEditor-CxvwGvQG.cjs +142 -0
- package/lib/RichTextEditor-DGcKEUGr.js +22166 -0
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.d.cts +38 -112
- package/lib/SearchAndReplace.d.ts +38 -112
- package/lib/SearchAndReplace.js +204 -192
- package/lib/Selection.cjs +1 -1
- package/lib/Selection.d.cts +25 -29
- package/lib/Selection.d.ts +25 -29
- package/lib/Selection.js +1 -1
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.d.cts +25 -29
- package/lib/SlashCommand.d.ts +25 -29
- package/lib/SlashCommand.js +178 -223
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.d.cts +25 -29
- package/lib/Strike.d.ts +25 -29
- package/lib/Strike.js +20 -14
- package/lib/SubAndSuperScript.cjs +1 -1
- package/lib/SubAndSuperScript.d.cts +25 -29
- package/lib/SubAndSuperScript.d.ts +25 -29
- package/lib/SubAndSuperScript.js +5 -3
- package/lib/Table.cjs +8 -10
- package/lib/Table.d.cts +28 -32
- package/lib/Table.d.ts +28 -32
- package/lib/Table.js +382 -2022
- package/lib/TableOfContent.cjs +1 -1
- package/lib/TableOfContent.d.cts +25 -29
- package/lib/TableOfContent.d.ts +25 -29
- package/lib/TableOfContent.js +5 -5
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.d.cts +27 -31
- package/lib/TaskList.d.ts +27 -31
- package/lib/TaskList.js +12 -154
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.d.cts +25 -29
- package/lib/TextAlign.d.ts +25 -29
- package/lib/TextAlign.js +11 -9
- package/lib/TextBubble.cjs +1 -1
- package/lib/TextBubble.d.cts +25 -29
- package/lib/TextBubble.d.ts +25 -29
- package/lib/TextBubble.js +5 -3
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.d.cts +25 -29
- package/lib/TextDirection.d.ts +25 -29
- package/lib/TextDirection.js +2 -3
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.d.cts +25 -29
- package/lib/TextUnderline.d.ts +25 -29
- package/lib/TextUnderline.js +40 -12
- package/lib/TrailingNode.cjs +1 -1
- package/lib/TrailingNode.d.cts +25 -29
- package/lib/TrailingNode.d.ts +25 -29
- package/lib/TrailingNode.js +1 -1
- package/lib/Twitter-BFULyqdR.js +1628 -0
- package/lib/Twitter-Cutpkh3h.cjs +1 -0
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.d.cts +25 -29
- package/lib/Twitter.d.ts +25 -29
- package/lib/Twitter.js +3 -3
- package/lib/Video.cjs +1 -1
- package/lib/Video.d.cts +25 -29
- package/lib/Video.d.ts +25 -29
- package/lib/Video.js +3 -3
- package/lib/bubble-extra.cjs +2 -2
- package/lib/bubble-extra.d.cts +25 -29
- package/lib/bubble-extra.d.ts +25 -29
- package/lib/bubble-extra.js +200 -192
- package/lib/dom-dataset-_6-diIRQ.cjs +33 -0
- package/lib/dom-dataset-lYeH6gfI.js +2361 -0
- package/lib/index-5iBZLua9.cjs +12 -0
- package/lib/index-6D1J-A-o.cjs +1 -0
- package/lib/index-B96Cclrj.cjs +3 -0
- package/lib/index-BBz7Nmv9.js +55 -0
- package/lib/index-BeCTd5v2.cjs +1 -0
- package/lib/index-ByurDDMv.js +237 -0
- package/lib/index-CUogRI7j.cjs +1 -0
- package/lib/index-Ch6dBBad.js +709 -0
- package/lib/index-DF2Lp4HZ.cjs +100 -0
- package/lib/{index-LUL9mqY4.js → index-D_L6n8O8.js} +4 -4
- package/lib/index-Dbvi-Bvh.cjs +1 -0
- package/lib/index-DpCrt7xs.cjs +1 -0
- package/lib/index-DsAX1Vq8.cjs +1 -0
- package/lib/index-Dy4DlW9o.js +12 -0
- package/lib/index-J3jHHZ4d.js +200 -0
- package/lib/{index-CsK90iVd.js → index-LmrOdnen.js} +302 -389
- package/lib/index-VvXaaKe3.js +898 -0
- package/lib/index-kbO3iWqL.js +13432 -0
- package/lib/index.cjs +1 -2
- package/lib/index.d.cts +26 -229
- package/lib/index.d.ts +26 -229
- package/lib/index.js +2 -588
- package/lib/jsx-runtime-CT7Pcg-t.js +13 -0
- package/lib/jsx-runtime-C_NLcKys.cjs +1 -0
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.d.cts +25 -29
- package/lib/locale-bundle.d.ts +25 -29
- package/lib/locale-bundle.js +1 -1
- package/lib/style.css +1 -1
- package/lib/{textarea-DdH64g04.cjs → textarea-DFo_aXnj.cjs} +1 -1
- package/lib/{textarea-CktfkXNe.js → textarea-aPtytkDx.js} +1 -1
- package/package.json +76 -70
- package/lib/RichTextEditor-DWlLqTl9.cjs +0 -140
- package/lib/RichTextEditor-KP2Rgcqe.js +0 -12751
- package/lib/Twitter-99ivY5qv.js +0 -1744
- package/lib/Twitter-BvfvUtNT.cjs +0 -17
- package/lib/dom-dataset-Byuf1YmW.cjs +0 -33
- package/lib/dom-dataset-Di3tIRrR.js +0 -1031
- package/lib/index-BI-IcZcN.cjs +0 -1
- package/lib/index-ByRfqzMr.cjs +0 -89
- package/lib/index-C1fzuXpN.js +0 -46
- package/lib/index-CbQQFj2T.js +0 -133
- package/lib/index-DI9T3iLd.js +0 -12354
- package/lib/index-D_A0TBRA.cjs +0 -1
- package/lib/index-DclQSrIx.cjs +0 -1
- package/lib/index-Z4b9rzn-.cjs +0 -1
|
@@ -1,1031 +0,0 @@
|
|
|
1
|
-
import { P as ue, a as ae, j as de, i as ce, p as le, E as he, k as fe, l as pe, o as me } from "./index-DI9T3iLd.js";
|
|
2
|
-
import ve from "tippy.js";
|
|
3
|
-
import g, { useRef as Se, useState as F, useDebugValue as Z, useEffect as K, forwardRef as ye, useLayoutEffect as Ee, useContext as ee, createContext as te, createRef as _e, memo as ge, createElement as be, version as q } from "react";
|
|
4
|
-
import Oe, { flushSync as we } from "react-dom";
|
|
5
|
-
class De {
|
|
6
|
-
constructor({ editor: e, element: t, view: r, tippyOptions: i = {}, updateDelay: o = 250, shouldShow: h }) {
|
|
7
|
-
this.preventHide = !1, this.shouldShow = ({ view: s, state: f, from: d, to: c }) => {
|
|
8
|
-
const { doc: u, selection: p } = f, { empty: m } = p, y = !u.textBetween(d, c).length && de(f.selection), S = this.element.contains(document.activeElement);
|
|
9
|
-
return !(!(s.hasFocus() || S) || m || y || !this.editor.isEditable);
|
|
10
|
-
}, this.mousedownHandler = () => {
|
|
11
|
-
this.preventHide = !0;
|
|
12
|
-
}, this.dragstartHandler = () => {
|
|
13
|
-
this.hide();
|
|
14
|
-
}, this.focusHandler = () => {
|
|
15
|
-
setTimeout(() => this.update(this.editor.view));
|
|
16
|
-
}, this.blurHandler = ({ event: s }) => {
|
|
17
|
-
var f;
|
|
18
|
-
if (this.preventHide) {
|
|
19
|
-
this.preventHide = !1;
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
s != null && s.relatedTarget && (!((f = this.element.parentNode) === null || f === void 0) && f.contains(s.relatedTarget)) || (s == null ? void 0 : s.relatedTarget) !== this.editor.view.dom && this.hide();
|
|
23
|
-
}, this.tippyBlurHandler = (s) => {
|
|
24
|
-
this.blurHandler({ event: s });
|
|
25
|
-
}, this.handleDebouncedUpdate = (s, f) => {
|
|
26
|
-
const d = !(f != null && f.selection.eq(s.state.selection)), c = !(f != null && f.doc.eq(s.state.doc));
|
|
27
|
-
!d && !c || (this.updateDebounceTimer && clearTimeout(this.updateDebounceTimer), this.updateDebounceTimer = window.setTimeout(() => {
|
|
28
|
-
this.updateHandler(s, d, c, f);
|
|
29
|
-
}, this.updateDelay));
|
|
30
|
-
}, this.updateHandler = (s, f, d, c) => {
|
|
31
|
-
var u, p, m;
|
|
32
|
-
const { state: y, composing: S } = s, { selection: E } = y;
|
|
33
|
-
if (S || !f && !d)
|
|
34
|
-
return;
|
|
35
|
-
this.createTooltip();
|
|
36
|
-
const { ranges: D } = E, v = Math.min(...D.map((a) => a.$from.pos)), l = Math.max(...D.map((a) => a.$to.pos));
|
|
37
|
-
if (!((u = this.shouldShow) === null || u === void 0 ? void 0 : u.call(this, {
|
|
38
|
-
editor: this.editor,
|
|
39
|
-
element: this.element,
|
|
40
|
-
view: s,
|
|
41
|
-
state: y,
|
|
42
|
-
oldState: c,
|
|
43
|
-
from: v,
|
|
44
|
-
to: l
|
|
45
|
-
}))) {
|
|
46
|
-
this.hide();
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
(p = this.tippy) === null || p === void 0 || p.setProps({
|
|
50
|
-
getReferenceClientRect: ((m = this.tippyOptions) === null || m === void 0 ? void 0 : m.getReferenceClientRect) || (() => {
|
|
51
|
-
if (ce(y.selection)) {
|
|
52
|
-
let a = s.nodeDOM(v);
|
|
53
|
-
if (a) {
|
|
54
|
-
const _ = a.dataset.nodeViewWrapper ? a : a.querySelector("[data-node-view-wrapper]");
|
|
55
|
-
if (_ && (a = _.firstChild), a)
|
|
56
|
-
return a.getBoundingClientRect();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return le(s, v, l);
|
|
60
|
-
})
|
|
61
|
-
}), this.show();
|
|
62
|
-
}, this.editor = e, this.element = t, this.view = r, this.updateDelay = o, h && (this.shouldShow = h), this.element.addEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.addEventListener("dragstart", this.dragstartHandler), this.editor.on("focus", this.focusHandler), this.editor.on("blur", this.blurHandler), this.tippyOptions = i, this.element.remove(), this.element.style.visibility = "visible";
|
|
63
|
-
}
|
|
64
|
-
createTooltip() {
|
|
65
|
-
const { element: e } = this.editor.options, t = !!e.parentElement;
|
|
66
|
-
this.element.tabIndex = 0, !(this.tippy || !t) && (this.tippy = ve(e, {
|
|
67
|
-
duration: 0,
|
|
68
|
-
getReferenceClientRect: null,
|
|
69
|
-
content: this.element,
|
|
70
|
-
interactive: !0,
|
|
71
|
-
trigger: "manual",
|
|
72
|
-
placement: "top",
|
|
73
|
-
hideOnClick: "toggle",
|
|
74
|
-
...this.tippyOptions
|
|
75
|
-
}), this.tippy.popper.firstChild && this.tippy.popper.firstChild.addEventListener("blur", this.tippyBlurHandler));
|
|
76
|
-
}
|
|
77
|
-
update(e, t) {
|
|
78
|
-
const { state: r } = e, i = r.selection.from !== r.selection.to;
|
|
79
|
-
if (this.updateDelay > 0 && i) {
|
|
80
|
-
this.handleDebouncedUpdate(e, t);
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
const o = !(t != null && t.selection.eq(e.state.selection)), h = !(t != null && t.doc.eq(e.state.doc));
|
|
84
|
-
this.updateHandler(e, o, h, t);
|
|
85
|
-
}
|
|
86
|
-
show() {
|
|
87
|
-
var e;
|
|
88
|
-
(e = this.tippy) === null || e === void 0 || e.show();
|
|
89
|
-
}
|
|
90
|
-
hide() {
|
|
91
|
-
var e;
|
|
92
|
-
(e = this.tippy) === null || e === void 0 || e.hide();
|
|
93
|
-
}
|
|
94
|
-
destroy() {
|
|
95
|
-
var e, t;
|
|
96
|
-
!((e = this.tippy) === null || e === void 0) && e.popper.firstChild && this.tippy.popper.firstChild.removeEventListener("blur", this.tippyBlurHandler), (t = this.tippy) === null || t === void 0 || t.destroy(), this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.removeEventListener("dragstart", this.dragstartHandler), this.editor.off("focus", this.focusHandler), this.editor.off("blur", this.blurHandler);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
const ne = (n) => new ue({
|
|
100
|
-
key: typeof n.pluginKey == "string" ? new ae(n.pluginKey) : n.pluginKey,
|
|
101
|
-
view: (e) => new De({ view: e, ...n })
|
|
102
|
-
});
|
|
103
|
-
he.create({
|
|
104
|
-
name: "bubbleMenu",
|
|
105
|
-
addOptions() {
|
|
106
|
-
return {
|
|
107
|
-
element: null,
|
|
108
|
-
tippyOptions: {},
|
|
109
|
-
pluginKey: "bubbleMenu",
|
|
110
|
-
updateDelay: void 0,
|
|
111
|
-
shouldShow: null
|
|
112
|
-
};
|
|
113
|
-
},
|
|
114
|
-
addProseMirrorPlugins() {
|
|
115
|
-
return this.options.element ? [
|
|
116
|
-
ne({
|
|
117
|
-
pluginKey: this.options.pluginKey,
|
|
118
|
-
editor: this.editor,
|
|
119
|
-
element: this.options.element,
|
|
120
|
-
tippyOptions: this.options.tippyOptions,
|
|
121
|
-
updateDelay: this.options.updateDelay,
|
|
122
|
-
shouldShow: this.options.shouldShow
|
|
123
|
-
})
|
|
124
|
-
] : [];
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
function Ce(n) {
|
|
128
|
-
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
129
|
-
}
|
|
130
|
-
var P = { exports: {} }, I = {};
|
|
131
|
-
/**
|
|
132
|
-
* @license React
|
|
133
|
-
* use-sync-external-store-shim.production.min.js
|
|
134
|
-
*
|
|
135
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
136
|
-
*
|
|
137
|
-
* This source code is licensed under the MIT license found in the
|
|
138
|
-
* LICENSE file in the root directory of this source tree.
|
|
139
|
-
*/
|
|
140
|
-
var z;
|
|
141
|
-
function Re() {
|
|
142
|
-
if (z) return I;
|
|
143
|
-
z = 1;
|
|
144
|
-
var n = g;
|
|
145
|
-
function e(u, p) {
|
|
146
|
-
return u === p && (u !== 0 || 1 / u === 1 / p) || u !== u && p !== p;
|
|
147
|
-
}
|
|
148
|
-
var t = typeof Object.is == "function" ? Object.is : e, r = n.useState, i = n.useEffect, o = n.useLayoutEffect, h = n.useDebugValue;
|
|
149
|
-
function s(u, p) {
|
|
150
|
-
var m = p(), y = r({ inst: { value: m, getSnapshot: p } }), S = y[0].inst, E = y[1];
|
|
151
|
-
return o(function() {
|
|
152
|
-
S.value = m, S.getSnapshot = p, f(S) && E({ inst: S });
|
|
153
|
-
}, [u, m, p]), i(function() {
|
|
154
|
-
return f(S) && E({ inst: S }), u(function() {
|
|
155
|
-
f(S) && E({ inst: S });
|
|
156
|
-
});
|
|
157
|
-
}, [u]), h(m), m;
|
|
158
|
-
}
|
|
159
|
-
function f(u) {
|
|
160
|
-
var p = u.getSnapshot;
|
|
161
|
-
u = u.value;
|
|
162
|
-
try {
|
|
163
|
-
var m = p();
|
|
164
|
-
return !t(u, m);
|
|
165
|
-
} catch {
|
|
166
|
-
return !0;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
function d(u, p) {
|
|
170
|
-
return p();
|
|
171
|
-
}
|
|
172
|
-
var c = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? d : s;
|
|
173
|
-
return I.useSyncExternalStore = n.useSyncExternalStore !== void 0 ? n.useSyncExternalStore : c, I;
|
|
174
|
-
}
|
|
175
|
-
var H = {};
|
|
176
|
-
/**
|
|
177
|
-
* @license React
|
|
178
|
-
* use-sync-external-store-shim.development.js
|
|
179
|
-
*
|
|
180
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
181
|
-
*
|
|
182
|
-
* This source code is licensed under the MIT license found in the
|
|
183
|
-
* LICENSE file in the root directory of this source tree.
|
|
184
|
-
*/
|
|
185
|
-
var G;
|
|
186
|
-
function Te() {
|
|
187
|
-
return G || (G = 1, process.env.NODE_ENV !== "production" && function() {
|
|
188
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
189
|
-
var n = g, e = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
190
|
-
function t(v) {
|
|
191
|
-
{
|
|
192
|
-
for (var l = arguments.length, b = new Array(l > 1 ? l - 1 : 0), a = 1; a < l; a++)
|
|
193
|
-
b[a - 1] = arguments[a];
|
|
194
|
-
r("error", v, b);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
function r(v, l, b) {
|
|
198
|
-
{
|
|
199
|
-
var a = e.ReactDebugCurrentFrame, _ = a.getStackAddendum();
|
|
200
|
-
_ !== "" && (l += "%s", b = b.concat([_]));
|
|
201
|
-
var w = b.map(function(O) {
|
|
202
|
-
return String(O);
|
|
203
|
-
});
|
|
204
|
-
w.unshift("Warning: " + l), Function.prototype.apply.call(console[v], console, w);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
function i(v, l) {
|
|
208
|
-
return v === l && (v !== 0 || 1 / v === 1 / l) || v !== v && l !== l;
|
|
209
|
-
}
|
|
210
|
-
var o = typeof Object.is == "function" ? Object.is : i, h = n.useState, s = n.useEffect, f = n.useLayoutEffect, d = n.useDebugValue, c = !1, u = !1;
|
|
211
|
-
function p(v, l, b) {
|
|
212
|
-
c || n.startTransition !== void 0 && (c = !0, t("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
|
|
213
|
-
var a = l();
|
|
214
|
-
if (!u) {
|
|
215
|
-
var _ = l();
|
|
216
|
-
o(a, _) || (t("The result of getSnapshot should be cached to avoid an infinite loop"), u = !0);
|
|
217
|
-
}
|
|
218
|
-
var w = h({
|
|
219
|
-
inst: {
|
|
220
|
-
value: a,
|
|
221
|
-
getSnapshot: l
|
|
222
|
-
}
|
|
223
|
-
}), O = w[0].inst, R = w[1];
|
|
224
|
-
return f(function() {
|
|
225
|
-
O.value = a, O.getSnapshot = l, m(O) && R({
|
|
226
|
-
inst: O
|
|
227
|
-
});
|
|
228
|
-
}, [v, a, l]), s(function() {
|
|
229
|
-
m(O) && R({
|
|
230
|
-
inst: O
|
|
231
|
-
});
|
|
232
|
-
var L = function() {
|
|
233
|
-
m(O) && R({
|
|
234
|
-
inst: O
|
|
235
|
-
});
|
|
236
|
-
};
|
|
237
|
-
return v(L);
|
|
238
|
-
}, [v]), d(a), a;
|
|
239
|
-
}
|
|
240
|
-
function m(v) {
|
|
241
|
-
var l = v.getSnapshot, b = v.value;
|
|
242
|
-
try {
|
|
243
|
-
var a = l();
|
|
244
|
-
return !o(b, a);
|
|
245
|
-
} catch {
|
|
246
|
-
return !0;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
function y(v, l, b) {
|
|
250
|
-
return l();
|
|
251
|
-
}
|
|
252
|
-
var S = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", E = !S, C = E ? y : p, D = n.useSyncExternalStore !== void 0 ? n.useSyncExternalStore : C;
|
|
253
|
-
H.useSyncExternalStore = D, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
254
|
-
}()), H;
|
|
255
|
-
}
|
|
256
|
-
process.env.NODE_ENV === "production" ? P.exports = Re() : P.exports = Te();
|
|
257
|
-
var M = P.exports;
|
|
258
|
-
const Me = (...n) => (e) => {
|
|
259
|
-
n.forEach((t) => {
|
|
260
|
-
typeof t == "function" ? t(e) : t && (t.current = e);
|
|
261
|
-
});
|
|
262
|
-
}, Le = ({ contentComponent: n }) => {
|
|
263
|
-
const e = M.useSyncExternalStore(n.subscribe, n.getSnapshot, n.getServerSnapshot);
|
|
264
|
-
return g.createElement(g.Fragment, null, Object.values(e));
|
|
265
|
-
};
|
|
266
|
-
function Ae() {
|
|
267
|
-
const n = /* @__PURE__ */ new Set();
|
|
268
|
-
let e = {};
|
|
269
|
-
return {
|
|
270
|
-
/**
|
|
271
|
-
* Subscribe to the editor instance's changes.
|
|
272
|
-
*/
|
|
273
|
-
subscribe(t) {
|
|
274
|
-
return n.add(t), () => {
|
|
275
|
-
n.delete(t);
|
|
276
|
-
};
|
|
277
|
-
},
|
|
278
|
-
getSnapshot() {
|
|
279
|
-
return e;
|
|
280
|
-
},
|
|
281
|
-
getServerSnapshot() {
|
|
282
|
-
return e;
|
|
283
|
-
},
|
|
284
|
-
/**
|
|
285
|
-
* Adds a new NodeView Renderer to the editor.
|
|
286
|
-
*/
|
|
287
|
-
setRenderer(t, r) {
|
|
288
|
-
e = {
|
|
289
|
-
...e,
|
|
290
|
-
[t]: Oe.createPortal(r.reactElement, r.element, t)
|
|
291
|
-
}, n.forEach((i) => i());
|
|
292
|
-
},
|
|
293
|
-
/**
|
|
294
|
-
* Removes a NodeView Renderer from the editor.
|
|
295
|
-
*/
|
|
296
|
-
removeRenderer(t) {
|
|
297
|
-
const r = { ...e };
|
|
298
|
-
delete r[t], e = r, n.forEach((i) => i());
|
|
299
|
-
}
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
class Ne extends g.Component {
|
|
303
|
-
constructor(e) {
|
|
304
|
-
var t;
|
|
305
|
-
super(e), this.editorContentRef = g.createRef(), this.initialized = !1, this.state = {
|
|
306
|
-
hasContentComponentInitialized: !!(!((t = e.editor) === null || t === void 0) && t.contentComponent)
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
componentDidMount() {
|
|
310
|
-
this.init();
|
|
311
|
-
}
|
|
312
|
-
componentDidUpdate() {
|
|
313
|
-
this.init();
|
|
314
|
-
}
|
|
315
|
-
init() {
|
|
316
|
-
const e = this.props.editor;
|
|
317
|
-
if (e && !e.isDestroyed && e.options.element) {
|
|
318
|
-
if (e.contentComponent)
|
|
319
|
-
return;
|
|
320
|
-
const t = this.editorContentRef.current;
|
|
321
|
-
t.append(...e.options.element.childNodes), e.setOptions({
|
|
322
|
-
element: t
|
|
323
|
-
}), e.contentComponent = Ae(), this.state.hasContentComponentInitialized || (this.unsubscribeToContentComponent = e.contentComponent.subscribe(() => {
|
|
324
|
-
this.setState((r) => r.hasContentComponentInitialized ? r : {
|
|
325
|
-
hasContentComponentInitialized: !0
|
|
326
|
-
}), this.unsubscribeToContentComponent && this.unsubscribeToContentComponent();
|
|
327
|
-
})), e.createNodeViews(), this.initialized = !0;
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
componentWillUnmount() {
|
|
331
|
-
const e = this.props.editor;
|
|
332
|
-
if (!e || (this.initialized = !1, e.isDestroyed || e.view.setProps({
|
|
333
|
-
nodeViews: {}
|
|
334
|
-
}), this.unsubscribeToContentComponent && this.unsubscribeToContentComponent(), e.contentComponent = null, !e.options.element.firstChild))
|
|
335
|
-
return;
|
|
336
|
-
const t = document.createElement("div");
|
|
337
|
-
t.append(...e.options.element.childNodes), e.setOptions({
|
|
338
|
-
element: t
|
|
339
|
-
});
|
|
340
|
-
}
|
|
341
|
-
render() {
|
|
342
|
-
const { editor: e, innerRef: t, ...r } = this.props;
|
|
343
|
-
return g.createElement(
|
|
344
|
-
g.Fragment,
|
|
345
|
-
null,
|
|
346
|
-
g.createElement("div", { ref: Me(t, this.editorContentRef), ...r }),
|
|
347
|
-
(e == null ? void 0 : e.contentComponent) && g.createElement(Le, { contentComponent: e.contentComponent })
|
|
348
|
-
);
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
const xe = ye((n, e) => {
|
|
352
|
-
const t = g.useMemo(() => Math.floor(Math.random() * 4294967295).toString(), [n.editor]);
|
|
353
|
-
return g.createElement(Ne, {
|
|
354
|
-
key: t,
|
|
355
|
-
innerRef: e,
|
|
356
|
-
...n
|
|
357
|
-
});
|
|
358
|
-
}), tt = g.memo(xe);
|
|
359
|
-
var Ve = function n(e, t) {
|
|
360
|
-
if (e === t) return !0;
|
|
361
|
-
if (e && t && typeof e == "object" && typeof t == "object") {
|
|
362
|
-
if (e.constructor !== t.constructor) return !1;
|
|
363
|
-
var r, i, o;
|
|
364
|
-
if (Array.isArray(e)) {
|
|
365
|
-
if (r = e.length, r != t.length) return !1;
|
|
366
|
-
for (i = r; i-- !== 0; )
|
|
367
|
-
if (!n(e[i], t[i])) return !1;
|
|
368
|
-
return !0;
|
|
369
|
-
}
|
|
370
|
-
if (e instanceof Map && t instanceof Map) {
|
|
371
|
-
if (e.size !== t.size) return !1;
|
|
372
|
-
for (i of e.entries())
|
|
373
|
-
if (!t.has(i[0])) return !1;
|
|
374
|
-
for (i of e.entries())
|
|
375
|
-
if (!n(i[1], t.get(i[0]))) return !1;
|
|
376
|
-
return !0;
|
|
377
|
-
}
|
|
378
|
-
if (e instanceof Set && t instanceof Set) {
|
|
379
|
-
if (e.size !== t.size) return !1;
|
|
380
|
-
for (i of e.entries())
|
|
381
|
-
if (!t.has(i[0])) return !1;
|
|
382
|
-
return !0;
|
|
383
|
-
}
|
|
384
|
-
if (ArrayBuffer.isView(e) && ArrayBuffer.isView(t)) {
|
|
385
|
-
if (r = e.length, r != t.length) return !1;
|
|
386
|
-
for (i = r; i-- !== 0; )
|
|
387
|
-
if (e[i] !== t[i]) return !1;
|
|
388
|
-
return !0;
|
|
389
|
-
}
|
|
390
|
-
if (e.constructor === RegExp) return e.source === t.source && e.flags === t.flags;
|
|
391
|
-
if (e.valueOf !== Object.prototype.valueOf) return e.valueOf() === t.valueOf();
|
|
392
|
-
if (e.toString !== Object.prototype.toString) return e.toString() === t.toString();
|
|
393
|
-
if (o = Object.keys(e), r = o.length, r !== Object.keys(t).length) return !1;
|
|
394
|
-
for (i = r; i-- !== 0; )
|
|
395
|
-
if (!Object.prototype.hasOwnProperty.call(t, o[i])) return !1;
|
|
396
|
-
for (i = r; i-- !== 0; ) {
|
|
397
|
-
var h = o[i];
|
|
398
|
-
if (!(h === "_owner" && e.$$typeof) && !n(e[h], t[h]))
|
|
399
|
-
return !1;
|
|
400
|
-
}
|
|
401
|
-
return !0;
|
|
402
|
-
}
|
|
403
|
-
return e !== e && t !== t;
|
|
404
|
-
}, Ie = /* @__PURE__ */ Ce(Ve), U = { exports: {} }, B = {};
|
|
405
|
-
/**
|
|
406
|
-
* @license React
|
|
407
|
-
* use-sync-external-store-shim/with-selector.production.min.js
|
|
408
|
-
*
|
|
409
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
410
|
-
*
|
|
411
|
-
* This source code is licensed under the MIT license found in the
|
|
412
|
-
* LICENSE file in the root directory of this source tree.
|
|
413
|
-
*/
|
|
414
|
-
var J;
|
|
415
|
-
function He() {
|
|
416
|
-
if (J) return B;
|
|
417
|
-
J = 1;
|
|
418
|
-
var n = g, e = M;
|
|
419
|
-
function t(d, c) {
|
|
420
|
-
return d === c && (d !== 0 || 1 / d === 1 / c) || d !== d && c !== c;
|
|
421
|
-
}
|
|
422
|
-
var r = typeof Object.is == "function" ? Object.is : t, i = e.useSyncExternalStore, o = n.useRef, h = n.useEffect, s = n.useMemo, f = n.useDebugValue;
|
|
423
|
-
return B.useSyncExternalStoreWithSelector = function(d, c, u, p, m) {
|
|
424
|
-
var y = o(null);
|
|
425
|
-
if (y.current === null) {
|
|
426
|
-
var S = { hasValue: !1, value: null };
|
|
427
|
-
y.current = S;
|
|
428
|
-
} else S = y.current;
|
|
429
|
-
y = s(function() {
|
|
430
|
-
function C(a) {
|
|
431
|
-
if (!D) {
|
|
432
|
-
if (D = !0, v = a, a = p(a), m !== void 0 && S.hasValue) {
|
|
433
|
-
var _ = S.value;
|
|
434
|
-
if (m(_, a)) return l = _;
|
|
435
|
-
}
|
|
436
|
-
return l = a;
|
|
437
|
-
}
|
|
438
|
-
if (_ = l, r(v, a)) return _;
|
|
439
|
-
var w = p(a);
|
|
440
|
-
return m !== void 0 && m(_, w) ? _ : (v = a, l = w);
|
|
441
|
-
}
|
|
442
|
-
var D = !1, v, l, b = u === void 0 ? null : u;
|
|
443
|
-
return [function() {
|
|
444
|
-
return C(c());
|
|
445
|
-
}, b === null ? void 0 : function() {
|
|
446
|
-
return C(b());
|
|
447
|
-
}];
|
|
448
|
-
}, [c, u, p, m]);
|
|
449
|
-
var E = i(d, y[0], y[1]);
|
|
450
|
-
return h(function() {
|
|
451
|
-
S.hasValue = !0, S.value = E;
|
|
452
|
-
}, [E]), f(E), E;
|
|
453
|
-
}, B;
|
|
454
|
-
}
|
|
455
|
-
var j = {};
|
|
456
|
-
/**
|
|
457
|
-
* @license React
|
|
458
|
-
* use-sync-external-store-shim/with-selector.development.js
|
|
459
|
-
*
|
|
460
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
461
|
-
*
|
|
462
|
-
* This source code is licensed under the MIT license found in the
|
|
463
|
-
* LICENSE file in the root directory of this source tree.
|
|
464
|
-
*/
|
|
465
|
-
var Y;
|
|
466
|
-
function Be() {
|
|
467
|
-
return Y || (Y = 1, process.env.NODE_ENV !== "production" && function() {
|
|
468
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
469
|
-
var n = g, e = M;
|
|
470
|
-
function t(c, u) {
|
|
471
|
-
return c === u && (c !== 0 || 1 / c === 1 / u) || c !== c && u !== u;
|
|
472
|
-
}
|
|
473
|
-
var r = typeof Object.is == "function" ? Object.is : t, i = e.useSyncExternalStore, o = n.useRef, h = n.useEffect, s = n.useMemo, f = n.useDebugValue;
|
|
474
|
-
function d(c, u, p, m, y) {
|
|
475
|
-
var S = o(null), E;
|
|
476
|
-
S.current === null ? (E = {
|
|
477
|
-
hasValue: !1,
|
|
478
|
-
value: null
|
|
479
|
-
}, S.current = E) : E = S.current;
|
|
480
|
-
var C = s(function() {
|
|
481
|
-
var b = !1, a, _, w = function(T) {
|
|
482
|
-
if (!b) {
|
|
483
|
-
b = !0, a = T;
|
|
484
|
-
var A = m(T);
|
|
485
|
-
if (y !== void 0 && E.hasValue) {
|
|
486
|
-
var N = E.value;
|
|
487
|
-
if (y(N, A))
|
|
488
|
-
return _ = N, N;
|
|
489
|
-
}
|
|
490
|
-
return _ = A, A;
|
|
491
|
-
}
|
|
492
|
-
var se = a, x = _;
|
|
493
|
-
if (r(se, T))
|
|
494
|
-
return x;
|
|
495
|
-
var V = m(T);
|
|
496
|
-
return y !== void 0 && y(x, V) ? x : (a = T, _ = V, V);
|
|
497
|
-
}, O = p === void 0 ? null : p, R = function() {
|
|
498
|
-
return w(u());
|
|
499
|
-
}, L = O === null ? void 0 : function() {
|
|
500
|
-
return w(O());
|
|
501
|
-
};
|
|
502
|
-
return [R, L];
|
|
503
|
-
}, [u, p, m, y]), D = C[0], v = C[1], l = i(c, D, v);
|
|
504
|
-
return h(function() {
|
|
505
|
-
E.hasValue = !0, E.value = l;
|
|
506
|
-
}, [l]), f(l), l;
|
|
507
|
-
}
|
|
508
|
-
j.useSyncExternalStoreWithSelector = d, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
509
|
-
}()), j;
|
|
510
|
-
}
|
|
511
|
-
process.env.NODE_ENV === "production" ? U.exports = He() : U.exports = Be();
|
|
512
|
-
var je = U.exports;
|
|
513
|
-
const Pe = typeof window < "u" ? Ee : K;
|
|
514
|
-
class Ue {
|
|
515
|
-
constructor(e) {
|
|
516
|
-
this.transactionNumber = 0, this.lastTransactionNumber = 0, this.subscribers = /* @__PURE__ */ new Set(), this.editor = e, this.lastSnapshot = { editor: e, transactionNumber: 0 }, this.getSnapshot = this.getSnapshot.bind(this), this.getServerSnapshot = this.getServerSnapshot.bind(this), this.watch = this.watch.bind(this), this.subscribe = this.subscribe.bind(this);
|
|
517
|
-
}
|
|
518
|
-
/**
|
|
519
|
-
* Get the current editor instance.
|
|
520
|
-
*/
|
|
521
|
-
getSnapshot() {
|
|
522
|
-
return this.transactionNumber === this.lastTransactionNumber ? this.lastSnapshot : (this.lastTransactionNumber = this.transactionNumber, this.lastSnapshot = { editor: this.editor, transactionNumber: this.transactionNumber }, this.lastSnapshot);
|
|
523
|
-
}
|
|
524
|
-
/**
|
|
525
|
-
* Always disable the editor on the server-side.
|
|
526
|
-
*/
|
|
527
|
-
getServerSnapshot() {
|
|
528
|
-
return { editor: null, transactionNumber: 0 };
|
|
529
|
-
}
|
|
530
|
-
/**
|
|
531
|
-
* Subscribe to the editor instance's changes.
|
|
532
|
-
*/
|
|
533
|
-
subscribe(e) {
|
|
534
|
-
return this.subscribers.add(e), () => {
|
|
535
|
-
this.subscribers.delete(e);
|
|
536
|
-
};
|
|
537
|
-
}
|
|
538
|
-
/**
|
|
539
|
-
* Watch the editor instance for changes.
|
|
540
|
-
*/
|
|
541
|
-
watch(e) {
|
|
542
|
-
if (this.editor = e, this.editor) {
|
|
543
|
-
const t = () => {
|
|
544
|
-
this.transactionNumber += 1, this.subscribers.forEach((i) => i());
|
|
545
|
-
}, r = this.editor;
|
|
546
|
-
return r.on("transaction", t), () => {
|
|
547
|
-
r.off("transaction", t);
|
|
548
|
-
};
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
function $e(n) {
|
|
553
|
-
var e;
|
|
554
|
-
const [t] = F(() => new Ue(n.editor)), r = je.useSyncExternalStoreWithSelector(t.subscribe, t.getSnapshot, t.getServerSnapshot, n.selector, (e = n.equalityFn) !== null && e !== void 0 ? e : Ie);
|
|
555
|
-
return Pe(() => t.watch(n.editor), [n.editor, t]), Z(r), r;
|
|
556
|
-
}
|
|
557
|
-
const k = process.env.NODE_ENV !== "production", $ = typeof window > "u", Fe = $ || !!(typeof window < "u" && window.next);
|
|
558
|
-
class W {
|
|
559
|
-
constructor(e) {
|
|
560
|
-
this.editor = null, this.subscriptions = /* @__PURE__ */ new Set(), this.isComponentMounted = !1, this.previousDeps = null, this.instanceId = "", this.options = e, this.subscriptions = /* @__PURE__ */ new Set(), this.setEditor(this.getInitialEditor()), this.scheduleDestroy(), this.getEditor = this.getEditor.bind(this), this.getServerSnapshot = this.getServerSnapshot.bind(this), this.subscribe = this.subscribe.bind(this), this.refreshEditorInstance = this.refreshEditorInstance.bind(this), this.scheduleDestroy = this.scheduleDestroy.bind(this), this.onRender = this.onRender.bind(this), this.createEditor = this.createEditor.bind(this);
|
|
561
|
-
}
|
|
562
|
-
setEditor(e) {
|
|
563
|
-
this.editor = e, this.instanceId = Math.random().toString(36).slice(2, 9), this.subscriptions.forEach((t) => t());
|
|
564
|
-
}
|
|
565
|
-
getInitialEditor() {
|
|
566
|
-
if (this.options.current.immediatelyRender === void 0)
|
|
567
|
-
return $ || Fe ? (k && console.warn("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches."), null) : this.createEditor();
|
|
568
|
-
if (this.options.current.immediatelyRender && $ && k)
|
|
569
|
-
throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");
|
|
570
|
-
return this.options.current.immediatelyRender ? this.createEditor() : null;
|
|
571
|
-
}
|
|
572
|
-
/**
|
|
573
|
-
* Create a new editor instance. And attach event listeners.
|
|
574
|
-
*/
|
|
575
|
-
createEditor() {
|
|
576
|
-
const e = {
|
|
577
|
-
...this.options.current,
|
|
578
|
-
// Always call the most recent version of the callback function by default
|
|
579
|
-
onBeforeCreate: (...r) => {
|
|
580
|
-
var i, o;
|
|
581
|
-
return (o = (i = this.options.current).onBeforeCreate) === null || o === void 0 ? void 0 : o.call(i, ...r);
|
|
582
|
-
},
|
|
583
|
-
onBlur: (...r) => {
|
|
584
|
-
var i, o;
|
|
585
|
-
return (o = (i = this.options.current).onBlur) === null || o === void 0 ? void 0 : o.call(i, ...r);
|
|
586
|
-
},
|
|
587
|
-
onCreate: (...r) => {
|
|
588
|
-
var i, o;
|
|
589
|
-
return (o = (i = this.options.current).onCreate) === null || o === void 0 ? void 0 : o.call(i, ...r);
|
|
590
|
-
},
|
|
591
|
-
onDestroy: (...r) => {
|
|
592
|
-
var i, o;
|
|
593
|
-
return (o = (i = this.options.current).onDestroy) === null || o === void 0 ? void 0 : o.call(i, ...r);
|
|
594
|
-
},
|
|
595
|
-
onFocus: (...r) => {
|
|
596
|
-
var i, o;
|
|
597
|
-
return (o = (i = this.options.current).onFocus) === null || o === void 0 ? void 0 : o.call(i, ...r);
|
|
598
|
-
},
|
|
599
|
-
onSelectionUpdate: (...r) => {
|
|
600
|
-
var i, o;
|
|
601
|
-
return (o = (i = this.options.current).onSelectionUpdate) === null || o === void 0 ? void 0 : o.call(i, ...r);
|
|
602
|
-
},
|
|
603
|
-
onTransaction: (...r) => {
|
|
604
|
-
var i, o;
|
|
605
|
-
return (o = (i = this.options.current).onTransaction) === null || o === void 0 ? void 0 : o.call(i, ...r);
|
|
606
|
-
},
|
|
607
|
-
onUpdate: (...r) => {
|
|
608
|
-
var i, o;
|
|
609
|
-
return (o = (i = this.options.current).onUpdate) === null || o === void 0 ? void 0 : o.call(i, ...r);
|
|
610
|
-
},
|
|
611
|
-
onContentError: (...r) => {
|
|
612
|
-
var i, o;
|
|
613
|
-
return (o = (i = this.options.current).onContentError) === null || o === void 0 ? void 0 : o.call(i, ...r);
|
|
614
|
-
},
|
|
615
|
-
onDrop: (...r) => {
|
|
616
|
-
var i, o;
|
|
617
|
-
return (o = (i = this.options.current).onDrop) === null || o === void 0 ? void 0 : o.call(i, ...r);
|
|
618
|
-
},
|
|
619
|
-
onPaste: (...r) => {
|
|
620
|
-
var i, o;
|
|
621
|
-
return (o = (i = this.options.current).onPaste) === null || o === void 0 ? void 0 : o.call(i, ...r);
|
|
622
|
-
}
|
|
623
|
-
};
|
|
624
|
-
return new fe(e);
|
|
625
|
-
}
|
|
626
|
-
/**
|
|
627
|
-
* Get the current editor instance.
|
|
628
|
-
*/
|
|
629
|
-
getEditor() {
|
|
630
|
-
return this.editor;
|
|
631
|
-
}
|
|
632
|
-
/**
|
|
633
|
-
* Always disable the editor on the server-side.
|
|
634
|
-
*/
|
|
635
|
-
getServerSnapshot() {
|
|
636
|
-
return null;
|
|
637
|
-
}
|
|
638
|
-
/**
|
|
639
|
-
* Subscribe to the editor instance's changes.
|
|
640
|
-
*/
|
|
641
|
-
subscribe(e) {
|
|
642
|
-
return this.subscriptions.add(e), () => {
|
|
643
|
-
this.subscriptions.delete(e);
|
|
644
|
-
};
|
|
645
|
-
}
|
|
646
|
-
static compareOptions(e, t) {
|
|
647
|
-
return Object.keys(e).every((r) => ["onCreate", "onBeforeCreate", "onDestroy", "onUpdate", "onTransaction", "onFocus", "onBlur", "onSelectionUpdate", "onContentError", "onDrop", "onPaste"].includes(r) ? !0 : r === "extensions" && e.extensions && t.extensions ? e.extensions.length !== t.extensions.length ? !1 : e.extensions.every((i, o) => {
|
|
648
|
-
var h;
|
|
649
|
-
return i === ((h = t.extensions) === null || h === void 0 ? void 0 : h[o]);
|
|
650
|
-
}) : e[r] === t[r]);
|
|
651
|
-
}
|
|
652
|
-
/**
|
|
653
|
-
* On each render, we will create, update, or destroy the editor instance.
|
|
654
|
-
* @param deps The dependencies to watch for changes
|
|
655
|
-
* @returns A cleanup function
|
|
656
|
-
*/
|
|
657
|
-
onRender(e) {
|
|
658
|
-
return () => (this.isComponentMounted = !0, clearTimeout(this.scheduledDestructionTimeout), this.editor && !this.editor.isDestroyed && e.length === 0 ? W.compareOptions(this.options.current, this.editor.options) || this.editor.setOptions({
|
|
659
|
-
...this.options.current,
|
|
660
|
-
editable: this.editor.isEditable
|
|
661
|
-
}) : this.refreshEditorInstance(e), () => {
|
|
662
|
-
this.isComponentMounted = !1, this.scheduleDestroy();
|
|
663
|
-
});
|
|
664
|
-
}
|
|
665
|
-
/**
|
|
666
|
-
* Recreate the editor instance if the dependencies have changed.
|
|
667
|
-
*/
|
|
668
|
-
refreshEditorInstance(e) {
|
|
669
|
-
if (this.editor && !this.editor.isDestroyed) {
|
|
670
|
-
if (this.previousDeps === null) {
|
|
671
|
-
this.previousDeps = e;
|
|
672
|
-
return;
|
|
673
|
-
}
|
|
674
|
-
if (this.previousDeps.length === e.length && this.previousDeps.every((r, i) => r === e[i]))
|
|
675
|
-
return;
|
|
676
|
-
}
|
|
677
|
-
this.editor && !this.editor.isDestroyed && this.editor.destroy(), this.setEditor(this.createEditor()), this.previousDeps = e;
|
|
678
|
-
}
|
|
679
|
-
/**
|
|
680
|
-
* Schedule the destruction of the editor instance.
|
|
681
|
-
* This will only destroy the editor if it was not mounted on the next tick.
|
|
682
|
-
* This is to avoid destroying the editor instance when it's actually still mounted.
|
|
683
|
-
*/
|
|
684
|
-
scheduleDestroy() {
|
|
685
|
-
const e = this.instanceId, t = this.editor;
|
|
686
|
-
this.scheduledDestructionTimeout = setTimeout(() => {
|
|
687
|
-
if (this.isComponentMounted && this.instanceId === e) {
|
|
688
|
-
t && t.setOptions(this.options.current);
|
|
689
|
-
return;
|
|
690
|
-
}
|
|
691
|
-
t && !t.isDestroyed && (t.destroy(), this.instanceId === e && this.setEditor(null));
|
|
692
|
-
}, 1);
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
function nt(n = {}, e = []) {
|
|
696
|
-
const t = Se(n);
|
|
697
|
-
t.current = n;
|
|
698
|
-
const [r] = F(() => new W(t)), i = M.useSyncExternalStore(r.subscribe, r.getEditor, r.getServerSnapshot);
|
|
699
|
-
return Z(i), K(r.onRender(e)), $e({
|
|
700
|
-
editor: i,
|
|
701
|
-
selector: ({ transactionNumber: o }) => n.shouldRerenderOnTransaction === !1 ? null : n.immediatelyRender && o === 0 ? 0 : o + 1
|
|
702
|
-
}), i;
|
|
703
|
-
}
|
|
704
|
-
const re = te({
|
|
705
|
-
editor: null
|
|
706
|
-
});
|
|
707
|
-
re.Consumer;
|
|
708
|
-
const Ke = () => ee(re), rt = (n) => {
|
|
709
|
-
const [e, t] = F(null), { editor: r } = Ke();
|
|
710
|
-
return K(() => {
|
|
711
|
-
var i;
|
|
712
|
-
if (!e || !((i = n.editor) === null || i === void 0) && i.isDestroyed || r != null && r.isDestroyed)
|
|
713
|
-
return;
|
|
714
|
-
const { pluginKey: o = "bubbleMenu", editor: h, tippyOptions: s = {}, updateDelay: f, shouldShow: d = null } = n, c = h || r;
|
|
715
|
-
if (!c) {
|
|
716
|
-
console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");
|
|
717
|
-
return;
|
|
718
|
-
}
|
|
719
|
-
const u = ne({
|
|
720
|
-
updateDelay: f,
|
|
721
|
-
editor: c,
|
|
722
|
-
element: e,
|
|
723
|
-
pluginKey: o,
|
|
724
|
-
shouldShow: d,
|
|
725
|
-
tippyOptions: s
|
|
726
|
-
});
|
|
727
|
-
return c.registerPlugin(u), () => {
|
|
728
|
-
c.unregisterPlugin(o);
|
|
729
|
-
};
|
|
730
|
-
}, [n.editor, r, e]), g.createElement("div", { ref: t, className: n.className, style: { visibility: "hidden" } }, n.children);
|
|
731
|
-
}, ie = te({
|
|
732
|
-
onDragStart: void 0
|
|
733
|
-
}), We = () => ee(ie), it = g.forwardRef((n, e) => {
|
|
734
|
-
const { onDragStart: t } = We(), r = n.as || "div";
|
|
735
|
-
return (
|
|
736
|
-
// @ts-ignore
|
|
737
|
-
g.createElement(r, { ...n, ref: e, "data-node-view-wrapper": "", onDragStart: t, style: {
|
|
738
|
-
whiteSpace: "normal",
|
|
739
|
-
...n.style
|
|
740
|
-
} })
|
|
741
|
-
);
|
|
742
|
-
});
|
|
743
|
-
function Q(n) {
|
|
744
|
-
return !!(typeof n == "function" && n.prototype && n.prototype.isReactComponent);
|
|
745
|
-
}
|
|
746
|
-
function X(n) {
|
|
747
|
-
return !!(typeof n == "object" && n.$$typeof && (n.$$typeof.toString() === "Symbol(react.forward_ref)" || n.$$typeof.description === "react.forward_ref"));
|
|
748
|
-
}
|
|
749
|
-
function qe(n) {
|
|
750
|
-
return !!(typeof n == "object" && n.$$typeof && (n.$$typeof.toString() === "Symbol(react.memo)" || n.$$typeof.description === "react.memo"));
|
|
751
|
-
}
|
|
752
|
-
function ze(n) {
|
|
753
|
-
if (Q(n) || X(n))
|
|
754
|
-
return !0;
|
|
755
|
-
if (qe(n)) {
|
|
756
|
-
const e = n.type;
|
|
757
|
-
if (e)
|
|
758
|
-
return Q(e) || X(e);
|
|
759
|
-
}
|
|
760
|
-
return !1;
|
|
761
|
-
}
|
|
762
|
-
function Ge() {
|
|
763
|
-
try {
|
|
764
|
-
if (q)
|
|
765
|
-
return parseInt(q.split(".")[0], 10) >= 19;
|
|
766
|
-
} catch {
|
|
767
|
-
}
|
|
768
|
-
return !1;
|
|
769
|
-
}
|
|
770
|
-
class Je {
|
|
771
|
-
/**
|
|
772
|
-
* Immediately creates element and renders the provided React component.
|
|
773
|
-
*/
|
|
774
|
-
constructor(e, { editor: t, props: r = {}, as: i = "div", className: o = "" }) {
|
|
775
|
-
this.ref = null, this.id = Math.floor(Math.random() * 4294967295).toString(), this.component = e, this.editor = t, this.props = r, this.element = document.createElement(i), this.element.classList.add("react-renderer"), o && this.element.classList.add(...o.split(" ")), this.editor.isInitialized ? we(() => {
|
|
776
|
-
this.render();
|
|
777
|
-
}) : queueMicrotask(() => {
|
|
778
|
-
this.render();
|
|
779
|
-
});
|
|
780
|
-
}
|
|
781
|
-
/**
|
|
782
|
-
* Render the React component.
|
|
783
|
-
*/
|
|
784
|
-
render() {
|
|
785
|
-
var e;
|
|
786
|
-
const t = this.component, r = this.props, i = this.editor, o = Ge(), h = ze(t), s = { ...r };
|
|
787
|
-
s.ref && !(o || h) && delete s.ref, !s.ref && (o || h) && (s.ref = (f) => {
|
|
788
|
-
this.ref = f;
|
|
789
|
-
}), this.reactElement = g.createElement(t, { ...s }), (e = i == null ? void 0 : i.contentComponent) === null || e === void 0 || e.setRenderer(this.id, this);
|
|
790
|
-
}
|
|
791
|
-
/**
|
|
792
|
-
* Re-renders the React component with new props.
|
|
793
|
-
*/
|
|
794
|
-
updateProps(e = {}) {
|
|
795
|
-
this.props = {
|
|
796
|
-
...this.props,
|
|
797
|
-
...e
|
|
798
|
-
}, this.render();
|
|
799
|
-
}
|
|
800
|
-
/**
|
|
801
|
-
* Destroy the React component.
|
|
802
|
-
*/
|
|
803
|
-
destroy() {
|
|
804
|
-
var e;
|
|
805
|
-
const t = this.editor;
|
|
806
|
-
(e = t == null ? void 0 : t.contentComponent) === null || e === void 0 || e.removeRenderer(this.id);
|
|
807
|
-
}
|
|
808
|
-
/**
|
|
809
|
-
* Update the attributes of the element that holds the React component.
|
|
810
|
-
*/
|
|
811
|
-
updateAttributes(e) {
|
|
812
|
-
Object.keys(e).forEach((t) => {
|
|
813
|
-
this.element.setAttribute(t, e[t]);
|
|
814
|
-
});
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
class Ye extends pe {
|
|
818
|
-
constructor(e, t, r) {
|
|
819
|
-
if (super(e, t, r), !this.node.isLeaf) {
|
|
820
|
-
this.options.contentDOMElementTag ? this.contentDOMElement = document.createElement(this.options.contentDOMElementTag) : this.contentDOMElement = document.createElement(this.node.isInline ? "span" : "div"), this.contentDOMElement.dataset.nodeViewContentReact = "", this.contentDOMElement.dataset.nodeViewWrapper = "", this.contentDOMElement.style.whiteSpace = "inherit";
|
|
821
|
-
const i = this.dom.querySelector("[data-node-view-content]");
|
|
822
|
-
if (!i)
|
|
823
|
-
return;
|
|
824
|
-
i.appendChild(this.contentDOMElement);
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
|
-
/**
|
|
828
|
-
* Setup the React component.
|
|
829
|
-
* Called on initialization.
|
|
830
|
-
*/
|
|
831
|
-
mount() {
|
|
832
|
-
const e = {
|
|
833
|
-
editor: this.editor,
|
|
834
|
-
node: this.node,
|
|
835
|
-
decorations: this.decorations,
|
|
836
|
-
innerDecorations: this.innerDecorations,
|
|
837
|
-
view: this.view,
|
|
838
|
-
selected: !1,
|
|
839
|
-
extension: this.extension,
|
|
840
|
-
HTMLAttributes: this.HTMLAttributes,
|
|
841
|
-
getPos: () => this.getPos(),
|
|
842
|
-
updateAttributes: (d = {}) => this.updateAttributes(d),
|
|
843
|
-
deleteNode: () => this.deleteNode(),
|
|
844
|
-
ref: _e()
|
|
845
|
-
};
|
|
846
|
-
if (!this.component.displayName) {
|
|
847
|
-
const d = (c) => c.charAt(0).toUpperCase() + c.substring(1);
|
|
848
|
-
this.component.displayName = d(this.extension.name);
|
|
849
|
-
}
|
|
850
|
-
const i = { onDragStart: this.onDragStart.bind(this), nodeViewContentRef: (d) => {
|
|
851
|
-
d && this.contentDOMElement && d.firstChild !== this.contentDOMElement && (d.hasAttribute("data-node-view-wrapper") && d.removeAttribute("data-node-view-wrapper"), d.appendChild(this.contentDOMElement));
|
|
852
|
-
} }, o = this.component, h = ge((d) => g.createElement(ie.Provider, { value: i }, be(o, d)));
|
|
853
|
-
h.displayName = "ReactNodeView";
|
|
854
|
-
let s = this.node.isInline ? "span" : "div";
|
|
855
|
-
this.options.as && (s = this.options.as);
|
|
856
|
-
const { className: f = "" } = this.options;
|
|
857
|
-
this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this), this.renderer = new Je(h, {
|
|
858
|
-
editor: this.editor,
|
|
859
|
-
props: e,
|
|
860
|
-
as: s,
|
|
861
|
-
className: `node-${this.node.type.name} ${f}`.trim()
|
|
862
|
-
}), this.editor.on("selectionUpdate", this.handleSelectionUpdate), this.updateElementAttributes();
|
|
863
|
-
}
|
|
864
|
-
/**
|
|
865
|
-
* Return the DOM element.
|
|
866
|
-
* This is the element that will be used to display the node view.
|
|
867
|
-
*/
|
|
868
|
-
get dom() {
|
|
869
|
-
var e;
|
|
870
|
-
if (this.renderer.element.firstElementChild && !(!((e = this.renderer.element.firstElementChild) === null || e === void 0) && e.hasAttribute("data-node-view-wrapper")))
|
|
871
|
-
throw Error("Please use the NodeViewWrapper component for your node view.");
|
|
872
|
-
return this.renderer.element;
|
|
873
|
-
}
|
|
874
|
-
/**
|
|
875
|
-
* Return the content DOM element.
|
|
876
|
-
* This is the element that will be used to display the rich-text content of the node.
|
|
877
|
-
*/
|
|
878
|
-
get contentDOM() {
|
|
879
|
-
return this.node.isLeaf ? null : this.contentDOMElement;
|
|
880
|
-
}
|
|
881
|
-
/**
|
|
882
|
-
* On editor selection update, check if the node is selected.
|
|
883
|
-
* If it is, call `selectNode`, otherwise call `deselectNode`.
|
|
884
|
-
*/
|
|
885
|
-
handleSelectionUpdate() {
|
|
886
|
-
const { from: e, to: t } = this.editor.state.selection, r = this.getPos();
|
|
887
|
-
if (typeof r == "number")
|
|
888
|
-
if (e <= r && t >= r + this.node.nodeSize) {
|
|
889
|
-
if (this.renderer.props.selected)
|
|
890
|
-
return;
|
|
891
|
-
this.selectNode();
|
|
892
|
-
} else {
|
|
893
|
-
if (!this.renderer.props.selected)
|
|
894
|
-
return;
|
|
895
|
-
this.deselectNode();
|
|
896
|
-
}
|
|
897
|
-
}
|
|
898
|
-
/**
|
|
899
|
-
* On update, update the React component.
|
|
900
|
-
* To prevent unnecessary updates, the `update` option can be used.
|
|
901
|
-
*/
|
|
902
|
-
update(e, t, r) {
|
|
903
|
-
const i = (o) => {
|
|
904
|
-
this.renderer.updateProps(o), typeof this.options.attrs == "function" && this.updateElementAttributes();
|
|
905
|
-
};
|
|
906
|
-
if (e.type !== this.node.type)
|
|
907
|
-
return !1;
|
|
908
|
-
if (typeof this.options.update == "function") {
|
|
909
|
-
const o = this.node, h = this.decorations, s = this.innerDecorations;
|
|
910
|
-
return this.node = e, this.decorations = t, this.innerDecorations = r, this.options.update({
|
|
911
|
-
oldNode: o,
|
|
912
|
-
oldDecorations: h,
|
|
913
|
-
newNode: e,
|
|
914
|
-
newDecorations: t,
|
|
915
|
-
oldInnerDecorations: s,
|
|
916
|
-
innerDecorations: r,
|
|
917
|
-
updateProps: () => i({ node: e, decorations: t, innerDecorations: r })
|
|
918
|
-
});
|
|
919
|
-
}
|
|
920
|
-
return e === this.node && this.decorations === t && this.innerDecorations === r || (this.node = e, this.decorations = t, this.innerDecorations = r, i({ node: e, decorations: t, innerDecorations: r })), !0;
|
|
921
|
-
}
|
|
922
|
-
/**
|
|
923
|
-
* Select the node.
|
|
924
|
-
* Add the `selected` prop and the `ProseMirror-selectednode` class.
|
|
925
|
-
*/
|
|
926
|
-
selectNode() {
|
|
927
|
-
this.renderer.updateProps({
|
|
928
|
-
selected: !0
|
|
929
|
-
}), this.renderer.element.classList.add("ProseMirror-selectednode");
|
|
930
|
-
}
|
|
931
|
-
/**
|
|
932
|
-
* Deselect the node.
|
|
933
|
-
* Remove the `selected` prop and the `ProseMirror-selectednode` class.
|
|
934
|
-
*/
|
|
935
|
-
deselectNode() {
|
|
936
|
-
this.renderer.updateProps({
|
|
937
|
-
selected: !1
|
|
938
|
-
}), this.renderer.element.classList.remove("ProseMirror-selectednode");
|
|
939
|
-
}
|
|
940
|
-
/**
|
|
941
|
-
* Destroy the React component instance.
|
|
942
|
-
*/
|
|
943
|
-
destroy() {
|
|
944
|
-
this.renderer.destroy(), this.editor.off("selectionUpdate", this.handleSelectionUpdate), this.contentDOMElement = null;
|
|
945
|
-
}
|
|
946
|
-
/**
|
|
947
|
-
* Update the attributes of the top-level element that holds the React component.
|
|
948
|
-
* Applying the attributes defined in the `attrs` option.
|
|
949
|
-
*/
|
|
950
|
-
updateElementAttributes() {
|
|
951
|
-
if (this.options.attrs) {
|
|
952
|
-
let e = {};
|
|
953
|
-
if (typeof this.options.attrs == "function") {
|
|
954
|
-
const t = this.editor.extensionManager.attributes, r = me(this.node, t);
|
|
955
|
-
e = this.options.attrs({ node: this.node, HTMLAttributes: r });
|
|
956
|
-
} else
|
|
957
|
-
e = this.options.attrs;
|
|
958
|
-
this.renderer.updateAttributes(e);
|
|
959
|
-
}
|
|
960
|
-
}
|
|
961
|
-
}
|
|
962
|
-
function ot(n, e) {
|
|
963
|
-
return (t) => t.editor.contentComponent ? new Ye(n, t, e) : {};
|
|
964
|
-
}
|
|
965
|
-
function oe(n) {
|
|
966
|
-
var e, t, r = "";
|
|
967
|
-
if (typeof n == "string" || typeof n == "number") r += n;
|
|
968
|
-
else if (typeof n == "object") if (Array.isArray(n)) {
|
|
969
|
-
var i = n.length;
|
|
970
|
-
for (e = 0; e < i; e++) n[e] && (t = oe(n[e])) && (r && (r += " "), r += t);
|
|
971
|
-
} else for (t in n) n[t] && (r && (r += " "), r += t);
|
|
972
|
-
return r;
|
|
973
|
-
}
|
|
974
|
-
function st() {
|
|
975
|
-
for (var n, e, t = 0, r = "", i = arguments.length; t < i; t++) (n = arguments[t]) && (e = oe(n)) && (r && (r += " "), r += e);
|
|
976
|
-
return r;
|
|
977
|
-
}
|
|
978
|
-
function ke(n) {
|
|
979
|
-
try {
|
|
980
|
-
return JSON.stringify(n);
|
|
981
|
-
} catch {
|
|
982
|
-
return JSON.stringify({});
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
function ut(n, e = !1) {
|
|
986
|
-
return (t) => {
|
|
987
|
-
const r = n.startsWith("data-") ? n : `data-${n}`;
|
|
988
|
-
let i = decodeURIComponent(t.getAttribute(r));
|
|
989
|
-
if (i == null || typeof i == "string" && i === "null")
|
|
990
|
-
try {
|
|
991
|
-
const s = t.outerHTML.match(/([\S\s])+?="([\S\s])+?"/g);
|
|
992
|
-
s && s.length > 0 && (i = (s.map((d) => d.trim()).reduce((d, c) => {
|
|
993
|
-
const u = c.indexOf("="), p = [c.slice(0, u), c.slice(u + 1).slice(1, -1)];
|
|
994
|
-
return d[p[0]] = p[1], d;
|
|
995
|
-
}, {})[n.toLowerCase()] || "").replaceAll(""", '"'));
|
|
996
|
-
} catch (h) {
|
|
997
|
-
console.error("Error getDatasetAttribute ", h.message, t);
|
|
998
|
-
}
|
|
999
|
-
if (e)
|
|
1000
|
-
try {
|
|
1001
|
-
return JSON.parse(i);
|
|
1002
|
-
} catch {
|
|
1003
|
-
return {};
|
|
1004
|
-
}
|
|
1005
|
-
if (i.includes("%") || i.includes("auto"))
|
|
1006
|
-
return i;
|
|
1007
|
-
const o = Number.parseInt(i);
|
|
1008
|
-
return o !== o ? i : o;
|
|
1009
|
-
};
|
|
1010
|
-
}
|
|
1011
|
-
function at(n) {
|
|
1012
|
-
const { attrs: e } = n;
|
|
1013
|
-
return Object.keys(e).reduce((t, r) => {
|
|
1014
|
-
const i = e[r];
|
|
1015
|
-
if (i == null)
|
|
1016
|
-
return t;
|
|
1017
|
-
let o = "";
|
|
1018
|
-
return typeof i == "object" ? o = ke(i) : o = i, t[r] = o, t;
|
|
1019
|
-
}, /* @__PURE__ */ Object.create(null));
|
|
1020
|
-
}
|
|
1021
|
-
export {
|
|
1022
|
-
rt as B,
|
|
1023
|
-
tt as E,
|
|
1024
|
-
it as N,
|
|
1025
|
-
ot as R,
|
|
1026
|
-
Je as a,
|
|
1027
|
-
st as c,
|
|
1028
|
-
ut as g,
|
|
1029
|
-
at as n,
|
|
1030
|
-
nt as u
|
|
1031
|
-
};
|