@clevertask/scribe 0.1.28 → 0.1.30
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 +30 -47
- package/dist/BarMenu-Bban-B3t.js +302 -0
- package/dist/assets/index.css +1 -1
- package/dist/components/Menu/BarMenu.d.ts.map +1 -1
- package/dist/components/Menu/BarMenu.js +1 -1
- 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 +107 -119
- 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 +152 -153
- package/dist/components/Menu/Mobile/ListOptionBar.js +1 -1
- package/dist/components/Menu/TableBubbleMenu.js +3 -3
- package/dist/components/Menu/TableHeightSettings.js +1 -1
- 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 +5 -5
- package/dist/components/Scribe/extension/emoji/suggest.js +1 -1
- package/dist/components/Scribe/extension/extension-link.js +1 -1
- package/dist/components/Scribe/extension/extension-markdown-paste.js +1 -1
- 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 -45
- 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 -1
- package/dist/components/Scribe/extension/resizable-table.js +2 -2
- package/dist/components/Scribe/extension/slashCommand/index.js +2 -2
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +1 -1
- package/dist/components/Scribe/extension/table-layout.js +1 -1
- 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 +3 -3
- package/dist/{dist-xjmWZ-oh.js → dist-DGEcUiqG.js} +650 -686
- package/dist/{dist-Dk0fXvrc.js → dist-TKt66Yz8.js} +2 -2
- package/dist/{dist-BiognBi4.js → dist-ZGDUiMX8.js} +189 -376
- package/dist/document-node-capabilities.js +1 -1
- package/dist/{extension-BU2USLV1.js → extension-I7Ocj_D_.js} +2 -2
- package/dist/extension-link-Cb1UO6hv.js +939 -0
- package/dist/main.css +0 -141
- package/dist/{menus-BDXjZsFU.js → menus-BrQTLTFL.js} +17 -17
- package/dist/{schema-extensions-DyCk1Goa.js → schema-extensions-CzDKrIf8.js} +1616 -1489
- package/dist/schema-extensions.js +1 -1
- package/dist/schema.js +1 -1
- package/dist/{table-layout-BoDS50DR.js → table-layout-Dt7KmVp_.js} +174 -123
- package/dist/utils/create-scribe-editor.d.ts +1 -1
- package/dist/utils/create-scribe-editor.d.ts.map +1 -1
- package/dist/utils/index.js +2 -2
- package/package.json +51 -51
- package/dist/BarMenu-BGWT4Oyk.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-DmM_EJTn.js +0 -909
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-CtkjhSXr.js";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
2
|
+
import { L as t, O as n, t as r } from "./dist-DGEcUiqG.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";
|
|
7
8
|
//#region builtin:esm-external-require-react
|
|
8
|
-
var
|
|
9
|
-
t.exports = Object.prototype.hasOwnProperty.call(
|
|
10
|
-
})),
|
|
11
|
-
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();
|
|
12
13
|
function n(e, t) {
|
|
13
14
|
return e === t && (e !== 0 || 1 / e == 1 / t) || e !== e && t !== t;
|
|
14
15
|
}
|
|
@@ -45,7 +46,7 @@ var C = /* @__PURE__ */ e(((e, t) => {
|
|
|
45
46
|
}
|
|
46
47
|
var d = typeof window > "u" || window.document === void 0 || window.document.createElement === void 0 ? u : c;
|
|
47
48
|
e.useSyncExternalStore = t.useSyncExternalStore === void 0 ? d : t.useSyncExternalStore;
|
|
48
|
-
})),
|
|
49
|
+
})), ne = /* @__PURE__ */ e(((e) => {
|
|
49
50
|
process.env.NODE_ENV !== "production" && (function() {
|
|
50
51
|
function t(e, t) {
|
|
51
52
|
return e === t && (e !== 0 || 1 / e == 1 / t) || e !== e && t !== t;
|
|
@@ -88,18 +89,18 @@ var C = /* @__PURE__ */ e(((e, t) => {
|
|
|
88
89
|
return t();
|
|
89
90
|
}
|
|
90
91
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
91
|
-
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;
|
|
92
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());
|
|
93
94
|
})();
|
|
94
|
-
})),
|
|
95
|
-
t.exports = process.env.NODE_ENV === "production" ?
|
|
96
|
-
})),
|
|
97
|
-
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) {
|
|
98
99
|
return function(n, r, i) {
|
|
99
100
|
return e(n, r, i) && t(n, r, i);
|
|
100
101
|
};
|
|
101
102
|
}
|
|
102
|
-
function
|
|
103
|
+
function E(e) {
|
|
103
104
|
return function(t, n, r) {
|
|
104
105
|
if (!t || !n || typeof t != "object" || typeof n != "object") return e(t, n, r);
|
|
105
106
|
let { cache: i } = r, a = i.get(t), o = i.get(n);
|
|
@@ -109,39 +110,39 @@ function D(e) {
|
|
|
109
110
|
return i.delete(t), i.delete(n), s;
|
|
110
111
|
};
|
|
111
112
|
}
|
|
112
|
-
function
|
|
113
|
+
function oe(e) {
|
|
113
114
|
return e?.[Symbol.toStringTag];
|
|
114
115
|
}
|
|
115
|
-
function
|
|
116
|
-
return
|
|
116
|
+
function D(e) {
|
|
117
|
+
return re(e).concat(ie(e));
|
|
117
118
|
}
|
|
118
|
-
var
|
|
119
|
-
function
|
|
119
|
+
var se = Object.hasOwn || ((e, t) => ae.call(e, t));
|
|
120
|
+
function O(e, t) {
|
|
120
121
|
return e === t || !e && !t && e !== e && t !== t;
|
|
121
122
|
}
|
|
122
|
-
var
|
|
123
|
-
function
|
|
124
|
-
return e.byteLength === t.byteLength &&
|
|
123
|
+
var ce = "__v", le = "__o", ue = "_owner", de = typeof Float16Array < "u", { getOwnPropertyDescriptor: k, keys: A } = Object;
|
|
124
|
+
function fe(e, t) {
|
|
125
|
+
return e.byteLength === t.byteLength && R(new Uint8Array(e), new Uint8Array(t));
|
|
125
126
|
}
|
|
126
|
-
function
|
|
127
|
+
function pe(e, t, n) {
|
|
127
128
|
let r = e.length;
|
|
128
129
|
if (t.length !== r) return !1;
|
|
129
130
|
for (; r-- > 0;) if (!n.equals(e[r], t[r], r, r, e, t, n)) return !1;
|
|
130
131
|
return !0;
|
|
131
132
|
}
|
|
132
|
-
function
|
|
133
|
-
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));
|
|
134
135
|
}
|
|
135
|
-
function
|
|
136
|
-
return
|
|
136
|
+
function he(e, t) {
|
|
137
|
+
return O(e.getTime(), t.getTime());
|
|
137
138
|
}
|
|
138
|
-
function
|
|
139
|
+
function j(e, t, n) {
|
|
139
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);
|
|
140
141
|
}
|
|
141
|
-
function
|
|
142
|
+
function ge(e, t) {
|
|
142
143
|
return e === t;
|
|
143
144
|
}
|
|
144
|
-
function
|
|
145
|
+
function M(e, t, n) {
|
|
145
146
|
let r = e.size;
|
|
146
147
|
if (r !== t.size) return !1;
|
|
147
148
|
if (!r) return !0;
|
|
@@ -165,27 +166,27 @@ function N(e, t, n) {
|
|
|
165
166
|
}
|
|
166
167
|
return !0;
|
|
167
168
|
}
|
|
168
|
-
var
|
|
169
|
-
function
|
|
170
|
-
let r =
|
|
171
|
-
if (
|
|
172
|
-
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;
|
|
173
174
|
return !0;
|
|
174
175
|
}
|
|
175
|
-
function
|
|
176
|
-
let r =
|
|
177
|
-
if (
|
|
176
|
+
function P(e, t, n) {
|
|
177
|
+
let r = D(e), i = r.length;
|
|
178
|
+
if (D(t).length !== i) return !1;
|
|
178
179
|
let a, o, s;
|
|
179
|
-
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;
|
|
180
181
|
return !0;
|
|
181
182
|
}
|
|
182
|
-
function
|
|
183
|
-
return
|
|
183
|
+
function F(e, t) {
|
|
184
|
+
return O(e.valueOf(), t.valueOf());
|
|
184
185
|
}
|
|
185
|
-
function
|
|
186
|
+
function I(e, t) {
|
|
186
187
|
return e.source === t.source && e.flags === t.flags;
|
|
187
188
|
}
|
|
188
|
-
function
|
|
189
|
+
function L(e, t, n) {
|
|
189
190
|
let r = e.size;
|
|
190
191
|
if (r !== t.size) return !1;
|
|
191
192
|
if (!r) return !0;
|
|
@@ -203,30 +204,30 @@ function I(e, t, n) {
|
|
|
203
204
|
}
|
|
204
205
|
return !0;
|
|
205
206
|
}
|
|
206
|
-
function
|
|
207
|
+
function R(e, t) {
|
|
207
208
|
let n = e.length;
|
|
208
209
|
if (t.length !== n || e.byteOffset !== t.byteOffset) return !1;
|
|
209
|
-
if (e instanceof Float64Array || e instanceof Float32Array ||
|
|
210
|
+
if (e instanceof Float64Array || e instanceof Float32Array || de && e instanceof Float16Array) {
|
|
210
211
|
for (; n-- > 0;) if (e[n] !== t[n] && (e[n] === e[n] || t[n] === t[n])) return !1;
|
|
211
212
|
return !0;
|
|
212
213
|
}
|
|
213
214
|
for (; n-- > 0;) if (e[n] !== t[n]) return !1;
|
|
214
215
|
return !0;
|
|
215
216
|
}
|
|
216
|
-
function
|
|
217
|
-
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 &&
|
|
217
|
+
function ve(e, t) {
|
|
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 && ye(e.searchParams, t.searchParams);
|
|
218
219
|
}
|
|
219
|
-
function
|
|
220
|
+
function ye(e, t) {
|
|
220
221
|
let n = e.toString(), r = t.toString();
|
|
221
|
-
return n === r ||
|
|
222
|
+
return n === r || z(n) === z(r);
|
|
222
223
|
}
|
|
223
|
-
function
|
|
224
|
+
function z(e) {
|
|
224
225
|
return e.split("&").sort().join("&");
|
|
225
226
|
}
|
|
226
|
-
function
|
|
227
|
-
return (r ===
|
|
227
|
+
function B(e, t, n, r) {
|
|
228
|
+
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);
|
|
228
229
|
}
|
|
229
|
-
var
|
|
230
|
+
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 = {
|
|
230
231
|
"[object Int8Array]": !0,
|
|
231
232
|
"[object Uint8Array]": !0,
|
|
232
233
|
"[object Uint8ClampedArray]": !0,
|
|
@@ -239,8 +240,8 @@ var Ce = "[object ArrayBuffer]", we = "[object Arguments]", Te = "[object Boolea
|
|
|
239
240
|
"[object Float64Array]": !0,
|
|
240
241
|
"[object BigInt64Array]": !0,
|
|
241
242
|
"[object BigUint64Array]": !0
|
|
242
|
-
},
|
|
243
|
-
function
|
|
243
|
+
}, Ne = "[object URL]", Pe = Object.prototype.toString;
|
|
244
|
+
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 }) {
|
|
244
245
|
return function(h, g, _) {
|
|
245
246
|
if (h === g) return !0;
|
|
246
247
|
if (h == null || g == null) return !1;
|
|
@@ -256,23 +257,23 @@ function Re({ areArrayBuffersEqual: e, areArraysEqual: t, areDataViewsEqual: n,
|
|
|
256
257
|
if (y === Map) return o(h, g, _);
|
|
257
258
|
if (y === Set) return d(h, g, _);
|
|
258
259
|
if (y == null) return c(h, g, _);
|
|
259
|
-
let b =
|
|
260
|
-
if (b ===
|
|
261
|
-
if (b ===
|
|
262
|
-
if (b ===
|
|
263
|
-
if (b ===
|
|
264
|
-
if (b ===
|
|
265
|
-
if (b ===
|
|
266
|
-
if (b ===
|
|
267
|
-
if (b ===
|
|
268
|
-
if (
|
|
269
|
-
if (b ===
|
|
270
|
-
if (b ===
|
|
271
|
-
if (b ===
|
|
260
|
+
let b = Pe.call(h);
|
|
261
|
+
if (b === we) return r(h, g, _);
|
|
262
|
+
if (b === ke) return u(h, g, _);
|
|
263
|
+
if (b === Ee) return o(h, g, _);
|
|
264
|
+
if (b === Ae) return d(h, g, _);
|
|
265
|
+
if (b === Oe) return typeof h.then != "function" && typeof g.then != "function" && c(h, g, _);
|
|
266
|
+
if (b === Ne) return p(h, g, _);
|
|
267
|
+
if (b === Te) return i(h, g, _);
|
|
268
|
+
if (b === xe) return c(h, g, _);
|
|
269
|
+
if (Me[b]) return f(h, g, _);
|
|
270
|
+
if (b === be) return e(h, g, _);
|
|
271
|
+
if (b === Ce) return n(h, g, _);
|
|
272
|
+
if (b === Se || b === De || b === je) return l(h, g, _);
|
|
272
273
|
if (m) {
|
|
273
274
|
let e = m[b];
|
|
274
275
|
if (!e) {
|
|
275
|
-
let t =
|
|
276
|
+
let t = oe(h);
|
|
276
277
|
t && (e = m[t]);
|
|
277
278
|
}
|
|
278
279
|
if (e) return e(h, g, _);
|
|
@@ -280,26 +281,26 @@ function Re({ areArrayBuffersEqual: e, areArraysEqual: t, areDataViewsEqual: n,
|
|
|
280
281
|
return !1;
|
|
281
282
|
};
|
|
282
283
|
}
|
|
283
|
-
function
|
|
284
|
+
function V({ circular: e, createCustomConfig: t, strict: n }) {
|
|
284
285
|
let r = {
|
|
285
|
-
areArrayBuffersEqual:
|
|
286
|
-
areArraysEqual: n ?
|
|
287
|
-
areDataViewsEqual:
|
|
288
|
-
areDatesEqual:
|
|
289
|
-
areErrorsEqual: n ?
|
|
290
|
-
areFunctionsEqual:
|
|
291
|
-
areMapsEqual: n ?
|
|
292
|
-
areNumbersEqual:
|
|
293
|
-
areObjectsEqual: n ?
|
|
294
|
-
arePrimitiveWrappersEqual:
|
|
295
|
-
areRegExpsEqual:
|
|
296
|
-
areSetsEqual: n ?
|
|
297
|
-
areTypedArraysEqual: n ?
|
|
298
|
-
areUrlsEqual:
|
|
286
|
+
areArrayBuffersEqual: fe,
|
|
287
|
+
areArraysEqual: n ? P : pe,
|
|
288
|
+
areDataViewsEqual: me,
|
|
289
|
+
areDatesEqual: he,
|
|
290
|
+
areErrorsEqual: n ? T(j, P) : T(j, N),
|
|
291
|
+
areFunctionsEqual: ge,
|
|
292
|
+
areMapsEqual: n ? T(M, P) : M,
|
|
293
|
+
areNumbersEqual: _e,
|
|
294
|
+
areObjectsEqual: n ? P : N,
|
|
295
|
+
arePrimitiveWrappersEqual: F,
|
|
296
|
+
areRegExpsEqual: I,
|
|
297
|
+
areSetsEqual: n ? T(L, P) : L,
|
|
298
|
+
areTypedArraysEqual: n ? T(R, P) : R,
|
|
299
|
+
areUrlsEqual: ve,
|
|
299
300
|
unknownTagComparators: void 0
|
|
300
301
|
};
|
|
301
302
|
if (t && (r = Object.assign({}, r, t(r))), e) {
|
|
302
|
-
let e =
|
|
303
|
+
let e = E(r.areArraysEqual), t = E(r.areErrorsEqual), n = E(r.areMapsEqual), i = E(r.areObjectsEqual), a = E(r.areSetsEqual);
|
|
303
304
|
r = Object.assign({}, r, {
|
|
304
305
|
areArraysEqual: e,
|
|
305
306
|
areErrorsEqual: t,
|
|
@@ -310,12 +311,12 @@ function ze({ circular: e, createCustomConfig: t, strict: n }) {
|
|
|
310
311
|
}
|
|
311
312
|
return r;
|
|
312
313
|
}
|
|
313
|
-
function
|
|
314
|
+
function Ie(e) {
|
|
314
315
|
return function(t, n, r, i, a, o, s) {
|
|
315
316
|
return e(t, n, s);
|
|
316
317
|
};
|
|
317
318
|
}
|
|
318
|
-
function
|
|
319
|
+
function Le({ circular: e, comparator: t, createState: n, equals: r, strict: i }) {
|
|
319
320
|
if (n) return function(a, o) {
|
|
320
321
|
let { cache: s = e ? /* @__PURE__ */ new WeakMap() : void 0, meta: c } = n();
|
|
321
322
|
return t(a, o, {
|
|
@@ -343,35 +344,35 @@ function Ve({ circular: e, comparator: t, createState: n, equals: r, strict: i }
|
|
|
343
344
|
return t(e, n, a);
|
|
344
345
|
};
|
|
345
346
|
}
|
|
346
|
-
var
|
|
347
|
-
|
|
347
|
+
var Re = H();
|
|
348
|
+
H({ strict: !0 }), H({ circular: !0 }), H({
|
|
348
349
|
circular: !0,
|
|
349
350
|
strict: !0
|
|
350
|
-
}),
|
|
351
|
+
}), H({ createInternalComparator: () => O }), H({
|
|
351
352
|
strict: !0,
|
|
352
|
-
createInternalComparator: () =>
|
|
353
|
-
}),
|
|
353
|
+
createInternalComparator: () => O
|
|
354
|
+
}), H({
|
|
354
355
|
circular: !0,
|
|
355
|
-
createInternalComparator: () =>
|
|
356
|
-
}),
|
|
356
|
+
createInternalComparator: () => O
|
|
357
|
+
}), H({
|
|
357
358
|
circular: !0,
|
|
358
|
-
createInternalComparator: () =>
|
|
359
|
+
createInternalComparator: () => O,
|
|
359
360
|
strict: !0
|
|
360
361
|
});
|
|
361
|
-
function
|
|
362
|
-
let { circular: t = !1, createInternalComparator: n, createState: r, strict: i = !1 } = e, a =
|
|
363
|
-
return
|
|
362
|
+
function H(e = {}) {
|
|
363
|
+
let { circular: t = !1, createInternalComparator: n, createState: r, strict: i = !1 } = e, a = Fe(V(e));
|
|
364
|
+
return Le({
|
|
364
365
|
circular: t,
|
|
365
366
|
comparator: a,
|
|
366
367
|
createState: r,
|
|
367
|
-
equals: n ? n(a) :
|
|
368
|
+
equals: n ? n(a) : Ie(a),
|
|
368
369
|
strict: i
|
|
369
370
|
});
|
|
370
371
|
}
|
|
371
372
|
//#endregion
|
|
372
373
|
//#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
|
|
373
|
-
var
|
|
374
|
-
var t =
|
|
374
|
+
var ze = /* @__PURE__ */ e(((e) => {
|
|
375
|
+
var t = S(), n = C();
|
|
375
376
|
function r(e, t) {
|
|
376
377
|
return e === t && (e !== 0 || 1 / e == 1 / t) || e !== e && t !== t;
|
|
377
378
|
}
|
|
@@ -415,13 +416,13 @@ var Ue = /* @__PURE__ */ e(((e) => {
|
|
|
415
416
|
f.hasValue = !0, f.value = p;
|
|
416
417
|
}, [p]), l(p), p;
|
|
417
418
|
};
|
|
418
|
-
})),
|
|
419
|
+
})), Be = /* @__PURE__ */ e(((e) => {
|
|
419
420
|
process.env.NODE_ENV !== "production" && (function() {
|
|
420
421
|
function t(e, t) {
|
|
421
422
|
return e === t && (e !== 0 || 1 / e == 1 / t) || e !== e && t !== t;
|
|
422
423
|
}
|
|
423
424
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
424
|
-
var n =
|
|
425
|
+
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;
|
|
425
426
|
e.useSyncExternalStoreWithSelector = function(e, t, n, r, u) {
|
|
426
427
|
var d = o(null);
|
|
427
428
|
if (d.current === null) {
|
|
@@ -462,17 +463,34 @@ var Ue = /* @__PURE__ */ e(((e) => {
|
|
|
462
463
|
}, [p]), l(p), p;
|
|
463
464
|
}, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
464
465
|
})();
|
|
465
|
-
})),
|
|
466
|
-
t.exports = process.env.NODE_ENV === "production" ?
|
|
467
|
-
})))()
|
|
466
|
+
})), Ve = (/* @__PURE__ */ e(((e, t) => {
|
|
467
|
+
t.exports = process.env.NODE_ENV === "production" ? ze() : Be();
|
|
468
|
+
})))();
|
|
469
|
+
function He(e, r) {
|
|
470
|
+
if (e.isDestroyed || r.defaultPrevented || !r.cancelable || !e.isEditable || r.inputType !== "insertParagraph" && r.inputType !== "insertLineBreak" || !t() && !n()) return;
|
|
471
|
+
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
|
+
if (!s || !i.dom.contains(s)) return;
|
|
473
|
+
let c = i.input.lastKeyCode;
|
|
474
|
+
c === 13 && (i.input.lastKeyCode = null), i.domObserver.forceFlush(), i.domObserver.flush();
|
|
475
|
+
let l = new KeyboardEvent("keydown", {
|
|
476
|
+
key: "Enter",
|
|
477
|
+
code: "Enter",
|
|
478
|
+
keyCode: 13,
|
|
479
|
+
shiftKey: r.inputType === "insertLineBreak",
|
|
480
|
+
bubbles: !0,
|
|
481
|
+
cancelable: !0
|
|
482
|
+
});
|
|
483
|
+
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
|
+
var U = new a("reactMobileEnter"), Ue = (...e) => (t) => {
|
|
468
486
|
e.forEach((e) => {
|
|
469
487
|
typeof e == "function" ? e(t) : e && (e.current = t);
|
|
470
488
|
});
|
|
471
|
-
},
|
|
472
|
-
let t = (0,
|
|
473
|
-
return /* @__PURE__ */
|
|
489
|
+
}, We = ({ contentComponent: e }) => {
|
|
490
|
+
let t = (0, w.useSyncExternalStore)(e.subscribe, e.getSnapshot, e.getServerSnapshot);
|
|
491
|
+
return /* @__PURE__ */ x(b, { children: Object.values(t) });
|
|
474
492
|
};
|
|
475
|
-
function
|
|
493
|
+
function Ge() {
|
|
476
494
|
let e = /* @__PURE__ */ new Set(), t = {}, n = !1, r = () => {
|
|
477
495
|
!n && e.size && (n = !0, queueMicrotask(() => {
|
|
478
496
|
n = !1, e.forEach((e) => e());
|
|
@@ -493,7 +511,7 @@ function Je() {
|
|
|
493
511
|
setRenderer(e, n) {
|
|
494
512
|
t = {
|
|
495
513
|
...t,
|
|
496
|
-
[e]:
|
|
514
|
+
[e]: v.createPortal(n.reactElement, n.element, e)
|
|
497
515
|
}, r();
|
|
498
516
|
},
|
|
499
517
|
removeRenderer(e) {
|
|
@@ -502,9 +520,9 @@ function Je() {
|
|
|
502
520
|
}
|
|
503
521
|
};
|
|
504
522
|
}
|
|
505
|
-
var
|
|
523
|
+
var Ke = class extends s.Component {
|
|
506
524
|
constructor(e) {
|
|
507
|
-
super(e), this.editorContentRef =
|
|
525
|
+
super(e), this.editorContentRef = s.createRef();
|
|
508
526
|
}
|
|
509
527
|
componentDidMount() {
|
|
510
528
|
this.init();
|
|
@@ -517,13 +535,16 @@ var Ye = class extends o.Component {
|
|
|
517
535
|
if (e && !e.isDestroyed && e.view.dom?.parentNode) {
|
|
518
536
|
if (e.contentComponent) return;
|
|
519
537
|
let t = this.editorContentRef.current;
|
|
520
|
-
t.append(...e.view.dom.parentNode.childNodes), e.setOptions({ element: t }), e.contentComponent =
|
|
538
|
+
t.append(...e.view.dom.parentNode.childNodes), e.setOptions({ element: t }), e.contentComponent = Ge(), e.createNodeViews(), e.registerPlugin(new i({
|
|
539
|
+
key: U,
|
|
540
|
+
props: { handleDOMEvents: { beforeinput: (t, n) => He(e, n) } }
|
|
541
|
+
})), e.isEditorContentInitialized = !0, this.forceUpdate();
|
|
521
542
|
}
|
|
522
543
|
}
|
|
523
544
|
componentWillUnmount() {
|
|
524
545
|
let e = this.props.editor;
|
|
525
546
|
if (e) {
|
|
526
|
-
e.isEditorContentInitialized = !1, e.isDestroyed || e.view.setProps({ nodeViews: {} }), e.contentComponent = null;
|
|
547
|
+
e.isEditorContentInitialized = !1, e.isDestroyed || (e.unregisterPlugin(U), e.view.setProps({ nodeViews: {} })), e.contentComponent = null;
|
|
527
548
|
try {
|
|
528
549
|
if (!e.view.dom?.parentNode) return;
|
|
529
550
|
let t = document.createElement("div");
|
|
@@ -533,19 +554,19 @@ var Ye = class extends o.Component {
|
|
|
533
554
|
}
|
|
534
555
|
render() {
|
|
535
556
|
let { editor: e, innerRef: t, ...n } = this.props;
|
|
536
|
-
return /* @__PURE__ */
|
|
537
|
-
ref:
|
|
557
|
+
return /* @__PURE__ */ ee(b, { children: [/* @__PURE__ */ x("div", {
|
|
558
|
+
ref: Ue(t, this.editorContentRef),
|
|
538
559
|
...n
|
|
539
|
-
}), e?.contentComponent && /* @__PURE__ */
|
|
560
|
+
}), e?.contentComponent && /* @__PURE__ */ x(We, { contentComponent: e.contentComponent })] });
|
|
540
561
|
}
|
|
541
|
-
},
|
|
542
|
-
let n =
|
|
543
|
-
return
|
|
562
|
+
}, qe = l((e, t) => {
|
|
563
|
+
let n = s.useMemo(() => Math.floor(Math.random() * 4294967295).toString(), [e.editor]);
|
|
564
|
+
return s.createElement(Ke, {
|
|
544
565
|
key: n,
|
|
545
566
|
innerRef: t,
|
|
546
567
|
...e
|
|
547
568
|
});
|
|
548
|
-
}),
|
|
569
|
+
}), W = s.memo(qe), Je = typeof window < "u" ? p : f, Ye = class {
|
|
549
570
|
constructor(e) {
|
|
550
571
|
this.transactionNumber = 0, this.lastTransactionNumber = 0, this.subscribers = /* @__PURE__ */ new Set(), this.editor = e, this.lastSnapshot = {
|
|
551
572
|
editor: e,
|
|
@@ -580,11 +601,11 @@ var Ye = class extends o.Component {
|
|
|
580
601
|
}
|
|
581
602
|
}
|
|
582
603
|
};
|
|
583
|
-
function
|
|
584
|
-
let [t] =
|
|
585
|
-
return
|
|
604
|
+
function G(e) {
|
|
605
|
+
let [t] = g(() => new Ye(e.editor)), n = (0, Ve.useSyncExternalStoreWithSelector)(t.subscribe, t.getSnapshot, t.getServerSnapshot, e.selector, e.equalityFn ?? Re);
|
|
606
|
+
return Je(() => t.watch(e.editor), [e.editor, t]), d(n), n;
|
|
586
607
|
}
|
|
587
|
-
var
|
|
608
|
+
var K = process.env.NODE_ENV !== "production", q = typeof window > "u", Xe = q || !!(typeof window < "u" && window.next), Ze = class e {
|
|
588
609
|
constructor(e) {
|
|
589
610
|
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);
|
|
590
611
|
}
|
|
@@ -593,7 +614,7 @@ var U = process.env.NODE_ENV !== "production", W = typeof window > "u", $e = W |
|
|
|
593
614
|
}
|
|
594
615
|
getInitialEditor() {
|
|
595
616
|
let e = this.options.current.immediatelyRender, t = e ?? !0;
|
|
596
|
-
return
|
|
617
|
+
return q ? (t && K && console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"), t = !1) : Xe && e === void 0 && (t = !1, K && 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;
|
|
597
618
|
}
|
|
598
619
|
createEditor() {
|
|
599
620
|
let e = {
|
|
@@ -655,7 +676,7 @@ var U = process.env.NODE_ENV !== "production", W = typeof window > "u", $e = W |
|
|
|
655
676
|
return (t = this.options.current).onUnmount?.call(t, ...e);
|
|
656
677
|
}
|
|
657
678
|
};
|
|
658
|
-
return new
|
|
679
|
+
return new r(e);
|
|
659
680
|
}
|
|
660
681
|
getEditor() {
|
|
661
682
|
return this.editor;
|
|
@@ -712,24 +733,25 @@ var U = process.env.NODE_ENV !== "production", W = typeof window > "u", $e = W |
|
|
|
712
733
|
}, 1);
|
|
713
734
|
}
|
|
714
735
|
};
|
|
715
|
-
function
|
|
716
|
-
let n =
|
|
736
|
+
function Qe(e = {}, t = []) {
|
|
737
|
+
let n = h(e);
|
|
717
738
|
n.current = e;
|
|
718
|
-
let [r] =
|
|
719
|
-
return
|
|
739
|
+
let [r] = g(() => new Ze(n)), i = (0, w.useSyncExternalStore)(r.subscribe, r.getEditor, r.getServerSnapshot);
|
|
740
|
+
return d(i), f(r.onRender(t)), G({
|
|
720
741
|
editor: i,
|
|
721
742
|
selector: ({ transactionNumber: t }) => e.shouldRerenderOnTransaction === !1 || e.shouldRerenderOnTransaction === void 0 ? null : e.immediatelyRender && t === 0 ? 0 : t + 1
|
|
722
743
|
}), i;
|
|
723
744
|
}
|
|
724
|
-
var
|
|
725
|
-
|
|
726
|
-
var
|
|
745
|
+
var J = c({ editor: null });
|
|
746
|
+
J.Consumer;
|
|
747
|
+
var $e = () => u(J), et = c({
|
|
727
748
|
onDragStart: () => {},
|
|
728
749
|
nodeViewContentChildren: void 0,
|
|
729
750
|
nodeViewContentRef: () => {}
|
|
730
|
-
}),
|
|
731
|
-
|
|
732
|
-
|
|
751
|
+
}), tt = () => u(et);
|
|
752
|
+
s.forwardRef((e, t) => {
|
|
753
|
+
let { onDragStart: n } = tt(), r = e.as || "div";
|
|
754
|
+
return /* @__PURE__ */ x(r, {
|
|
733
755
|
...e,
|
|
734
756
|
ref: t,
|
|
735
757
|
"data-node-view-wrapper": "",
|
|
@@ -740,32 +762,32 @@ var nt = () => f(G), K = s({
|
|
|
740
762
|
}
|
|
741
763
|
});
|
|
742
764
|
});
|
|
743
|
-
function
|
|
765
|
+
function Y(e) {
|
|
744
766
|
return !!(typeof e == "function" && e.prototype && e.prototype.isReactComponent);
|
|
745
767
|
}
|
|
746
|
-
function
|
|
768
|
+
function X(e) {
|
|
747
769
|
return !(typeof e != "object" || !e.$$typeof || e.$$typeof.toString() !== "Symbol(react.forward_ref)" && e.$$typeof.description !== "react.forward_ref");
|
|
748
770
|
}
|
|
749
|
-
function
|
|
771
|
+
function nt(e) {
|
|
750
772
|
return !(typeof e != "object" || !e.$$typeof || e.$$typeof.toString() !== "Symbol(react.memo)" && e.$$typeof.description !== "react.memo");
|
|
751
773
|
}
|
|
752
|
-
function
|
|
753
|
-
if (
|
|
754
|
-
if (
|
|
774
|
+
function rt(e) {
|
|
775
|
+
if (Y(e) || X(e)) return !0;
|
|
776
|
+
if (nt(e)) {
|
|
755
777
|
let t = e.type;
|
|
756
|
-
if (t) return
|
|
778
|
+
if (t) return Y(t) || X(t);
|
|
757
779
|
}
|
|
758
780
|
return !1;
|
|
759
781
|
}
|
|
760
|
-
function
|
|
782
|
+
function it() {
|
|
761
783
|
try {
|
|
762
|
-
if (
|
|
784
|
+
if (_) return parseInt(_.split(".")[0], 10) >= 19;
|
|
763
785
|
} catch {}
|
|
764
786
|
return !1;
|
|
765
787
|
}
|
|
766
|
-
var
|
|
788
|
+
var at = class {
|
|
767
789
|
constructor(e, { editor: t, props: n = {}, as: r = "div", className: i = "" }) {
|
|
768
|
-
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 ?
|
|
790
|
+
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(() => {
|
|
769
791
|
this.render();
|
|
770
792
|
}) : queueMicrotask(() => {
|
|
771
793
|
this.destroyed || this.render();
|
|
@@ -774,10 +796,10 @@ var Y = class {
|
|
|
774
796
|
render() {
|
|
775
797
|
var e;
|
|
776
798
|
if (this.destroyed) return;
|
|
777
|
-
let t = this.component, n = this.props, r = this.editor, i =
|
|
799
|
+
let t = this.component, n = this.props, r = this.editor, i = it(), a = rt(t), o = { ...n };
|
|
778
800
|
o.ref && !(i || a) && delete o.ref, !o.ref && (i || a) && (o.ref = (e) => {
|
|
779
801
|
this.ref = e;
|
|
780
|
-
}), this.reactElement = /* @__PURE__ */
|
|
802
|
+
}), this.reactElement = /* @__PURE__ */ x(t, { ...o }), r == null || (e = r.contentComponent) == null || e.setRenderer(this.id, this);
|
|
781
803
|
}
|
|
782
804
|
updateProps(e = {}) {
|
|
783
805
|
if (this.destroyed) return;
|
|
@@ -809,241 +831,32 @@ var Y = class {
|
|
|
809
831
|
});
|
|
810
832
|
}
|
|
811
833
|
};
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
var t;
|
|
815
|
-
let n = e.getRootNode(), r = typeof n.getSelection == "function" ? n.getSelection() : (t = e.ownerDocument) == null || (t = t.defaultView) == null ? void 0 : t.getSelection();
|
|
816
|
-
if (!r || r.rangeCount === 0) return null;
|
|
817
|
-
let { anchorNode: i, anchorOffset: a, focusNode: o, focusOffset: s } = r;
|
|
818
|
-
return !i || !o || !e.contains(i) || !e.contains(o) ? null : () => {
|
|
819
|
-
try {
|
|
820
|
-
r.setBaseAndExtent(i, a, o, s);
|
|
821
|
-
} catch {}
|
|
822
|
-
};
|
|
823
|
-
}
|
|
824
|
-
function lt(e, t, n) {
|
|
825
|
-
return e.node(n) === t.node(n) && e.before(n) === t.before(n);
|
|
826
|
-
}
|
|
827
|
-
function X(e) {
|
|
828
|
-
if (!n(e)) return [];
|
|
829
|
-
let { $from: t, $to: r } = e, i = [], a = Math.min(t.depth, r.depth);
|
|
830
|
-
for (let e = 1; e <= a && lt(t, r, e); e += 1) i.push(t.before(e));
|
|
831
|
-
return i;
|
|
832
|
-
}
|
|
833
|
-
var ut = class {
|
|
834
|
-
constructor(e) {
|
|
835
|
-
this.views = /* @__PURE__ */ new WeakMap(), this.viewCount = 0, this.insideViews = /* @__PURE__ */ new Set(), this.syncQueued = !1, this.scheduleSync = () => {
|
|
836
|
-
this.syncQueued || (this.syncQueued = !0, queueMicrotask(() => {
|
|
837
|
-
this.syncQueued = !1, this.sync();
|
|
838
|
-
}));
|
|
839
|
-
}, this.handleTransaction = () => this.scheduleSync(), this.editor = e;
|
|
840
|
-
}
|
|
841
|
-
register(e) {
|
|
842
|
-
this.viewCount === 0 && this.editor.on("transaction", this.handleTransaction), this.views.set(e.dom, e), this.viewCount += 1, this.scheduleSync();
|
|
843
|
-
}
|
|
844
|
-
unregister(e) {
|
|
845
|
-
this.views.delete(e.dom), --this.viewCount, this.insideViews.delete(e), this.viewCount === 0 && this.editor.off("transaction", this.handleTransaction);
|
|
846
|
-
}
|
|
847
|
-
sync() {
|
|
848
|
-
if (this.viewCount === 0 || this.editor.isDestroyed) return;
|
|
849
|
-
let e = this.findInsideViews();
|
|
850
|
-
this.updateViews(this.insideViews, e, !1), this.updateViews(e, this.insideViews, !0), this.insideViews = e;
|
|
851
|
-
}
|
|
852
|
-
updateViews(e, t, n) {
|
|
853
|
-
for (let r of e) t.has(r) || r.setSelectionInside(n);
|
|
854
|
-
}
|
|
855
|
-
findInsideViews() {
|
|
856
|
-
let e = /* @__PURE__ */ new Set();
|
|
857
|
-
for (let t of X(this.editor.state.selection)) {
|
|
858
|
-
let n = this.editor.view.nodeDOM(t), r = n ? this.views.get(n) : void 0;
|
|
859
|
-
r && e.add(r);
|
|
860
|
-
}
|
|
861
|
-
return e;
|
|
862
|
-
}
|
|
863
|
-
}, Z = /* @__PURE__ */ new WeakMap();
|
|
864
|
-
function Q(e) {
|
|
865
|
-
let t = Z.get(e);
|
|
866
|
-
return t || (t = new ut(e), Z.set(e, t)), t;
|
|
867
|
-
}
|
|
868
|
-
var dt = class extends r {
|
|
869
|
-
constructor(e, t, n) {
|
|
870
|
-
if (super(e, t, n), this.nodeSelected = !1, this.handlePositionUpdate = () => {
|
|
871
|
-
let e = this.getPos();
|
|
872
|
-
typeof e == "number" && e !== this.currentPos && (this.currentPos = e, this.renderer.updateProps({ getPos: () => this.getPos() }), typeof this.options.attrs == "function" && this.updateElementAttributes());
|
|
873
|
-
}, this.cachedExtensionWithSyncedStorage = null, !this.node.isLeaf) {
|
|
874
|
-
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";
|
|
875
|
-
let e = this.dom.querySelector("[data-node-view-content]");
|
|
876
|
-
e ? e.appendChild(this.contentDOMElement) : this.dom.appendChild(this.contentDOMElement);
|
|
877
|
-
}
|
|
878
|
-
this.options.trackNodeViewPosition && this.editor.on("update", this.handlePositionUpdate);
|
|
879
|
-
}
|
|
880
|
-
get extensionWithSyncedStorage() {
|
|
881
|
-
if (!this.cachedExtensionWithSyncedStorage) {
|
|
882
|
-
let e = this.editor, t = this.extension;
|
|
883
|
-
this.cachedExtensionWithSyncedStorage = new Proxy(t, { get(n, r, i) {
|
|
884
|
-
return r === "storage" ? e.storage[t.name] ?? {} : Reflect.get(n, r, i);
|
|
885
|
-
} });
|
|
886
|
-
}
|
|
887
|
-
return this.cachedExtensionWithSyncedStorage;
|
|
888
|
-
}
|
|
889
|
-
mount() {
|
|
890
|
-
let e = {
|
|
891
|
-
editor: this.editor,
|
|
892
|
-
node: this.node,
|
|
893
|
-
decorations: this.decorations,
|
|
894
|
-
innerDecorations: this.innerDecorations,
|
|
895
|
-
view: this.view,
|
|
896
|
-
selected: !1,
|
|
897
|
-
selectionInside: !1,
|
|
898
|
-
extension: this.extensionWithSyncedStorage,
|
|
899
|
-
HTMLAttributes: this.HTMLAttributes,
|
|
900
|
-
getPos: () => this.getPos(),
|
|
901
|
-
updateAttributes: (e = {}) => this.updateAttributes(e),
|
|
902
|
-
deleteNode: () => this.deleteNode(),
|
|
903
|
-
ref: l()
|
|
904
|
-
};
|
|
905
|
-
if (!this.component.displayName) {
|
|
906
|
-
let e = (e) => e.charAt(0).toUpperCase() + e.substring(1);
|
|
907
|
-
this.component.displayName = e(this.extension.name);
|
|
908
|
-
}
|
|
909
|
-
let t = {
|
|
910
|
-
onDragStart: this.onDragStart.bind(this),
|
|
911
|
-
nodeViewContentRef: (e) => {
|
|
912
|
-
if (e && this.contentDOMElement && e.firstChild !== this.contentDOMElement) {
|
|
913
|
-
e.hasAttribute("data-node-view-wrapper") && e.removeAttribute("data-node-view-wrapper");
|
|
914
|
-
let t = ct(this.contentDOMElement);
|
|
915
|
-
e.appendChild(this.contentDOMElement), t?.();
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
}, n = this.component, r = d((e) => /* @__PURE__ */ S(K.Provider, {
|
|
919
|
-
value: t,
|
|
920
|
-
children: c(n, e)
|
|
921
|
-
}));
|
|
922
|
-
r.displayName = "ReactNodeView";
|
|
923
|
-
let i = this.node.isInline ? "span" : "div";
|
|
924
|
-
this.options.as && (i = this.options.as);
|
|
925
|
-
let { className: a = "" } = this.options;
|
|
926
|
-
this.renderer = new Y(r, {
|
|
927
|
-
editor: this.editor,
|
|
928
|
-
props: e,
|
|
929
|
-
as: i,
|
|
930
|
-
className: `node-${this.node.type.name} ${a}`.trim()
|
|
931
|
-
}), Q(this.editor).register(this), this.updateElementAttributes(), this.currentPos = this.getPos();
|
|
932
|
-
}
|
|
933
|
-
get dom() {
|
|
934
|
-
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.");
|
|
935
|
-
return this.renderer.element;
|
|
936
|
-
}
|
|
937
|
-
get contentDOM() {
|
|
938
|
-
return this.node.isLeaf ? null : this.contentDOMElement;
|
|
939
|
-
}
|
|
940
|
-
update(e, t, n) {
|
|
941
|
-
let r = (e) => {
|
|
942
|
-
this.renderer.updateProps(e), typeof this.options.attrs == "function" && this.updateElementAttributes();
|
|
943
|
-
};
|
|
944
|
-
if (e.type !== this.node.type) return !1;
|
|
945
|
-
if (typeof this.options.update == "function") {
|
|
946
|
-
let i = this.node, a = this.decorations, o = this.innerDecorations;
|
|
947
|
-
return this.node = e, this.decorations = t, this.innerDecorations = n, this.currentPos = this.getPos(), this.options.update({
|
|
948
|
-
oldNode: i,
|
|
949
|
-
oldDecorations: a,
|
|
950
|
-
newNode: e,
|
|
951
|
-
newDecorations: t,
|
|
952
|
-
oldInnerDecorations: o,
|
|
953
|
-
innerDecorations: n,
|
|
954
|
-
updateProps: () => r({
|
|
955
|
-
node: e,
|
|
956
|
-
decorations: t,
|
|
957
|
-
innerDecorations: n,
|
|
958
|
-
extension: this.extensionWithSyncedStorage
|
|
959
|
-
})
|
|
960
|
-
});
|
|
961
|
-
}
|
|
962
|
-
if (e === this.node) return this.node = e, this.decorations = t, this.innerDecorations = n, !0;
|
|
963
|
-
let i = this.getPos();
|
|
964
|
-
this.node = e, this.decorations = t, this.innerDecorations = n, this.currentPos = i;
|
|
965
|
-
let a = {
|
|
966
|
-
node: e,
|
|
967
|
-
decorations: t,
|
|
968
|
-
innerDecorations: n,
|
|
969
|
-
extension: this.extensionWithSyncedStorage
|
|
970
|
-
};
|
|
971
|
-
return this.options.trackNodeViewPosition && (a.getPos = () => this.getPos()), r(a), !0;
|
|
972
|
-
}
|
|
973
|
-
selectNode() {
|
|
974
|
-
this.nodeSelected = !0, this.updateSelectedState(!0);
|
|
975
|
-
}
|
|
976
|
-
deselectNode() {
|
|
977
|
-
this.nodeSelected = !1, this.updateSelectedState(this.options.selectedOnTextSelection === !0 && this.isTextSelectionInside());
|
|
978
|
-
}
|
|
979
|
-
setSelectionInside(e) {
|
|
980
|
-
let t = this.nodeSelected || this.options.selectedOnTextSelection === !0 && e;
|
|
981
|
-
this.renderer.updateProps({
|
|
982
|
-
selectionInside: e,
|
|
983
|
-
selected: t
|
|
984
|
-
}), this.renderer.element.classList.toggle("ProseMirror-selectednode", t);
|
|
985
|
-
}
|
|
986
|
-
updateSelectedState(e) {
|
|
987
|
-
this.renderer.updateProps({ selected: e }), this.renderer.element.classList.toggle("ProseMirror-selectednode", e);
|
|
988
|
-
}
|
|
989
|
-
isTextSelectionInside() {
|
|
990
|
-
let e = this.getPos();
|
|
991
|
-
return typeof e == "number" && X(this.editor.state.selection).includes(e);
|
|
992
|
-
}
|
|
993
|
-
destroy() {
|
|
994
|
-
this.renderer.destroy(), Q(this.editor).unregister(this), this.options.trackNodeViewPosition && this.editor.off("update", this.handlePositionUpdate), this.contentDOMElement = null;
|
|
995
|
-
}
|
|
996
|
-
updateElementAttributes() {
|
|
997
|
-
if (this.options.attrs) {
|
|
998
|
-
let e = {};
|
|
999
|
-
if (typeof this.options.attrs == "function") {
|
|
1000
|
-
let n = this.editor.extensionManager.attributes, r = t(this.node, n);
|
|
1001
|
-
e = this.options.attrs({
|
|
1002
|
-
node: this.node,
|
|
1003
|
-
HTMLAttributes: r
|
|
1004
|
-
});
|
|
1005
|
-
} else e = this.options.attrs;
|
|
1006
|
-
this.renderer.updateAttributes(e);
|
|
1007
|
-
}
|
|
1008
|
-
}
|
|
1009
|
-
};
|
|
1010
|
-
function ft(e, t) {
|
|
1011
|
-
return (n) => n.editor.contentComponent ? new dt(e, n, t) : {
|
|
1012
|
-
dom: document.createElement("span"),
|
|
1013
|
-
contentDOM: null,
|
|
1014
|
-
update: () => !1,
|
|
1015
|
-
destroy: () => {},
|
|
1016
|
-
selectNode: () => {},
|
|
1017
|
-
deselectNode: () => {},
|
|
1018
|
-
stopEvent: () => !1,
|
|
1019
|
-
ignoreMutation: () => !0
|
|
1020
|
-
};
|
|
1021
|
-
}
|
|
1022
|
-
var $ = s({ get editor() {
|
|
834
|
+
s.createContext({ markViewContentRef: () => {} });
|
|
835
|
+
var Z = c({ get editor() {
|
|
1023
836
|
throw Error("useTiptap must be used within a <Tiptap> provider");
|
|
1024
837
|
} });
|
|
1025
|
-
|
|
1026
|
-
var
|
|
1027
|
-
function
|
|
838
|
+
Z.displayName = "TiptapContext";
|
|
839
|
+
var ot = () => u(Z);
|
|
840
|
+
function Q({ children: e, ...t }) {
|
|
1028
841
|
let n = "editor" in t ? t.editor : t.instance;
|
|
1029
842
|
if (!n) throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");
|
|
1030
|
-
let r =
|
|
1031
|
-
return /* @__PURE__ */
|
|
843
|
+
let r = m(() => ({ editor: n }), [n]), i = m(() => ({ editor: n }), [n]);
|
|
844
|
+
return /* @__PURE__ */ x(J.Provider, {
|
|
1032
845
|
value: i,
|
|
1033
|
-
children: /* @__PURE__ */
|
|
846
|
+
children: /* @__PURE__ */ x(Z.Provider, {
|
|
1034
847
|
value: r,
|
|
1035
848
|
children: e
|
|
1036
849
|
})
|
|
1037
850
|
});
|
|
1038
851
|
}
|
|
1039
|
-
|
|
1040
|
-
function
|
|
1041
|
-
let { editor: t } =
|
|
1042
|
-
return /* @__PURE__ */
|
|
852
|
+
Q.displayName = "Tiptap";
|
|
853
|
+
function $({ ...e }) {
|
|
854
|
+
let { editor: t } = ot();
|
|
855
|
+
return /* @__PURE__ */ x(W, {
|
|
1043
856
|
editor: t,
|
|
1044
857
|
...e
|
|
1045
858
|
});
|
|
1046
859
|
}
|
|
1047
|
-
|
|
860
|
+
$.displayName = "Tiptap.Content", Object.assign(Q, { Content: $ });
|
|
1048
861
|
//#endregion
|
|
1049
|
-
export {
|
|
862
|
+
export { G as a, Qe as i, at as n, $e as r, W as t };
|