reactjs-tiptap-editor 0.3.5 → 0.3.7
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/lib/{ActionMenuButton-DocMG_Xt.cjs → ActionMenuButton-CqlhqVIW.cjs} +1 -1
- package/lib/{ActionMenuButton-D9WfF2ep.js → ActionMenuButton-DXwpQHj4.js} +1 -1
- package/lib/Attachment.cjs +1 -1
- package/lib/Attachment.d.cts +13 -13
- package/lib/Attachment.d.ts +13 -13
- package/lib/Attachment.js +3 -3
- package/lib/Blockquote.cjs +1 -1
- package/lib/Blockquote.d.cts +13 -13
- package/lib/Blockquote.d.ts +13 -13
- package/lib/Blockquote.js +2 -2
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.d.cts +13 -13
- package/lib/Bold.d.ts +13 -13
- package/lib/Bold.js +2 -2
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.d.cts +13 -13
- package/lib/BulletList.d.ts +13 -13
- package/lib/BulletList.js +2 -2
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.d.cts +13 -13
- package/lib/Clear.d.ts +13 -13
- package/lib/Clear.js +2 -2
- package/lib/Code.cjs +1 -1
- package/lib/Code.d.cts +13 -13
- package/lib/Code.d.ts +13 -13
- package/lib/Code.js +2 -2
- package/lib/CodeBlock.cjs +1 -1
- package/lib/CodeBlock.d.cts +13 -13
- package/lib/CodeBlock.d.ts +13 -13
- package/lib/CodeBlock.js +3 -3
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.d.cts +13 -13
- package/lib/CodeView.d.ts +13 -13
- package/lib/CodeView.js +2 -2
- package/lib/Color.cjs +1 -1
- package/lib/Color.d.cts +13 -13
- package/lib/Color.d.ts +13 -13
- package/lib/Color.js +3 -3
- package/lib/Document.cjs +1 -1
- package/lib/Document.d.cts +13 -13
- package/lib/Document.d.ts +13 -13
- package/lib/Document.js +1 -1
- package/lib/{Drawer-DdyndCxA.js → Drawer-B6uGc4Ab.js} +3 -3
- package/lib/{Drawer-C6yrcHc7.cjs → Drawer-DBt_aN5x.cjs} +1 -1
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.d.cts +13 -13
- package/lib/Drawer.d.ts +13 -13
- package/lib/Drawer.js +4 -4
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.d.cts +13 -13
- package/lib/Emoji.d.ts +13 -13
- package/lib/Emoji.js +4 -4
- package/lib/{Excalidraw-D5qXWfKq.js → Excalidraw-Bp252YTN.js} +3 -3
- package/lib/{Excalidraw-BS6_3xHm.cjs → Excalidraw-CYLyPnI4.cjs} +1 -1
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.d.cts +13 -13
- package/lib/Excalidraw.d.ts +13 -13
- package/lib/Excalidraw.js +3 -3
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.d.cts +13 -13
- package/lib/ExportPdf.d.ts +13 -13
- package/lib/ExportPdf.js +2 -2
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.d.cts +13 -13
- package/lib/ExportWord.d.ts +13 -13
- package/lib/ExportWord.js +2 -2
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.d.cts +13 -13
- package/lib/FontFamily.d.ts +13 -13
- package/lib/FontFamily.js +4 -4
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.d.cts +13 -13
- package/lib/FontSize.d.ts +13 -13
- package/lib/FontSize.js +3 -3
- package/lib/FormatPainter.cjs +1 -1
- package/lib/FormatPainter.d.cts +13 -13
- package/lib/FormatPainter.d.ts +13 -13
- package/lib/FormatPainter.js +2 -2
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.d.cts +13 -13
- package/lib/Heading.d.ts +13 -13
- package/lib/Heading.js +3 -3
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.d.cts +13 -13
- package/lib/Highlight.d.ts +13 -13
- package/lib/Highlight.js +2 -2
- package/lib/History.cjs +1 -1
- package/lib/History.d.cts +13 -13
- package/lib/History.d.ts +13 -13
- package/lib/History.js +2 -2
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.d.cts +13 -13
- package/lib/HorizontalRule.d.ts +13 -13
- package/lib/HorizontalRule.js +10 -8
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.d.cts +13 -13
- package/lib/Iframe.d.ts +13 -13
- package/lib/Iframe.js +3 -3
- package/lib/Image.cjs +1 -1
- package/lib/Image.d.cts +13 -13
- package/lib/Image.d.ts +13 -13
- package/lib/Image.js +3 -3
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.d.cts +13 -13
- package/lib/ImageGif.d.ts +13 -13
- package/lib/ImageGif.js +3 -3
- package/lib/ImportWord.cjs +2 -2
- package/lib/ImportWord.d.cts +13 -13
- package/lib/ImportWord.d.ts +13 -13
- package/lib/ImportWord.js +4 -4
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.d.cts +13 -13
- package/lib/Indent.d.ts +13 -13
- package/lib/Indent.js +2 -2
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.d.cts +13 -13
- package/lib/Italic.d.ts +13 -13
- package/lib/Italic.js +2 -2
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.d.cts +13 -13
- package/lib/Katex.d.ts +13 -13
- package/lib/Katex.js +4 -4
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.d.cts +13 -13
- package/lib/LineHeight.d.ts +13 -13
- package/lib/LineHeight.js +2 -2
- package/lib/Link.cjs +1 -1
- package/lib/Link.d.cts +13 -13
- package/lib/Link.d.ts +13 -13
- package/lib/Link.js +2 -2
- package/lib/ListItem.cjs +1 -1
- package/lib/ListItem.d.cts +13 -13
- package/lib/ListItem.d.ts +13 -13
- package/lib/ListItem.js +1 -1
- package/lib/Mention.cjs +1 -1
- package/lib/Mention.d.cts +13 -13
- package/lib/Mention.d.ts +13 -13
- package/lib/Mention.js +3 -3
- package/lib/Mermaid.cjs +1 -1
- package/lib/Mermaid.d.cts +13 -13
- package/lib/Mermaid.d.ts +13 -13
- package/lib/Mermaid.js +16 -16
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.d.cts +13 -13
- package/lib/MoreMark.d.ts +13 -13
- package/lib/MoreMark.js +3 -3
- package/lib/MultiColumn.cjs +1 -1
- package/lib/MultiColumn.d.cts +13 -13
- package/lib/MultiColumn.d.ts +13 -13
- package/lib/MultiColumn.js +2 -2
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.d.cts +13 -13
- package/lib/OrderedList.d.ts +13 -13
- package/lib/OrderedList.js +2 -2
- package/lib/{RichTextEditor-DS30aD8t.js → RichTextEditor-BfYZYQb9.js} +899 -905
- package/lib/RichTextEditor-Db6oQoYY.cjs +137 -0
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.d.cts +13 -13
- package/lib/SearchAndReplace.d.ts +13 -13
- package/lib/SearchAndReplace.js +2 -2
- package/lib/Selection.cjs +1 -1
- package/lib/Selection.d.cts +13 -13
- package/lib/Selection.d.ts +13 -13
- package/lib/Selection.js +1 -1
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.d.cts +13 -13
- package/lib/SlashCommand.d.ts +13 -13
- package/lib/SlashCommand.js +4 -4
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.d.cts +13 -13
- package/lib/Strike.d.ts +13 -13
- package/lib/Strike.js +2 -2
- package/lib/SubAndSuperScript.cjs +1 -1
- package/lib/SubAndSuperScript.d.cts +13 -13
- package/lib/SubAndSuperScript.d.ts +13 -13
- package/lib/SubAndSuperScript.js +3 -3
- package/lib/Table.cjs +1 -1
- package/lib/Table.d.cts +13 -13
- package/lib/Table.d.ts +13 -13
- package/lib/Table.js +15 -15
- package/lib/TableOfContent.cjs +1 -1
- package/lib/TableOfContent.d.cts +13 -13
- package/lib/TableOfContent.d.ts +13 -13
- package/lib/TableOfContent.js +3 -3
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.d.cts +13 -13
- package/lib/TaskList.d.ts +13 -13
- package/lib/TaskList.js +2 -2
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.d.cts +13 -13
- package/lib/TextAlign.d.ts +13 -13
- package/lib/TextAlign.js +47 -46
- package/lib/TextBubble.cjs +1 -1
- package/lib/TextBubble.d.cts +13 -13
- package/lib/TextBubble.d.ts +13 -13
- package/lib/TextBubble.js +2 -2
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.d.cts +13 -13
- package/lib/TextDirection.d.ts +13 -13
- package/lib/TextDirection.js +2 -2
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.d.cts +13 -13
- package/lib/TextUnderline.d.ts +13 -13
- package/lib/TextUnderline.js +2 -2
- package/lib/TrailingNode.cjs +1 -1
- package/lib/TrailingNode.d.cts +13 -13
- package/lib/TrailingNode.d.ts +13 -13
- package/lib/TrailingNode.js +1 -1
- package/lib/{Twitter-VKMhfUTN.js → Twitter-CZA9dXpC.js} +44 -44
- package/lib/{Twitter-Dwmo5UJ-.cjs → Twitter-DLO12QnF.cjs} +1 -1
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.d.cts +13 -13
- package/lib/Twitter.d.ts +13 -13
- package/lib/Twitter.js +3 -3
- package/lib/Video.cjs +1 -1
- package/lib/Video.d.cts +13 -13
- package/lib/Video.d.ts +13 -13
- package/lib/Video.js +2 -2
- package/lib/bubble-extra.cjs +1 -1
- package/lib/bubble-extra.d.cts +13 -13
- package/lib/bubble-extra.d.ts +13 -13
- package/lib/bubble-extra.js +6 -6
- package/lib/{dom-dataset-pKb7TLlt.js → dom-dataset-2RXYq9wp.js} +397 -376
- package/lib/dom-dataset-DmsCLv1q.cjs +33 -0
- package/lib/{index-BaTWsqZj.js → index-BGwJ0NfQ.js} +1 -1
- package/lib/{index-Dk3tSDmG.js → index-BkoojfPK.js} +1 -1
- package/lib/{index-COecBbaE.cjs → index-CSvnpArE.cjs} +11 -11
- package/lib/{index-DEe_Svay.js → index-CXIIg9Sq.js} +676 -644
- package/lib/{index-DjP7Onch.cjs → index-CrxasX7b.cjs} +1 -1
- package/lib/{index-CySbCeQd.cjs → index-Cyh1yoFk.cjs} +1 -1
- package/lib/{index-DCFzuS5p.js → index-fKx6CYUM.js} +1 -1
- package/lib/{index-ClFtfQ0J.cjs → index-h9_SDuwc.cjs} +1 -1
- package/lib/index.cjs +1 -1
- package/lib/index.d.cts +13 -13
- package/lib/index.d.ts +13 -13
- package/lib/index.js +27 -27
- package/lib/locale-bundle.d.cts +13 -13
- package/lib/locale-bundle.d.ts +13 -13
- package/lib/{textarea-DITg4shx.js → textarea-BUlQB7hI.js} +1 -1
- package/lib/{textarea-I3qcfzYg.cjs → textarea-ILk3QoYy.cjs} +1 -1
- package/package.json +71 -71
- package/lib/RichTextEditor-CFS3E6GK.cjs +0 -137
- package/lib/dom-dataset-CAXnsjYE.cjs +0 -33
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { P as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
class
|
|
6
|
-
constructor({ editor: e, element: t, view:
|
|
7
|
-
this.preventHide = !1, this.shouldShow = ({ view:
|
|
8
|
-
const { doc:
|
|
9
|
-
return !(!(
|
|
1
|
+
import { P as ue, a as ae, j as de, i as le, p as ce, E as he, k as fe, l as pe, o as me } from "./index-CXIIg9Sq.js";
|
|
2
|
+
import ve from "tippy.js";
|
|
3
|
+
import g, { useRef as Se, useState as F, useDebugValue as k, 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: l, to: d }) => {
|
|
8
|
+
const { doc: u, selection: p } = f, { empty: m } = p, y = !u.textBetween(l, d).length && de(f.selection), S = this.element.contains(document.activeElement);
|
|
9
|
+
return !(!(s.hasFocus() || S) || m || y || !this.editor.isEditable);
|
|
10
10
|
}, this.mousedownHandler = () => {
|
|
11
11
|
this.preventHide = !0;
|
|
12
12
|
}, this.dragstartHandler = () => {
|
|
13
13
|
this.hide();
|
|
14
14
|
}, this.focusHandler = () => {
|
|
15
15
|
setTimeout(() => this.update(this.editor.view));
|
|
16
|
-
}, this.blurHandler = ({ event:
|
|
16
|
+
}, this.blurHandler = ({ event: s }) => {
|
|
17
17
|
var f;
|
|
18
18
|
if (this.preventHide) {
|
|
19
19
|
this.preventHide = !1;
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
}, this.tippyBlurHandler = (
|
|
24
|
-
this.blurHandler({ event:
|
|
25
|
-
}, this.handleDebouncedUpdate = (
|
|
26
|
-
const l = !(f != null && f.selection.eq(
|
|
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 l = !(f != null && f.selection.eq(s.state.selection)), d = !(f != null && f.doc.eq(s.state.doc));
|
|
27
27
|
!l && !d || (this.updateDebounceTimer && clearTimeout(this.updateDebounceTimer), this.updateDebounceTimer = window.setTimeout(() => {
|
|
28
|
-
this.updateHandler(
|
|
28
|
+
this.updateHandler(s, l, d, f);
|
|
29
29
|
}, this.updateDelay));
|
|
30
|
-
}, this.updateHandler = (
|
|
31
|
-
var
|
|
32
|
-
const { state:
|
|
30
|
+
}, this.updateHandler = (s, f, l, d) => {
|
|
31
|
+
var u, p, m;
|
|
32
|
+
const { state: y, composing: S } = s, { selection: E } = y;
|
|
33
33
|
if (S || !f && !l)
|
|
34
34
|
return;
|
|
35
35
|
this.createTooltip();
|
|
36
|
-
const { ranges:
|
|
37
|
-
if (!((
|
|
36
|
+
const { ranges: D } = E, v = Math.min(...D.map((a) => a.$from.pos)), c = Math.max(...D.map((a) => a.$to.pos));
|
|
37
|
+
if (!((u = this.shouldShow) === null || u === void 0 ? void 0 : u.call(this, {
|
|
38
38
|
editor: this.editor,
|
|
39
39
|
element: this.element,
|
|
40
|
-
view:
|
|
41
|
-
state:
|
|
40
|
+
view: s,
|
|
41
|
+
state: y,
|
|
42
42
|
oldState: d,
|
|
43
43
|
from: v,
|
|
44
44
|
to: c
|
|
@@ -46,24 +46,24 @@ class ye {
|
|
|
46
46
|
this.hide();
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
|
-
(
|
|
49
|
+
(p = this.tippy) === null || p === void 0 || p.setProps({
|
|
50
50
|
getReferenceClientRect: ((m = this.tippyOptions) === null || m === void 0 ? void 0 : m.getReferenceClientRect) || (() => {
|
|
51
|
-
if (
|
|
52
|
-
let
|
|
53
|
-
if (
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
56
|
-
return
|
|
51
|
+
if (le(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
57
|
}
|
|
58
58
|
}
|
|
59
|
-
return
|
|
59
|
+
return ce(s, v, c);
|
|
60
60
|
})
|
|
61
61
|
}), this.show();
|
|
62
|
-
}, this.editor = e, this.element = t, this.view =
|
|
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
63
|
}
|
|
64
64
|
createTooltip() {
|
|
65
65
|
const { element: e } = this.editor.options, t = !!e.parentElement;
|
|
66
|
-
this.tippy || !t || (this.tippy =
|
|
66
|
+
this.tippy || !t || (this.tippy = ve(e, {
|
|
67
67
|
duration: 0,
|
|
68
68
|
getReferenceClientRect: null,
|
|
69
69
|
content: this.element,
|
|
@@ -75,13 +75,13 @@ class ye {
|
|
|
75
75
|
}), this.tippy.popper.firstChild && this.tippy.popper.firstChild.addEventListener("blur", this.tippyBlurHandler));
|
|
76
76
|
}
|
|
77
77
|
update(e, t) {
|
|
78
|
-
const { state:
|
|
79
|
-
if (this.updateDelay > 0 &&
|
|
78
|
+
const { state: r } = e, i = r.selection.from !== r.selection.to;
|
|
79
|
+
if (this.updateDelay > 0 && i) {
|
|
80
80
|
this.handleDebouncedUpdate(e, t);
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
|
-
const o = !(t != null && t.selection.eq(e.state.selection)),
|
|
84
|
-
this.updateHandler(e, o,
|
|
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
85
|
}
|
|
86
86
|
show() {
|
|
87
87
|
var e;
|
|
@@ -96,11 +96,11 @@ class ye {
|
|
|
96
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
97
|
}
|
|
98
98
|
}
|
|
99
|
-
const
|
|
100
|
-
key: typeof
|
|
101
|
-
view: (e) => new
|
|
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
102
|
});
|
|
103
|
-
|
|
103
|
+
he.create({
|
|
104
104
|
name: "bubbleMenu",
|
|
105
105
|
addOptions() {
|
|
106
106
|
return {
|
|
@@ -113,7 +113,7 @@ de.create({
|
|
|
113
113
|
},
|
|
114
114
|
addProseMirrorPlugins() {
|
|
115
115
|
return this.options.element ? [
|
|
116
|
-
|
|
116
|
+
ne({
|
|
117
117
|
pluginKey: this.options.pluginKey,
|
|
118
118
|
editor: this.editor,
|
|
119
119
|
element: this.options.element,
|
|
@@ -124,10 +124,10 @@ de.create({
|
|
|
124
124
|
] : [];
|
|
125
125
|
}
|
|
126
126
|
});
|
|
127
|
-
function
|
|
128
|
-
return
|
|
127
|
+
function Ce(n) {
|
|
128
|
+
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
129
129
|
}
|
|
130
|
-
var
|
|
130
|
+
var P = { exports: {} }, I = {};
|
|
131
131
|
/**
|
|
132
132
|
* @license React
|
|
133
133
|
* use-sync-external-store-shim.production.min.js
|
|
@@ -138,39 +138,39 @@ var j = { exports: {} }, I = {};
|
|
|
138
138
|
* LICENSE file in the root directory of this source tree.
|
|
139
139
|
*/
|
|
140
140
|
var z;
|
|
141
|
-
function
|
|
141
|
+
function Re() {
|
|
142
142
|
if (z) return I;
|
|
143
143
|
z = 1;
|
|
144
|
-
var
|
|
145
|
-
function e(
|
|
146
|
-
return
|
|
144
|
+
var n = g;
|
|
145
|
+
function e(u, p) {
|
|
146
|
+
return u === p && (u !== 0 || 1 / u === 1 / p) || u !== u && p !== p;
|
|
147
147
|
}
|
|
148
|
-
var t = typeof Object.is == "function" ? Object.is : e,
|
|
149
|
-
function
|
|
150
|
-
var m =
|
|
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
151
|
return o(function() {
|
|
152
|
-
S.value = m, S.getSnapshot =
|
|
153
|
-
}, [
|
|
154
|
-
return f(S) &&
|
|
155
|
-
f(S) &&
|
|
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
156
|
});
|
|
157
|
-
}, [
|
|
157
|
+
}, [u]), h(m), m;
|
|
158
158
|
}
|
|
159
|
-
function f(
|
|
160
|
-
var
|
|
161
|
-
|
|
159
|
+
function f(u) {
|
|
160
|
+
var p = u.getSnapshot;
|
|
161
|
+
u = u.value;
|
|
162
162
|
try {
|
|
163
|
-
var m =
|
|
164
|
-
return !t(
|
|
163
|
+
var m = p();
|
|
164
|
+
return !t(u, m);
|
|
165
165
|
} catch {
|
|
166
166
|
return !0;
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
function l(
|
|
170
|
-
return
|
|
169
|
+
function l(u, p) {
|
|
170
|
+
return p();
|
|
171
171
|
}
|
|
172
|
-
var d = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? l :
|
|
173
|
-
return I.useSyncExternalStore =
|
|
172
|
+
var d = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? l : s;
|
|
173
|
+
return I.useSyncExternalStore = n.useSyncExternalStore !== void 0 ? n.useSyncExternalStore : d, I;
|
|
174
174
|
}
|
|
175
175
|
var H = {};
|
|
176
176
|
/**
|
|
@@ -183,96 +183,96 @@ var H = {};
|
|
|
183
183
|
* LICENSE file in the root directory of this source tree.
|
|
184
184
|
*/
|
|
185
185
|
var G;
|
|
186
|
-
function
|
|
186
|
+
function Te() {
|
|
187
187
|
return G || (G = 1, process.env.NODE_ENV !== "production" && function() {
|
|
188
188
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
189
|
-
var
|
|
189
|
+
var n = g, e = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
190
190
|
function t(v) {
|
|
191
191
|
{
|
|
192
|
-
for (var c = arguments.length,
|
|
193
|
-
|
|
194
|
-
|
|
192
|
+
for (var c = arguments.length, b = new Array(c > 1 ? c - 1 : 0), a = 1; a < c; a++)
|
|
193
|
+
b[a - 1] = arguments[a];
|
|
194
|
+
r("error", v, b);
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function r(v, c, b) {
|
|
198
198
|
{
|
|
199
|
-
var
|
|
200
|
-
|
|
201
|
-
var w =
|
|
202
|
-
return String(
|
|
199
|
+
var a = e.ReactDebugCurrentFrame, _ = a.getStackAddendum();
|
|
200
|
+
_ !== "" && (c += "%s", b = b.concat([_]));
|
|
201
|
+
var w = b.map(function(O) {
|
|
202
|
+
return String(O);
|
|
203
203
|
});
|
|
204
204
|
w.unshift("Warning: " + c), Function.prototype.apply.call(console[v], console, w);
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function i(v, c) {
|
|
208
208
|
return v === c && (v !== 0 || 1 / v === 1 / c) || v !== v && c !== c;
|
|
209
209
|
}
|
|
210
|
-
var o = typeof Object.is == "function" ? Object.is :
|
|
211
|
-
function
|
|
212
|
-
d ||
|
|
213
|
-
var
|
|
214
|
-
if (!
|
|
215
|
-
var
|
|
216
|
-
o(
|
|
210
|
+
var o = typeof Object.is == "function" ? Object.is : i, h = n.useState, s = n.useEffect, f = n.useLayoutEffect, l = n.useDebugValue, d = !1, u = !1;
|
|
211
|
+
function p(v, c, b) {
|
|
212
|
+
d || n.startTransition !== void 0 && (d = !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 = c();
|
|
214
|
+
if (!u) {
|
|
215
|
+
var _ = c();
|
|
216
|
+
o(a, _) || (t("The result of getSnapshot should be cached to avoid an infinite loop"), u = !0);
|
|
217
217
|
}
|
|
218
|
-
var w =
|
|
218
|
+
var w = h({
|
|
219
219
|
inst: {
|
|
220
|
-
value:
|
|
220
|
+
value: a,
|
|
221
221
|
getSnapshot: c
|
|
222
222
|
}
|
|
223
|
-
}),
|
|
223
|
+
}), O = w[0].inst, R = w[1];
|
|
224
224
|
return f(function() {
|
|
225
|
-
|
|
226
|
-
inst:
|
|
225
|
+
O.value = a, O.getSnapshot = c, m(O) && R({
|
|
226
|
+
inst: O
|
|
227
227
|
});
|
|
228
|
-
}, [v,
|
|
229
|
-
m(
|
|
230
|
-
inst:
|
|
228
|
+
}, [v, a, c]), s(function() {
|
|
229
|
+
m(O) && R({
|
|
230
|
+
inst: O
|
|
231
231
|
});
|
|
232
232
|
var L = function() {
|
|
233
|
-
m(
|
|
234
|
-
inst:
|
|
233
|
+
m(O) && R({
|
|
234
|
+
inst: O
|
|
235
235
|
});
|
|
236
236
|
};
|
|
237
237
|
return v(L);
|
|
238
|
-
}, [v]), l(
|
|
238
|
+
}, [v]), l(a), a;
|
|
239
239
|
}
|
|
240
240
|
function m(v) {
|
|
241
|
-
var c = v.getSnapshot,
|
|
241
|
+
var c = v.getSnapshot, b = v.value;
|
|
242
242
|
try {
|
|
243
|
-
var
|
|
244
|
-
return !o(
|
|
243
|
+
var a = c();
|
|
244
|
+
return !o(b, a);
|
|
245
245
|
} catch {
|
|
246
246
|
return !0;
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
|
-
function
|
|
249
|
+
function y(v, c, b) {
|
|
250
250
|
return c();
|
|
251
251
|
}
|
|
252
|
-
var S = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u",
|
|
253
|
-
H.useSyncExternalStore =
|
|
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
254
|
}()), H;
|
|
255
255
|
}
|
|
256
|
-
process.env.NODE_ENV === "production" ?
|
|
257
|
-
var M =
|
|
258
|
-
const
|
|
259
|
-
|
|
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
260
|
typeof t == "function" ? t(e) : t && (t.current = e);
|
|
261
261
|
});
|
|
262
|
-
},
|
|
263
|
-
const e = M.useSyncExternalStore(
|
|
264
|
-
return
|
|
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
265
|
};
|
|
266
|
-
function
|
|
267
|
-
const
|
|
266
|
+
function Ae() {
|
|
267
|
+
const n = /* @__PURE__ */ new Set();
|
|
268
268
|
let e = {};
|
|
269
269
|
return {
|
|
270
270
|
/**
|
|
271
271
|
* Subscribe to the editor instance's changes.
|
|
272
272
|
*/
|
|
273
273
|
subscribe(t) {
|
|
274
|
-
return
|
|
275
|
-
|
|
274
|
+
return n.add(t), () => {
|
|
275
|
+
n.delete(t);
|
|
276
276
|
};
|
|
277
277
|
},
|
|
278
278
|
getSnapshot() {
|
|
@@ -284,25 +284,25 @@ function Ce() {
|
|
|
284
284
|
/**
|
|
285
285
|
* Adds a new NodeView Renderer to the editor.
|
|
286
286
|
*/
|
|
287
|
-
setRenderer(t,
|
|
287
|
+
setRenderer(t, r) {
|
|
288
288
|
e = {
|
|
289
289
|
...e,
|
|
290
|
-
[t]:
|
|
291
|
-
},
|
|
290
|
+
[t]: Oe.createPortal(r.reactElement, r.element, t)
|
|
291
|
+
}, n.forEach((i) => i());
|
|
292
292
|
},
|
|
293
293
|
/**
|
|
294
294
|
* Removes a NodeView Renderer from the editor.
|
|
295
295
|
*/
|
|
296
296
|
removeRenderer(t) {
|
|
297
|
-
const
|
|
298
|
-
delete
|
|
297
|
+
const r = { ...e };
|
|
298
|
+
delete r[t], e = r, n.forEach((i) => i());
|
|
299
299
|
}
|
|
300
300
|
};
|
|
301
301
|
}
|
|
302
|
-
class
|
|
302
|
+
class Ne extends g.Component {
|
|
303
303
|
constructor(e) {
|
|
304
304
|
var t;
|
|
305
|
-
super(e), this.editorContentRef =
|
|
305
|
+
super(e), this.editorContentRef = g.createRef(), this.initialized = !1, this.state = {
|
|
306
306
|
hasContentComponentInitialized: !!(!((t = e.editor) === null || t === void 0) && t.contentComponent)
|
|
307
307
|
};
|
|
308
308
|
}
|
|
@@ -320,8 +320,8 @@ class De extends y.Component {
|
|
|
320
320
|
const t = this.editorContentRef.current;
|
|
321
321
|
t.append(...e.options.element.childNodes), e.setOptions({
|
|
322
322
|
element: t
|
|
323
|
-
}), e.contentComponent =
|
|
324
|
-
this.setState((
|
|
323
|
+
}), e.contentComponent = Ae(), this.state.hasContentComponentInitialized || (this.unsubscribeToContentComponent = e.contentComponent.subscribe(() => {
|
|
324
|
+
this.setState((r) => r.hasContentComponentInitialized ? r : {
|
|
325
325
|
hasContentComponentInitialized: !0
|
|
326
326
|
}), this.unsubscribeToContentComponent && this.unsubscribeToContentComponent();
|
|
327
327
|
})), e.createNodeViews(), this.initialized = !0;
|
|
@@ -339,69 +339,69 @@ class De extends y.Component {
|
|
|
339
339
|
});
|
|
340
340
|
}
|
|
341
341
|
render() {
|
|
342
|
-
const { editor: e, innerRef: t, ...
|
|
343
|
-
return
|
|
344
|
-
|
|
342
|
+
const { editor: e, innerRef: t, ...r } = this.props;
|
|
343
|
+
return g.createElement(
|
|
344
|
+
g.Fragment,
|
|
345
345
|
null,
|
|
346
|
-
|
|
347
|
-
(e == null ? void 0 : e.contentComponent) &&
|
|
346
|
+
g.createElement("div", { ref: Me(t, this.editorContentRef), ...r }),
|
|
347
|
+
(e == null ? void 0 : e.contentComponent) && g.createElement(Le, { contentComponent: e.contentComponent })
|
|
348
348
|
);
|
|
349
349
|
}
|
|
350
350
|
}
|
|
351
|
-
const
|
|
352
|
-
const t =
|
|
353
|
-
return
|
|
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
354
|
key: t,
|
|
355
355
|
innerRef: e,
|
|
356
|
-
...
|
|
356
|
+
...n
|
|
357
357
|
});
|
|
358
|
-
}),
|
|
359
|
-
var
|
|
358
|
+
}), tt = g.memo(xe);
|
|
359
|
+
var Ve = function n(e, t) {
|
|
360
360
|
if (e === t) return !0;
|
|
361
361
|
if (e && t && typeof e == "object" && typeof t == "object") {
|
|
362
362
|
if (e.constructor !== t.constructor) return !1;
|
|
363
|
-
var
|
|
363
|
+
var r, i, o;
|
|
364
364
|
if (Array.isArray(e)) {
|
|
365
|
-
if (
|
|
366
|
-
for (
|
|
367
|
-
if (!
|
|
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
368
|
return !0;
|
|
369
369
|
}
|
|
370
370
|
if (e instanceof Map && t instanceof Map) {
|
|
371
371
|
if (e.size !== t.size) return !1;
|
|
372
|
-
for (
|
|
373
|
-
if (!t.has(
|
|
374
|
-
for (
|
|
375
|
-
if (!i
|
|
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
376
|
return !0;
|
|
377
377
|
}
|
|
378
378
|
if (e instanceof Set && t instanceof Set) {
|
|
379
379
|
if (e.size !== t.size) return !1;
|
|
380
|
-
for (
|
|
381
|
-
if (!t.has(
|
|
380
|
+
for (i of e.entries())
|
|
381
|
+
if (!t.has(i[0])) return !1;
|
|
382
382
|
return !0;
|
|
383
383
|
}
|
|
384
384
|
if (ArrayBuffer.isView(e) && ArrayBuffer.isView(t)) {
|
|
385
|
-
if (
|
|
386
|
-
for (
|
|
387
|
-
if (e[
|
|
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
388
|
return !0;
|
|
389
389
|
}
|
|
390
390
|
if (e.constructor === RegExp) return e.source === t.source && e.flags === t.flags;
|
|
391
391
|
if (e.valueOf !== Object.prototype.valueOf) return e.valueOf() === t.valueOf();
|
|
392
392
|
if (e.toString !== Object.prototype.toString) return e.toString() === t.toString();
|
|
393
|
-
if (o = Object.keys(e),
|
|
394
|
-
for (
|
|
395
|
-
if (!Object.prototype.hasOwnProperty.call(t, o[
|
|
396
|
-
for (
|
|
397
|
-
var
|
|
398
|
-
if (!(
|
|
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
399
|
return !1;
|
|
400
400
|
}
|
|
401
401
|
return !0;
|
|
402
402
|
}
|
|
403
403
|
return e !== e && t !== t;
|
|
404
|
-
},
|
|
404
|
+
}, Ie = /* @__PURE__ */ Ce(Ve), U = { exports: {} }, B = {};
|
|
405
405
|
/**
|
|
406
406
|
* @license React
|
|
407
407
|
* use-sync-external-store-shim/with-selector.production.min.js
|
|
@@ -411,48 +411,48 @@ var Te = function i(e, t) {
|
|
|
411
411
|
* This source code is licensed under the MIT license found in the
|
|
412
412
|
* LICENSE file in the root directory of this source tree.
|
|
413
413
|
*/
|
|
414
|
-
var
|
|
415
|
-
function
|
|
416
|
-
if (
|
|
417
|
-
|
|
418
|
-
var
|
|
414
|
+
var J;
|
|
415
|
+
function He() {
|
|
416
|
+
if (J) return B;
|
|
417
|
+
J = 1;
|
|
418
|
+
var n = g, e = M;
|
|
419
419
|
function t(l, d) {
|
|
420
420
|
return l === d && (l !== 0 || 1 / l === 1 / d) || l !== l && d !== d;
|
|
421
421
|
}
|
|
422
|
-
var
|
|
423
|
-
return B.useSyncExternalStoreWithSelector = function(l, d,
|
|
424
|
-
var
|
|
425
|
-
if (
|
|
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(l, d, u, p, m) {
|
|
424
|
+
var y = o(null);
|
|
425
|
+
if (y.current === null) {
|
|
426
426
|
var S = { hasValue: !1, value: null };
|
|
427
|
-
|
|
428
|
-
} else S =
|
|
429
|
-
|
|
430
|
-
function
|
|
431
|
-
if (!
|
|
432
|
-
if (
|
|
433
|
-
var
|
|
434
|
-
if (m(
|
|
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 c = _;
|
|
435
435
|
}
|
|
436
|
-
return c =
|
|
436
|
+
return c = a;
|
|
437
437
|
}
|
|
438
|
-
if (
|
|
439
|
-
var w =
|
|
440
|
-
return m !== void 0 && m(
|
|
438
|
+
if (_ = c, r(v, a)) return _;
|
|
439
|
+
var w = p(a);
|
|
440
|
+
return m !== void 0 && m(_, w) ? _ : (v = a, c = w);
|
|
441
441
|
}
|
|
442
|
-
var
|
|
442
|
+
var D = !1, v, c, b = u === void 0 ? null : u;
|
|
443
443
|
return [function() {
|
|
444
|
-
return
|
|
445
|
-
},
|
|
446
|
-
return
|
|
444
|
+
return C(d());
|
|
445
|
+
}, b === null ? void 0 : function() {
|
|
446
|
+
return C(b());
|
|
447
447
|
}];
|
|
448
|
-
}, [d,
|
|
449
|
-
var
|
|
450
|
-
return
|
|
451
|
-
S.hasValue = !0, S.value =
|
|
452
|
-
}, [
|
|
448
|
+
}, [d, u, p, m]);
|
|
449
|
+
var E = i(l, y[0], y[1]);
|
|
450
|
+
return h(function() {
|
|
451
|
+
S.hasValue = !0, S.value = E;
|
|
452
|
+
}, [E]), f(E), E;
|
|
453
453
|
}, B;
|
|
454
454
|
}
|
|
455
|
-
var
|
|
455
|
+
var j = {};
|
|
456
456
|
/**
|
|
457
457
|
* @license React
|
|
458
458
|
* use-sync-external-store-shim/with-selector.development.js
|
|
@@ -462,56 +462,56 @@ var P = {};
|
|
|
462
462
|
* This source code is licensed under the MIT license found in the
|
|
463
463
|
* LICENSE file in the root directory of this source tree.
|
|
464
464
|
*/
|
|
465
|
-
var
|
|
466
|
-
function
|
|
467
|
-
return
|
|
465
|
+
var Y;
|
|
466
|
+
function Be() {
|
|
467
|
+
return Y || (Y = 1, process.env.NODE_ENV !== "production" && function() {
|
|
468
468
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
469
|
-
var
|
|
470
|
-
function t(d,
|
|
471
|
-
return d ===
|
|
469
|
+
var n = g, e = M;
|
|
470
|
+
function t(d, u) {
|
|
471
|
+
return d === u && (d !== 0 || 1 / d === 1 / u) || d !== d && u !== u;
|
|
472
472
|
}
|
|
473
|
-
var
|
|
474
|
-
function l(d,
|
|
475
|
-
var S = o(null),
|
|
476
|
-
S.current === null ? (
|
|
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 l(d, u, p, m, y) {
|
|
475
|
+
var S = o(null), E;
|
|
476
|
+
S.current === null ? (E = {
|
|
477
477
|
hasValue: !1,
|
|
478
478
|
value: null
|
|
479
|
-
}, S.current =
|
|
480
|
-
var
|
|
481
|
-
var
|
|
482
|
-
if (!
|
|
483
|
-
|
|
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
484
|
var A = m(T);
|
|
485
|
-
if (
|
|
486
|
-
var N =
|
|
487
|
-
if (
|
|
488
|
-
return
|
|
485
|
+
if (y !== void 0 && E.hasValue) {
|
|
486
|
+
var N = E.value;
|
|
487
|
+
if (y(N, A))
|
|
488
|
+
return _ = N, N;
|
|
489
489
|
}
|
|
490
|
-
return
|
|
490
|
+
return _ = A, A;
|
|
491
491
|
}
|
|
492
|
-
var
|
|
493
|
-
if (
|
|
492
|
+
var se = a, x = _;
|
|
493
|
+
if (r(se, T))
|
|
494
494
|
return x;
|
|
495
495
|
var V = m(T);
|
|
496
|
-
return
|
|
497
|
-
},
|
|
498
|
-
return w(
|
|
499
|
-
}, L =
|
|
500
|
-
return w(
|
|
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
501
|
};
|
|
502
502
|
return [R, L];
|
|
503
|
-
}, [
|
|
504
|
-
return
|
|
505
|
-
|
|
503
|
+
}, [u, p, m, y]), D = C[0], v = C[1], c = i(d, D, v);
|
|
504
|
+
return h(function() {
|
|
505
|
+
E.hasValue = !0, E.value = c;
|
|
506
506
|
}, [c]), f(c), c;
|
|
507
507
|
}
|
|
508
|
-
|
|
509
|
-
}()),
|
|
508
|
+
j.useSyncExternalStoreWithSelector = l, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
509
|
+
}()), j;
|
|
510
510
|
}
|
|
511
|
-
process.env.NODE_ENV === "production" ? U.exports =
|
|
512
|
-
var
|
|
513
|
-
const
|
|
514
|
-
class
|
|
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
515
|
constructor(e) {
|
|
516
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
517
|
}
|
|
@@ -541,21 +541,21 @@ class Ve {
|
|
|
541
541
|
watch(e) {
|
|
542
542
|
if (this.editor = e, this.editor) {
|
|
543
543
|
const t = () => {
|
|
544
|
-
this.transactionNumber += 1, this.subscribers.forEach((
|
|
545
|
-
},
|
|
546
|
-
return
|
|
547
|
-
|
|
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
548
|
};
|
|
549
549
|
}
|
|
550
550
|
}
|
|
551
551
|
}
|
|
552
|
-
function
|
|
552
|
+
function $e(n) {
|
|
553
553
|
var e;
|
|
554
|
-
const [t] =
|
|
555
|
-
return
|
|
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]), k(r), r;
|
|
556
556
|
}
|
|
557
|
-
const
|
|
558
|
-
class
|
|
557
|
+
const Q = process.env.NODE_ENV !== "production", $ = typeof window > "u", Fe = $ || !!(typeof window < "u" && window.next);
|
|
558
|
+
class W {
|
|
559
559
|
constructor(e) {
|
|
560
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
561
|
}
|
|
@@ -564,8 +564,8 @@ class q {
|
|
|
564
564
|
}
|
|
565
565
|
getInitialEditor() {
|
|
566
566
|
if (this.options.current.immediatelyRender === void 0)
|
|
567
|
-
return
|
|
568
|
-
if (this.options.current.immediatelyRender &&
|
|
567
|
+
return $ || Fe ? (Q && 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 && $ && Q)
|
|
569
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
570
|
return this.options.current.immediatelyRender ? this.createEditor() : null;
|
|
571
571
|
}
|
|
@@ -576,52 +576,52 @@ class q {
|
|
|
576
576
|
const e = {
|
|
577
577
|
...this.options.current,
|
|
578
578
|
// Always call the most recent version of the callback function by default
|
|
579
|
-
onBeforeCreate: (...
|
|
580
|
-
var
|
|
581
|
-
return (o = (
|
|
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
582
|
},
|
|
583
|
-
onBlur: (...
|
|
584
|
-
var
|
|
585
|
-
return (o = (
|
|
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
586
|
},
|
|
587
|
-
onCreate: (...
|
|
588
|
-
var
|
|
589
|
-
return (o = (
|
|
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
590
|
},
|
|
591
|
-
onDestroy: (...
|
|
592
|
-
var
|
|
593
|
-
return (o = (
|
|
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
594
|
},
|
|
595
|
-
onFocus: (...
|
|
596
|
-
var
|
|
597
|
-
return (o = (
|
|
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
598
|
},
|
|
599
|
-
onSelectionUpdate: (...
|
|
600
|
-
var
|
|
601
|
-
return (o = (
|
|
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
602
|
},
|
|
603
|
-
onTransaction: (...
|
|
604
|
-
var
|
|
605
|
-
return (o = (
|
|
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
606
|
},
|
|
607
|
-
onUpdate: (...
|
|
608
|
-
var
|
|
609
|
-
return (o = (
|
|
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
610
|
},
|
|
611
|
-
onContentError: (...
|
|
612
|
-
var
|
|
613
|
-
return (o = (
|
|
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
614
|
},
|
|
615
|
-
onDrop: (...
|
|
616
|
-
var
|
|
617
|
-
return (o = (
|
|
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
618
|
},
|
|
619
|
-
onPaste: (...
|
|
620
|
-
var
|
|
621
|
-
return (o = (
|
|
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
622
|
}
|
|
623
623
|
};
|
|
624
|
-
return new
|
|
624
|
+
return new fe(e);
|
|
625
625
|
}
|
|
626
626
|
/**
|
|
627
627
|
* Get the current editor instance.
|
|
@@ -644,10 +644,10 @@ class q {
|
|
|
644
644
|
};
|
|
645
645
|
}
|
|
646
646
|
static compareOptions(e, t) {
|
|
647
|
-
return Object.keys(e).every((
|
|
648
|
-
var
|
|
649
|
-
return
|
|
650
|
-
}) : e[
|
|
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
651
|
}
|
|
652
652
|
/**
|
|
653
653
|
* On each render, we will create, update, or destroy the editor instance.
|
|
@@ -655,7 +655,7 @@ class q {
|
|
|
655
655
|
* @returns A cleanup function
|
|
656
656
|
*/
|
|
657
657
|
onRender(e) {
|
|
658
|
-
return () => (this.isComponentMounted = !0, clearTimeout(this.scheduledDestructionTimeout), this.editor && !this.editor.isDestroyed && e.length === 0 ?
|
|
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
659
|
...this.options.current,
|
|
660
660
|
editable: this.editor.isEditable
|
|
661
661
|
}) : this.refreshEditorInstance(e), () => {
|
|
@@ -671,7 +671,7 @@ class q {
|
|
|
671
671
|
this.previousDeps = e;
|
|
672
672
|
return;
|
|
673
673
|
}
|
|
674
|
-
if (this.previousDeps.length === e.length && this.previousDeps.every((
|
|
674
|
+
if (this.previousDeps.length === e.length && this.previousDeps.every((r, i) => r === e[i]))
|
|
675
675
|
return;
|
|
676
676
|
}
|
|
677
677
|
this.editor && !this.editor.isDestroyed && this.editor.destroy(), this.setEditor(this.createEditor()), this.previousDeps = e;
|
|
@@ -692,67 +692,87 @@ class q {
|
|
|
692
692
|
}, 1);
|
|
693
693
|
}
|
|
694
694
|
}
|
|
695
|
-
function
|
|
696
|
-
const t =
|
|
697
|
-
t.current =
|
|
698
|
-
const [
|
|
699
|
-
return
|
|
700
|
-
editor:
|
|
701
|
-
selector: ({ transactionNumber: o }) =>
|
|
702
|
-
}),
|
|
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 k(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
703
|
}
|
|
704
|
-
const
|
|
704
|
+
const re = te({
|
|
705
705
|
editor: null
|
|
706
706
|
});
|
|
707
|
-
|
|
708
|
-
const
|
|
709
|
-
const [e, t] =
|
|
710
|
-
return
|
|
711
|
-
var
|
|
712
|
-
if (!e || !((
|
|
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
713
|
return;
|
|
714
|
-
const { pluginKey: o = "bubbleMenu", editor:
|
|
714
|
+
const { pluginKey: o = "bubbleMenu", editor: h, tippyOptions: s = {}, updateDelay: f, shouldShow: l = null } = n, d = h || r;
|
|
715
715
|
if (!d) {
|
|
716
716
|
console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");
|
|
717
717
|
return;
|
|
718
718
|
}
|
|
719
|
-
const
|
|
719
|
+
const u = ne({
|
|
720
720
|
updateDelay: f,
|
|
721
721
|
editor: d,
|
|
722
722
|
element: e,
|
|
723
723
|
pluginKey: o,
|
|
724
724
|
shouldShow: l,
|
|
725
|
-
tippyOptions:
|
|
725
|
+
tippyOptions: s
|
|
726
726
|
});
|
|
727
|
-
return d.registerPlugin(
|
|
727
|
+
return d.registerPlugin(u), () => {
|
|
728
728
|
d.unregisterPlugin(o);
|
|
729
729
|
};
|
|
730
|
-
}, [
|
|
731
|
-
},
|
|
730
|
+
}, [n.editor, r, e]), g.createElement("div", { ref: t, className: n.className, style: { visibility: "hidden" } }, n.children);
|
|
731
|
+
}, ie = te({
|
|
732
732
|
onDragStart: void 0
|
|
733
|
-
}),
|
|
734
|
-
const { onDragStart: t } =
|
|
733
|
+
}), We = () => ee(ie), it = g.forwardRef((n, e) => {
|
|
734
|
+
const { onDragStart: t } = We(), r = n.as || "div";
|
|
735
735
|
return (
|
|
736
736
|
// @ts-ignore
|
|
737
|
-
|
|
737
|
+
g.createElement(r, { ...n, ref: e, "data-node-view-wrapper": "", onDragStart: t, style: {
|
|
738
738
|
whiteSpace: "normal",
|
|
739
|
-
...
|
|
739
|
+
...n.style
|
|
740
740
|
} })
|
|
741
741
|
);
|
|
742
742
|
});
|
|
743
|
-
function
|
|
744
|
-
return !!(typeof
|
|
743
|
+
function X(n) {
|
|
744
|
+
return !!(typeof n == "function" && n.prototype && n.prototype.isReactComponent);
|
|
745
745
|
}
|
|
746
|
-
function
|
|
747
|
-
|
|
748
|
-
|
|
746
|
+
function Z(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 (X(n) || Z(n))
|
|
754
|
+
return !0;
|
|
755
|
+
if (qe(n)) {
|
|
756
|
+
const e = n.type;
|
|
757
|
+
if (e)
|
|
758
|
+
return X(e) || Z(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;
|
|
749
769
|
}
|
|
750
|
-
class
|
|
770
|
+
class Je {
|
|
751
771
|
/**
|
|
752
772
|
* Immediately creates element and renders the provided React component.
|
|
753
773
|
*/
|
|
754
|
-
constructor(e, { editor: t, props:
|
|
755
|
-
this.ref = null, this.id = Math.floor(Math.random() * 4294967295).toString(), this.component = e, this.editor = t, this.props =
|
|
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(() => {
|
|
756
776
|
this.render();
|
|
757
777
|
}) : this.render();
|
|
758
778
|
}
|
|
@@ -761,10 +781,10 @@ class Fe {
|
|
|
761
781
|
*/
|
|
762
782
|
render() {
|
|
763
783
|
var e;
|
|
764
|
-
const t = this.component,
|
|
765
|
-
(
|
|
766
|
-
this.ref =
|
|
767
|
-
}), this.reactElement =
|
|
784
|
+
const t = this.component, r = this.props, i = this.editor, o = Ge(), h = ze(t), s = { ...r };
|
|
785
|
+
s.ref && !(o || h) && delete s.ref, !s.ref && (o || h) && (s.ref = (f) => {
|
|
786
|
+
this.ref = f;
|
|
787
|
+
}), this.reactElement = g.createElement(t, { ...s }), (e = i == null ? void 0 : i.contentComponent) === null || e === void 0 || e.setRenderer(this.id, this);
|
|
768
788
|
}
|
|
769
789
|
/**
|
|
770
790
|
* Re-renders the React component with new props.
|
|
@@ -792,7 +812,7 @@ class Fe {
|
|
|
792
812
|
});
|
|
793
813
|
}
|
|
794
814
|
}
|
|
795
|
-
class
|
|
815
|
+
class Ye extends pe {
|
|
796
816
|
/**
|
|
797
817
|
* Setup the React component.
|
|
798
818
|
* Called on initialization.
|
|
@@ -809,23 +829,24 @@ class Ke extends ce {
|
|
|
809
829
|
HTMLAttributes: this.HTMLAttributes,
|
|
810
830
|
getPos: () => this.getPos(),
|
|
811
831
|
updateAttributes: (l = {}) => this.updateAttributes(l),
|
|
812
|
-
deleteNode: () => this.deleteNode()
|
|
832
|
+
deleteNode: () => this.deleteNode(),
|
|
833
|
+
ref: _e()
|
|
813
834
|
};
|
|
814
835
|
if (!this.component.displayName) {
|
|
815
836
|
const l = (d) => d.charAt(0).toUpperCase() + d.substring(1);
|
|
816
837
|
this.component.displayName = l(this.extension.name);
|
|
817
838
|
}
|
|
818
|
-
const
|
|
839
|
+
const i = { onDragStart: this.onDragStart.bind(this), nodeViewContentRef: (l) => {
|
|
819
840
|
l && this.contentDOMElement && l.firstChild !== this.contentDOMElement && l.appendChild(this.contentDOMElement);
|
|
820
|
-
} }, o = this.component,
|
|
821
|
-
|
|
822
|
-
let
|
|
823
|
-
this.options.as && (
|
|
841
|
+
} }, o = this.component, h = ge((l) => g.createElement(ie.Provider, { value: i }, be(o, l)));
|
|
842
|
+
h.displayName = "ReactNodeView", this.node.isLeaf ? this.contentDOMElement = null : this.options.contentDOMElementTag ? this.contentDOMElement = document.createElement(this.options.contentDOMElementTag) : this.contentDOMElement = document.createElement(this.node.isInline ? "span" : "div"), this.contentDOMElement && (this.contentDOMElement.dataset.nodeViewContentReact = "", this.contentDOMElement.style.whiteSpace = "inherit");
|
|
843
|
+
let s = this.node.isInline ? "span" : "div";
|
|
844
|
+
this.options.as && (s = this.options.as);
|
|
824
845
|
const { className: f = "" } = this.options;
|
|
825
|
-
this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this), this.renderer = new
|
|
846
|
+
this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this), this.renderer = new Je(h, {
|
|
826
847
|
editor: this.editor,
|
|
827
848
|
props: e,
|
|
828
|
-
as:
|
|
849
|
+
as: s,
|
|
829
850
|
className: `node-${this.node.type.name} ${f}`.trim()
|
|
830
851
|
}), this.editor.on("selectionUpdate", this.handleSelectionUpdate), this.updateElementAttributes();
|
|
831
852
|
}
|
|
@@ -851,9 +872,9 @@ class Ke extends ce {
|
|
|
851
872
|
* If it is, call `selectNode`, otherwise call `deselectNode`.
|
|
852
873
|
*/
|
|
853
874
|
handleSelectionUpdate() {
|
|
854
|
-
const { from: e, to: t } = this.editor.state.selection,
|
|
855
|
-
if (typeof
|
|
856
|
-
if (e <=
|
|
875
|
+
const { from: e, to: t } = this.editor.state.selection, r = this.getPos();
|
|
876
|
+
if (typeof r == "number")
|
|
877
|
+
if (e <= r && t >= r + this.node.nodeSize) {
|
|
857
878
|
if (this.renderer.props.selected)
|
|
858
879
|
return;
|
|
859
880
|
this.selectNode();
|
|
@@ -867,25 +888,25 @@ class Ke extends ce {
|
|
|
867
888
|
* On update, update the React component.
|
|
868
889
|
* To prevent unnecessary updates, the `update` option can be used.
|
|
869
890
|
*/
|
|
870
|
-
update(e, t,
|
|
871
|
-
const
|
|
891
|
+
update(e, t, r) {
|
|
892
|
+
const i = (o) => {
|
|
872
893
|
this.renderer.updateProps(o), typeof this.options.attrs == "function" && this.updateElementAttributes();
|
|
873
894
|
};
|
|
874
895
|
if (e.type !== this.node.type)
|
|
875
896
|
return !1;
|
|
876
897
|
if (typeof this.options.update == "function") {
|
|
877
|
-
const o = this.node,
|
|
878
|
-
return this.node = e, this.decorations = t, this.innerDecorations =
|
|
898
|
+
const o = this.node, h = this.decorations, s = this.innerDecorations;
|
|
899
|
+
return this.node = e, this.decorations = t, this.innerDecorations = r, this.options.update({
|
|
879
900
|
oldNode: o,
|
|
880
|
-
oldDecorations:
|
|
901
|
+
oldDecorations: h,
|
|
881
902
|
newNode: e,
|
|
882
903
|
newDecorations: t,
|
|
883
|
-
oldInnerDecorations:
|
|
884
|
-
innerDecorations:
|
|
885
|
-
updateProps: () =>
|
|
904
|
+
oldInnerDecorations: s,
|
|
905
|
+
innerDecorations: r,
|
|
906
|
+
updateProps: () => i({ node: e, decorations: t, innerDecorations: r })
|
|
886
907
|
});
|
|
887
908
|
}
|
|
888
|
-
return e === this.node && this.decorations === t && this.innerDecorations ===
|
|
909
|
+
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;
|
|
889
910
|
}
|
|
890
911
|
/**
|
|
891
912
|
* Select the node.
|
|
@@ -919,81 +940,81 @@ class Ke extends ce {
|
|
|
919
940
|
if (this.options.attrs) {
|
|
920
941
|
let e = {};
|
|
921
942
|
if (typeof this.options.attrs == "function") {
|
|
922
|
-
const t = this.editor.extensionManager.attributes,
|
|
923
|
-
e = this.options.attrs({ node: this.node, HTMLAttributes:
|
|
943
|
+
const t = this.editor.extensionManager.attributes, r = me(this.node, t);
|
|
944
|
+
e = this.options.attrs({ node: this.node, HTMLAttributes: r });
|
|
924
945
|
} else
|
|
925
946
|
e = this.options.attrs;
|
|
926
947
|
this.renderer.updateAttributes(e);
|
|
927
948
|
}
|
|
928
949
|
}
|
|
929
950
|
}
|
|
930
|
-
function
|
|
931
|
-
return (t) => t.editor.contentComponent ? new
|
|
951
|
+
function ot(n, e) {
|
|
952
|
+
return (t) => t.editor.contentComponent ? new Ye(n, t, e) : {};
|
|
932
953
|
}
|
|
933
|
-
function
|
|
934
|
-
var e, t,
|
|
935
|
-
if (typeof
|
|
936
|
-
else if (typeof
|
|
937
|
-
var
|
|
938
|
-
for (e = 0; e <
|
|
939
|
-
} else for (t in
|
|
940
|
-
return
|
|
954
|
+
function oe(n) {
|
|
955
|
+
var e, t, r = "";
|
|
956
|
+
if (typeof n == "string" || typeof n == "number") r += n;
|
|
957
|
+
else if (typeof n == "object") if (Array.isArray(n)) {
|
|
958
|
+
var i = n.length;
|
|
959
|
+
for (e = 0; e < i; e++) n[e] && (t = oe(n[e])) && (r && (r += " "), r += t);
|
|
960
|
+
} else for (t in n) n[t] && (r && (r += " "), r += t);
|
|
961
|
+
return r;
|
|
941
962
|
}
|
|
942
|
-
function
|
|
943
|
-
for (var
|
|
944
|
-
return
|
|
963
|
+
function st() {
|
|
964
|
+
for (var n, e, t = 0, r = "", i = arguments.length; t < i; t++) (n = arguments[t]) && (e = oe(n)) && (r && (r += " "), r += e);
|
|
965
|
+
return r;
|
|
945
966
|
}
|
|
946
|
-
function
|
|
967
|
+
function Qe(n) {
|
|
947
968
|
try {
|
|
948
|
-
return JSON.stringify(
|
|
969
|
+
return JSON.stringify(n);
|
|
949
970
|
} catch {
|
|
950
971
|
return JSON.stringify({});
|
|
951
972
|
}
|
|
952
973
|
}
|
|
953
|
-
function
|
|
974
|
+
function ut(n, e = !1) {
|
|
954
975
|
return (t) => {
|
|
955
|
-
const
|
|
956
|
-
let
|
|
957
|
-
if (
|
|
976
|
+
const r = n.startsWith("data-") ? n : `data-${n}`;
|
|
977
|
+
let i = decodeURIComponent(t.getAttribute(r));
|
|
978
|
+
if (i == null || typeof i == "string" && i === "null")
|
|
958
979
|
try {
|
|
959
|
-
const
|
|
960
|
-
|
|
961
|
-
const
|
|
962
|
-
return l[
|
|
963
|
-
}, {})[
|
|
964
|
-
} catch (
|
|
965
|
-
console.error("Error getDatasetAttribute ",
|
|
980
|
+
const s = t.outerHTML.match(/([\S\s])+?="([\S\s])+?"/g);
|
|
981
|
+
s && s.length > 0 && (i = (s.map((l) => l.trim()).reduce((l, d) => {
|
|
982
|
+
const u = d.indexOf("="), p = [d.slice(0, u), d.slice(u + 1).slice(1, -1)];
|
|
983
|
+
return l[p[0]] = p[1], l;
|
|
984
|
+
}, {})[n.toLowerCase()] || "").replaceAll(""", '"'));
|
|
985
|
+
} catch (h) {
|
|
986
|
+
console.error("Error getDatasetAttribute ", h.message, t);
|
|
966
987
|
}
|
|
967
988
|
if (e)
|
|
968
989
|
try {
|
|
969
|
-
return JSON.parse(
|
|
990
|
+
return JSON.parse(i);
|
|
970
991
|
} catch {
|
|
971
992
|
return {};
|
|
972
993
|
}
|
|
973
|
-
if (
|
|
974
|
-
return
|
|
975
|
-
const o = Number.parseInt(
|
|
976
|
-
return o !== o ?
|
|
994
|
+
if (i.includes("%") || i.includes("auto"))
|
|
995
|
+
return i;
|
|
996
|
+
const o = Number.parseInt(i);
|
|
997
|
+
return o !== o ? i : o;
|
|
977
998
|
};
|
|
978
999
|
}
|
|
979
|
-
function
|
|
980
|
-
const { attrs: e } =
|
|
981
|
-
return Object.keys(e).reduce((t,
|
|
982
|
-
const
|
|
983
|
-
if (
|
|
1000
|
+
function at(n) {
|
|
1001
|
+
const { attrs: e } = n;
|
|
1002
|
+
return Object.keys(e).reduce((t, r) => {
|
|
1003
|
+
const i = e[r];
|
|
1004
|
+
if (i == null)
|
|
984
1005
|
return t;
|
|
985
1006
|
let o = "";
|
|
986
|
-
return typeof
|
|
1007
|
+
return typeof i == "object" ? o = Qe(i) : o = i, t[r] = o, t;
|
|
987
1008
|
}, /* @__PURE__ */ Object.create(null));
|
|
988
1009
|
}
|
|
989
1010
|
export {
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
1011
|
+
rt as B,
|
|
1012
|
+
tt as E,
|
|
1013
|
+
it as N,
|
|
1014
|
+
ot as R,
|
|
1015
|
+
Je as a,
|
|
1016
|
+
st as c,
|
|
1017
|
+
ut as g,
|
|
1018
|
+
at as n,
|
|
1019
|
+
nt as u
|
|
999
1020
|
};
|