@clevertask/scribe 0.1.13 → 0.1.15
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 +52 -0
- package/dist/{BarMenu-O2IVhHXx.js → BarMenu-x4sf3ECS.js} +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/ExternalLinkDisplayOptions.d.ts +13 -0
- package/dist/components/Menu/ExternalLinkDisplayOptions.d.ts.map +1 -0
- package/dist/components/Menu/ExternalLinkDisplayOptions.js +90 -0
- package/dist/components/Menu/LinkBubbleMenu.d.ts.map +1 -1
- package/dist/components/Menu/LinkBubbleMenu.js +161 -61
- package/dist/components/Menu/LinkEditor.d.ts +9 -0
- package/dist/components/Menu/LinkEditor.d.ts.map +1 -1
- package/dist/components/Menu/LinkEditor.js +117 -64
- package/dist/components/Menu/Mobile/ListOptionBar.js +1 -1
- package/dist/components/Menu/TableBubbleMenu.js +2 -2
- package/dist/components/Menu/contextualMenuOwner.d.ts +1 -1
- package/dist/components/Menu/contextualMenuOwner.d.ts.map +1 -1
- package/dist/components/Menu/contextualMenuOwner.js +9 -6
- package/dist/components/Menu/linkBubbleMenuPlugin.d.ts +24 -1
- package/dist/components/Menu/linkBubbleMenuPlugin.d.ts.map +1 -1
- package/dist/components/Menu/linkBubbleMenuPlugin.js +43 -6
- package/dist/components/Scribe/extension/callout.js +1 -1
- 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 +2 -2
- package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/attributes.d.ts +18 -0
- package/dist/components/Scribe/extension/external-link-preview/attributes.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/attributes.js +82 -0
- package/dist/components/Scribe/extension/external-link-preview/commands.d.ts +53 -0
- package/dist/components/Scribe/extension/external-link-preview/commands.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/commands.js +134 -0
- package/dist/components/Scribe/extension/external-link-preview/index.d.ts +13 -0
- package/dist/components/Scribe/extension/external-link-preview/index.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/index.js +140 -0
- package/dist/components/Scribe/extension/external-link-preview/node-view.d.ts +3 -0
- package/dist/components/Scribe/extension/external-link-preview/node-view.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/node-view.js +97 -0
- package/dist/components/Scribe/extension/external-link-preview/normalization.d.ts +7 -0
- package/dist/components/Scribe/extension/external-link-preview/normalization.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/normalization.js +21 -0
- package/dist/components/Scribe/extension/external-link-preview/paste.d.ts +9 -0
- package/dist/components/Scribe/extension/external-link-preview/paste.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/paste.js +54 -0
- package/dist/components/Scribe/extension/external-link-preview/policy.d.ts +7 -0
- package/dist/components/Scribe/extension/external-link-preview/policy.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/policy.js +38 -0
- package/dist/components/Scribe/extension/external-link-preview/render-html.d.ts +7 -0
- package/dist/components/Scribe/extension/external-link-preview/render-html.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/render-html.js +62 -0
- package/dist/components/Scribe/extension/external-link-preview/resolver.d.ts +23 -0
- package/dist/components/Scribe/extension/external-link-preview/resolver.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/resolver.js +118 -0
- package/dist/components/Scribe/extension/external-link-preview/serialization.d.ts +10 -0
- package/dist/components/Scribe/extension/external-link-preview/serialization.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/serialization.js +69 -0
- package/dist/components/Scribe/extension/external-link-preview/types.d.ts +58 -0
- package/dist/components/Scribe/extension/external-link-preview/types.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/types.js +4 -0
- package/dist/components/Scribe/extension/index.d.ts +1 -1
- package/dist/components/Scribe/extension/index.d.ts.map +1 -1
- package/dist/components/Scribe/extension/index.js +1 -1
- package/dist/components/Scribe/extension/resizable-table.js +1 -1
- package/dist/components/Scribe/extension/slashCommand/index.js +1 -1
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +1 -1
- package/dist/components/Scribe/extension/tableOfContents.js +1 -1
- package/dist/components/Scribe/index.d.ts +14 -0
- package/dist/components/Scribe/index.d.ts.map +1 -1
- package/dist/components/Scribe/index.js +5 -5
- package/dist/{dist-BoYfa2nz.js → dist-DDjaA1Pn.js} +309 -150
- package/dist/{dist-W9E-K577.js → dist-tNcpTcFT.js} +738 -637
- package/dist/{extension-D5WIAWhc.js → extension-dRUfQQo6.js} +1940 -1938
- package/dist/{extension-link-D8Zi7OSa.js → extension-link-RYtPpHwt.js} +28 -27
- package/dist/{html-to-markdown-C920nQtn.js → html-to-markdown-nbQ6qHyO.js} +173 -162
- package/dist/main.css +148 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +12 -9
- package/dist/{markdown-to-html-CW0Nb9Ye.js → markdown-to-html-B-KKCZRs.js} +115 -111
- package/dist/{menus-B1Zz0GjH.js → menus-U2HdvQnu.js} +11 -11
- package/dist/{resizable-table-Bf-fb9iv.js → resizable-table-m0AzovsZ.js} +14 -14
- package/dist/{slashCommand-47omO4ob.js → slashCommand-CtvgnL0Z.js} +1 -1
- package/dist/utils/create-scribe-editor.d.ts +4 -1
- package/dist/utils/create-scribe-editor.d.ts.map +1 -1
- package/dist/utils/html-to-markdown.d.ts.map +1 -1
- package/dist/utils/html-to-markdown.js +1 -1
- package/dist/utils/index.js +7 -7
- package/dist/utils/markdown-to-html.d.ts.map +1 -1
- package/dist/utils/markdown-to-html.js +1 -1
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-CtkjhSXr.js";
|
|
2
|
-
import { t } from "./dist-
|
|
3
|
-
import * as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { Fragment as
|
|
2
|
+
import { C as t, N as n, o as r, t as i } from "./dist-tNcpTcFT.js";
|
|
3
|
+
import * as a from "react";
|
|
4
|
+
import o, { createContext as s, createElement as c, createRef as l, forwardRef as u, memo as d, useContext as f, useDebugValue as p, useEffect as m, useLayoutEffect as h, useMemo as g, useRef as _, useState as v, version as y } from "react";
|
|
5
|
+
import b, { flushSync as ee } from "react-dom";
|
|
6
|
+
import { Fragment as x, jsx as S, jsxs as te } from "react/jsx-runtime";
|
|
7
7
|
//#region builtin:esm-external-require-react
|
|
8
|
-
var
|
|
9
|
-
t.exports = { ...
|
|
10
|
-
})),
|
|
11
|
-
var t =
|
|
8
|
+
var C = /* @__PURE__ */ e(((e, t) => {
|
|
9
|
+
t.exports = { ...a };
|
|
10
|
+
})), w = /* @__PURE__ */ e(((e) => {
|
|
11
|
+
var t = C();
|
|
12
12
|
function n(e, t) {
|
|
13
13
|
return e === t && (e !== 0 || 1 / e == 1 / t) || e !== e && t !== t;
|
|
14
14
|
}
|
|
@@ -45,7 +45,7 @@ var y = /* @__PURE__ */ e(((e, t) => {
|
|
|
45
45
|
}
|
|
46
46
|
var d = typeof window > "u" || window.document === void 0 || window.document.createElement === void 0 ? u : c;
|
|
47
47
|
e.useSyncExternalStore = t.useSyncExternalStore === void 0 ? d : t.useSyncExternalStore;
|
|
48
|
-
})),
|
|
48
|
+
})), ne = /* @__PURE__ */ e(((e) => {
|
|
49
49
|
process.env.NODE_ENV !== "production" && (function() {
|
|
50
50
|
function t(e, t) {
|
|
51
51
|
return e === t && (e !== 0 || 1 / e == 1 / t) || e !== e && t !== t;
|
|
@@ -88,18 +88,18 @@ var y = /* @__PURE__ */ e(((e, t) => {
|
|
|
88
88
|
return t();
|
|
89
89
|
}
|
|
90
90
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
91
|
-
var a =
|
|
91
|
+
var a = C(), 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
92
|
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
93
|
})();
|
|
94
|
-
})),
|
|
95
|
-
t.exports = process.env.NODE_ENV === "production" ?
|
|
96
|
-
})),
|
|
97
|
-
function
|
|
94
|
+
})), T = /* @__PURE__ */ e(((e, t) => {
|
|
95
|
+
t.exports = process.env.NODE_ENV === "production" ? w() : ne();
|
|
96
|
+
})), E = T(), { getOwnPropertyNames: re, getOwnPropertySymbols: ie } = Object, { hasOwnProperty: ae } = Object.prototype;
|
|
97
|
+
function D(e, t) {
|
|
98
98
|
return function(n, r, i) {
|
|
99
99
|
return e(n, r, i) && t(n, r, i);
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function O(e) {
|
|
103
103
|
return function(t, n, r) {
|
|
104
104
|
if (!t || !n || typeof t != "object" || typeof n != "object") return e(t, n, r);
|
|
105
105
|
let { cache: i } = r, a = i.get(t), o = i.get(n);
|
|
@@ -109,36 +109,36 @@ function E(e) {
|
|
|
109
109
|
return i.delete(t), i.delete(n), s;
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function oe(e) {
|
|
113
113
|
return e?.[Symbol.toStringTag];
|
|
114
114
|
}
|
|
115
|
-
function
|
|
116
|
-
return
|
|
115
|
+
function k(e) {
|
|
116
|
+
return re(e).concat(ie(e));
|
|
117
117
|
}
|
|
118
|
-
var
|
|
119
|
-
function
|
|
118
|
+
var se = Object.hasOwn || ((e, t) => ae.call(e, t));
|
|
119
|
+
function A(e, t) {
|
|
120
120
|
return e === t || !e && !t && e !== e && t !== t;
|
|
121
121
|
}
|
|
122
|
-
var
|
|
123
|
-
function
|
|
122
|
+
var ce = "__v", le = "__o", ue = "_owner", { getOwnPropertyDescriptor: j, keys: M } = Object;
|
|
123
|
+
function de(e, t) {
|
|
124
124
|
return e.byteLength === t.byteLength && R(new Uint8Array(e), new Uint8Array(t));
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function fe(e, t, n) {
|
|
127
127
|
let r = e.length;
|
|
128
128
|
if (t.length !== r) return !1;
|
|
129
129
|
for (; r-- > 0;) if (!n.equals(e[r], t[r], r, r, e, t, n)) return !1;
|
|
130
130
|
return !0;
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function pe(e, t) {
|
|
133
133
|
return e.byteLength === t.byteLength && R(new Uint8Array(e.buffer, e.byteOffset, e.byteLength), new Uint8Array(t.buffer, t.byteOffset, t.byteLength));
|
|
134
134
|
}
|
|
135
|
-
function
|
|
136
|
-
return
|
|
135
|
+
function me(e, t) {
|
|
136
|
+
return A(e.getTime(), t.getTime());
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function he(e, t) {
|
|
139
139
|
return e.name === t.name && e.message === t.message && e.cause === t.cause && e.stack === t.stack;
|
|
140
140
|
}
|
|
141
|
-
function
|
|
141
|
+
function ge(e, t) {
|
|
142
142
|
return e === t;
|
|
143
143
|
}
|
|
144
144
|
function N(e, t, n) {
|
|
@@ -165,24 +165,24 @@ function N(e, t, n) {
|
|
|
165
165
|
}
|
|
166
166
|
return !0;
|
|
167
167
|
}
|
|
168
|
-
var
|
|
169
|
-
function
|
|
168
|
+
var _e = A;
|
|
169
|
+
function P(e, t, n) {
|
|
170
170
|
let r = M(e), i = r.length;
|
|
171
171
|
if (M(t).length !== i) return !1;
|
|
172
|
-
for (; i-- > 0;) if (!
|
|
172
|
+
for (; i-- > 0;) if (!z(e, t, n, r[i])) return !1;
|
|
173
173
|
return !0;
|
|
174
174
|
}
|
|
175
|
-
function
|
|
176
|
-
let r =
|
|
177
|
-
if (
|
|
175
|
+
function F(e, t, n) {
|
|
176
|
+
let r = k(e), i = r.length;
|
|
177
|
+
if (k(t).length !== i) return !1;
|
|
178
178
|
let a, o, s;
|
|
179
|
-
for (; i-- > 0;) if (a = r[i], !
|
|
179
|
+
for (; i-- > 0;) if (a = r[i], !z(e, t, n, a) || (o = j(e, a), s = j(t, a), (o || s) && (!o || !s || o.configurable !== s.configurable || o.enumerable !== s.enumerable || o.writable !== s.writable))) return !1;
|
|
180
180
|
return !0;
|
|
181
181
|
}
|
|
182
|
-
function F(e, t) {
|
|
183
|
-
return k(e.valueOf(), t.valueOf());
|
|
184
|
-
}
|
|
185
182
|
function I(e, t) {
|
|
183
|
+
return A(e.valueOf(), t.valueOf());
|
|
184
|
+
}
|
|
185
|
+
function ve(e, t) {
|
|
186
186
|
return e.source === t.source && e.flags === t.flags;
|
|
187
187
|
}
|
|
188
188
|
function L(e, t, n) {
|
|
@@ -209,13 +209,13 @@ function R(e, t) {
|
|
|
209
209
|
for (; n-- > 0;) if (e[n] !== t[n]) return !1;
|
|
210
210
|
return !0;
|
|
211
211
|
}
|
|
212
|
-
function
|
|
212
|
+
function ye(e, t) {
|
|
213
213
|
return e.hostname === t.hostname && e.pathname === t.pathname && e.protocol === t.protocol && e.port === t.port && e.hash === t.hash && e.username === t.username && e.password === t.password;
|
|
214
214
|
}
|
|
215
|
-
function
|
|
216
|
-
return (r ===
|
|
215
|
+
function z(e, t, n, r) {
|
|
216
|
+
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);
|
|
217
217
|
}
|
|
218
|
-
var
|
|
218
|
+
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 = {
|
|
219
219
|
"[object Int8Array]": !0,
|
|
220
220
|
"[object Uint8Array]": !0,
|
|
221
221
|
"[object Uint8ClampedArray]": !0,
|
|
@@ -228,8 +228,8 @@ var V = "[object ArrayBuffer]", pe = "[object Arguments]", me = "[object Boolean
|
|
|
228
228
|
"[object Float64Array]": !0,
|
|
229
229
|
"[object BigInt64Array]": !0,
|
|
230
230
|
"[object BigUint64Array]": !0
|
|
231
|
-
},
|
|
232
|
-
function
|
|
231
|
+
}, Ne = "[object URL]", Pe = Object.prototype.toString;
|
|
232
|
+
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 }) {
|
|
233
233
|
return function(h, g, _) {
|
|
234
234
|
if (h === g) return !0;
|
|
235
235
|
if (h == null || g == null) return !1;
|
|
@@ -244,23 +244,23 @@ function De({ areArrayBuffersEqual: e, areArraysEqual: t, areDataViewsEqual: n,
|
|
|
244
244
|
if (y === RegExp) return u(h, g, _);
|
|
245
245
|
if (y === Map) return o(h, g, _);
|
|
246
246
|
if (y === Set) return d(h, g, _);
|
|
247
|
-
let b =
|
|
248
|
-
if (b ===
|
|
249
|
-
if (b ===
|
|
250
|
-
if (b ===
|
|
251
|
-
if (b ===
|
|
252
|
-
if (b ===
|
|
253
|
-
if (b ===
|
|
254
|
-
if (b ===
|
|
255
|
-
if (b ===
|
|
256
|
-
if (
|
|
257
|
-
if (b ===
|
|
258
|
-
if (b ===
|
|
259
|
-
if (b ===
|
|
247
|
+
let b = Pe.call(h);
|
|
248
|
+
if (b === we) return r(h, g, _);
|
|
249
|
+
if (b === ke) return u(h, g, _);
|
|
250
|
+
if (b === Ee) return o(h, g, _);
|
|
251
|
+
if (b === Ae) return d(h, g, _);
|
|
252
|
+
if (b === Oe) return typeof h.then != "function" && typeof g.then != "function" && c(h, g, _);
|
|
253
|
+
if (b === Ne) return p(h, g, _);
|
|
254
|
+
if (b === Te) return i(h, g, _);
|
|
255
|
+
if (b === xe) return c(h, g, _);
|
|
256
|
+
if (Me[b]) return f(h, g, _);
|
|
257
|
+
if (b === be) return e(h, g, _);
|
|
258
|
+
if (b === Ce) return n(h, g, _);
|
|
259
|
+
if (b === Se || b === De || b === je) return l(h, g, _);
|
|
260
260
|
if (m) {
|
|
261
261
|
let e = m[b];
|
|
262
262
|
if (!e) {
|
|
263
|
-
let t =
|
|
263
|
+
let t = oe(h);
|
|
264
264
|
t && (e = m[t]);
|
|
265
265
|
}
|
|
266
266
|
if (e) return e(h, g, _);
|
|
@@ -268,26 +268,26 @@ function De({ areArrayBuffersEqual: e, areArraysEqual: t, areDataViewsEqual: n,
|
|
|
268
268
|
return !1;
|
|
269
269
|
};
|
|
270
270
|
}
|
|
271
|
-
function
|
|
271
|
+
function Ie({ circular: e, createCustomConfig: t, strict: n }) {
|
|
272
272
|
let r = {
|
|
273
|
-
areArrayBuffersEqual:
|
|
274
|
-
areArraysEqual: n ?
|
|
275
|
-
areDataViewsEqual:
|
|
276
|
-
areDatesEqual:
|
|
277
|
-
areErrorsEqual:
|
|
278
|
-
areFunctionsEqual:
|
|
279
|
-
areMapsEqual: n ?
|
|
280
|
-
areNumbersEqual:
|
|
281
|
-
areObjectsEqual: n ?
|
|
282
|
-
arePrimitiveWrappersEqual:
|
|
283
|
-
areRegExpsEqual:
|
|
284
|
-
areSetsEqual: n ?
|
|
285
|
-
areTypedArraysEqual: n ?
|
|
286
|
-
areUrlsEqual:
|
|
273
|
+
areArrayBuffersEqual: de,
|
|
274
|
+
areArraysEqual: n ? F : fe,
|
|
275
|
+
areDataViewsEqual: pe,
|
|
276
|
+
areDatesEqual: me,
|
|
277
|
+
areErrorsEqual: he,
|
|
278
|
+
areFunctionsEqual: ge,
|
|
279
|
+
areMapsEqual: n ? D(N, F) : N,
|
|
280
|
+
areNumbersEqual: _e,
|
|
281
|
+
areObjectsEqual: n ? F : P,
|
|
282
|
+
arePrimitiveWrappersEqual: I,
|
|
283
|
+
areRegExpsEqual: ve,
|
|
284
|
+
areSetsEqual: n ? D(L, F) : L,
|
|
285
|
+
areTypedArraysEqual: n ? D(R, F) : R,
|
|
286
|
+
areUrlsEqual: ye,
|
|
287
287
|
unknownTagComparators: void 0
|
|
288
288
|
};
|
|
289
289
|
if (t && (r = Object.assign({}, r, t(r))), e) {
|
|
290
|
-
let e =
|
|
290
|
+
let e = O(r.areArraysEqual), t = O(r.areMapsEqual), n = O(r.areObjectsEqual), i = O(r.areSetsEqual);
|
|
291
291
|
r = Object.assign({}, r, {
|
|
292
292
|
areArraysEqual: e,
|
|
293
293
|
areMapsEqual: t,
|
|
@@ -297,12 +297,12 @@ function Oe({ circular: e, createCustomConfig: t, strict: n }) {
|
|
|
297
297
|
}
|
|
298
298
|
return r;
|
|
299
299
|
}
|
|
300
|
-
function
|
|
300
|
+
function Le(e) {
|
|
301
301
|
return function(t, n, r, i, a, o, s) {
|
|
302
302
|
return e(t, n, s);
|
|
303
303
|
};
|
|
304
304
|
}
|
|
305
|
-
function
|
|
305
|
+
function Re({ circular: e, comparator: t, createState: n, equals: r, strict: i }) {
|
|
306
306
|
if (n) return function(a, o) {
|
|
307
307
|
let { cache: s = e ? /* @__PURE__ */ new WeakMap() : void 0, meta: c } = n();
|
|
308
308
|
return t(a, o, {
|
|
@@ -330,35 +330,35 @@ function Ae({ circular: e, comparator: t, createState: n, equals: r, strict: i }
|
|
|
330
330
|
return t(e, n, a);
|
|
331
331
|
};
|
|
332
332
|
}
|
|
333
|
-
var
|
|
334
|
-
|
|
333
|
+
var ze = B();
|
|
334
|
+
B({ strict: !0 }), B({ circular: !0 }), B({
|
|
335
335
|
circular: !0,
|
|
336
336
|
strict: !0
|
|
337
|
-
}),
|
|
337
|
+
}), B({ createInternalComparator: () => A }), B({
|
|
338
338
|
strict: !0,
|
|
339
|
-
createInternalComparator: () =>
|
|
340
|
-
}),
|
|
339
|
+
createInternalComparator: () => A
|
|
340
|
+
}), B({
|
|
341
341
|
circular: !0,
|
|
342
|
-
createInternalComparator: () =>
|
|
343
|
-
}),
|
|
342
|
+
createInternalComparator: () => A
|
|
343
|
+
}), B({
|
|
344
344
|
circular: !0,
|
|
345
|
-
createInternalComparator: () =>
|
|
345
|
+
createInternalComparator: () => A,
|
|
346
346
|
strict: !0
|
|
347
347
|
});
|
|
348
|
-
function
|
|
349
|
-
let { circular: t = !1, createInternalComparator: n, createState: r, strict: i = !1 } = e, a =
|
|
350
|
-
return
|
|
348
|
+
function B(e = {}) {
|
|
349
|
+
let { circular: t = !1, createInternalComparator: n, createState: r, strict: i = !1 } = e, a = Fe(Ie(e));
|
|
350
|
+
return Re({
|
|
351
351
|
circular: t,
|
|
352
352
|
comparator: a,
|
|
353
353
|
createState: r,
|
|
354
|
-
equals: n ? n(a) :
|
|
354
|
+
equals: n ? n(a) : Le(a),
|
|
355
355
|
strict: i
|
|
356
356
|
});
|
|
357
357
|
}
|
|
358
358
|
//#endregion
|
|
359
359
|
//#region node_modules/.pnpm/use-sync-external-store@1.6.0_react@19.2.5/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js
|
|
360
|
-
var
|
|
361
|
-
var t =
|
|
360
|
+
var Be = /* @__PURE__ */ e(((e) => {
|
|
361
|
+
var t = C(), n = T();
|
|
362
362
|
function r(e, t) {
|
|
363
363
|
return e === t && (e !== 0 || 1 / e == 1 / t) || e !== e && t !== t;
|
|
364
364
|
}
|
|
@@ -402,13 +402,13 @@ var Me = /* @__PURE__ */ e(((e) => {
|
|
|
402
402
|
f.hasValue = !0, f.value = p;
|
|
403
403
|
}, [p]), l(p), p;
|
|
404
404
|
};
|
|
405
|
-
})),
|
|
405
|
+
})), Ve = /* @__PURE__ */ e(((e) => {
|
|
406
406
|
process.env.NODE_ENV !== "production" && (function() {
|
|
407
407
|
function t(e, t) {
|
|
408
408
|
return e === t && (e !== 0 || 1 / e == 1 / t) || e !== e && t !== t;
|
|
409
409
|
}
|
|
410
410
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
411
|
-
var n =
|
|
411
|
+
var n = C(), r = T(), i = typeof Object.is == "function" ? Object.is : t, a = r.useSyncExternalStore, o = n.useRef, s = n.useEffect, c = n.useMemo, l = n.useDebugValue;
|
|
412
412
|
e.useSyncExternalStoreWithSelector = function(e, t, n, r, u) {
|
|
413
413
|
var d = o(null);
|
|
414
414
|
if (d.current === null) {
|
|
@@ -449,17 +449,17 @@ var Me = /* @__PURE__ */ e(((e) => {
|
|
|
449
449
|
}, [p]), l(p), p;
|
|
450
450
|
}, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
451
451
|
})();
|
|
452
|
-
})),
|
|
453
|
-
t.exports = process.env.NODE_ENV === "production" ?
|
|
454
|
-
})))(),
|
|
452
|
+
})), He = (/* @__PURE__ */ e(((e, t) => {
|
|
453
|
+
t.exports = process.env.NODE_ENV === "production" ? Be() : Ve();
|
|
454
|
+
})))(), Ue = (...e) => (t) => {
|
|
455
455
|
e.forEach((e) => {
|
|
456
456
|
typeof e == "function" ? e(t) : e && (e.current = t);
|
|
457
457
|
});
|
|
458
|
-
},
|
|
459
|
-
let t = (0,
|
|
460
|
-
return /* @__PURE__ */
|
|
458
|
+
}, We = ({ contentComponent: e }) => {
|
|
459
|
+
let t = (0, E.useSyncExternalStore)(e.subscribe, e.getSnapshot, e.getServerSnapshot);
|
|
460
|
+
return /* @__PURE__ */ S(x, { children: Object.values(t) });
|
|
461
461
|
};
|
|
462
|
-
function
|
|
462
|
+
function Ge() {
|
|
463
463
|
let e = /* @__PURE__ */ new Set(), t = {}, n = !1, r = () => {
|
|
464
464
|
n || !e.size || (n = !0, queueMicrotask(() => {
|
|
465
465
|
n = !1, e.forEach((e) => e());
|
|
@@ -480,7 +480,7 @@ function Le() {
|
|
|
480
480
|
setRenderer(e, n) {
|
|
481
481
|
t = {
|
|
482
482
|
...t,
|
|
483
|
-
[e]:
|
|
483
|
+
[e]: b.createPortal(n.reactElement, n.element, e)
|
|
484
484
|
}, r();
|
|
485
485
|
},
|
|
486
486
|
removeRenderer(e) {
|
|
@@ -489,9 +489,9 @@ function Le() {
|
|
|
489
489
|
}
|
|
490
490
|
};
|
|
491
491
|
}
|
|
492
|
-
var
|
|
492
|
+
var Ke = class extends o.Component {
|
|
493
493
|
constructor(e) {
|
|
494
|
-
super(e), this.editorContentRef =
|
|
494
|
+
super(e), this.editorContentRef = o.createRef();
|
|
495
495
|
}
|
|
496
496
|
componentDidMount() {
|
|
497
497
|
this.init();
|
|
@@ -504,7 +504,7 @@ var Re = class extends r.Component {
|
|
|
504
504
|
if (e && !e.isDestroyed && e.view.dom?.parentNode) {
|
|
505
505
|
if (e.contentComponent) return;
|
|
506
506
|
let t = this.editorContentRef.current;
|
|
507
|
-
t.append(...e.view.dom.parentNode.childNodes), e.setOptions({ element: t }), e.contentComponent =
|
|
507
|
+
t.append(...e.view.dom.parentNode.childNodes), e.setOptions({ element: t }), e.contentComponent = Ge(), e.createNodeViews(), e.isEditorContentInitialized = !0, this.forceUpdate();
|
|
508
508
|
}
|
|
509
509
|
}
|
|
510
510
|
componentWillUnmount() {
|
|
@@ -520,19 +520,19 @@ var Re = class extends r.Component {
|
|
|
520
520
|
}
|
|
521
521
|
render() {
|
|
522
522
|
let { editor: e, innerRef: t, ...n } = this.props;
|
|
523
|
-
return /* @__PURE__ */
|
|
524
|
-
ref:
|
|
523
|
+
return /* @__PURE__ */ te(x, { children: [/* @__PURE__ */ S("div", {
|
|
524
|
+
ref: Ue(t, this.editorContentRef),
|
|
525
525
|
...n
|
|
526
|
-
}), e?.contentComponent && /* @__PURE__ */
|
|
526
|
+
}), e?.contentComponent && /* @__PURE__ */ S(We, { contentComponent: e.contentComponent })] });
|
|
527
527
|
}
|
|
528
|
-
},
|
|
529
|
-
let n =
|
|
530
|
-
return
|
|
528
|
+
}, qe = u((e, t) => {
|
|
529
|
+
let n = o.useMemo(() => Math.floor(Math.random() * 4294967295).toString(), [e.editor]);
|
|
530
|
+
return o.createElement(Ke, {
|
|
531
531
|
key: n,
|
|
532
532
|
innerRef: t,
|
|
533
533
|
...e
|
|
534
534
|
});
|
|
535
|
-
}),
|
|
535
|
+
}), V = o.memo(qe), Je = typeof window < "u" ? h : m, Ye = class {
|
|
536
536
|
constructor(e) {
|
|
537
537
|
this.transactionNumber = 0, this.lastTransactionNumber = 0, this.subscribers = /* @__PURE__ */ new Set(), this.editor = e, this.lastSnapshot = {
|
|
538
538
|
editor: e,
|
|
@@ -567,11 +567,11 @@ var Re = class extends r.Component {
|
|
|
567
567
|
}
|
|
568
568
|
}
|
|
569
569
|
};
|
|
570
|
-
function
|
|
571
|
-
let [t] =
|
|
572
|
-
return
|
|
570
|
+
function H(e) {
|
|
571
|
+
let [t] = v(() => new Ye(e.editor)), n = (0, He.useSyncExternalStoreWithSelector)(t.subscribe, t.getSnapshot, t.getServerSnapshot, e.selector, e.equalityFn ?? ze);
|
|
572
|
+
return Je(() => t.watch(e.editor), [e.editor, t]), p(n), n;
|
|
573
573
|
}
|
|
574
|
-
var
|
|
574
|
+
var U = process.env.NODE_ENV !== "production", W = typeof window > "u", Xe = W || !!(typeof window < "u" && window.next), Ze = class e {
|
|
575
575
|
constructor(e) {
|
|
576
576
|
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);
|
|
577
577
|
}
|
|
@@ -580,7 +580,7 @@ var G = process.env.NODE_ENV !== "production", K = typeof window > "u", He = K |
|
|
|
580
580
|
}
|
|
581
581
|
getInitialEditor() {
|
|
582
582
|
let e = this.options.current.immediatelyRender, t = e ?? !0;
|
|
583
|
-
return
|
|
583
|
+
return W ? (t && U && console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"), t = !1) : Xe && e === void 0 && (t = !1, U && 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;
|
|
584
584
|
}
|
|
585
585
|
createEditor() {
|
|
586
586
|
let e = {
|
|
@@ -642,7 +642,7 @@ var G = process.env.NODE_ENV !== "production", K = typeof window > "u", He = K |
|
|
|
642
642
|
return (t = this.options.current).onUnmount?.call(t, ...e);
|
|
643
643
|
}
|
|
644
644
|
};
|
|
645
|
-
return new
|
|
645
|
+
return new i(e);
|
|
646
646
|
}
|
|
647
647
|
getEditor() {
|
|
648
648
|
return this.editor;
|
|
@@ -699,25 +699,24 @@ var G = process.env.NODE_ENV !== "production", K = typeof window > "u", He = K |
|
|
|
699
699
|
}, 1);
|
|
700
700
|
}
|
|
701
701
|
};
|
|
702
|
-
function
|
|
703
|
-
let n =
|
|
702
|
+
function Qe(e = {}, t = []) {
|
|
703
|
+
let n = _(e);
|
|
704
704
|
n.current = e;
|
|
705
|
-
let [r] =
|
|
706
|
-
return
|
|
705
|
+
let [r] = v(() => new Ze(n)), i = (0, E.useSyncExternalStore)(r.subscribe, r.getEditor, r.getServerSnapshot);
|
|
706
|
+
return p(i), m(r.onRender(t)), H({
|
|
707
707
|
editor: i,
|
|
708
708
|
selector: ({ transactionNumber: t }) => e.shouldRerenderOnTransaction === !1 || e.shouldRerenderOnTransaction === void 0 ? null : e.immediatelyRender && t === 0 ? 0 : t + 1
|
|
709
709
|
}), i;
|
|
710
710
|
}
|
|
711
|
-
var
|
|
712
|
-
|
|
713
|
-
var
|
|
711
|
+
var G = s({ editor: null });
|
|
712
|
+
G.Consumer;
|
|
713
|
+
var $e = () => f(G), K = s({
|
|
714
714
|
onDragStart: () => {},
|
|
715
715
|
nodeViewContentChildren: void 0,
|
|
716
716
|
nodeViewContentRef: () => {}
|
|
717
|
-
}),
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
return /* @__PURE__ */ _(r, {
|
|
717
|
+
}), et = () => f(K), tt = o.forwardRef((e, t) => {
|
|
718
|
+
let { onDragStart: n } = et(), r = e.as || "div";
|
|
719
|
+
return /* @__PURE__ */ S(r, {
|
|
721
720
|
...e,
|
|
722
721
|
ref: t,
|
|
723
722
|
"data-node-view-wrapper": "",
|
|
@@ -728,32 +727,32 @@ r.forwardRef((e, t) => {
|
|
|
728
727
|
}
|
|
729
728
|
});
|
|
730
729
|
});
|
|
731
|
-
function
|
|
730
|
+
function q(e) {
|
|
732
731
|
return !!(typeof e == "function" && e.prototype && e.prototype.isReactComponent);
|
|
733
732
|
}
|
|
734
|
-
function
|
|
733
|
+
function J(e) {
|
|
735
734
|
return !!(typeof e == "object" && e.$$typeof && (e.$$typeof.toString() === "Symbol(react.forward_ref)" || e.$$typeof.description === "react.forward_ref"));
|
|
736
735
|
}
|
|
737
|
-
function
|
|
736
|
+
function Y(e) {
|
|
738
737
|
return !!(typeof e == "object" && e.$$typeof && (e.$$typeof.toString() === "Symbol(react.memo)" || e.$$typeof.description === "react.memo"));
|
|
739
738
|
}
|
|
740
|
-
function
|
|
741
|
-
if (
|
|
742
|
-
if (
|
|
739
|
+
function nt(e) {
|
|
740
|
+
if (q(e) || J(e)) return !0;
|
|
741
|
+
if (Y(e)) {
|
|
743
742
|
let t = e.type;
|
|
744
|
-
if (t) return
|
|
743
|
+
if (t) return q(t) || J(t);
|
|
745
744
|
}
|
|
746
745
|
return !1;
|
|
747
746
|
}
|
|
748
|
-
function
|
|
747
|
+
function rt() {
|
|
749
748
|
try {
|
|
750
|
-
if (
|
|
749
|
+
if (y) return parseInt(y.split(".")[0], 10) >= 19;
|
|
751
750
|
} catch {}
|
|
752
751
|
return !1;
|
|
753
752
|
}
|
|
754
|
-
var
|
|
753
|
+
var X = class {
|
|
755
754
|
constructor(e, { editor: t, props: n = {}, as: r = "div", className: i = "" }) {
|
|
756
|
-
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 ?
|
|
755
|
+
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 ? ee(() => {
|
|
757
756
|
this.render();
|
|
758
757
|
}) : queueMicrotask(() => {
|
|
759
758
|
this.destroyed || this.render();
|
|
@@ -762,10 +761,10 @@ var Xe = class {
|
|
|
762
761
|
render() {
|
|
763
762
|
var e;
|
|
764
763
|
if (this.destroyed) return;
|
|
765
|
-
let t = this.component, n = this.props, r = this.editor, i =
|
|
764
|
+
let t = this.component, n = this.props, r = this.editor, i = rt(), a = nt(t), o = { ...n };
|
|
766
765
|
o.ref && !(i || a) && delete o.ref, !o.ref && (i || a) && (o.ref = (e) => {
|
|
767
766
|
this.ref = e;
|
|
768
|
-
}), this.reactElement = /* @__PURE__ */
|
|
767
|
+
}), this.reactElement = /* @__PURE__ */ S(t, { ...o }), (e = r?.contentComponent) == null || e.setRenderer(this.id, this);
|
|
769
768
|
}
|
|
770
769
|
updateProps(e = {}) {
|
|
771
770
|
if (this.destroyed) return;
|
|
@@ -795,19 +794,179 @@ var Xe = class {
|
|
|
795
794
|
});
|
|
796
795
|
}
|
|
797
796
|
};
|
|
798
|
-
|
|
799
|
-
|
|
797
|
+
o.createContext({ markViewContentRef: () => {} });
|
|
798
|
+
function it(e) {
|
|
799
|
+
let t = e.getRootNode(), n = typeof t.getSelection == "function" ? t.getSelection() : (e.ownerDocument?.defaultView)?.getSelection();
|
|
800
|
+
if (!n || n.rangeCount === 0) return null;
|
|
801
|
+
let { anchorNode: r, anchorOffset: i, focusNode: a, focusOffset: o } = n;
|
|
802
|
+
return !r || !a || !e.contains(r) || !e.contains(a) ? null : () => {
|
|
803
|
+
try {
|
|
804
|
+
n.setBaseAndExtent(r, i, a, o);
|
|
805
|
+
} catch {}
|
|
806
|
+
};
|
|
807
|
+
}
|
|
808
|
+
var at = class extends r {
|
|
809
|
+
constructor(e, t, n) {
|
|
810
|
+
if (super(e, t, n), this.selectionRafId = null, this.handlePositionUpdate = () => {
|
|
811
|
+
let e = this.getPos();
|
|
812
|
+
typeof e == "number" && e !== this.currentPos && (this.currentPos = e, this.renderer.updateProps({ getPos: () => this.getPos() }), typeof this.options.attrs == "function" && this.updateElementAttributes());
|
|
813
|
+
}, this.cachedExtensionWithSyncedStorage = null, !this.node.isLeaf) {
|
|
814
|
+
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";
|
|
815
|
+
let e = this.dom.querySelector("[data-node-view-content]");
|
|
816
|
+
e ? e.appendChild(this.contentDOMElement) : this.dom.appendChild(this.contentDOMElement);
|
|
817
|
+
}
|
|
818
|
+
this.options.trackNodeViewPosition && this.editor.on("update", this.handlePositionUpdate);
|
|
819
|
+
}
|
|
820
|
+
get extensionWithSyncedStorage() {
|
|
821
|
+
if (!this.cachedExtensionWithSyncedStorage) {
|
|
822
|
+
let e = this.editor, t = this.extension;
|
|
823
|
+
this.cachedExtensionWithSyncedStorage = new Proxy(t, { get(n, r, i) {
|
|
824
|
+
return r === "storage" ? e.storage[t.name] ?? {} : Reflect.get(n, r, i);
|
|
825
|
+
} });
|
|
826
|
+
}
|
|
827
|
+
return this.cachedExtensionWithSyncedStorage;
|
|
828
|
+
}
|
|
829
|
+
mount() {
|
|
830
|
+
let e = {
|
|
831
|
+
editor: this.editor,
|
|
832
|
+
node: this.node,
|
|
833
|
+
decorations: this.decorations,
|
|
834
|
+
innerDecorations: this.innerDecorations,
|
|
835
|
+
view: this.view,
|
|
836
|
+
selected: !1,
|
|
837
|
+
extension: this.extensionWithSyncedStorage,
|
|
838
|
+
HTMLAttributes: this.HTMLAttributes,
|
|
839
|
+
getPos: () => this.getPos(),
|
|
840
|
+
updateAttributes: (e = {}) => this.updateAttributes(e),
|
|
841
|
+
deleteNode: () => this.deleteNode(),
|
|
842
|
+
ref: l()
|
|
843
|
+
};
|
|
844
|
+
if (!this.component.displayName) {
|
|
845
|
+
let e = (e) => e.charAt(0).toUpperCase() + e.substring(1);
|
|
846
|
+
this.component.displayName = e(this.extension.name);
|
|
847
|
+
}
|
|
848
|
+
let t = {
|
|
849
|
+
onDragStart: this.onDragStart.bind(this),
|
|
850
|
+
nodeViewContentRef: (e) => {
|
|
851
|
+
if (e && this.contentDOMElement && e.firstChild !== this.contentDOMElement) {
|
|
852
|
+
e.hasAttribute("data-node-view-wrapper") && e.removeAttribute("data-node-view-wrapper");
|
|
853
|
+
let t = it(this.contentDOMElement);
|
|
854
|
+
e.appendChild(this.contentDOMElement), t?.();
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
}, n = this.component, r = d((e) => /* @__PURE__ */ S(K.Provider, {
|
|
858
|
+
value: t,
|
|
859
|
+
children: c(n, e)
|
|
860
|
+
}));
|
|
861
|
+
r.displayName = "ReactNodeView";
|
|
862
|
+
let i = this.node.isInline ? "span" : "div";
|
|
863
|
+
this.options.as && (i = this.options.as);
|
|
864
|
+
let { className: a = "" } = this.options;
|
|
865
|
+
this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this), this.renderer = new X(r, {
|
|
866
|
+
editor: this.editor,
|
|
867
|
+
props: e,
|
|
868
|
+
as: i,
|
|
869
|
+
className: `node-${this.node.type.name} ${a}`.trim()
|
|
870
|
+
}), this.editor.on("selectionUpdate", this.handleSelectionUpdate), this.updateElementAttributes(), this.currentPos = this.getPos();
|
|
871
|
+
}
|
|
872
|
+
get dom() {
|
|
873
|
+
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.");
|
|
874
|
+
return this.renderer.element;
|
|
875
|
+
}
|
|
876
|
+
get contentDOM() {
|
|
877
|
+
return this.node.isLeaf ? null : this.contentDOMElement;
|
|
878
|
+
}
|
|
879
|
+
handleSelectionUpdate() {
|
|
880
|
+
this.selectionRafId &&= (cancelAnimationFrame(this.selectionRafId), null), this.selectionRafId = requestAnimationFrame(() => {
|
|
881
|
+
this.selectionRafId = null;
|
|
882
|
+
let e = this.getPos() ?? this.currentPos;
|
|
883
|
+
if (typeof e == "number") {
|
|
884
|
+
if (n({
|
|
885
|
+
selection: this.editor.state.selection,
|
|
886
|
+
pos: e,
|
|
887
|
+
nodeSize: this.node.nodeSize,
|
|
888
|
+
selectedOnTextSelection: this.options.selectedOnTextSelection
|
|
889
|
+
})) {
|
|
890
|
+
if (this.renderer.props.selected) return;
|
|
891
|
+
this.selectNode();
|
|
892
|
+
} else {
|
|
893
|
+
if (!this.renderer.props.selected) return;
|
|
894
|
+
this.deselectNode();
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
});
|
|
898
|
+
}
|
|
899
|
+
update(e, t, n) {
|
|
900
|
+
let r = (e) => {
|
|
901
|
+
this.renderer.updateProps(e), typeof this.options.attrs == "function" && this.updateElementAttributes();
|
|
902
|
+
};
|
|
903
|
+
if (e.type !== this.node.type) return !1;
|
|
904
|
+
if (typeof this.options.update == "function") {
|
|
905
|
+
let i = this.node, a = this.decorations, o = this.innerDecorations;
|
|
906
|
+
return this.node = e, this.decorations = t, this.innerDecorations = n, this.currentPos = this.getPos(), this.options.update({
|
|
907
|
+
oldNode: i,
|
|
908
|
+
oldDecorations: a,
|
|
909
|
+
newNode: e,
|
|
910
|
+
newDecorations: t,
|
|
911
|
+
oldInnerDecorations: o,
|
|
912
|
+
innerDecorations: n,
|
|
913
|
+
updateProps: () => r({
|
|
914
|
+
node: e,
|
|
915
|
+
decorations: t,
|
|
916
|
+
innerDecorations: n,
|
|
917
|
+
extension: this.extensionWithSyncedStorage
|
|
918
|
+
})
|
|
919
|
+
});
|
|
920
|
+
}
|
|
921
|
+
if (e === this.node) return this.node = e, this.decorations = t, this.innerDecorations = n, !0;
|
|
922
|
+
let i = this.getPos();
|
|
923
|
+
this.node = e, this.decorations = t, this.innerDecorations = n, this.currentPos = i;
|
|
924
|
+
let a = {
|
|
925
|
+
node: e,
|
|
926
|
+
decorations: t,
|
|
927
|
+
innerDecorations: n,
|
|
928
|
+
extension: this.extensionWithSyncedStorage
|
|
929
|
+
};
|
|
930
|
+
return this.options.trackNodeViewPosition && (a.getPos = () => this.getPos()), r(a), !0;
|
|
931
|
+
}
|
|
932
|
+
selectNode() {
|
|
933
|
+
this.renderer.updateProps({ selected: !0 }), this.renderer.element.classList.add("ProseMirror-selectednode");
|
|
934
|
+
}
|
|
935
|
+
deselectNode() {
|
|
936
|
+
this.renderer.updateProps({ selected: !1 }), this.renderer.element.classList.remove("ProseMirror-selectednode");
|
|
937
|
+
}
|
|
938
|
+
destroy() {
|
|
939
|
+
this.renderer.destroy(), this.editor.off("selectionUpdate", this.handleSelectionUpdate), this.options.trackNodeViewPosition && this.editor.off("update", this.handlePositionUpdate), this.contentDOMElement = null, this.selectionRafId &&= (cancelAnimationFrame(this.selectionRafId), null);
|
|
940
|
+
}
|
|
941
|
+
updateElementAttributes() {
|
|
942
|
+
if (this.options.attrs) {
|
|
943
|
+
let e = {};
|
|
944
|
+
if (typeof this.options.attrs == "function") {
|
|
945
|
+
let n = this.editor.extensionManager.attributes, r = t(this.node, n);
|
|
946
|
+
e = this.options.attrs({
|
|
947
|
+
node: this.node,
|
|
948
|
+
HTMLAttributes: r
|
|
949
|
+
});
|
|
950
|
+
} else e = this.options.attrs;
|
|
951
|
+
this.renderer.updateAttributes(e);
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
};
|
|
955
|
+
function ot(e, t) {
|
|
956
|
+
return (n) => n.editor.contentComponent ? new at(e, n, t) : {};
|
|
957
|
+
}
|
|
958
|
+
var Z = s({ get editor() {
|
|
800
959
|
throw Error("useTiptap must be used within a <Tiptap> provider");
|
|
801
960
|
} });
|
|
802
961
|
Z.displayName = "TiptapContext";
|
|
803
|
-
var
|
|
962
|
+
var st = () => f(Z);
|
|
804
963
|
function Q({ children: e, ...t }) {
|
|
805
964
|
let n = "editor" in t ? t.editor : t.instance;
|
|
806
965
|
if (!n) throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");
|
|
807
|
-
let r =
|
|
808
|
-
return /* @__PURE__ */
|
|
966
|
+
let r = g(() => ({ editor: n }), [n]), i = g(() => ({ editor: n }), [n]);
|
|
967
|
+
return /* @__PURE__ */ S(G.Provider, {
|
|
809
968
|
value: i,
|
|
810
|
-
children: /* @__PURE__ */
|
|
969
|
+
children: /* @__PURE__ */ S(Z.Provider, {
|
|
811
970
|
value: r,
|
|
812
971
|
children: e
|
|
813
972
|
})
|
|
@@ -815,12 +974,12 @@ function Q({ children: e, ...t }) {
|
|
|
815
974
|
}
|
|
816
975
|
Q.displayName = "Tiptap";
|
|
817
976
|
function $({ ...e }) {
|
|
818
|
-
let { editor: t } =
|
|
819
|
-
return /* @__PURE__ */
|
|
977
|
+
let { editor: t } = st();
|
|
978
|
+
return /* @__PURE__ */ S(V, {
|
|
820
979
|
editor: t,
|
|
821
980
|
...e
|
|
822
981
|
});
|
|
823
982
|
}
|
|
824
983
|
$.displayName = "Tiptap.Content", Object.assign(Q, { Content: $ });
|
|
825
984
|
//#endregion
|
|
826
|
-
export {
|
|
985
|
+
export { $e as a, X as i, tt as n, Qe as o, ot as r, H as s, V as t };
|