@clevertask/scribe 0.1.29 → 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/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 +7 -7
- 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-DnVcys79.js → dist-DGEcUiqG.js} +464 -561
- package/dist/{dist-CDJRm4fL.js → dist-TKt66Yz8.js} +1 -1
- package/dist/{dist-B0xwy1Q5.js → dist-ZGDUiMX8.js} +174 -382
- package/dist/document-node-capabilities.js +1 -1
- package/dist/{extension-BPeoqfHR.js → extension-I7Ocj_D_.js} +1 -1
- package/dist/extension-link-Cb1UO6hv.js +939 -0
- package/dist/main.css +0 -141
- package/dist/{menus-scgppp2C.js → menus-BrQTLTFL.js} +15 -15
- package/dist/{schema-extensions-ITR9LEgX.js → schema-extensions-CzDKrIf8.js} +1324 -1324
- package/dist/schema-extensions.js +1 -1
- package/dist/schema.js +1 -1
- package/dist/{table-layout-iVolql5p.js → table-layout-Dt7KmVp_.js} +36 -36
- 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 +1 -1
- 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-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";
|
|
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", 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));
|
|
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,30 @@ 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
|
-
if (e instanceof Float64Array || e instanceof Float32Array ||
|
|
210
|
+
if (e instanceof Float64Array || e instanceof Float32Array || de && e instanceof Float16Array) {
|
|
211
211
|
for (; n-- > 0;) if (e[n] !== t[n] && (e[n] === e[n] || t[n] === t[n])) return !1;
|
|
212
212
|
return !0;
|
|
213
213
|
}
|
|
214
214
|
for (; n-- > 0;) if (e[n] !== t[n]) return !1;
|
|
215
215
|
return !0;
|
|
216
216
|
}
|
|
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 &&
|
|
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);
|
|
219
219
|
}
|
|
220
|
-
function
|
|
220
|
+
function ye(e, t) {
|
|
221
221
|
let n = e.toString(), r = t.toString();
|
|
222
|
-
return n === r ||
|
|
222
|
+
return n === r || z(n) === z(r);
|
|
223
223
|
}
|
|
224
|
-
function
|
|
224
|
+
function z(e) {
|
|
225
225
|
return e.split("&").sort().join("&");
|
|
226
226
|
}
|
|
227
|
-
function
|
|
228
|
-
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);
|
|
229
229
|
}
|
|
230
|
-
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 = {
|
|
231
231
|
"[object Int8Array]": !0,
|
|
232
232
|
"[object Uint8Array]": !0,
|
|
233
233
|
"[object Uint8ClampedArray]": !0,
|
|
@@ -240,8 +240,8 @@ var De = "[object ArrayBuffer]", Oe = "[object Arguments]", ke = "[object Boolea
|
|
|
240
240
|
"[object Float64Array]": !0,
|
|
241
241
|
"[object BigInt64Array]": !0,
|
|
242
242
|
"[object BigUint64Array]": !0
|
|
243
|
-
},
|
|
244
|
-
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 }) {
|
|
245
245
|
return function(h, g, _) {
|
|
246
246
|
if (h === g) return !0;
|
|
247
247
|
if (h == null || g == null) return !1;
|
|
@@ -257,23 +257,23 @@ function He({ areArrayBuffersEqual: e, areArraysEqual: t, areDataViewsEqual: n,
|
|
|
257
257
|
if (y === Map) return o(h, g, _);
|
|
258
258
|
if (y === Set) return d(h, g, _);
|
|
259
259
|
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 ===
|
|
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, _);
|
|
273
273
|
if (m) {
|
|
274
274
|
let e = m[b];
|
|
275
275
|
if (!e) {
|
|
276
|
-
let t =
|
|
276
|
+
let t = oe(h);
|
|
277
277
|
t && (e = m[t]);
|
|
278
278
|
}
|
|
279
279
|
if (e) return e(h, g, _);
|
|
@@ -281,26 +281,26 @@ function He({ areArrayBuffersEqual: e, areArraysEqual: t, areDataViewsEqual: n,
|
|
|
281
281
|
return !1;
|
|
282
282
|
};
|
|
283
283
|
}
|
|
284
|
-
function
|
|
284
|
+
function V({ circular: e, createCustomConfig: t, strict: n }) {
|
|
285
285
|
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:
|
|
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,
|
|
300
300
|
unknownTagComparators: void 0
|
|
301
301
|
};
|
|
302
302
|
if (t && (r = Object.assign({}, r, t(r))), e) {
|
|
303
|
-
let e =
|
|
303
|
+
let e = E(r.areArraysEqual), t = E(r.areErrorsEqual), n = E(r.areMapsEqual), i = E(r.areObjectsEqual), a = E(r.areSetsEqual);
|
|
304
304
|
r = Object.assign({}, r, {
|
|
305
305
|
areArraysEqual: e,
|
|
306
306
|
areErrorsEqual: t,
|
|
@@ -311,12 +311,12 @@ function Ue({ circular: e, createCustomConfig: t, strict: n }) {
|
|
|
311
311
|
}
|
|
312
312
|
return r;
|
|
313
313
|
}
|
|
314
|
-
function
|
|
314
|
+
function Ie(e) {
|
|
315
315
|
return function(t, n, r, i, a, o, s) {
|
|
316
316
|
return e(t, n, s);
|
|
317
317
|
};
|
|
318
318
|
}
|
|
319
|
-
function
|
|
319
|
+
function Le({ circular: e, comparator: t, createState: n, equals: r, strict: i }) {
|
|
320
320
|
if (n) return function(a, o) {
|
|
321
321
|
let { cache: s = e ? /* @__PURE__ */ new WeakMap() : void 0, meta: c } = n();
|
|
322
322
|
return t(a, o, {
|
|
@@ -344,35 +344,35 @@ function Ge({ circular: e, comparator: t, createState: n, equals: r, strict: i }
|
|
|
344
344
|
return t(e, n, a);
|
|
345
345
|
};
|
|
346
346
|
}
|
|
347
|
-
var
|
|
348
|
-
|
|
347
|
+
var Re = H();
|
|
348
|
+
H({ strict: !0 }), H({ circular: !0 }), H({
|
|
349
349
|
circular: !0,
|
|
350
350
|
strict: !0
|
|
351
|
-
}),
|
|
351
|
+
}), H({ createInternalComparator: () => O }), H({
|
|
352
352
|
strict: !0,
|
|
353
|
-
createInternalComparator: () =>
|
|
354
|
-
}),
|
|
353
|
+
createInternalComparator: () => O
|
|
354
|
+
}), H({
|
|
355
355
|
circular: !0,
|
|
356
|
-
createInternalComparator: () =>
|
|
357
|
-
}),
|
|
356
|
+
createInternalComparator: () => O
|
|
357
|
+
}), H({
|
|
358
358
|
circular: !0,
|
|
359
|
-
createInternalComparator: () =>
|
|
359
|
+
createInternalComparator: () => O,
|
|
360
360
|
strict: !0
|
|
361
361
|
});
|
|
362
|
-
function
|
|
363
|
-
let { circular: t = !1, createInternalComparator: n, createState: r, strict: i = !1 } = e, a =
|
|
364
|
-
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({
|
|
365
365
|
circular: t,
|
|
366
366
|
comparator: a,
|
|
367
367
|
createState: r,
|
|
368
|
-
equals: n ? n(a) :
|
|
368
|
+
equals: n ? n(a) : Ie(a),
|
|
369
369
|
strict: i
|
|
370
370
|
});
|
|
371
371
|
}
|
|
372
372
|
//#endregion
|
|
373
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
|
|
374
|
-
var
|
|
375
|
-
var t =
|
|
374
|
+
var ze = /* @__PURE__ */ e(((e) => {
|
|
375
|
+
var t = S(), n = C();
|
|
376
376
|
function r(e, t) {
|
|
377
377
|
return e === t && (e !== 0 || 1 / e == 1 / t) || e !== e && t !== t;
|
|
378
378
|
}
|
|
@@ -416,13 +416,13 @@ var qe = /* @__PURE__ */ e(((e) => {
|
|
|
416
416
|
f.hasValue = !0, f.value = p;
|
|
417
417
|
}, [p]), l(p), p;
|
|
418
418
|
};
|
|
419
|
-
})),
|
|
419
|
+
})), Be = /* @__PURE__ */ e(((e) => {
|
|
420
420
|
process.env.NODE_ENV !== "production" && (function() {
|
|
421
421
|
function t(e, t) {
|
|
422
422
|
return e === t && (e !== 0 || 1 / e == 1 / t) || e !== e && t !== t;
|
|
423
423
|
}
|
|
424
424
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
425
|
-
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;
|
|
426
426
|
e.useSyncExternalStoreWithSelector = function(e, t, n, r, u) {
|
|
427
427
|
var d = o(null);
|
|
428
428
|
if (d.current === null) {
|
|
@@ -463,11 +463,11 @@ var qe = /* @__PURE__ */ e(((e) => {
|
|
|
463
463
|
}, [p]), l(p), p;
|
|
464
464
|
}, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
465
465
|
})();
|
|
466
|
-
})),
|
|
467
|
-
t.exports = process.env.NODE_ENV === "production" ?
|
|
466
|
+
})), Ve = (/* @__PURE__ */ e(((e, t) => {
|
|
467
|
+
t.exports = process.env.NODE_ENV === "production" ? ze() : Be();
|
|
468
468
|
})))();
|
|
469
|
-
function
|
|
470
|
-
if (e.isDestroyed ||
|
|
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
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
472
|
if (!s || !i.dom.contains(s)) return;
|
|
473
473
|
let c = i.input.lastKeyCode;
|
|
@@ -476,21 +476,21 @@ function Xe(e, t) {
|
|
|
476
476
|
key: "Enter",
|
|
477
477
|
code: "Enter",
|
|
478
478
|
keyCode: 13,
|
|
479
|
-
shiftKey:
|
|
479
|
+
shiftKey: r.inputType === "insertLineBreak",
|
|
480
480
|
bubbles: !0,
|
|
481
481
|
cancelable: !0
|
|
482
482
|
});
|
|
483
|
-
i.someProp("handleKeyDown", (e) => e(i, l)) ? (
|
|
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
484
|
}
|
|
485
|
-
var
|
|
485
|
+
var U = new a("reactMobileEnter"), Ue = (...e) => (t) => {
|
|
486
486
|
e.forEach((e) => {
|
|
487
487
|
typeof e == "function" ? e(t) : e && (e.current = t);
|
|
488
488
|
});
|
|
489
|
-
},
|
|
490
|
-
let t = (0,
|
|
491
|
-
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) });
|
|
492
492
|
};
|
|
493
|
-
function
|
|
493
|
+
function Ge() {
|
|
494
494
|
let e = /* @__PURE__ */ new Set(), t = {}, n = !1, r = () => {
|
|
495
495
|
!n && e.size && (n = !0, queueMicrotask(() => {
|
|
496
496
|
n = !1, e.forEach((e) => e());
|
|
@@ -511,7 +511,7 @@ function $e() {
|
|
|
511
511
|
setRenderer(e, n) {
|
|
512
512
|
t = {
|
|
513
513
|
...t,
|
|
514
|
-
[e]:
|
|
514
|
+
[e]: v.createPortal(n.reactElement, n.element, e)
|
|
515
515
|
}, r();
|
|
516
516
|
},
|
|
517
517
|
removeRenderer(e) {
|
|
@@ -520,9 +520,9 @@ function $e() {
|
|
|
520
520
|
}
|
|
521
521
|
};
|
|
522
522
|
}
|
|
523
|
-
var
|
|
523
|
+
var Ke = class extends s.Component {
|
|
524
524
|
constructor(e) {
|
|
525
|
-
super(e), this.editorContentRef =
|
|
525
|
+
super(e), this.editorContentRef = s.createRef();
|
|
526
526
|
}
|
|
527
527
|
componentDidMount() {
|
|
528
528
|
this.init();
|
|
@@ -535,16 +535,16 @@ var et = class extends u.Component {
|
|
|
535
535
|
if (e && !e.isDestroyed && e.view.dom?.parentNode) {
|
|
536
536
|
if (e.contentComponent) return;
|
|
537
537
|
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) =>
|
|
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
541
|
})), e.isEditorContentInitialized = !0, this.forceUpdate();
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
544
|
componentWillUnmount() {
|
|
545
545
|
let e = this.props.editor;
|
|
546
546
|
if (e) {
|
|
547
|
-
e.isEditorContentInitialized = !1, e.isDestroyed || (e.unregisterPlugin(
|
|
547
|
+
e.isEditorContentInitialized = !1, e.isDestroyed || (e.unregisterPlugin(U), e.view.setProps({ nodeViews: {} })), e.contentComponent = null;
|
|
548
548
|
try {
|
|
549
549
|
if (!e.view.dom?.parentNode) return;
|
|
550
550
|
let t = document.createElement("div");
|
|
@@ -554,19 +554,19 @@ var et = class extends u.Component {
|
|
|
554
554
|
}
|
|
555
555
|
render() {
|
|
556
556
|
let { editor: e, innerRef: t, ...n } = this.props;
|
|
557
|
-
return /* @__PURE__ */
|
|
558
|
-
ref:
|
|
557
|
+
return /* @__PURE__ */ ee(b, { children: [/* @__PURE__ */ x("div", {
|
|
558
|
+
ref: Ue(t, this.editorContentRef),
|
|
559
559
|
...n
|
|
560
|
-
}), e?.contentComponent && /* @__PURE__ */
|
|
560
|
+
}), e?.contentComponent && /* @__PURE__ */ x(We, { contentComponent: e.contentComponent })] });
|
|
561
561
|
}
|
|
562
|
-
},
|
|
563
|
-
let n =
|
|
564
|
-
return
|
|
562
|
+
}, qe = l((e, t) => {
|
|
563
|
+
let n = s.useMemo(() => Math.floor(Math.random() * 4294967295).toString(), [e.editor]);
|
|
564
|
+
return s.createElement(Ke, {
|
|
565
565
|
key: n,
|
|
566
566
|
innerRef: t,
|
|
567
567
|
...e
|
|
568
568
|
});
|
|
569
|
-
}),
|
|
569
|
+
}), W = s.memo(qe), Je = typeof window < "u" ? p : f, Ye = class {
|
|
570
570
|
constructor(e) {
|
|
571
571
|
this.transactionNumber = 0, this.lastTransactionNumber = 0, this.subscribers = /* @__PURE__ */ new Set(), this.editor = e, this.lastSnapshot = {
|
|
572
572
|
editor: e,
|
|
@@ -601,11 +601,11 @@ var et = class extends u.Component {
|
|
|
601
601
|
}
|
|
602
602
|
}
|
|
603
603
|
};
|
|
604
|
-
function
|
|
605
|
-
let [t] =
|
|
606
|
-
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;
|
|
607
607
|
}
|
|
608
|
-
var
|
|
608
|
+
var K = process.env.NODE_ENV !== "production", q = typeof window > "u", Xe = q || !!(typeof window < "u" && window.next), Ze = class e {
|
|
609
609
|
constructor(e) {
|
|
610
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);
|
|
611
611
|
}
|
|
@@ -614,7 +614,7 @@ var W = process.env.NODE_ENV !== "production", G = typeof window > "u", it = G |
|
|
|
614
614
|
}
|
|
615
615
|
getInitialEditor() {
|
|
616
616
|
let e = this.options.current.immediatelyRender, t = e ?? !0;
|
|
617
|
-
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;
|
|
618
618
|
}
|
|
619
619
|
createEditor() {
|
|
620
620
|
let e = {
|
|
@@ -676,7 +676,7 @@ var W = process.env.NODE_ENV !== "production", G = typeof window > "u", it = G |
|
|
|
676
676
|
return (t = this.options.current).onUnmount?.call(t, ...e);
|
|
677
677
|
}
|
|
678
678
|
};
|
|
679
|
-
return new
|
|
679
|
+
return new r(e);
|
|
680
680
|
}
|
|
681
681
|
getEditor() {
|
|
682
682
|
return this.editor;
|
|
@@ -733,24 +733,25 @@ var W = process.env.NODE_ENV !== "production", G = typeof window > "u", it = G |
|
|
|
733
733
|
}, 1);
|
|
734
734
|
}
|
|
735
735
|
};
|
|
736
|
-
function
|
|
737
|
-
let n =
|
|
736
|
+
function Qe(e = {}, t = []) {
|
|
737
|
+
let n = h(e);
|
|
738
738
|
n.current = e;
|
|
739
|
-
let [r] =
|
|
740
|
-
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({
|
|
741
741
|
editor: i,
|
|
742
742
|
selector: ({ transactionNumber: t }) => e.shouldRerenderOnTransaction === !1 || e.shouldRerenderOnTransaction === void 0 ? null : e.immediatelyRender && t === 0 ? 0 : t + 1
|
|
743
743
|
}), i;
|
|
744
744
|
}
|
|
745
|
-
var
|
|
746
|
-
|
|
747
|
-
var
|
|
745
|
+
var J = c({ editor: null });
|
|
746
|
+
J.Consumer;
|
|
747
|
+
var $e = () => u(J), et = c({
|
|
748
748
|
onDragStart: () => {},
|
|
749
749
|
nodeViewContentChildren: void 0,
|
|
750
750
|
nodeViewContentRef: () => {}
|
|
751
|
-
}),
|
|
752
|
-
|
|
753
|
-
|
|
751
|
+
}), tt = () => u(et);
|
|
752
|
+
s.forwardRef((e, t) => {
|
|
753
|
+
let { onDragStart: n } = tt(), r = e.as || "div";
|
|
754
|
+
return /* @__PURE__ */ x(r, {
|
|
754
755
|
...e,
|
|
755
756
|
ref: t,
|
|
756
757
|
"data-node-view-wrapper": "",
|
|
@@ -761,32 +762,32 @@ var st = () => g(K), q = d({
|
|
|
761
762
|
}
|
|
762
763
|
});
|
|
763
764
|
});
|
|
764
|
-
function
|
|
765
|
+
function Y(e) {
|
|
765
766
|
return !!(typeof e == "function" && e.prototype && e.prototype.isReactComponent);
|
|
766
767
|
}
|
|
767
|
-
function
|
|
768
|
+
function X(e) {
|
|
768
769
|
return !(typeof e != "object" || !e.$$typeof || e.$$typeof.toString() !== "Symbol(react.forward_ref)" && e.$$typeof.description !== "react.forward_ref");
|
|
769
770
|
}
|
|
770
|
-
function
|
|
771
|
+
function nt(e) {
|
|
771
772
|
return !(typeof e != "object" || !e.$$typeof || e.$$typeof.toString() !== "Symbol(react.memo)" && e.$$typeof.description !== "react.memo");
|
|
772
773
|
}
|
|
773
|
-
function
|
|
774
|
-
if (
|
|
775
|
-
if (
|
|
774
|
+
function rt(e) {
|
|
775
|
+
if (Y(e) || X(e)) return !0;
|
|
776
|
+
if (nt(e)) {
|
|
776
777
|
let t = e.type;
|
|
777
|
-
if (t) return
|
|
778
|
+
if (t) return Y(t) || X(t);
|
|
778
779
|
}
|
|
779
780
|
return !1;
|
|
780
781
|
}
|
|
781
|
-
function
|
|
782
|
+
function it() {
|
|
782
783
|
try {
|
|
783
|
-
if (
|
|
784
|
+
if (_) return parseInt(_.split(".")[0], 10) >= 19;
|
|
784
785
|
} catch {}
|
|
785
786
|
return !1;
|
|
786
787
|
}
|
|
787
|
-
var
|
|
788
|
+
var at = class {
|
|
788
789
|
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 ?
|
|
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(() => {
|
|
790
791
|
this.render();
|
|
791
792
|
}) : queueMicrotask(() => {
|
|
792
793
|
this.destroyed || this.render();
|
|
@@ -795,10 +796,10 @@ var X = class {
|
|
|
795
796
|
render() {
|
|
796
797
|
var e;
|
|
797
798
|
if (this.destroyed) return;
|
|
798
|
-
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 };
|
|
799
800
|
o.ref && !(i || a) && delete o.ref, !o.ref && (i || a) && (o.ref = (e) => {
|
|
800
801
|
this.ref = e;
|
|
801
|
-
}), this.reactElement = /* @__PURE__ */
|
|
802
|
+
}), this.reactElement = /* @__PURE__ */ x(t, { ...o }), r == null || (e = r.contentComponent) == null || e.setRenderer(this.id, this);
|
|
802
803
|
}
|
|
803
804
|
updateProps(e = {}) {
|
|
804
805
|
if (this.destroyed) return;
|
|
@@ -830,241 +831,32 @@ var X = class {
|
|
|
830
831
|
});
|
|
831
832
|
}
|
|
832
833
|
};
|
|
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() {
|
|
834
|
+
s.createContext({ markViewContentRef: () => {} });
|
|
835
|
+
var Z = c({ get editor() {
|
|
1044
836
|
throw Error("useTiptap must be used within a <Tiptap> provider");
|
|
1045
837
|
} });
|
|
1046
|
-
|
|
1047
|
-
var
|
|
1048
|
-
function
|
|
838
|
+
Z.displayName = "TiptapContext";
|
|
839
|
+
var ot = () => u(Z);
|
|
840
|
+
function Q({ children: e, ...t }) {
|
|
1049
841
|
let n = "editor" in t ? t.editor : t.instance;
|
|
1050
842
|
if (!n) throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");
|
|
1051
|
-
let r =
|
|
1052
|
-
return /* @__PURE__ */
|
|
843
|
+
let r = m(() => ({ editor: n }), [n]), i = m(() => ({ editor: n }), [n]);
|
|
844
|
+
return /* @__PURE__ */ x(J.Provider, {
|
|
1053
845
|
value: i,
|
|
1054
|
-
children: /* @__PURE__ */
|
|
846
|
+
children: /* @__PURE__ */ x(Z.Provider, {
|
|
1055
847
|
value: r,
|
|
1056
848
|
children: e
|
|
1057
849
|
})
|
|
1058
850
|
});
|
|
1059
851
|
}
|
|
1060
|
-
|
|
852
|
+
Q.displayName = "Tiptap";
|
|
1061
853
|
function $({ ...e }) {
|
|
1062
|
-
let { editor: t } =
|
|
1063
|
-
return /* @__PURE__ */
|
|
854
|
+
let { editor: t } = ot();
|
|
855
|
+
return /* @__PURE__ */ x(W, {
|
|
1064
856
|
editor: t,
|
|
1065
857
|
...e
|
|
1066
858
|
});
|
|
1067
859
|
}
|
|
1068
|
-
$.displayName = "Tiptap.Content", Object.assign(
|
|
860
|
+
$.displayName = "Tiptap.Content", Object.assign(Q, { Content: $ });
|
|
1069
861
|
//#endregion
|
|
1070
|
-
export {
|
|
862
|
+
export { G as a, Qe as i, at as n, $e as r, W as t };
|