@clevertask/scribe 0.1.29 → 0.1.31
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 +39 -53
- package/dist/BarMenu-Bm5IfWVV.js +302 -0
- package/dist/components/Menu/BarMenu.d.ts.map +1 -1
- package/dist/components/Menu/BarMenu.js +1 -2
- package/dist/components/Menu/BubbleMenu.js +2 -2
- package/dist/components/Menu/CalloutBubbleMenu.js +2 -2
- package/dist/components/Menu/LinkBubbleMenu.d.ts.map +1 -1
- package/dist/components/Menu/LinkBubbleMenu.js +113 -103
- package/dist/components/Menu/LinkEditor.d.ts +0 -7
- package/dist/components/Menu/LinkEditor.d.ts.map +1 -1
- package/dist/components/Menu/LinkEditor.js +148 -157
- package/dist/components/Menu/Mobile/ListOptionBar.js +1 -1
- package/dist/components/Menu/TableBubbleMenu.js +3 -3
- package/dist/components/Menu/TableHeightSettings.js +3 -11
- package/dist/components/Menu/TableLayoutOptions.js +1 -5
- package/dist/components/Menu/linkBubbleMenuPlugin.d.ts.map +1 -1
- package/dist/components/Menu/linkBubbleMenuPlugin.js +9 -5
- package/dist/components/Scribe/extension/callout.js +7 -7
- package/dist/components/Scribe/extension/emoji/suggest.js +2 -2
- package/dist/components/Scribe/extension/extension-link.js +1 -2
- package/dist/components/Scribe/extension/extension-markdown-paste.js +2 -2
- package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/attributes.d.ts +0 -7
- package/dist/components/Scribe/extension/external-link-preview/attributes.d.ts.map +1 -1
- package/dist/components/Scribe/extension/external-link-preview/attributes.js +26 -51
- package/dist/components/Scribe/extension/external-link-preview/commands.d.ts +5 -12
- package/dist/components/Scribe/extension/external-link-preview/commands.d.ts.map +1 -1
- package/dist/components/Scribe/extension/external-link-preview/commands.js +56 -121
- package/dist/components/Scribe/extension/external-link-preview/index.d.ts +4 -6
- package/dist/components/Scribe/extension/external-link-preview/index.d.ts.map +1 -1
- package/dist/components/Scribe/extension/external-link-preview/index.js +5 -41
- package/dist/components/Scribe/extension/external-link-preview/render-html.d.ts +1 -0
- package/dist/components/Scribe/extension/external-link-preview/render-html.d.ts.map +1 -1
- package/dist/components/Scribe/extension/external-link-preview/render-html.js +17 -60
- package/dist/components/Scribe/extension/external-link-preview/schema.d.ts +2 -2
- package/dist/components/Scribe/extension/external-link-preview/schema.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/serialization.d.ts.map +1 -1
- package/dist/components/Scribe/extension/external-link-preview/serialization.js +29 -51
- package/dist/components/Scribe/extension/external-link-preview/types.d.ts +14 -17
- package/dist/components/Scribe/extension/external-link-preview/types.d.ts.map +1 -1
- package/dist/components/Scribe/extension/index.js +1 -2
- package/dist/components/Scribe/extension/resizable-table.js +2 -2
- package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +10 -14
- package/dist/components/Scribe/extension/slashCommand/index.js +2 -2
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +2 -2
- package/dist/components/Scribe/extension/table-layout.js +1 -2
- package/dist/components/Scribe/extension/tableOfContents.js +1 -1
- package/dist/components/Scribe/index.d.ts +3 -9
- package/dist/components/Scribe/index.d.ts.map +1 -1
- package/dist/components/Scribe/index.js +7 -21
- package/dist/{dist-DnVcys79.js → dist-BoAzo5MN.js} +491 -598
- package/dist/{dist-CDJRm4fL.js → dist-BqlzKS-_.js} +9 -17
- package/dist/{dist-B0xwy1Q5.js → dist-SM4NoN4h.js} +174 -385
- package/dist/document-node-capabilities.js +1 -1
- package/dist/{extension-BPeoqfHR.js → extension-dz0CIf3r.js} +1 -1
- package/dist/extension-link-DxIXGCtV.js +931 -0
- package/dist/{html-to-markdown-DF93it73.js → html-to-markdown-DeRG9OPm.js} +1 -1
- package/dist/main.css +1 -141
- package/dist/main.js +2 -2
- package/dist/{markdown-to-html-BoK5O_j-.js → markdown-to-html-tCPjQ5u6.js} +23 -70
- package/dist/{menus-scgppp2C.js → menus-BKxcTUsl.js} +36 -118
- package/dist/{purify.es-q6CUdJQi.js → purify.es-CSWcs7f1.js} +1 -23
- package/dist/{schema-extensions-ITR9LEgX.js → schema-extensions-B9hR1VrD.js} +1335 -1360
- package/dist/schema-extensions.js +1 -2
- package/dist/schema.js +1 -1
- package/dist/{table-layout-iVolql5p.js → table-layout-ClqaGg1E.js} +36 -36
- package/dist/{tippy.esm-MjWnmeEn.js → tippy.esm-C8V6GlaF.js} +5 -17
- package/dist/utils/create-scribe-editor.d.ts +1 -1
- package/dist/utils/create-scribe-editor.d.ts.map +1 -1
- package/dist/utils/create-scribe-editor.js +1 -2
- package/dist/utils/html-to-markdown.js +1 -2
- package/dist/utils/index.js +4 -4
- package/dist/utils/markdown-to-html.js +1 -2
- package/package.json +10 -10
- package/dist/BarMenu-BC8XoC6e.js +0 -302
- package/dist/components/Menu/ExternalLinkDisplayOptions.d.ts +0 -13
- package/dist/components/Menu/ExternalLinkDisplayOptions.d.ts.map +0 -1
- package/dist/components/Menu/ExternalLinkDisplayOptions.js +0 -90
- package/dist/components/Scribe/extension/external-link-preview/node-view.d.ts +0 -3
- package/dist/components/Scribe/extension/external-link-preview/node-view.d.ts.map +0 -1
- package/dist/components/Scribe/extension/external-link-preview/node-view.js +0 -97
- package/dist/components/Scribe/extension/external-link-preview/normalization.d.ts +0 -7
- package/dist/components/Scribe/extension/external-link-preview/normalization.d.ts.map +0 -1
- package/dist/components/Scribe/extension/external-link-preview/normalization.js +0 -21
- package/dist/components/Scribe/extension/external-link-preview/paste.d.ts +0 -8
- package/dist/components/Scribe/extension/external-link-preview/paste.d.ts.map +0 -1
- package/dist/components/Scribe/extension/external-link-preview/paste.js +0 -53
- package/dist/components/Scribe/extension/external-link-preview/policy.d.ts +0 -7
- package/dist/components/Scribe/extension/external-link-preview/policy.d.ts.map +0 -1
- package/dist/components/Scribe/extension/external-link-preview/policy.js +0 -38
- package/dist/components/Scribe/extension/external-link-preview/resolver.d.ts +0 -23
- package/dist/components/Scribe/extension/external-link-preview/resolver.d.ts.map +0 -1
- package/dist/components/Scribe/extension/external-link-preview/resolver.js +0 -118
- package/dist/extension-link-RvaqaDqr.js +0 -934
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-CtkjhSXr.js";
|
|
2
|
-
import {
|
|
3
|
-
import { Plugin as
|
|
4
|
-
import * as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { Fragment as
|
|
2
|
+
import { L as t, O as n, t as r } from "./dist-BoAzo5MN.js";
|
|
3
|
+
import { Plugin as i, PluginKey as a } from "@tiptap/pm/state";
|
|
4
|
+
import * as o from "react";
|
|
5
|
+
import s, { createContext as c, forwardRef as l, useContext as u, useDebugValue as d, useEffect as f, useLayoutEffect as p, useMemo as m, useRef as h, useState as g, version as _ } from "react";
|
|
6
|
+
import v, { flushSync as y } from "react-dom";
|
|
7
|
+
import { Fragment as b, jsx as x, jsxs as ee } from "react/jsx-runtime";
|
|
8
8
|
//#region builtin:esm-external-require-react
|
|
9
|
-
var
|
|
10
|
-
t.exports = Object.prototype.hasOwnProperty.call(
|
|
11
|
-
})),
|
|
12
|
-
var t =
|
|
9
|
+
var S = /* @__PURE__ */ e(((e, t) => {
|
|
10
|
+
t.exports = Object.prototype.hasOwnProperty.call(o, "module.exports") ? o["module.exports"] : { ...o };
|
|
11
|
+
})), te = /* @__PURE__ */ e(((e) => {
|
|
12
|
+
var t = S();
|
|
13
13
|
function n(e, t) {
|
|
14
14
|
return e === t && (e !== 0 || 1 / e == 1 / t) || e !== e && t !== t;
|
|
15
15
|
}
|
|
@@ -46,7 +46,7 @@ var w = /* @__PURE__ */ e(((e, t) => {
|
|
|
46
46
|
}
|
|
47
47
|
var d = typeof window > "u" || window.document === void 0 || window.document.createElement === void 0 ? u : c;
|
|
48
48
|
e.useSyncExternalStore = t.useSyncExternalStore === void 0 ? d : t.useSyncExternalStore;
|
|
49
|
-
})),
|
|
49
|
+
})), ne = /* @__PURE__ */ e(((e) => {
|
|
50
50
|
process.env.NODE_ENV !== "production" && (function() {
|
|
51
51
|
function t(e, t) {
|
|
52
52
|
return e === t && (e !== 0 || 1 / e == 1 / t) || e !== e && t !== t;
|
|
@@ -89,18 +89,18 @@ var w = /* @__PURE__ */ e(((e, t) => {
|
|
|
89
89
|
return t();
|
|
90
90
|
}
|
|
91
91
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
92
|
-
var a =
|
|
92
|
+
var a = S(), o = typeof Object.is == "function" ? Object.is : t, s = a.useState, c = a.useEffect, l = a.useLayoutEffect, u = a.useDebugValue, d = !1, f = !1, p = typeof window > "u" || window.document === void 0 || window.document.createElement === void 0 ? i : n;
|
|
93
93
|
e.useSyncExternalStore = a.useSyncExternalStore === void 0 ? p : a.useSyncExternalStore, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
94
94
|
})();
|
|
95
|
-
})),
|
|
96
|
-
t.exports = process.env.NODE_ENV === "production" ?
|
|
97
|
-
})),
|
|
98
|
-
function
|
|
95
|
+
})), C = /* @__PURE__ */ e(((e, t) => {
|
|
96
|
+
t.exports = process.env.NODE_ENV === "production" ? te() : ne();
|
|
97
|
+
})), w = C(), { getOwnPropertyNames: re, getOwnPropertySymbols: ie } = Object, { hasOwnProperty: ae } = Object.prototype;
|
|
98
|
+
function T(e, t) {
|
|
99
99
|
return function(n, r, i) {
|
|
100
100
|
return e(n, r, i) && t(n, r, i);
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
|
-
function
|
|
103
|
+
function E(e) {
|
|
104
104
|
return function(t, n, r) {
|
|
105
105
|
if (!t || !n || typeof t != "object" || typeof n != "object") return e(t, n, r);
|
|
106
106
|
let { cache: i } = r, a = i.get(t), o = i.get(n);
|
|
@@ -110,39 +110,39 @@ function D(e) {
|
|
|
110
110
|
return i.delete(t), i.delete(n), s;
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
|
-
function
|
|
113
|
+
function oe(e) {
|
|
114
114
|
return e?.[Symbol.toStringTag];
|
|
115
115
|
}
|
|
116
|
-
function
|
|
117
|
-
return
|
|
116
|
+
function D(e) {
|
|
117
|
+
return re(e).concat(ie(e));
|
|
118
118
|
}
|
|
119
|
-
var
|
|
120
|
-
function
|
|
119
|
+
var se = Object.hasOwn || ((e, t) => ae.call(e, t));
|
|
120
|
+
function O(e, t) {
|
|
121
121
|
return e === t || !e && !t && e !== e && t !== t;
|
|
122
122
|
}
|
|
123
|
-
var
|
|
124
|
-
function
|
|
125
|
-
return e.byteLength === t.byteLength &&
|
|
123
|
+
var ce = "__v", le = "__o", ue = "_owner", { getOwnPropertyDescriptor: k, keys: A } = Object, de = k(Object.getPrototypeOf(Int8Array.prototype), Symbol.toStringTag).get;
|
|
124
|
+
function fe(e, t) {
|
|
125
|
+
return e.byteLength === t.byteLength && R(new Uint8Array(e), new Uint8Array(t));
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function pe(e, t, n) {
|
|
128
128
|
let r = e.length;
|
|
129
129
|
if (t.length !== r) return !1;
|
|
130
130
|
for (; r-- > 0;) if (!n.equals(e[r], t[r], r, r, e, t, n)) return !1;
|
|
131
131
|
return !0;
|
|
132
132
|
}
|
|
133
|
-
function
|
|
134
|
-
return e.byteLength === t.byteLength &&
|
|
133
|
+
function me(e, t) {
|
|
134
|
+
return e.byteLength === t.byteLength && R(new Uint8Array(e.buffer, e.byteOffset, e.byteLength), new Uint8Array(t.buffer, t.byteOffset, t.byteLength));
|
|
135
135
|
}
|
|
136
|
-
function
|
|
137
|
-
return
|
|
136
|
+
function he(e, t) {
|
|
137
|
+
return O(e.getTime(), t.getTime());
|
|
138
138
|
}
|
|
139
|
-
function
|
|
139
|
+
function j(e, t, n) {
|
|
140
140
|
return e.name === t.name && e.message === t.message && e.stack === t.stack && n.equals(e.cause, t.cause, "cause", "cause", e, t, n);
|
|
141
141
|
}
|
|
142
|
-
function
|
|
142
|
+
function ge(e, t) {
|
|
143
143
|
return e === t;
|
|
144
144
|
}
|
|
145
|
-
function
|
|
145
|
+
function M(e, t, n) {
|
|
146
146
|
let r = e.size;
|
|
147
147
|
if (r !== t.size) return !1;
|
|
148
148
|
if (!r) return !0;
|
|
@@ -166,27 +166,27 @@ function N(e, t, n) {
|
|
|
166
166
|
}
|
|
167
167
|
return !0;
|
|
168
168
|
}
|
|
169
|
-
var
|
|
170
|
-
function
|
|
171
|
-
let r =
|
|
172
|
-
if (
|
|
173
|
-
for (; i-- > 0;) if (!
|
|
169
|
+
var _e = O;
|
|
170
|
+
function N(e, t, n) {
|
|
171
|
+
let r = A(e), i = r.length;
|
|
172
|
+
if (A(t).length !== i) return !1;
|
|
173
|
+
for (; i-- > 0;) if (!B(e, t, n, r[i])) return !1;
|
|
174
174
|
return !0;
|
|
175
175
|
}
|
|
176
|
-
function
|
|
177
|
-
let r =
|
|
178
|
-
if (
|
|
176
|
+
function P(e, t, n) {
|
|
177
|
+
let r = D(e), i = r.length;
|
|
178
|
+
if (D(t).length !== i) return !1;
|
|
179
179
|
let a, o, s;
|
|
180
|
-
for (; i-- > 0;) if (a = r[i], !
|
|
180
|
+
for (; i-- > 0;) if (a = r[i], !B(e, t, n, a) || (o = k(e, a), s = k(t, a), (o || s) && (!o || !s || o.configurable !== s.configurable || o.enumerable !== s.enumerable || o.writable !== s.writable))) return !1;
|
|
181
181
|
return !0;
|
|
182
182
|
}
|
|
183
|
-
function
|
|
184
|
-
return
|
|
183
|
+
function F(e, t) {
|
|
184
|
+
return O(e.valueOf(), t.valueOf());
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function I(e, t) {
|
|
187
187
|
return e.source === t.source && e.flags === t.flags;
|
|
188
188
|
}
|
|
189
|
-
function
|
|
189
|
+
function L(e, t, n) {
|
|
190
190
|
let r = e.size;
|
|
191
191
|
if (r !== t.size) return !1;
|
|
192
192
|
if (!r) return !0;
|
|
@@ -204,30 +204,31 @@ function I(e, t, n) {
|
|
|
204
204
|
}
|
|
205
205
|
return !0;
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function R(e, t) {
|
|
208
208
|
let n = e.length;
|
|
209
209
|
if (t.length !== n || e.byteOffset !== t.byteOffset) return !1;
|
|
210
|
-
|
|
210
|
+
let r = de.call(e);
|
|
211
|
+
if (r === "Float64Array" || r === "Float32Array" || r === "Float16Array") {
|
|
211
212
|
for (; n-- > 0;) if (e[n] !== t[n] && (e[n] === e[n] || t[n] === t[n])) return !1;
|
|
212
213
|
return !0;
|
|
213
214
|
}
|
|
214
215
|
for (; n-- > 0;) if (e[n] !== t[n]) return !1;
|
|
215
216
|
return !0;
|
|
216
217
|
}
|
|
217
|
-
function
|
|
218
|
-
return e.href === t.href || e.protocol === t.protocol && e.username === t.username && e.password === t.password && e.host === t.host && e.pathname === t.pathname && e.hash === t.hash &&
|
|
218
|
+
function ve(e, t) {
|
|
219
|
+
return e.href === t.href || e.protocol === t.protocol && e.username === t.username && e.password === t.password && e.host === t.host && e.pathname === t.pathname && e.hash === t.hash && ye(e.searchParams, t.searchParams);
|
|
219
220
|
}
|
|
220
|
-
function
|
|
221
|
+
function ye(e, t) {
|
|
221
222
|
let n = e.toString(), r = t.toString();
|
|
222
|
-
return n === r ||
|
|
223
|
+
return n === r || z(n) === z(r);
|
|
223
224
|
}
|
|
224
|
-
function
|
|
225
|
+
function z(e) {
|
|
225
226
|
return e.split("&").sort().join("&");
|
|
226
227
|
}
|
|
227
|
-
function
|
|
228
|
-
return (r ===
|
|
228
|
+
function B(e, t, n, r) {
|
|
229
|
+
return (r === ue || r === le || r === ce) && (e.$$typeof || t.$$typeof) ? !0 : se(t, r) && n.equals(e[r], t[r], r, r, e, t, n);
|
|
229
230
|
}
|
|
230
|
-
var
|
|
231
|
+
var be = "[object ArrayBuffer]", xe = "[object Arguments]", Se = "[object Boolean]", Ce = "[object DataView]", we = "[object Date]", Te = "[object Error]", Ee = "[object Map]", De = "[object Number]", Oe = "[object Object]", ke = "[object RegExp]", Ae = "[object Set]", je = "[object String]", Me = {
|
|
231
232
|
"[object Int8Array]": !0,
|
|
232
233
|
"[object Uint8Array]": !0,
|
|
233
234
|
"[object Uint8ClampedArray]": !0,
|
|
@@ -240,8 +241,8 @@ var De = "[object ArrayBuffer]", Oe = "[object Arguments]", ke = "[object Boolea
|
|
|
240
241
|
"[object Float64Array]": !0,
|
|
241
242
|
"[object BigInt64Array]": !0,
|
|
242
243
|
"[object BigUint64Array]": !0
|
|
243
|
-
},
|
|
244
|
-
function
|
|
244
|
+
}, Ne = "[object URL]", Pe = Object.prototype.toString;
|
|
245
|
+
function Fe({ areArrayBuffersEqual: e, areArraysEqual: t, areDataViewsEqual: n, areDatesEqual: r, areErrorsEqual: i, areFunctionsEqual: a, areMapsEqual: o, areNumbersEqual: s, areObjectsEqual: c, arePrimitiveWrappersEqual: l, areRegExpsEqual: u, areSetsEqual: d, areTypedArraysEqual: f, areUrlsEqual: p, unknownTagComparators: m }) {
|
|
245
246
|
return function(h, g, _) {
|
|
246
247
|
if (h === g) return !0;
|
|
247
248
|
if (h == null || g == null) return !1;
|
|
@@ -257,23 +258,23 @@ function He({ areArrayBuffersEqual: e, areArraysEqual: t, areDataViewsEqual: n,
|
|
|
257
258
|
if (y === Map) return o(h, g, _);
|
|
258
259
|
if (y === Set) return d(h, g, _);
|
|
259
260
|
if (y == null) return c(h, g, _);
|
|
260
|
-
let b =
|
|
261
|
-
if (b ===
|
|
262
|
-
if (b ===
|
|
263
|
-
if (b ===
|
|
264
|
-
if (b ===
|
|
265
|
-
if (b ===
|
|
266
|
-
if (b ===
|
|
267
|
-
if (b ===
|
|
268
|
-
if (b ===
|
|
269
|
-
if (
|
|
270
|
-
if (b ===
|
|
271
|
-
if (b ===
|
|
272
|
-
if (b ===
|
|
261
|
+
let b = Pe.call(h);
|
|
262
|
+
if (b === we) return r(h, g, _);
|
|
263
|
+
if (b === ke) return u(h, g, _);
|
|
264
|
+
if (b === Ee) return o(h, g, _);
|
|
265
|
+
if (b === Ae) return d(h, g, _);
|
|
266
|
+
if (b === Oe) return typeof h.then != "function" && typeof g.then != "function" && c(h, g, _);
|
|
267
|
+
if (b === Ne) return p(h, g, _);
|
|
268
|
+
if (b === Te) return i(h, g, _);
|
|
269
|
+
if (b === xe) return c(h, g, _);
|
|
270
|
+
if (Me[b]) return f(h, g, _);
|
|
271
|
+
if (b === be) return e(h, g, _);
|
|
272
|
+
if (b === Ce) return n(h, g, _);
|
|
273
|
+
if (b === Se || b === De || b === je) return l(h, g, _);
|
|
273
274
|
if (m) {
|
|
274
275
|
let e = m[b];
|
|
275
276
|
if (!e) {
|
|
276
|
-
let t =
|
|
277
|
+
let t = oe(h);
|
|
277
278
|
t && (e = m[t]);
|
|
278
279
|
}
|
|
279
280
|
if (e) return e(h, g, _);
|
|
@@ -281,26 +282,26 @@ function He({ areArrayBuffersEqual: e, areArraysEqual: t, areDataViewsEqual: n,
|
|
|
281
282
|
return !1;
|
|
282
283
|
};
|
|
283
284
|
}
|
|
284
|
-
function
|
|
285
|
+
function Ie({ circular: e, createCustomConfig: t, strict: n }) {
|
|
285
286
|
let r = {
|
|
286
|
-
areArrayBuffersEqual:
|
|
287
|
-
areArraysEqual: n ?
|
|
288
|
-
areDataViewsEqual:
|
|
289
|
-
areDatesEqual:
|
|
290
|
-
areErrorsEqual: n ?
|
|
291
|
-
areFunctionsEqual:
|
|
292
|
-
areMapsEqual: n ?
|
|
293
|
-
areNumbersEqual:
|
|
294
|
-
areObjectsEqual: n ?
|
|
295
|
-
arePrimitiveWrappersEqual:
|
|
296
|
-
areRegExpsEqual:
|
|
297
|
-
areSetsEqual: n ?
|
|
298
|
-
areTypedArraysEqual: n ?
|
|
299
|
-
areUrlsEqual:
|
|
287
|
+
areArrayBuffersEqual: fe,
|
|
288
|
+
areArraysEqual: n ? P : pe,
|
|
289
|
+
areDataViewsEqual: me,
|
|
290
|
+
areDatesEqual: he,
|
|
291
|
+
areErrorsEqual: n ? T(j, P) : T(j, N),
|
|
292
|
+
areFunctionsEqual: ge,
|
|
293
|
+
areMapsEqual: n ? T(M, P) : M,
|
|
294
|
+
areNumbersEqual: _e,
|
|
295
|
+
areObjectsEqual: n ? P : N,
|
|
296
|
+
arePrimitiveWrappersEqual: F,
|
|
297
|
+
areRegExpsEqual: I,
|
|
298
|
+
areSetsEqual: n ? T(L, P) : L,
|
|
299
|
+
areTypedArraysEqual: n ? T(R, P) : R,
|
|
300
|
+
areUrlsEqual: ve,
|
|
300
301
|
unknownTagComparators: void 0
|
|
301
302
|
};
|
|
302
303
|
if (t && (r = Object.assign({}, r, t(r))), e) {
|
|
303
|
-
let e =
|
|
304
|
+
let e = E(r.areArraysEqual), t = E(r.areErrorsEqual), n = E(r.areMapsEqual), i = E(r.areObjectsEqual), a = E(r.areSetsEqual);
|
|
304
305
|
r = Object.assign({}, r, {
|
|
305
306
|
areArraysEqual: e,
|
|
306
307
|
areErrorsEqual: t,
|
|
@@ -311,12 +312,12 @@ function Ue({ circular: e, createCustomConfig: t, strict: n }) {
|
|
|
311
312
|
}
|
|
312
313
|
return r;
|
|
313
314
|
}
|
|
314
|
-
function
|
|
315
|
+
function Le(e) {
|
|
315
316
|
return function(t, n, r, i, a, o, s) {
|
|
316
317
|
return e(t, n, s);
|
|
317
318
|
};
|
|
318
319
|
}
|
|
319
|
-
function
|
|
320
|
+
function Re({ circular: e, comparator: t, createState: n, equals: r, strict: i }) {
|
|
320
321
|
if (n) return function(a, o) {
|
|
321
322
|
let { cache: s = e ? /* @__PURE__ */ new WeakMap() : void 0, meta: c } = n();
|
|
322
323
|
return t(a, o, {
|
|
@@ -344,35 +345,35 @@ function Ge({ circular: e, comparator: t, createState: n, equals: r, strict: i }
|
|
|
344
345
|
return t(e, n, a);
|
|
345
346
|
};
|
|
346
347
|
}
|
|
347
|
-
var
|
|
348
|
-
|
|
348
|
+
var ze = V();
|
|
349
|
+
V({ strict: !0 }), V({ circular: !0 }), V({
|
|
349
350
|
circular: !0,
|
|
350
351
|
strict: !0
|
|
351
|
-
}),
|
|
352
|
+
}), V({ createInternalComparator: () => O }), V({
|
|
352
353
|
strict: !0,
|
|
353
|
-
createInternalComparator: () =>
|
|
354
|
-
}),
|
|
354
|
+
createInternalComparator: () => O
|
|
355
|
+
}), V({
|
|
355
356
|
circular: !0,
|
|
356
|
-
createInternalComparator: () =>
|
|
357
|
-
}),
|
|
357
|
+
createInternalComparator: () => O
|
|
358
|
+
}), V({
|
|
358
359
|
circular: !0,
|
|
359
|
-
createInternalComparator: () =>
|
|
360
|
+
createInternalComparator: () => O,
|
|
360
361
|
strict: !0
|
|
361
362
|
});
|
|
362
|
-
function
|
|
363
|
-
let { circular: t = !1, createInternalComparator: n, createState: r, strict: i = !1 } = e, a =
|
|
364
|
-
return
|
|
363
|
+
function V(e = {}) {
|
|
364
|
+
let { circular: t = !1, createInternalComparator: n, createState: r, strict: i = !1 } = e, a = Fe(Ie(e));
|
|
365
|
+
return Re({
|
|
365
366
|
circular: t,
|
|
366
367
|
comparator: a,
|
|
367
368
|
createState: r,
|
|
368
|
-
equals: n ? n(a) :
|
|
369
|
+
equals: n ? n(a) : Le(a),
|
|
369
370
|
strict: i
|
|
370
371
|
});
|
|
371
372
|
}
|
|
372
373
|
//#endregion
|
|
373
374
|
//#region node_modules/.pnpm/use-sync-external-store@1.7.0_react@19.2.5/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js
|
|
374
|
-
var
|
|
375
|
-
var t =
|
|
375
|
+
var Be = /* @__PURE__ */ e(((e) => {
|
|
376
|
+
var t = S(), n = C();
|
|
376
377
|
function r(e, t) {
|
|
377
378
|
return e === t && (e !== 0 || 1 / e == 1 / t) || e !== e && t !== t;
|
|
378
379
|
}
|
|
@@ -416,13 +417,13 @@ var qe = /* @__PURE__ */ e(((e) => {
|
|
|
416
417
|
f.hasValue = !0, f.value = p;
|
|
417
418
|
}, [p]), l(p), p;
|
|
418
419
|
};
|
|
419
|
-
})),
|
|
420
|
+
})), Ve = /* @__PURE__ */ e(((e) => {
|
|
420
421
|
process.env.NODE_ENV !== "production" && (function() {
|
|
421
422
|
function t(e, t) {
|
|
422
423
|
return e === t && (e !== 0 || 1 / e == 1 / t) || e !== e && t !== t;
|
|
423
424
|
}
|
|
424
425
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
425
|
-
var n =
|
|
426
|
+
var n = S(), r = C(), i = typeof Object.is == "function" ? Object.is : t, a = r.useSyncExternalStore, o = n.useRef, s = n.useEffect, c = n.useMemo, l = n.useDebugValue;
|
|
426
427
|
e.useSyncExternalStoreWithSelector = function(e, t, n, r, u) {
|
|
427
428
|
var d = o(null);
|
|
428
429
|
if (d.current === null) {
|
|
@@ -463,11 +464,11 @@ var qe = /* @__PURE__ */ e(((e) => {
|
|
|
463
464
|
}, [p]), l(p), p;
|
|
464
465
|
}, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
465
466
|
})();
|
|
466
|
-
})),
|
|
467
|
-
t.exports = process.env.NODE_ENV === "production" ?
|
|
467
|
+
})), He = (/* @__PURE__ */ e(((e, t) => {
|
|
468
|
+
t.exports = process.env.NODE_ENV === "production" ? Be() : Ve();
|
|
468
469
|
})))();
|
|
469
|
-
function
|
|
470
|
-
if (e.isDestroyed ||
|
|
470
|
+
function Ue(e, r) {
|
|
471
|
+
if (e.isDestroyed || r.defaultPrevented || !r.cancelable || !e.isEditable || r.inputType !== "insertParagraph" && r.inputType !== "insertLineBreak" || !t() && !n()) return;
|
|
471
472
|
let i = e.view, a = i.root, o = (a.getSelection?.call(a) ?? i.dom.ownerDocument.getSelection())?.anchorNode, s = (o?.nodeType === 1 ? o : o?.parentElement)?.closest("[data-node-view-content-react]");
|
|
472
473
|
if (!s || !i.dom.contains(s)) return;
|
|
473
474
|
let c = i.input.lastKeyCode;
|
|
@@ -476,21 +477,21 @@ function Xe(e, t) {
|
|
|
476
477
|
key: "Enter",
|
|
477
478
|
code: "Enter",
|
|
478
479
|
keyCode: 13,
|
|
479
|
-
shiftKey:
|
|
480
|
+
shiftKey: r.inputType === "insertLineBreak",
|
|
480
481
|
bubbles: !0,
|
|
481
482
|
cancelable: !0
|
|
482
483
|
});
|
|
483
|
-
i.someProp("handleKeyDown", (e) => e(i, l)) ? (
|
|
484
|
+
i.someProp("handleKeyDown", (e) => e(i, l)) ? (r.preventDefault(), i.input.lastIOSEnter = 0, clearTimeout(i.input.lastIOSEnterFallbackTimeout)) : c === 13 && (i.input.lastKeyCode = c);
|
|
484
485
|
}
|
|
485
|
-
var
|
|
486
|
+
var H = new a("reactMobileEnter"), We = (...e) => (t) => {
|
|
486
487
|
e.forEach((e) => {
|
|
487
488
|
typeof e == "function" ? e(t) : e && (e.current = t);
|
|
488
489
|
});
|
|
489
|
-
},
|
|
490
|
-
let t = (0,
|
|
491
|
-
return /* @__PURE__ */
|
|
490
|
+
}, Ge = ({ contentComponent: e }) => {
|
|
491
|
+
let t = (0, w.useSyncExternalStore)(e.subscribe, e.getSnapshot, e.getServerSnapshot);
|
|
492
|
+
return /* @__PURE__ */ x(b, { children: Object.values(t) });
|
|
492
493
|
};
|
|
493
|
-
function
|
|
494
|
+
function Ke() {
|
|
494
495
|
let e = /* @__PURE__ */ new Set(), t = {}, n = !1, r = () => {
|
|
495
496
|
!n && e.size && (n = !0, queueMicrotask(() => {
|
|
496
497
|
n = !1, e.forEach((e) => e());
|
|
@@ -511,7 +512,7 @@ function $e() {
|
|
|
511
512
|
setRenderer(e, n) {
|
|
512
513
|
t = {
|
|
513
514
|
...t,
|
|
514
|
-
[e]:
|
|
515
|
+
[e]: v.createPortal(n.reactElement, n.element, e)
|
|
515
516
|
}, r();
|
|
516
517
|
},
|
|
517
518
|
removeRenderer(e) {
|
|
@@ -520,9 +521,9 @@ function $e() {
|
|
|
520
521
|
}
|
|
521
522
|
};
|
|
522
523
|
}
|
|
523
|
-
var
|
|
524
|
+
var qe = class extends s.Component {
|
|
524
525
|
constructor(e) {
|
|
525
|
-
super(e), this.editorContentRef =
|
|
526
|
+
super(e), this.editorContentRef = s.createRef();
|
|
526
527
|
}
|
|
527
528
|
componentDidMount() {
|
|
528
529
|
this.init();
|
|
@@ -535,16 +536,16 @@ var et = class extends u.Component {
|
|
|
535
536
|
if (e && !e.isDestroyed && e.view.dom?.parentNode) {
|
|
536
537
|
if (e.contentComponent) return;
|
|
537
538
|
let t = this.editorContentRef.current;
|
|
538
|
-
t.append(...e.view.dom.parentNode.childNodes), e.setOptions({ element: t }), e.contentComponent =
|
|
539
|
-
key:
|
|
540
|
-
props: { handleDOMEvents: { beforeinput: (t, n) =>
|
|
539
|
+
t.append(...e.view.dom.parentNode.childNodes), e.setOptions({ element: t }), e.contentComponent = Ke(), e.createNodeViews(), e.registerPlugin(new i({
|
|
540
|
+
key: H,
|
|
541
|
+
props: { handleDOMEvents: { beforeinput: (t, n) => Ue(e, n) } }
|
|
541
542
|
})), e.isEditorContentInitialized = !0, this.forceUpdate();
|
|
542
543
|
}
|
|
543
544
|
}
|
|
544
545
|
componentWillUnmount() {
|
|
545
546
|
let e = this.props.editor;
|
|
546
547
|
if (e) {
|
|
547
|
-
e.isEditorContentInitialized = !1, e.isDestroyed || (e.unregisterPlugin(
|
|
548
|
+
e.isEditorContentInitialized = !1, e.isDestroyed || (e.unregisterPlugin(H), e.view.setProps({ nodeViews: {} })), e.contentComponent = null;
|
|
548
549
|
try {
|
|
549
550
|
if (!e.view.dom?.parentNode) return;
|
|
550
551
|
let t = document.createElement("div");
|
|
@@ -554,19 +555,19 @@ var et = class extends u.Component {
|
|
|
554
555
|
}
|
|
555
556
|
render() {
|
|
556
557
|
let { editor: e, innerRef: t, ...n } = this.props;
|
|
557
|
-
return /* @__PURE__ */
|
|
558
|
-
ref:
|
|
558
|
+
return /* @__PURE__ */ ee(b, { children: [/* @__PURE__ */ x("div", {
|
|
559
|
+
ref: We(t, this.editorContentRef),
|
|
559
560
|
...n
|
|
560
|
-
}), e?.contentComponent && /* @__PURE__ */
|
|
561
|
+
}), e?.contentComponent && /* @__PURE__ */ x(Ge, { contentComponent: e.contentComponent })] });
|
|
561
562
|
}
|
|
562
|
-
},
|
|
563
|
-
let n =
|
|
564
|
-
return
|
|
563
|
+
}, Je = l((e, t) => {
|
|
564
|
+
let n = s.useMemo(() => Math.floor(Math.random() * 4294967295).toString(), [e.editor]);
|
|
565
|
+
return s.createElement(qe, {
|
|
565
566
|
key: n,
|
|
566
567
|
innerRef: t,
|
|
567
568
|
...e
|
|
568
569
|
});
|
|
569
|
-
}),
|
|
570
|
+
}), U = s.memo(Je), Ye = typeof window < "u" ? p : f, Xe = class {
|
|
570
571
|
constructor(e) {
|
|
571
572
|
this.transactionNumber = 0, this.lastTransactionNumber = 0, this.subscribers = /* @__PURE__ */ new Set(), this.editor = e, this.lastSnapshot = {
|
|
572
573
|
editor: e,
|
|
@@ -574,10 +575,10 @@ var et = class extends u.Component {
|
|
|
574
575
|
}, this.getSnapshot = this.getSnapshot.bind(this), this.getServerSnapshot = this.getServerSnapshot.bind(this), this.watch = this.watch.bind(this), this.subscribe = this.subscribe.bind(this);
|
|
575
576
|
}
|
|
576
577
|
getSnapshot() {
|
|
577
|
-
return this.transactionNumber === this.lastTransactionNumber
|
|
578
|
+
return this.transactionNumber === this.lastTransactionNumber || (this.lastTransactionNumber = this.transactionNumber, this.lastSnapshot = {
|
|
578
579
|
editor: this.editor,
|
|
579
580
|
transactionNumber: this.transactionNumber
|
|
580
|
-
}, this.lastSnapshot
|
|
581
|
+
}), this.lastSnapshot;
|
|
581
582
|
}
|
|
582
583
|
getServerSnapshot() {
|
|
583
584
|
return {
|
|
@@ -601,11 +602,11 @@ var et = class extends u.Component {
|
|
|
601
602
|
}
|
|
602
603
|
}
|
|
603
604
|
};
|
|
604
|
-
function
|
|
605
|
-
let [t] =
|
|
606
|
-
return
|
|
605
|
+
function W(e) {
|
|
606
|
+
let [t] = g(() => new Xe(e.editor)), n = (0, He.useSyncExternalStoreWithSelector)(t.subscribe, t.getSnapshot, t.getServerSnapshot, e.selector, e.equalityFn ?? ze);
|
|
607
|
+
return Ye(() => t.watch(e.editor), [e.editor, t]), d(n), n;
|
|
607
608
|
}
|
|
608
|
-
var
|
|
609
|
+
var G = process.env.NODE_ENV !== "production", K = typeof window > "u", Ze = K || !!(typeof window < "u" && window.next), Qe = class e {
|
|
609
610
|
constructor(e) {
|
|
610
611
|
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);
|
|
611
612
|
}
|
|
@@ -614,7 +615,7 @@ var W = process.env.NODE_ENV !== "production", G = typeof window > "u", it = G |
|
|
|
614
615
|
}
|
|
615
616
|
getInitialEditor() {
|
|
616
617
|
let e = this.options.current.immediatelyRender, t = e ?? !0;
|
|
617
|
-
return
|
|
618
|
+
return K ? (t && G && console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"), t = !1) : Ze && e === void 0 && (t = !1, G && console.warn("Next.js detected. `immediatelyRender` defaults to false to avoid hydration mismatches. Pass `immediatelyRender: true` explicitly if you are rendering the editor only on the client.")), t ? this.createEditor() : null;
|
|
618
619
|
}
|
|
619
620
|
createEditor() {
|
|
620
621
|
let e = {
|
|
@@ -676,7 +677,7 @@ var W = process.env.NODE_ENV !== "production", G = typeof window > "u", it = G |
|
|
|
676
677
|
return (t = this.options.current).onUnmount?.call(t, ...e);
|
|
677
678
|
}
|
|
678
679
|
};
|
|
679
|
-
return new
|
|
680
|
+
return new r(e);
|
|
680
681
|
}
|
|
681
682
|
getEditor() {
|
|
682
683
|
return this.editor;
|
|
@@ -725,32 +726,29 @@ var W = process.env.NODE_ENV !== "production", G = typeof window > "u", it = G |
|
|
|
725
726
|
scheduleDestroy() {
|
|
726
727
|
let e = this.instanceId, t = this.editor;
|
|
727
728
|
this.scheduledDestructionTimeout = setTimeout(() => {
|
|
728
|
-
|
|
729
|
-
t && t.setOptions(this.options.current);
|
|
730
|
-
return;
|
|
731
|
-
}
|
|
732
|
-
t && !t.isDestroyed && (t.destroy(), this.instanceId === e && this.setEditor(null));
|
|
729
|
+
this.isComponentMounted && this.instanceId === e ? t && t.setOptions(this.options.current) : t && !t.isDestroyed && (t.destroy(), this.instanceId === e && this.setEditor(null));
|
|
733
730
|
}, 1);
|
|
734
731
|
}
|
|
735
732
|
};
|
|
736
|
-
function
|
|
737
|
-
let n =
|
|
733
|
+
function $e(e = {}, t = []) {
|
|
734
|
+
let n = h(e);
|
|
738
735
|
n.current = e;
|
|
739
|
-
let [r] =
|
|
740
|
-
return
|
|
736
|
+
let [r] = g(() => new Qe(n)), i = (0, w.useSyncExternalStore)(r.subscribe, r.getEditor, r.getServerSnapshot);
|
|
737
|
+
return d(i), f(r.onRender(t)), W({
|
|
741
738
|
editor: i,
|
|
742
739
|
selector: ({ transactionNumber: t }) => e.shouldRerenderOnTransaction === !1 || e.shouldRerenderOnTransaction === void 0 ? null : e.immediatelyRender && t === 0 ? 0 : t + 1
|
|
743
740
|
}), i;
|
|
744
741
|
}
|
|
745
|
-
var
|
|
746
|
-
|
|
747
|
-
var
|
|
742
|
+
var q = c({ editor: null });
|
|
743
|
+
q.Consumer;
|
|
744
|
+
var et = () => u(q), tt = c({
|
|
748
745
|
onDragStart: () => {},
|
|
749
746
|
nodeViewContentChildren: void 0,
|
|
750
747
|
nodeViewContentRef: () => {}
|
|
751
|
-
}),
|
|
752
|
-
|
|
753
|
-
|
|
748
|
+
}), nt = () => u(tt);
|
|
749
|
+
s.forwardRef((e, t) => {
|
|
750
|
+
let { onDragStart: n } = nt(), r = e.as || "div";
|
|
751
|
+
return /* @__PURE__ */ x(r, {
|
|
754
752
|
...e,
|
|
755
753
|
ref: t,
|
|
756
754
|
"data-node-view-wrapper": "",
|
|
@@ -767,26 +765,26 @@ function J(e) {
|
|
|
767
765
|
function Y(e) {
|
|
768
766
|
return !(typeof e != "object" || !e.$$typeof || e.$$typeof.toString() !== "Symbol(react.forward_ref)" && e.$$typeof.description !== "react.forward_ref");
|
|
769
767
|
}
|
|
770
|
-
function
|
|
768
|
+
function rt(e) {
|
|
771
769
|
return !(typeof e != "object" || !e.$$typeof || e.$$typeof.toString() !== "Symbol(react.memo)" && e.$$typeof.description !== "react.memo");
|
|
772
770
|
}
|
|
773
|
-
function
|
|
771
|
+
function X(e) {
|
|
774
772
|
if (J(e) || Y(e)) return !0;
|
|
775
|
-
if (
|
|
773
|
+
if (rt(e)) {
|
|
776
774
|
let t = e.type;
|
|
777
775
|
if (t) return J(t) || Y(t);
|
|
778
776
|
}
|
|
779
777
|
return !1;
|
|
780
778
|
}
|
|
781
|
-
function
|
|
779
|
+
function it() {
|
|
782
780
|
try {
|
|
783
|
-
if (
|
|
781
|
+
if (_) return parseInt(_.split(".")[0], 10) >= 19;
|
|
784
782
|
} catch {}
|
|
785
783
|
return !1;
|
|
786
784
|
}
|
|
787
|
-
var
|
|
785
|
+
var at = class {
|
|
788
786
|
constructor(e, { editor: t, props: n = {}, as: r = "div", className: i = "" }) {
|
|
789
|
-
this.ref = null, this.destroyed = !1, this.id = Math.floor(Math.random() * 4294967295).toString(), this.component = e, this.editor = t, this.props = n, this.element = document.createElement(r), this.element.classList.add("react-renderer"), i && this.element.classList.add(...i.split(" ")), this.editor.isEditorContentInitialized ?
|
|
787
|
+
this.ref = null, this.destroyed = !1, this.id = Math.floor(Math.random() * 4294967295).toString(), this.component = e, this.editor = t, this.props = n, this.element = document.createElement(r), this.element.classList.add("react-renderer"), i && this.element.classList.add(...i.split(" ")), this.editor.isEditorContentInitialized ? y(() => {
|
|
790
788
|
this.render();
|
|
791
789
|
}) : queueMicrotask(() => {
|
|
792
790
|
this.destroyed || this.render();
|
|
@@ -795,10 +793,10 @@ var X = class {
|
|
|
795
793
|
render() {
|
|
796
794
|
var e;
|
|
797
795
|
if (this.destroyed) return;
|
|
798
|
-
let t = this.component, n = this.props, r = this.editor, i =
|
|
796
|
+
let t = this.component, n = this.props, r = this.editor, i = it(), a = X(t), o = { ...n };
|
|
799
797
|
o.ref && !(i || a) && delete o.ref, !o.ref && (i || a) && (o.ref = (e) => {
|
|
800
798
|
this.ref = e;
|
|
801
|
-
}), this.reactElement = /* @__PURE__ */
|
|
799
|
+
}), this.reactElement = /* @__PURE__ */ x(t, { ...o }), r == null || (e = r.contentComponent) == null || e.setRenderer(this.id, this);
|
|
802
800
|
}
|
|
803
801
|
updateProps(e = {}) {
|
|
804
802
|
if (this.destroyed) return;
|
|
@@ -830,241 +828,32 @@ var X = class {
|
|
|
830
828
|
});
|
|
831
829
|
}
|
|
832
830
|
};
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
var t;
|
|
836
|
-
let n = e.getRootNode(), r = typeof n.getSelection == "function" ? n.getSelection() : (t = e.ownerDocument) == null || (t = t.defaultView) == null ? void 0 : t.getSelection();
|
|
837
|
-
if (!r || r.rangeCount === 0) return null;
|
|
838
|
-
let { anchorNode: i, anchorOffset: a, focusNode: o, focusOffset: s } = r;
|
|
839
|
-
return !i || !o || !e.contains(i) || !e.contains(o) ? null : () => {
|
|
840
|
-
try {
|
|
841
|
-
r.setBaseAndExtent(i, a, o, s);
|
|
842
|
-
} catch {}
|
|
843
|
-
};
|
|
844
|
-
}
|
|
845
|
-
function mt(e, t, n) {
|
|
846
|
-
return e.node(n) === t.node(n) && e.before(n) === t.before(n);
|
|
847
|
-
}
|
|
848
|
-
function Z(e) {
|
|
849
|
-
if (!i(e)) return [];
|
|
850
|
-
let { $from: t, $to: n } = e, r = [], a = Math.min(t.depth, n.depth);
|
|
851
|
-
for (let e = 1; e <= a && mt(t, n, e); e += 1) r.push(t.before(e));
|
|
852
|
-
return r;
|
|
853
|
-
}
|
|
854
|
-
var ht = class {
|
|
855
|
-
constructor(e) {
|
|
856
|
-
this.views = /* @__PURE__ */ new WeakMap(), this.viewCount = 0, this.insideViews = /* @__PURE__ */ new Set(), this.syncQueued = !1, this.scheduleSync = () => {
|
|
857
|
-
this.syncQueued || (this.syncQueued = !0, queueMicrotask(() => {
|
|
858
|
-
this.syncQueued = !1, this.sync();
|
|
859
|
-
}));
|
|
860
|
-
}, this.handleTransaction = () => this.scheduleSync(), this.editor = e;
|
|
861
|
-
}
|
|
862
|
-
register(e) {
|
|
863
|
-
this.viewCount === 0 && this.editor.on("transaction", this.handleTransaction), this.views.set(e.dom, e), this.viewCount += 1, this.scheduleSync();
|
|
864
|
-
}
|
|
865
|
-
unregister(e) {
|
|
866
|
-
this.views.delete(e.dom), --this.viewCount, this.insideViews.delete(e), this.viewCount === 0 && this.editor.off("transaction", this.handleTransaction);
|
|
867
|
-
}
|
|
868
|
-
sync() {
|
|
869
|
-
if (this.viewCount === 0 || this.editor.isDestroyed) return;
|
|
870
|
-
let e = this.findInsideViews();
|
|
871
|
-
this.updateViews(this.insideViews, e, !1), this.updateViews(e, this.insideViews, !0), this.insideViews = e;
|
|
872
|
-
}
|
|
873
|
-
updateViews(e, t, n) {
|
|
874
|
-
for (let r of e) t.has(r) || r.setSelectionInside(n);
|
|
875
|
-
}
|
|
876
|
-
findInsideViews() {
|
|
877
|
-
let e = /* @__PURE__ */ new Set();
|
|
878
|
-
for (let t of Z(this.editor.state.selection)) {
|
|
879
|
-
let n = this.editor.view.nodeDOM(t), r = n ? this.views.get(n) : void 0;
|
|
880
|
-
r && e.add(r);
|
|
881
|
-
}
|
|
882
|
-
return e;
|
|
883
|
-
}
|
|
884
|
-
}, gt = /* @__PURE__ */ new WeakMap();
|
|
885
|
-
function _t(e) {
|
|
886
|
-
let t = gt.get(e);
|
|
887
|
-
return t || (t = new ht(e), gt.set(e, t)), t;
|
|
888
|
-
}
|
|
889
|
-
var vt = class extends a {
|
|
890
|
-
constructor(e, t, n) {
|
|
891
|
-
if (super(e, t, n), this.nodeSelected = !1, this.handlePositionUpdate = () => {
|
|
892
|
-
let e = this.getPos();
|
|
893
|
-
typeof e == "number" && e !== this.currentPos && (this.currentPos = e, this.renderer.updateProps({ getPos: () => this.getPos() }), typeof this.options.attrs == "function" && this.updateElementAttributes());
|
|
894
|
-
}, this.cachedExtensionWithSyncedStorage = null, !this.node.isLeaf) {
|
|
895
|
-
this.contentDOMElement = this.options.contentDOMElementTag ? document.createElement(this.options.contentDOMElementTag) : document.createElement(this.node.isInline ? "span" : "div"), this.contentDOMElement.dataset.nodeViewContentReact = "", this.contentDOMElement.dataset.nodeViewWrapper = "", this.contentDOMElement.style.whiteSpace = "inherit";
|
|
896
|
-
let e = this.dom.querySelector("[data-node-view-content]");
|
|
897
|
-
e ? e.appendChild(this.contentDOMElement) : this.dom.appendChild(this.contentDOMElement);
|
|
898
|
-
}
|
|
899
|
-
this.options.trackNodeViewPosition && this.editor.on("update", this.handlePositionUpdate);
|
|
900
|
-
}
|
|
901
|
-
get extensionWithSyncedStorage() {
|
|
902
|
-
if (!this.cachedExtensionWithSyncedStorage) {
|
|
903
|
-
let e = this.editor, t = this.extension;
|
|
904
|
-
this.cachedExtensionWithSyncedStorage = new Proxy(t, { get(n, r, i) {
|
|
905
|
-
return r === "storage" ? e.storage[t.name] ?? {} : Reflect.get(n, r, i);
|
|
906
|
-
} });
|
|
907
|
-
}
|
|
908
|
-
return this.cachedExtensionWithSyncedStorage;
|
|
909
|
-
}
|
|
910
|
-
mount() {
|
|
911
|
-
let e = {
|
|
912
|
-
editor: this.editor,
|
|
913
|
-
node: this.node,
|
|
914
|
-
decorations: this.decorations,
|
|
915
|
-
innerDecorations: this.innerDecorations,
|
|
916
|
-
view: this.view,
|
|
917
|
-
selected: !1,
|
|
918
|
-
selectionInside: !1,
|
|
919
|
-
extension: this.extensionWithSyncedStorage,
|
|
920
|
-
HTMLAttributes: this.HTMLAttributes,
|
|
921
|
-
getPos: () => this.getPos(),
|
|
922
|
-
updateAttributes: (e = {}) => this.updateAttributes(e),
|
|
923
|
-
deleteNode: () => this.deleteNode(),
|
|
924
|
-
ref: p()
|
|
925
|
-
};
|
|
926
|
-
if (!this.component.displayName) {
|
|
927
|
-
let e = (e) => e.charAt(0).toUpperCase() + e.substring(1);
|
|
928
|
-
this.component.displayName = e(this.extension.name);
|
|
929
|
-
}
|
|
930
|
-
let t = {
|
|
931
|
-
onDragStart: this.onDragStart.bind(this),
|
|
932
|
-
nodeViewContentRef: (e) => {
|
|
933
|
-
if (e && this.contentDOMElement && e.firstChild !== this.contentDOMElement) {
|
|
934
|
-
e.hasAttribute("data-node-view-wrapper") && e.removeAttribute("data-node-view-wrapper");
|
|
935
|
-
let t = pt(this.contentDOMElement);
|
|
936
|
-
e.appendChild(this.contentDOMElement), t?.();
|
|
937
|
-
}
|
|
938
|
-
}
|
|
939
|
-
}, n = this.component, r = h((e) => /* @__PURE__ */ C(q.Provider, {
|
|
940
|
-
value: t,
|
|
941
|
-
children: f(n, e)
|
|
942
|
-
}));
|
|
943
|
-
r.displayName = "ReactNodeView";
|
|
944
|
-
let i = this.node.isInline ? "span" : "div";
|
|
945
|
-
this.options.as && (i = this.options.as);
|
|
946
|
-
let { className: a = "" } = this.options;
|
|
947
|
-
this.renderer = new X(r, {
|
|
948
|
-
editor: this.editor,
|
|
949
|
-
props: e,
|
|
950
|
-
as: i,
|
|
951
|
-
className: `node-${this.node.type.name} ${a}`.trim()
|
|
952
|
-
}), _t(this.editor).register(this), this.updateElementAttributes(), this.currentPos = this.getPos();
|
|
953
|
-
}
|
|
954
|
-
get dom() {
|
|
955
|
-
if (this.renderer.element.firstElementChild && !this.renderer.element.firstElementChild?.hasAttribute("data-node-view-wrapper")) throw Error("Please use the NodeViewWrapper component for your node view.");
|
|
956
|
-
return this.renderer.element;
|
|
957
|
-
}
|
|
958
|
-
get contentDOM() {
|
|
959
|
-
return this.node.isLeaf ? null : this.contentDOMElement;
|
|
960
|
-
}
|
|
961
|
-
update(e, t, n) {
|
|
962
|
-
let r = (e) => {
|
|
963
|
-
this.renderer.updateProps(e), typeof this.options.attrs == "function" && this.updateElementAttributes();
|
|
964
|
-
};
|
|
965
|
-
if (e.type !== this.node.type) return !1;
|
|
966
|
-
if (typeof this.options.update == "function") {
|
|
967
|
-
let i = this.node, a = this.decorations, o = this.innerDecorations;
|
|
968
|
-
return this.node = e, this.decorations = t, this.innerDecorations = n, this.currentPos = this.getPos(), this.options.update({
|
|
969
|
-
oldNode: i,
|
|
970
|
-
oldDecorations: a,
|
|
971
|
-
newNode: e,
|
|
972
|
-
newDecorations: t,
|
|
973
|
-
oldInnerDecorations: o,
|
|
974
|
-
innerDecorations: n,
|
|
975
|
-
updateProps: () => r({
|
|
976
|
-
node: e,
|
|
977
|
-
decorations: t,
|
|
978
|
-
innerDecorations: n,
|
|
979
|
-
extension: this.extensionWithSyncedStorage
|
|
980
|
-
})
|
|
981
|
-
});
|
|
982
|
-
}
|
|
983
|
-
if (e === this.node) return this.node = e, this.decorations = t, this.innerDecorations = n, !0;
|
|
984
|
-
let i = this.getPos();
|
|
985
|
-
this.node = e, this.decorations = t, this.innerDecorations = n, this.currentPos = i;
|
|
986
|
-
let a = {
|
|
987
|
-
node: e,
|
|
988
|
-
decorations: t,
|
|
989
|
-
innerDecorations: n,
|
|
990
|
-
extension: this.extensionWithSyncedStorage
|
|
991
|
-
};
|
|
992
|
-
return this.options.trackNodeViewPosition && (a.getPos = () => this.getPos()), r(a), !0;
|
|
993
|
-
}
|
|
994
|
-
selectNode() {
|
|
995
|
-
this.nodeSelected = !0, this.updateSelectedState(!0);
|
|
996
|
-
}
|
|
997
|
-
deselectNode() {
|
|
998
|
-
this.nodeSelected = !1, this.updateSelectedState(this.options.selectedOnTextSelection === !0 && this.isTextSelectionInside());
|
|
999
|
-
}
|
|
1000
|
-
setSelectionInside(e) {
|
|
1001
|
-
let t = this.nodeSelected || this.options.selectedOnTextSelection === !0 && e;
|
|
1002
|
-
this.renderer.updateProps({
|
|
1003
|
-
selectionInside: e,
|
|
1004
|
-
selected: t
|
|
1005
|
-
}), this.renderer.element.classList.toggle("ProseMirror-selectednode", t);
|
|
1006
|
-
}
|
|
1007
|
-
updateSelectedState(e) {
|
|
1008
|
-
this.renderer.updateProps({ selected: e }), this.renderer.element.classList.toggle("ProseMirror-selectednode", e);
|
|
1009
|
-
}
|
|
1010
|
-
isTextSelectionInside() {
|
|
1011
|
-
let e = this.getPos();
|
|
1012
|
-
return typeof e == "number" && Z(this.editor.state.selection).includes(e);
|
|
1013
|
-
}
|
|
1014
|
-
destroy() {
|
|
1015
|
-
this.renderer.destroy(), _t(this.editor).unregister(this), this.options.trackNodeViewPosition && this.editor.off("update", this.handlePositionUpdate), this.contentDOMElement = null;
|
|
1016
|
-
}
|
|
1017
|
-
updateElementAttributes() {
|
|
1018
|
-
if (this.options.attrs) {
|
|
1019
|
-
let e = {};
|
|
1020
|
-
if (typeof this.options.attrs == "function") {
|
|
1021
|
-
let n = this.editor.extensionManager.attributes, r = t(this.node, n);
|
|
1022
|
-
e = this.options.attrs({
|
|
1023
|
-
node: this.node,
|
|
1024
|
-
HTMLAttributes: r
|
|
1025
|
-
});
|
|
1026
|
-
} else e = this.options.attrs;
|
|
1027
|
-
this.renderer.updateAttributes(e);
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
|
-
};
|
|
1031
|
-
function yt(e, t) {
|
|
1032
|
-
return (n) => n.editor.contentComponent ? new vt(e, n, t) : {
|
|
1033
|
-
dom: document.createElement("span"),
|
|
1034
|
-
contentDOM: null,
|
|
1035
|
-
update: () => !1,
|
|
1036
|
-
destroy: () => {},
|
|
1037
|
-
selectNode: () => {},
|
|
1038
|
-
deselectNode: () => {},
|
|
1039
|
-
stopEvent: () => !1,
|
|
1040
|
-
ignoreMutation: () => !0
|
|
1041
|
-
};
|
|
1042
|
-
}
|
|
1043
|
-
var Q = d({ get editor() {
|
|
831
|
+
s.createContext({ markViewContentRef: () => {} });
|
|
832
|
+
var Z = c({ get editor() {
|
|
1044
833
|
throw Error("useTiptap must be used within a <Tiptap> provider");
|
|
1045
834
|
} });
|
|
1046
|
-
|
|
1047
|
-
var
|
|
1048
|
-
function
|
|
835
|
+
Z.displayName = "TiptapContext";
|
|
836
|
+
var ot = () => u(Z);
|
|
837
|
+
function Q({ children: e, ...t }) {
|
|
1049
838
|
let n = "editor" in t ? t.editor : t.instance;
|
|
1050
839
|
if (!n) throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");
|
|
1051
|
-
let r =
|
|
1052
|
-
return /* @__PURE__ */
|
|
840
|
+
let r = m(() => ({ editor: n }), [n]), i = m(() => ({ editor: n }), [n]);
|
|
841
|
+
return /* @__PURE__ */ x(q.Provider, {
|
|
1053
842
|
value: i,
|
|
1054
|
-
children: /* @__PURE__ */
|
|
843
|
+
children: /* @__PURE__ */ x(Z.Provider, {
|
|
1055
844
|
value: r,
|
|
1056
845
|
children: e
|
|
1057
846
|
})
|
|
1058
847
|
});
|
|
1059
848
|
}
|
|
1060
|
-
|
|
849
|
+
Q.displayName = "Tiptap";
|
|
1061
850
|
function $({ ...e }) {
|
|
1062
|
-
let { editor: t } =
|
|
1063
|
-
return /* @__PURE__ */
|
|
851
|
+
let { editor: t } = ot();
|
|
852
|
+
return /* @__PURE__ */ x(U, {
|
|
1064
853
|
editor: t,
|
|
1065
854
|
...e
|
|
1066
855
|
});
|
|
1067
856
|
}
|
|
1068
|
-
$.displayName = "Tiptap.Content", Object.assign(
|
|
857
|
+
$.displayName = "Tiptap.Content", Object.assign(Q, { Content: $ });
|
|
1069
858
|
//#endregion
|
|
1070
|
-
export {
|
|
859
|
+
export { W as a, $e as i, at as n, et as r, U as t };
|