@alxgrn/prose-editor 0.0.10 → 0.0.13
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/dist/index.css +1 -1
- package/dist/lib/prose/menubar/elements/InsertImage.d.ts +1 -0
- package/dist/lib/prose/plugins/imagePlugin.d.ts +3 -3
- package/dist/prose-editor.es.js +724 -728
- package/dist/prose-editor.es.js.map +1 -1
- package/dist/prose-editor.umd.js +21 -21
- package/dist/prose-editor.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/prose-editor.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import './index.css';var Rf = Object.defineProperty;
|
|
2
2
|
var If = (n, e, t) => e in n ? Rf(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
-
var
|
|
4
|
-
import
|
|
3
|
+
var F = (n, e, t) => If(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import A, { createContext as ct, useLayoutEffect as Pf, useContext as oe, forwardRef as Ge, useState as N, useRef as I, useImperativeHandle as ns, useCallback as He, useMemo as Me, useReducer as vf, memo as Fe, createElement as Hn, useSyncExternalStore as Vf, cloneElement as rs, Component as $f, useEffect as q } from "react";
|
|
5
5
|
import { unstable_batchedUpdates as zf, flushSync as Ri, createPortal as jf } from "react-dom";
|
|
6
6
|
import { Icons as O, Prompt as Ff, Modal as Pa, Form as va, Image as Bf, Input as Pr, Editable as Va, Button as Lf, Menu as Fn } from "@alxgrn/telefrag-ui";
|
|
7
7
|
function Wf(n) {
|
|
@@ -58,13 +58,13 @@ function qf() {
|
|
|
58
58
|
return b.$$typeof === mr ? null : b.displayName || b.name || null;
|
|
59
59
|
if (typeof b == "string") return b;
|
|
60
60
|
switch (b) {
|
|
61
|
-
case
|
|
61
|
+
case D:
|
|
62
62
|
return "Fragment";
|
|
63
|
-
case
|
|
63
|
+
case P:
|
|
64
64
|
return "Portal";
|
|
65
|
-
case
|
|
65
|
+
case z:
|
|
66
66
|
return "Profiler";
|
|
67
|
-
case
|
|
67
|
+
case B:
|
|
68
68
|
return "StrictMode";
|
|
69
69
|
case dt:
|
|
70
70
|
return "Suspense";
|
|
@@ -77,17 +77,17 @@ function qf() {
|
|
|
77
77
|
), b.$$typeof) {
|
|
78
78
|
case _:
|
|
79
79
|
return (b.displayName || "Context") + ".Provider";
|
|
80
|
-
case
|
|
80
|
+
case R:
|
|
81
81
|
return (b._context.displayName || "Context") + ".Consumer";
|
|
82
82
|
case ke:
|
|
83
|
-
var
|
|
84
|
-
return b = b.displayName, b || (b =
|
|
83
|
+
var E = b.render;
|
|
84
|
+
return b = b.displayName, b || (b = E.displayName || E.name || "", b = b !== "" ? "ForwardRef(" + b + ")" : "ForwardRef"), b;
|
|
85
85
|
case $e:
|
|
86
|
-
return
|
|
86
|
+
return E = b.displayName || null, E !== null ? E : n(b.type) || "Memo";
|
|
87
87
|
case $t:
|
|
88
|
-
|
|
88
|
+
E = b._payload, b = b._init;
|
|
89
89
|
try {
|
|
90
|
-
return n(b(
|
|
90
|
+
return n(b(E));
|
|
91
91
|
} catch {
|
|
92
92
|
}
|
|
93
93
|
}
|
|
@@ -99,17 +99,17 @@ function qf() {
|
|
|
99
99
|
function t(b) {
|
|
100
100
|
try {
|
|
101
101
|
e(b);
|
|
102
|
-
var
|
|
102
|
+
var E = !1;
|
|
103
103
|
} catch {
|
|
104
|
-
|
|
104
|
+
E = !0;
|
|
105
105
|
}
|
|
106
|
-
if (
|
|
107
|
-
|
|
108
|
-
var
|
|
109
|
-
return
|
|
110
|
-
|
|
106
|
+
if (E) {
|
|
107
|
+
E = console;
|
|
108
|
+
var T = E.error, L = typeof Symbol == "function" && Symbol.toStringTag && b[Symbol.toStringTag] || b.constructor.name || "Object";
|
|
109
|
+
return T.call(
|
|
110
|
+
E,
|
|
111
111
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
112
|
-
|
|
112
|
+
L
|
|
113
113
|
), e(b);
|
|
114
114
|
}
|
|
115
115
|
}
|
|
@@ -157,26 +157,26 @@ function qf() {
|
|
|
157
157
|
if (ks === void 0)
|
|
158
158
|
try {
|
|
159
159
|
throw Error();
|
|
160
|
-
} catch (
|
|
161
|
-
var
|
|
162
|
-
ks =
|
|
163
|
-
at`) ? " (<anonymous>)" : -1 <
|
|
160
|
+
} catch (T) {
|
|
161
|
+
var E = T.stack.trim().match(/\n( *(at )?)/);
|
|
162
|
+
ks = E && E[1] || "", Di = -1 < T.stack.indexOf(`
|
|
163
|
+
at`) ? " (<anonymous>)" : -1 < T.stack.indexOf("@") ? "@unknown:0:0" : "";
|
|
164
164
|
}
|
|
165
165
|
return `
|
|
166
166
|
` + ks + b + Di;
|
|
167
167
|
}
|
|
168
|
-
function l(b,
|
|
168
|
+
function l(b, E) {
|
|
169
169
|
if (!b || Cs) return "";
|
|
170
|
-
var
|
|
171
|
-
if (
|
|
172
|
-
Cs = !0,
|
|
173
|
-
var
|
|
174
|
-
|
|
170
|
+
var T = ws.get(b);
|
|
171
|
+
if (T !== void 0) return T;
|
|
172
|
+
Cs = !0, T = Error.prepareStackTrace, Error.prepareStackTrace = void 0;
|
|
173
|
+
var L = null;
|
|
174
|
+
L = zt.H, zt.H = null, s();
|
|
175
175
|
try {
|
|
176
176
|
var ie = {
|
|
177
177
|
DetermineComponentFrameRoot: function() {
|
|
178
178
|
try {
|
|
179
|
-
if (
|
|
179
|
+
if (E) {
|
|
180
180
|
var ht = function() {
|
|
181
181
|
throw Error();
|
|
182
182
|
};
|
|
@@ -225,50 +225,50 @@ function qf() {
|
|
|
225
225
|
"name",
|
|
226
226
|
{ value: "DetermineComponentFrameRoot" }
|
|
227
227
|
);
|
|
228
|
-
var
|
|
228
|
+
var j = ie.DetermineComponentFrameRoot(), Ze = j[0], ln = j[1];
|
|
229
229
|
if (Ze && ln) {
|
|
230
|
-
var
|
|
230
|
+
var de = Ze.split(`
|
|
231
231
|
`), Ft = ln.split(`
|
|
232
232
|
`);
|
|
233
|
-
for (
|
|
233
|
+
for (j = J = 0; J < de.length && !de[J].includes(
|
|
234
234
|
"DetermineComponentFrameRoot"
|
|
235
235
|
); )
|
|
236
236
|
J++;
|
|
237
|
-
for (;
|
|
237
|
+
for (; j < Ft.length && !Ft[j].includes(
|
|
238
238
|
"DetermineComponentFrameRoot"
|
|
239
239
|
); )
|
|
240
|
-
|
|
241
|
-
if (J ===
|
|
242
|
-
for (J =
|
|
243
|
-
|
|
244
|
-
for (; 1 <= J && 0 <=
|
|
245
|
-
if (
|
|
246
|
-
if (J !== 1 ||
|
|
240
|
+
j++;
|
|
241
|
+
if (J === de.length || j === Ft.length)
|
|
242
|
+
for (J = de.length - 1, j = Ft.length - 1; 1 <= J && 0 <= j && de[J] !== Ft[j]; )
|
|
243
|
+
j--;
|
|
244
|
+
for (; 1 <= J && 0 <= j; J--, j--)
|
|
245
|
+
if (de[J] !== Ft[j]) {
|
|
246
|
+
if (J !== 1 || j !== 1)
|
|
247
247
|
do
|
|
248
|
-
if (J--,
|
|
248
|
+
if (J--, j--, 0 > j || de[J] !== Ft[j]) {
|
|
249
249
|
var Rn = `
|
|
250
|
-
` +
|
|
250
|
+
` + de[J].replace(
|
|
251
251
|
" at new ",
|
|
252
252
|
" at "
|
|
253
253
|
);
|
|
254
254
|
return b.displayName && Rn.includes("<anonymous>") && (Rn = Rn.replace("<anonymous>", b.displayName)), typeof b == "function" && ws.set(b, Rn), Rn;
|
|
255
255
|
}
|
|
256
|
-
while (1 <= J && 0 <=
|
|
256
|
+
while (1 <= J && 0 <= j);
|
|
257
257
|
break;
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
260
|
} finally {
|
|
261
|
-
Cs = !1, zt.H =
|
|
261
|
+
Cs = !1, zt.H = L, o(), Error.prepareStackTrace = T;
|
|
262
262
|
}
|
|
263
|
-
return
|
|
263
|
+
return de = (de = b ? b.displayName || b.name : "") ? i(de) : "", typeof b == "function" && ws.set(b, de), de;
|
|
264
264
|
}
|
|
265
265
|
function a(b) {
|
|
266
266
|
if (b == null) return "";
|
|
267
267
|
if (typeof b == "function") {
|
|
268
|
-
var
|
|
268
|
+
var E = b.prototype;
|
|
269
269
|
return l(
|
|
270
270
|
b,
|
|
271
|
-
!(!
|
|
271
|
+
!(!E || !E.isReactComponent)
|
|
272
272
|
);
|
|
273
273
|
}
|
|
274
274
|
if (typeof b == "string") return i(b);
|
|
@@ -285,9 +285,9 @@ function qf() {
|
|
|
285
285
|
case $e:
|
|
286
286
|
return a(b.type);
|
|
287
287
|
case $t:
|
|
288
|
-
|
|
288
|
+
E = b._payload, b = b._init;
|
|
289
289
|
try {
|
|
290
|
-
return a(b(
|
|
290
|
+
return a(b(E));
|
|
291
291
|
} catch {
|
|
292
292
|
}
|
|
293
293
|
}
|
|
@@ -299,20 +299,20 @@ function qf() {
|
|
|
299
299
|
}
|
|
300
300
|
function u(b) {
|
|
301
301
|
if (bi.call(b, "key")) {
|
|
302
|
-
var
|
|
303
|
-
if (
|
|
302
|
+
var E = Object.getOwnPropertyDescriptor(b, "key").get;
|
|
303
|
+
if (E && E.isReactWarning) return !1;
|
|
304
304
|
}
|
|
305
305
|
return b.key !== void 0;
|
|
306
306
|
}
|
|
307
|
-
function f(b,
|
|
308
|
-
function
|
|
307
|
+
function f(b, E) {
|
|
308
|
+
function T() {
|
|
309
309
|
Oi || (Oi = !0, console.error(
|
|
310
310
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
311
|
-
|
|
311
|
+
E
|
|
312
312
|
));
|
|
313
313
|
}
|
|
314
|
-
|
|
315
|
-
get:
|
|
314
|
+
T.isReactWarning = !0, Object.defineProperty(b, "key", {
|
|
315
|
+
get: T,
|
|
316
316
|
configurable: !0
|
|
317
317
|
});
|
|
318
318
|
}
|
|
@@ -322,14 +322,14 @@ function qf() {
|
|
|
322
322
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
323
323
|
)), b = this.props.ref, b !== void 0 ? b : null;
|
|
324
324
|
}
|
|
325
|
-
function h(b,
|
|
326
|
-
return
|
|
327
|
-
$$typeof:
|
|
325
|
+
function h(b, E, T, L, ie, J) {
|
|
326
|
+
return T = J.ref, b = {
|
|
327
|
+
$$typeof: v,
|
|
328
328
|
type: b,
|
|
329
|
-
key:
|
|
329
|
+
key: E,
|
|
330
330
|
props: J,
|
|
331
331
|
_owner: ie
|
|
332
|
-
}, (
|
|
332
|
+
}, (T !== void 0 ? T : null) !== null ? Object.defineProperty(b, "ref", {
|
|
333
333
|
enumerable: !1,
|
|
334
334
|
get: d
|
|
335
335
|
}) : Object.defineProperty(b, "ref", { enumerable: !1, value: null }), b._store = {}, Object.defineProperty(b._store, "validated", {
|
|
@@ -344,102 +344,102 @@ function qf() {
|
|
|
344
344
|
value: null
|
|
345
345
|
}), Object.freeze && (Object.freeze(b.props), Object.freeze(b)), b;
|
|
346
346
|
}
|
|
347
|
-
function p(b,
|
|
348
|
-
if (typeof b == "string" || typeof b == "function" || b ===
|
|
349
|
-
var
|
|
350
|
-
if (
|
|
351
|
-
if (
|
|
352
|
-
if (Ss(
|
|
353
|
-
for (
|
|
354
|
-
y(
|
|
355
|
-
Object.freeze && Object.freeze(
|
|
347
|
+
function p(b, E, T, L, ie, J) {
|
|
348
|
+
if (typeof b == "string" || typeof b == "function" || b === D || b === z || b === B || b === dt || b === Ee || b === on || typeof b == "object" && b !== null && (b.$$typeof === $t || b.$$typeof === $e || b.$$typeof === _ || b.$$typeof === R || b.$$typeof === ke || b.$$typeof === Tf || b.getModuleId !== void 0)) {
|
|
349
|
+
var j = E.children;
|
|
350
|
+
if (j !== void 0)
|
|
351
|
+
if (L)
|
|
352
|
+
if (Ss(j)) {
|
|
353
|
+
for (L = 0; L < j.length; L++)
|
|
354
|
+
y(j[L], b);
|
|
355
|
+
Object.freeze && Object.freeze(j);
|
|
356
356
|
} else
|
|
357
357
|
console.error(
|
|
358
358
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
359
359
|
);
|
|
360
|
-
else y(
|
|
360
|
+
else y(j, b);
|
|
361
361
|
} else
|
|
362
|
-
|
|
362
|
+
j = "", (b === void 0 || typeof b == "object" && b !== null && Object.keys(b).length === 0) && (j += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."), b === null ? L = "null" : Ss(b) ? L = "array" : b !== void 0 && b.$$typeof === v ? (L = "<" + (n(b.type) || "Unknown") + " />", j = " Did you accidentally export a JSX literal instead of a component?") : L = typeof b, console.error(
|
|
363
363
|
"React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",
|
|
364
|
-
|
|
365
|
-
|
|
364
|
+
L,
|
|
365
|
+
j
|
|
366
366
|
);
|
|
367
|
-
if (bi.call(
|
|
368
|
-
|
|
369
|
-
var Ze = Object.keys(
|
|
370
|
-
return
|
|
367
|
+
if (bi.call(E, "key")) {
|
|
368
|
+
j = n(b);
|
|
369
|
+
var Ze = Object.keys(E).filter(function(de) {
|
|
370
|
+
return de !== "key";
|
|
371
371
|
});
|
|
372
|
-
|
|
372
|
+
L = 0 < Ze.length ? "{key: someKey, " + Ze.join(": ..., ") + ": ...}" : "{key: someKey}", Ti[j + L] || (Ze = 0 < Ze.length ? "{" + Ze.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
373
373
|
`A props object containing a "key" prop is being spread into JSX:
|
|
374
374
|
let props = %s;
|
|
375
375
|
<%s {...props} />
|
|
376
376
|
React keys must be passed directly to JSX without using spread:
|
|
377
377
|
let props = %s;
|
|
378
378
|
<%s key={someKey} {...props} />`,
|
|
379
|
-
|
|
380
|
-
|
|
379
|
+
L,
|
|
380
|
+
j,
|
|
381
381
|
Ze,
|
|
382
|
-
|
|
383
|
-
), Ti[
|
|
384
|
-
}
|
|
385
|
-
if (
|
|
386
|
-
|
|
387
|
-
for (var ln in
|
|
388
|
-
ln !== "key" && (
|
|
389
|
-
} else
|
|
390
|
-
return
|
|
391
|
-
|
|
382
|
+
j
|
|
383
|
+
), Ti[j + L] = !0);
|
|
384
|
+
}
|
|
385
|
+
if (j = null, T !== void 0 && (t(T), j = "" + T), u(E) && (t(E.key), j = "" + E.key), "key" in E) {
|
|
386
|
+
T = {};
|
|
387
|
+
for (var ln in E)
|
|
388
|
+
ln !== "key" && (T[ln] = E[ln]);
|
|
389
|
+
} else T = E;
|
|
390
|
+
return j && f(
|
|
391
|
+
T,
|
|
392
392
|
typeof b == "function" ? b.displayName || b.name || "Unknown" : b
|
|
393
|
-
), h(b,
|
|
393
|
+
), h(b, j, J, ie, c(), T);
|
|
394
394
|
}
|
|
395
|
-
function y(b,
|
|
395
|
+
function y(b, E) {
|
|
396
396
|
if (typeof b == "object" && b && b.$$typeof !== Af) {
|
|
397
397
|
if (Ss(b))
|
|
398
|
-
for (var
|
|
399
|
-
var
|
|
400
|
-
m(
|
|
398
|
+
for (var T = 0; T < b.length; T++) {
|
|
399
|
+
var L = b[T];
|
|
400
|
+
m(L) && x(L, E);
|
|
401
401
|
}
|
|
402
402
|
else if (m(b))
|
|
403
403
|
b._store && (b._store.validated = 1);
|
|
404
|
-
else if (b === null || typeof b != "object" ?
|
|
405
|
-
for (; !(b =
|
|
406
|
-
m(b.value) && x(b.value,
|
|
404
|
+
else if (b === null || typeof b != "object" ? T = null : (T = Tn && b[Tn] || b["@@iterator"], T = typeof T == "function" ? T : null), typeof T == "function" && T !== b.entries && (T = T.call(b), T !== b))
|
|
405
|
+
for (; !(b = T.next()).done; )
|
|
406
|
+
m(b.value) && x(b.value, E);
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
409
|
function m(b) {
|
|
410
|
-
return typeof b == "object" && b !== null && b.$$typeof ===
|
|
411
|
-
}
|
|
412
|
-
function x(b,
|
|
413
|
-
if (b._store && !b._store.validated && b.key == null && (b._store.validated = 1,
|
|
414
|
-
Ai[
|
|
415
|
-
var
|
|
416
|
-
b && b._owner != null && b._owner !== c() && (
|
|
417
|
-
var
|
|
410
|
+
return typeof b == "object" && b !== null && b.$$typeof === v;
|
|
411
|
+
}
|
|
412
|
+
function x(b, E) {
|
|
413
|
+
if (b._store && !b._store.validated && b.key == null && (b._store.validated = 1, E = k(E), !Ai[E])) {
|
|
414
|
+
Ai[E] = !0;
|
|
415
|
+
var T = "";
|
|
416
|
+
b && b._owner != null && b._owner !== c() && (T = null, typeof b._owner.tag == "number" ? T = n(b._owner.type) : typeof b._owner.name == "string" && (T = b._owner.name), T = " It was passed a child from " + T + ".");
|
|
417
|
+
var L = zt.getCurrentStack;
|
|
418
418
|
zt.getCurrentStack = function() {
|
|
419
419
|
var ie = a(b.type);
|
|
420
|
-
return
|
|
420
|
+
return L && (ie += L() || ""), ie;
|
|
421
421
|
}, console.error(
|
|
422
422
|
'Each child in a list should have a unique "key" prop.%s%s See https://react.dev/link/warning-keys for more information.',
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
), zt.getCurrentStack =
|
|
423
|
+
E,
|
|
424
|
+
T
|
|
425
|
+
), zt.getCurrentStack = L;
|
|
426
426
|
}
|
|
427
427
|
}
|
|
428
428
|
function k(b) {
|
|
429
|
-
var
|
|
430
|
-
return
|
|
429
|
+
var E = "", T = c();
|
|
430
|
+
return T && (T = n(T.type)) && (E = `
|
|
431
431
|
|
|
432
|
-
Check the render method of \`` +
|
|
432
|
+
Check the render method of \`` + T + "`."), E || (b = n(b)) && (E = `
|
|
433
433
|
|
|
434
|
-
Check the top-level render call using <` + b + ">."),
|
|
434
|
+
Check the top-level render call using <` + b + ">."), E;
|
|
435
435
|
}
|
|
436
|
-
var
|
|
436
|
+
var M = A, v = Symbol.for("react.transitional.element"), P = Symbol.for("react.portal"), D = Symbol.for("react.fragment"), B = Symbol.for("react.strict_mode"), z = Symbol.for("react.profiler"), R = Symbol.for("react.consumer"), _ = Symbol.for("react.context"), ke = Symbol.for("react.forward_ref"), dt = Symbol.for("react.suspense"), Ee = Symbol.for("react.suspense_list"), $e = Symbol.for("react.memo"), $t = Symbol.for("react.lazy"), on = Symbol.for("react.offscreen"), Tn = Symbol.iterator, mr = Symbol.for("react.client.reference"), zt = M.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, bi = Object.prototype.hasOwnProperty, jt = Object.assign, Tf = Symbol.for("react.client.reference"), Ss = Array.isArray, An = 0, xi, Si, ki, Ci, wi, Mi, Ni;
|
|
437
437
|
r.__reactDisabledLog = !0;
|
|
438
438
|
var ks, Di, Cs = !1, ws = new (typeof WeakMap == "function" ? WeakMap : Map)(), Af = Symbol.for("react.client.reference"), Oi, Ei = {}, Ti = {}, Ai = {};
|
|
439
|
-
Pn.Fragment =
|
|
440
|
-
return p(b,
|
|
441
|
-
}, Pn.jsxs = function(b,
|
|
442
|
-
return p(b,
|
|
439
|
+
Pn.Fragment = D, Pn.jsx = function(b, E, T, L, ie) {
|
|
440
|
+
return p(b, E, T, !1, L, ie);
|
|
441
|
+
}, Pn.jsxs = function(b, E, T, L, ie) {
|
|
442
|
+
return p(b, E, T, !0, L, ie);
|
|
443
443
|
};
|
|
444
444
|
}()), Pn;
|
|
445
445
|
}
|
|
@@ -983,7 +983,7 @@ class W {
|
|
|
983
983
|
W.none = [];
|
|
984
984
|
class Vr extends Error {
|
|
985
985
|
}
|
|
986
|
-
class
|
|
986
|
+
class C {
|
|
987
987
|
/**
|
|
988
988
|
Create a slice. When specifying a non-zero open depth, you must
|
|
989
989
|
make sure that there are nodes of at least that depth at the
|
|
@@ -1010,13 +1010,13 @@ class w {
|
|
|
1010
1010
|
*/
|
|
1011
1011
|
insertAt(e, t) {
|
|
1012
1012
|
let r = Fa(this.content, e + this.openStart, t);
|
|
1013
|
-
return r && new
|
|
1013
|
+
return r && new C(r, this.openStart, this.openEnd);
|
|
1014
1014
|
}
|
|
1015
1015
|
/**
|
|
1016
1016
|
@internal
|
|
1017
1017
|
*/
|
|
1018
1018
|
removeBetween(e, t) {
|
|
1019
|
-
return new
|
|
1019
|
+
return new C(ja(this.content, e + this.openStart, t + this.openStart), this.openStart, this.openEnd);
|
|
1020
1020
|
}
|
|
1021
1021
|
/**
|
|
1022
1022
|
Tests whether this slice is equal to another slice.
|
|
@@ -1044,11 +1044,11 @@ class w {
|
|
|
1044
1044
|
*/
|
|
1045
1045
|
static fromJSON(e, t) {
|
|
1046
1046
|
if (!t)
|
|
1047
|
-
return
|
|
1047
|
+
return C.empty;
|
|
1048
1048
|
let r = t.openStart || 0, s = t.openEnd || 0;
|
|
1049
1049
|
if (typeof r != "number" || typeof s != "number")
|
|
1050
1050
|
throw new RangeError("Invalid input for Slice.fromJSON");
|
|
1051
|
-
return new
|
|
1051
|
+
return new C(S.fromJSON(e, t.content), r, s);
|
|
1052
1052
|
}
|
|
1053
1053
|
/**
|
|
1054
1054
|
Create a slice from a fragment by taking the maximum possible
|
|
@@ -1060,10 +1060,10 @@ class w {
|
|
|
1060
1060
|
r++;
|
|
1061
1061
|
for (let o = e.lastChild; o && !o.isLeaf && (t || !o.type.spec.isolating); o = o.lastChild)
|
|
1062
1062
|
s++;
|
|
1063
|
-
return new
|
|
1063
|
+
return new C(e, r, s);
|
|
1064
1064
|
}
|
|
1065
1065
|
}
|
|
1066
|
-
|
|
1066
|
+
C.empty = new C(S.empty, 0, 0);
|
|
1067
1067
|
function ja(n, e, t) {
|
|
1068
1068
|
let { index: r, offset: s } = n.findIndex(e), o = n.maybeChild(r), { index: i, offset: l } = n.findIndex(t);
|
|
1069
1069
|
if (s == e || o.isText) {
|
|
@@ -1589,9 +1589,9 @@ class Ne {
|
|
|
1589
1589
|
*/
|
|
1590
1590
|
slice(e, t = this.content.size, r = !1) {
|
|
1591
1591
|
if (e == t)
|
|
1592
|
-
return
|
|
1592
|
+
return C.empty;
|
|
1593
1593
|
let s = this.resolve(e), o = this.resolve(t), i = r ? 0 : s.sharedDepth(t), l = s.start(i), c = s.node(i).content.cut(s.pos - l, o.pos - l);
|
|
1594
|
-
return new
|
|
1594
|
+
return new C(c, s.depth - i, o.depth - i);
|
|
1595
1595
|
}
|
|
1596
1596
|
/**
|
|
1597
1597
|
Replace the part of the document between the given positions with
|
|
@@ -2632,7 +2632,7 @@ class Xt {
|
|
|
2632
2632
|
*/
|
|
2633
2633
|
parseSlice(e, t = {}) {
|
|
2634
2634
|
let r = new Bi(this, t, !0);
|
|
2635
|
-
return r.addAll(e, W.none, t.from, t.to),
|
|
2635
|
+
return r.addAll(e, W.none, t.from, t.to), C.maxOpen(r.finish());
|
|
2636
2636
|
}
|
|
2637
2637
|
/**
|
|
2638
2638
|
@internal
|
|
@@ -3520,7 +3520,7 @@ class Un {
|
|
|
3520
3520
|
}
|
|
3521
3521
|
}
|
|
3522
3522
|
const Ds = /* @__PURE__ */ Object.create(null);
|
|
3523
|
-
class
|
|
3523
|
+
class fe {
|
|
3524
3524
|
/**
|
|
3525
3525
|
Get the step map that represents the changes made by this step,
|
|
3526
3526
|
and which can be used to transform between positions in the old
|
|
@@ -3603,7 +3603,7 @@ function vo(n, e, t) {
|
|
|
3603
3603
|
}
|
|
3604
3604
|
return S.fromArray(r);
|
|
3605
3605
|
}
|
|
3606
|
-
class kt extends
|
|
3606
|
+
class kt extends fe {
|
|
3607
3607
|
/**
|
|
3608
3608
|
Create a mark step.
|
|
3609
3609
|
*/
|
|
@@ -3611,7 +3611,7 @@ class kt extends de {
|
|
|
3611
3611
|
super(), this.from = e, this.to = t, this.mark = r;
|
|
3612
3612
|
}
|
|
3613
3613
|
apply(e) {
|
|
3614
|
-
let t = e.slice(this.from, this.to), r = e.resolve(this.from), s = r.node(r.sharedDepth(this.to)), o = new
|
|
3614
|
+
let t = e.slice(this.from, this.to), r = e.resolve(this.from), s = r.node(r.sharedDepth(this.to)), o = new C(vo(t.content, (i, l) => !i.isAtom || !l.type.allowsMarkType(this.mark.type) ? i : i.mark(this.mark.addToSet(i.marks)), s), t.openStart, t.openEnd);
|
|
3615
3615
|
return Y.fromReplace(e, this.from, this.to, o);
|
|
3616
3616
|
}
|
|
3617
3617
|
invert() {
|
|
@@ -3641,8 +3641,8 @@ class kt extends de {
|
|
|
3641
3641
|
return new kt(t.from, t.to, e.markFromJSON(t.mark));
|
|
3642
3642
|
}
|
|
3643
3643
|
}
|
|
3644
|
-
|
|
3645
|
-
class _e extends
|
|
3644
|
+
fe.jsonID("addMark", kt);
|
|
3645
|
+
class _e extends fe {
|
|
3646
3646
|
/**
|
|
3647
3647
|
Create a mark-removing step.
|
|
3648
3648
|
*/
|
|
@@ -3650,7 +3650,7 @@ class _e extends de {
|
|
|
3650
3650
|
super(), this.from = e, this.to = t, this.mark = r;
|
|
3651
3651
|
}
|
|
3652
3652
|
apply(e) {
|
|
3653
|
-
let t = e.slice(this.from, this.to), r = new
|
|
3653
|
+
let t = e.slice(this.from, this.to), r = new C(vo(t.content, (s) => s.mark(this.mark.removeFromSet(s.marks)), e), t.openStart, t.openEnd);
|
|
3654
3654
|
return Y.fromReplace(e, this.from, this.to, r);
|
|
3655
3655
|
}
|
|
3656
3656
|
invert() {
|
|
@@ -3680,8 +3680,8 @@ class _e extends de {
|
|
|
3680
3680
|
return new _e(t.from, t.to, e.markFromJSON(t.mark));
|
|
3681
3681
|
}
|
|
3682
3682
|
}
|
|
3683
|
-
|
|
3684
|
-
class Ct extends
|
|
3683
|
+
fe.jsonID("removeMark", _e);
|
|
3684
|
+
class Ct extends fe {
|
|
3685
3685
|
/**
|
|
3686
3686
|
Create a node mark step.
|
|
3687
3687
|
*/
|
|
@@ -3693,7 +3693,7 @@ class Ct extends de {
|
|
|
3693
3693
|
if (!t)
|
|
3694
3694
|
return Y.fail("No node at mark step's position");
|
|
3695
3695
|
let r = t.type.create(t.attrs, null, this.mark.addToSet(t.marks));
|
|
3696
|
-
return Y.fromReplace(e, this.pos, this.pos + 1, new
|
|
3696
|
+
return Y.fromReplace(e, this.pos, this.pos + 1, new C(S.from(r), 0, t.isLeaf ? 0 : 1));
|
|
3697
3697
|
}
|
|
3698
3698
|
invert(e) {
|
|
3699
3699
|
let t = e.nodeAt(this.pos);
|
|
@@ -3724,8 +3724,8 @@ class Ct extends de {
|
|
|
3724
3724
|
return new Ct(t.pos, e.markFromJSON(t.mark));
|
|
3725
3725
|
}
|
|
3726
3726
|
}
|
|
3727
|
-
|
|
3728
|
-
class Qt extends
|
|
3727
|
+
fe.jsonID("addNodeMark", Ct);
|
|
3728
|
+
class Qt extends fe {
|
|
3729
3729
|
/**
|
|
3730
3730
|
Create a mark-removing step.
|
|
3731
3731
|
*/
|
|
@@ -3737,7 +3737,7 @@ class Qt extends de {
|
|
|
3737
3737
|
if (!t)
|
|
3738
3738
|
return Y.fail("No node at mark step's position");
|
|
3739
3739
|
let r = t.type.create(t.attrs, null, this.mark.removeFromSet(t.marks));
|
|
3740
|
-
return Y.fromReplace(e, this.pos, this.pos + 1, new
|
|
3740
|
+
return Y.fromReplace(e, this.pos, this.pos + 1, new C(S.from(r), 0, t.isLeaf ? 0 : 1));
|
|
3741
3741
|
}
|
|
3742
3742
|
invert(e) {
|
|
3743
3743
|
let t = e.nodeAt(this.pos);
|
|
@@ -3759,8 +3759,8 @@ class Qt extends de {
|
|
|
3759
3759
|
return new Qt(t.pos, e.markFromJSON(t.mark));
|
|
3760
3760
|
}
|
|
3761
3761
|
}
|
|
3762
|
-
|
|
3763
|
-
class ae extends
|
|
3762
|
+
fe.jsonID("removeNodeMark", Qt);
|
|
3763
|
+
class ae extends fe {
|
|
3764
3764
|
/**
|
|
3765
3765
|
The given `slice` should fit the 'gap' between `from` and
|
|
3766
3766
|
`to`—the depths must line up, and the surrounding nodes must be
|
|
@@ -3790,10 +3790,10 @@ class ae extends de {
|
|
|
3790
3790
|
if (!(e instanceof ae) || e.structure || this.structure)
|
|
3791
3791
|
return null;
|
|
3792
3792
|
if (this.from + this.slice.size == e.from && !this.slice.openEnd && !e.slice.openStart) {
|
|
3793
|
-
let t = this.slice.size + e.slice.size == 0 ?
|
|
3793
|
+
let t = this.slice.size + e.slice.size == 0 ? C.empty : new C(this.slice.content.append(e.slice.content), this.slice.openStart, e.slice.openEnd);
|
|
3794
3794
|
return new ae(this.from, this.to + (e.to - e.from), t, this.structure);
|
|
3795
3795
|
} else if (e.to == this.from && !this.slice.openStart && !e.slice.openEnd) {
|
|
3796
|
-
let t = this.slice.size + e.slice.size == 0 ?
|
|
3796
|
+
let t = this.slice.size + e.slice.size == 0 ? C.empty : new C(e.slice.content.append(this.slice.content), e.slice.openStart, this.slice.openEnd);
|
|
3797
3797
|
return new ae(e.from, this.to, t, this.structure);
|
|
3798
3798
|
} else
|
|
3799
3799
|
return null;
|
|
@@ -3808,11 +3808,11 @@ class ae extends de {
|
|
|
3808
3808
|
static fromJSON(e, t) {
|
|
3809
3809
|
if (typeof t.from != "number" || typeof t.to != "number")
|
|
3810
3810
|
throw new RangeError("Invalid input for ReplaceStep.fromJSON");
|
|
3811
|
-
return new ae(t.from, t.to,
|
|
3811
|
+
return new ae(t.from, t.to, C.fromJSON(e, t.slice), !!t.structure);
|
|
3812
3812
|
}
|
|
3813
3813
|
}
|
|
3814
|
-
|
|
3815
|
-
class se extends
|
|
3814
|
+
fe.jsonID("replace", ae);
|
|
3815
|
+
class se extends fe {
|
|
3816
3816
|
/**
|
|
3817
3817
|
Create a replace-around step with the given range and gap.
|
|
3818
3818
|
`insert` should be the point in the slice into which the content
|
|
@@ -3866,10 +3866,10 @@ class se extends de {
|
|
|
3866
3866
|
static fromJSON(e, t) {
|
|
3867
3867
|
if (typeof t.from != "number" || typeof t.to != "number" || typeof t.gapFrom != "number" || typeof t.gapTo != "number" || typeof t.insert != "number")
|
|
3868
3868
|
throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");
|
|
3869
|
-
return new se(t.from, t.to, t.gapFrom, t.gapTo,
|
|
3869
|
+
return new se(t.from, t.to, t.gapFrom, t.gapTo, C.fromJSON(e, t.slice), t.insert, !!t.structure);
|
|
3870
3870
|
}
|
|
3871
3871
|
}
|
|
3872
|
-
|
|
3872
|
+
fe.jsonID("replaceAround", se);
|
|
3873
3873
|
function so(n, e, t) {
|
|
3874
3874
|
let r = n.resolve(e), s = t - e, o = r.depth;
|
|
3875
3875
|
for (; s > 0 && o > 0 && r.indexAfter(o) == r.node(o).childCount; )
|
|
@@ -3928,7 +3928,7 @@ function Vo(n, e, t, r = t.contentMatch, s = !0) {
|
|
|
3928
3928
|
for (let a = 0; a < o.childCount; a++) {
|
|
3929
3929
|
let c = o.child(a), u = l + c.nodeSize, f = r.matchType(c.type);
|
|
3930
3930
|
if (!f)
|
|
3931
|
-
i.push(new ae(l, u,
|
|
3931
|
+
i.push(new ae(l, u, C.empty));
|
|
3932
3932
|
else {
|
|
3933
3933
|
r = f;
|
|
3934
3934
|
for (let d = 0; d < c.marks.length; d++)
|
|
@@ -3936,14 +3936,14 @@ function Vo(n, e, t, r = t.contentMatch, s = !0) {
|
|
|
3936
3936
|
if (s && c.isText && t.whitespace != "pre") {
|
|
3937
3937
|
let d, h = /\r?\n|\r/g, p;
|
|
3938
3938
|
for (; d = h.exec(c.text); )
|
|
3939
|
-
p || (p = new
|
|
3939
|
+
p || (p = new C(S.from(t.schema.text(" ", t.allowedMarks(c.marks))), 0, 0)), i.push(new ae(l + d.index, l + d.index + d[0].length, p));
|
|
3940
3940
|
}
|
|
3941
3941
|
}
|
|
3942
3942
|
l = u;
|
|
3943
3943
|
}
|
|
3944
3944
|
if (!r.validEnd) {
|
|
3945
3945
|
let a = r.fillBefore(S.empty, !0);
|
|
3946
|
-
n.replace(l, l, new
|
|
3946
|
+
n.replace(l, l, new C(a, 0, 0));
|
|
3947
3947
|
}
|
|
3948
3948
|
for (let a = i.length - 1; a >= 0; a--)
|
|
3949
3949
|
n.step(i[a]);
|
|
@@ -3969,7 +3969,7 @@ function xd(n, e, t) {
|
|
|
3969
3969
|
let d = S.empty, h = 0;
|
|
3970
3970
|
for (let p = o, y = !1; p > t; p--)
|
|
3971
3971
|
y || s.after(p + 1) < s.end(p) ? (y = !0, d = S.from(s.node(p).copy(d)), h++) : c++;
|
|
3972
|
-
n.step(new se(a, c, i, l, new
|
|
3972
|
+
n.step(new se(a, c, i, l, new C(u.append(d), f, h), u.size - f, !0));
|
|
3973
3973
|
}
|
|
3974
3974
|
function $o(n, e, t = null, r = n) {
|
|
3975
3975
|
let s = Sd(n, e), o = s && kd(r, e);
|
|
@@ -4005,7 +4005,7 @@ function Cd(n, e, t) {
|
|
|
4005
4005
|
r = S.from(t[i].type.create(t[i].attrs, r));
|
|
4006
4006
|
}
|
|
4007
4007
|
let s = e.start, o = e.end;
|
|
4008
|
-
n.step(new se(s, o, s, o, new
|
|
4008
|
+
n.step(new se(s, o, s, o, new C(r, 0, 0), t.length, !0));
|
|
4009
4009
|
}
|
|
4010
4010
|
function wd(n, e, t, r, s) {
|
|
4011
4011
|
if (!r.isTextblock)
|
|
@@ -4021,7 +4021,7 @@ function wd(n, e, t, r, s) {
|
|
|
4021
4021
|
}
|
|
4022
4022
|
c === !1 && oc(n, i, l, o), Vo(n, n.mapping.slice(o).map(l, 1), r, void 0, c === null);
|
|
4023
4023
|
let u = n.mapping.slice(o), f = u.map(l, 1), d = u.map(l + i.nodeSize, 1);
|
|
4024
|
-
return n.step(new se(f, d, f + 1, d - 1, new
|
|
4024
|
+
return n.step(new se(f, d, f + 1, d - 1, new C(S.from(r.create(a, null, i.marks)), 0, 0), 1, !0)), c === !0 && sc(n, i, l, o), !1;
|
|
4025
4025
|
}
|
|
4026
4026
|
});
|
|
4027
4027
|
}
|
|
@@ -4059,7 +4059,7 @@ function Nd(n, e, t, r, s) {
|
|
|
4059
4059
|
return n.replaceWith(e, e + o.nodeSize, i);
|
|
4060
4060
|
if (!t.validContent(o.content))
|
|
4061
4061
|
throw new RangeError("Invalid content for node type " + t.name);
|
|
4062
|
-
n.step(new se(e, e + o.nodeSize, e + 1, e + o.nodeSize - 1, new
|
|
4062
|
+
n.step(new se(e, e + o.nodeSize, e + 1, e + o.nodeSize - 1, new C(S.from(i), 0, 0), 1, !0));
|
|
4063
4063
|
}
|
|
4064
4064
|
function bn(n, e, t = 1, r) {
|
|
4065
4065
|
let s = n.resolve(e), o = s.depth - t, i = r && r[r.length - 1] || s.parent;
|
|
@@ -4085,7 +4085,7 @@ function Dd(n, e, t = 1, r) {
|
|
|
4085
4085
|
let u = r && r[c];
|
|
4086
4086
|
i = S.from(u ? u.type.create(u.attrs, i) : s.node(l).copy(i));
|
|
4087
4087
|
}
|
|
4088
|
-
n.step(new ae(e, e, new
|
|
4088
|
+
n.step(new ae(e, e, new C(o.append(i), t, t), !0));
|
|
4089
4089
|
}
|
|
4090
4090
|
function En(n, e) {
|
|
4091
4091
|
let t = n.resolve(e), r = t.index();
|
|
@@ -4128,7 +4128,7 @@ function Ed(n, e, t) {
|
|
|
4128
4128
|
}
|
|
4129
4129
|
i.inlineContent && Vo(n, e + t - 1, i, o.node().contentMatchAt(o.index()), r == null);
|
|
4130
4130
|
let a = n.mapping.slice(l), c = a.map(e - t);
|
|
4131
|
-
if (n.step(new ae(c, a.map(e + t, -1),
|
|
4131
|
+
if (n.step(new ae(c, a.map(e + t, -1), C.empty, !0)), r === !0) {
|
|
4132
4132
|
let u = n.doc.resolve(c);
|
|
4133
4133
|
sc(n, u.node(), u.before(), n.steps.length);
|
|
4134
4134
|
}
|
|
@@ -4177,7 +4177,7 @@ function zo(n, e, t) {
|
|
|
4177
4177
|
}
|
|
4178
4178
|
return null;
|
|
4179
4179
|
}
|
|
4180
|
-
function jo(n, e, t = e, r =
|
|
4180
|
+
function jo(n, e, t = e, r = C.empty) {
|
|
4181
4181
|
if (e == t && !r.size)
|
|
4182
4182
|
return null;
|
|
4183
4183
|
let s = n.resolve(e), o = n.resolve(t);
|
|
@@ -4213,7 +4213,7 @@ class Ad {
|
|
|
4213
4213
|
let o = this.placed, i = r.depth, l = s.depth;
|
|
4214
4214
|
for (; i && l && o.childCount == 1; )
|
|
4215
4215
|
o = o.firstChild.content, i--, l--;
|
|
4216
|
-
let a = new
|
|
4216
|
+
let a = new C(o, i, l);
|
|
4217
4217
|
return e > -1 ? new se(r.pos, e, this.$to.pos, this.$to.end(), a, t) : a.size || r.pos != this.$to.pos ? new ae(r.pos, s.pos, a) : null;
|
|
4218
4218
|
}
|
|
4219
4219
|
// Find a position on the start spine of `this.unplaced` that has
|
|
@@ -4247,15 +4247,15 @@ class Ad {
|
|
|
4247
4247
|
}
|
|
4248
4248
|
openMore() {
|
|
4249
4249
|
let { content: e, openStart: t, openEnd: r } = this.unplaced, s = Os(e, t);
|
|
4250
|
-
return !s.childCount || s.firstChild.isLeaf ? !1 : (this.unplaced = new
|
|
4250
|
+
return !s.childCount || s.firstChild.isLeaf ? !1 : (this.unplaced = new C(e, t + 1, Math.max(r, s.size + t >= e.size - r ? t + 1 : 0)), !0);
|
|
4251
4251
|
}
|
|
4252
4252
|
dropNode() {
|
|
4253
4253
|
let { content: e, openStart: t, openEnd: r } = this.unplaced, s = Os(e, t);
|
|
4254
4254
|
if (s.childCount <= 1 && t > 0) {
|
|
4255
4255
|
let o = e.size - t <= t + s.size;
|
|
4256
|
-
this.unplaced = new
|
|
4256
|
+
this.unplaced = new C(Vn(e, t - 1, 1), t - 1, o ? t - 1 : r);
|
|
4257
4257
|
} else
|
|
4258
|
-
this.unplaced = new
|
|
4258
|
+
this.unplaced = new C(Vn(e, t, 1), t, r);
|
|
4259
4259
|
}
|
|
4260
4260
|
// Move content from the unplaced slice at `sliceDepth` to the
|
|
4261
4261
|
// frontier node at `frontierDepth`. Close that frontier node when
|
|
@@ -4285,7 +4285,7 @@ class Ad {
|
|
|
4285
4285
|
let x = m.lastChild;
|
|
4286
4286
|
this.frontier.push({ type: x.type, match: x.contentMatchAt(x.childCount) }), m = x.content;
|
|
4287
4287
|
}
|
|
4288
|
-
this.unplaced = p ? e == 0 ?
|
|
4288
|
+
this.unplaced = p ? e == 0 ? C.empty : new C(Vn(i.content, e - 1, 1), e - 1, h < 0 ? i.openEnd : e - 1) : new C(Vn(i.content, e, c), i.openStart, i.openEnd);
|
|
4289
4289
|
}
|
|
4290
4290
|
mustMoveInline() {
|
|
4291
4291
|
if (!this.$to.parent.isTextblock)
|
|
@@ -4402,9 +4402,9 @@ function Pd(n, e, t, r) {
|
|
|
4402
4402
|
for (let y = 0; y < i.length; y++) {
|
|
4403
4403
|
let m = i[(y + a) % i.length], x = !0;
|
|
4404
4404
|
m < 0 && (x = !1, m = -m);
|
|
4405
|
-
let k = s.node(m - 1),
|
|
4406
|
-
if (k.canReplaceWith(
|
|
4407
|
-
return n.replace(s.before(m), x ? o.after(m) : t, new
|
|
4405
|
+
let k = s.node(m - 1), M = s.index(m - 1);
|
|
4406
|
+
if (k.canReplaceWith(M, M, p.type, p.marks))
|
|
4407
|
+
return n.replace(s.before(m), x ? o.after(m) : t, new C(uc(r.content, 0, r.openStart, h), h, r.openEnd));
|
|
4408
4408
|
}
|
|
4409
4409
|
}
|
|
4410
4410
|
let f = n.steps.length;
|
|
@@ -4429,7 +4429,7 @@ function vd(n, e, t, r) {
|
|
|
4429
4429
|
let s = Td(n.doc, e, r.type);
|
|
4430
4430
|
s != null && (e = t = s);
|
|
4431
4431
|
}
|
|
4432
|
-
n.replaceRange(e, t, new
|
|
4432
|
+
n.replaceRange(e, t, new C(S.from(r), 0, 0));
|
|
4433
4433
|
}
|
|
4434
4434
|
function Vd(n, e, t) {
|
|
4435
4435
|
let r = n.doc.resolve(e), s = n.doc.resolve(t), o = fc(r, s);
|
|
@@ -4455,7 +4455,7 @@ function fc(n, e) {
|
|
|
4455
4455
|
}
|
|
4456
4456
|
return t;
|
|
4457
4457
|
}
|
|
4458
|
-
class xn extends
|
|
4458
|
+
class xn extends fe {
|
|
4459
4459
|
/**
|
|
4460
4460
|
Construct an attribute step.
|
|
4461
4461
|
*/
|
|
@@ -4471,7 +4471,7 @@ class xn extends de {
|
|
|
4471
4471
|
r[o] = t.attrs[o];
|
|
4472
4472
|
r[this.attr] = this.value;
|
|
4473
4473
|
let s = t.type.create(r, null, t.marks);
|
|
4474
|
-
return Y.fromReplace(e, this.pos, this.pos + 1, new
|
|
4474
|
+
return Y.fromReplace(e, this.pos, this.pos + 1, new C(S.from(s), 0, t.isLeaf ? 0 : 1));
|
|
4475
4475
|
}
|
|
4476
4476
|
getMap() {
|
|
4477
4477
|
return we.empty;
|
|
@@ -4492,8 +4492,8 @@ class xn extends de {
|
|
|
4492
4492
|
return new xn(t.pos, t.attr, t.value);
|
|
4493
4493
|
}
|
|
4494
4494
|
}
|
|
4495
|
-
|
|
4496
|
-
class Yn extends
|
|
4495
|
+
fe.jsonID("attr", xn);
|
|
4496
|
+
class Yn extends fe {
|
|
4497
4497
|
/**
|
|
4498
4498
|
Construct an attribute step.
|
|
4499
4499
|
*/
|
|
@@ -4526,7 +4526,7 @@ class Yn extends de {
|
|
|
4526
4526
|
return new Yn(t.attr, t.value);
|
|
4527
4527
|
}
|
|
4528
4528
|
}
|
|
4529
|
-
|
|
4529
|
+
fe.jsonID("docAttr", Yn);
|
|
4530
4530
|
let Mn = class extends Error {
|
|
4531
4531
|
};
|
|
4532
4532
|
Mn = function n(e) {
|
|
@@ -4584,7 +4584,7 @@ class dc {
|
|
|
4584
4584
|
Replace the part of the document between `from` and `to` with the
|
|
4585
4585
|
given `slice`.
|
|
4586
4586
|
*/
|
|
4587
|
-
replace(e, t = e, r =
|
|
4587
|
+
replace(e, t = e, r = C.empty) {
|
|
4588
4588
|
let s = jo(this.doc, e, t, r);
|
|
4589
4589
|
return s && this.step(s), this;
|
|
4590
4590
|
}
|
|
@@ -4593,13 +4593,13 @@ class dc {
|
|
|
4593
4593
|
fragment, node, or array of nodes.
|
|
4594
4594
|
*/
|
|
4595
4595
|
replaceWith(e, t, r) {
|
|
4596
|
-
return this.replace(e, t, new
|
|
4596
|
+
return this.replace(e, t, new C(S.from(r), 0, 0));
|
|
4597
4597
|
}
|
|
4598
4598
|
/**
|
|
4599
4599
|
Delete the content between the given positions.
|
|
4600
4600
|
*/
|
|
4601
4601
|
delete(e, t) {
|
|
4602
|
-
return this.replace(e, t,
|
|
4602
|
+
return this.replace(e, t, C.empty);
|
|
4603
4603
|
}
|
|
4604
4604
|
/**
|
|
4605
4605
|
Insert the given content at the given position.
|
|
@@ -4762,7 +4762,7 @@ class dc {
|
|
|
4762
4762
|
}
|
|
4763
4763
|
}
|
|
4764
4764
|
const Ts = /* @__PURE__ */ Object.create(null);
|
|
4765
|
-
class
|
|
4765
|
+
class $ {
|
|
4766
4766
|
/**
|
|
4767
4767
|
Initialize a selection with the head and anchor and ranges. If no
|
|
4768
4768
|
ranges are given, constructs a single range across `$anchor` and
|
|
@@ -4827,14 +4827,14 @@ class V {
|
|
|
4827
4827
|
Replace the selection with a slice or, if no slice is given,
|
|
4828
4828
|
delete the selection. Will append to the given transaction.
|
|
4829
4829
|
*/
|
|
4830
|
-
replace(e, t =
|
|
4830
|
+
replace(e, t = C.empty) {
|
|
4831
4831
|
let r = t.content.lastChild, s = null;
|
|
4832
4832
|
for (let l = 0; l < t.openEnd; l++)
|
|
4833
4833
|
s = r, r = r.lastChild;
|
|
4834
4834
|
let o = e.steps.length, i = this.ranges;
|
|
4835
4835
|
for (let l = 0; l < i.length; l++) {
|
|
4836
4836
|
let { $from: a, $to: c } = i[l], u = e.mapping.slice(o);
|
|
4837
|
-
e.replaceRange(u.map(a.pos), u.map(c.pos), l ?
|
|
4837
|
+
e.replaceRange(u.map(a.pos), u.map(c.pos), l ? C.empty : t), l == 0 && Yi(e, o, (r ? r.isInline : s && s.isTextblock) ? -1 : 1);
|
|
4838
4838
|
}
|
|
4839
4839
|
}
|
|
4840
4840
|
/**
|
|
@@ -4856,7 +4856,7 @@ class V {
|
|
|
4856
4856
|
found.
|
|
4857
4857
|
*/
|
|
4858
4858
|
static findFrom(e, t, r = !1) {
|
|
4859
|
-
let s = e.parent.inlineContent ? new
|
|
4859
|
+
let s = e.parent.inlineContent ? new V(e) : dn(e.node(0), e.parent, e.pos, e.index(), t, r);
|
|
4860
4860
|
if (s)
|
|
4861
4861
|
return s;
|
|
4862
4862
|
for (let o = e.depth - 1; o >= 0; o--) {
|
|
@@ -4923,10 +4923,10 @@ class V {
|
|
|
4923
4923
|
returns the bookmark for that.
|
|
4924
4924
|
*/
|
|
4925
4925
|
getBookmark() {
|
|
4926
|
-
return
|
|
4926
|
+
return V.between(this.$anchor, this.$head).getBookmark();
|
|
4927
4927
|
}
|
|
4928
4928
|
}
|
|
4929
|
-
|
|
4929
|
+
$.prototype.visible = !0;
|
|
4930
4930
|
class hc {
|
|
4931
4931
|
/**
|
|
4932
4932
|
Create a range.
|
|
@@ -4939,7 +4939,7 @@ let Ki = !1;
|
|
|
4939
4939
|
function Ui(n) {
|
|
4940
4940
|
!Ki && !n.parent.inlineContent && (Ki = !0, console.warn("TextSelection endpoint not pointing into a node with inline content (" + n.parent.type.name + ")"));
|
|
4941
4941
|
}
|
|
4942
|
-
class
|
|
4942
|
+
class V extends $ {
|
|
4943
4943
|
/**
|
|
4944
4944
|
Construct a text selection between the given points.
|
|
4945
4945
|
*/
|
|
@@ -4956,18 +4956,18 @@ class v extends V {
|
|
|
4956
4956
|
map(e, t) {
|
|
4957
4957
|
let r = e.resolve(t.map(this.head));
|
|
4958
4958
|
if (!r.parent.inlineContent)
|
|
4959
|
-
return
|
|
4959
|
+
return $.near(r);
|
|
4960
4960
|
let s = e.resolve(t.map(this.anchor));
|
|
4961
|
-
return new
|
|
4961
|
+
return new V(s.parent.inlineContent ? s : r, r);
|
|
4962
4962
|
}
|
|
4963
|
-
replace(e, t =
|
|
4964
|
-
if (super.replace(e, t), t ==
|
|
4963
|
+
replace(e, t = C.empty) {
|
|
4964
|
+
if (super.replace(e, t), t == C.empty) {
|
|
4965
4965
|
let r = this.$from.marksAcross(this.$to);
|
|
4966
4966
|
r && e.ensureMarks(r);
|
|
4967
4967
|
}
|
|
4968
4968
|
}
|
|
4969
4969
|
eq(e) {
|
|
4970
|
-
return e instanceof
|
|
4970
|
+
return e instanceof V && e.anchor == this.anchor && e.head == this.head;
|
|
4971
4971
|
}
|
|
4972
4972
|
getBookmark() {
|
|
4973
4973
|
return new ls(this.anchor, this.head);
|
|
@@ -4981,7 +4981,7 @@ class v extends V {
|
|
|
4981
4981
|
static fromJSON(e, t) {
|
|
4982
4982
|
if (typeof t.anchor != "number" || typeof t.head != "number")
|
|
4983
4983
|
throw new RangeError("Invalid input for TextSelection.fromJSON");
|
|
4984
|
-
return new
|
|
4984
|
+
return new V(e.resolve(t.anchor), e.resolve(t.head));
|
|
4985
4985
|
}
|
|
4986
4986
|
/**
|
|
4987
4987
|
Create a text selection from non-resolved positions.
|
|
@@ -5001,16 +5001,16 @@ class v extends V {
|
|
|
5001
5001
|
static between(e, t, r) {
|
|
5002
5002
|
let s = e.pos - t.pos;
|
|
5003
5003
|
if ((!r || s) && (r = s >= 0 ? 1 : -1), !t.parent.inlineContent) {
|
|
5004
|
-
let o =
|
|
5004
|
+
let o = $.findFrom(t, r, !0) || $.findFrom(t, -r, !0);
|
|
5005
5005
|
if (o)
|
|
5006
5006
|
t = o.$head;
|
|
5007
5007
|
else
|
|
5008
|
-
return
|
|
5008
|
+
return $.near(t, r);
|
|
5009
5009
|
}
|
|
5010
|
-
return e.parent.inlineContent || (s == 0 ? e = t : (e = (
|
|
5010
|
+
return e.parent.inlineContent || (s == 0 ? e = t : (e = ($.findFrom(e, -r, !0) || $.findFrom(e, r, !0)).$anchor, e.pos < t.pos != s < 0 && (e = t))), new V(e, t);
|
|
5011
5011
|
}
|
|
5012
5012
|
}
|
|
5013
|
-
|
|
5013
|
+
$.jsonID("text", V);
|
|
5014
5014
|
class ls {
|
|
5015
5015
|
constructor(e, t) {
|
|
5016
5016
|
this.anchor = e, this.head = t;
|
|
@@ -5019,10 +5019,10 @@ class ls {
|
|
|
5019
5019
|
return new ls(e.map(this.anchor), e.map(this.head));
|
|
5020
5020
|
}
|
|
5021
5021
|
resolve(e) {
|
|
5022
|
-
return
|
|
5022
|
+
return V.between(e.resolve(this.anchor), e.resolve(this.head));
|
|
5023
5023
|
}
|
|
5024
5024
|
}
|
|
5025
|
-
class
|
|
5025
|
+
class w extends $ {
|
|
5026
5026
|
/**
|
|
5027
5027
|
Create a node selection. Does not verify the validity of its
|
|
5028
5028
|
argument.
|
|
@@ -5033,13 +5033,13 @@ class M extends V {
|
|
|
5033
5033
|
}
|
|
5034
5034
|
map(e, t) {
|
|
5035
5035
|
let { deleted: r, pos: s } = t.mapResult(this.anchor), o = e.resolve(s);
|
|
5036
|
-
return r ?
|
|
5036
|
+
return r ? $.near(o) : new w(o);
|
|
5037
5037
|
}
|
|
5038
5038
|
content() {
|
|
5039
|
-
return new
|
|
5039
|
+
return new C(S.from(this.node), 0, 0);
|
|
5040
5040
|
}
|
|
5041
5041
|
eq(e) {
|
|
5042
|
-
return e instanceof
|
|
5042
|
+
return e instanceof w && e.anchor == this.anchor;
|
|
5043
5043
|
}
|
|
5044
5044
|
toJSON() {
|
|
5045
5045
|
return { type: "node", anchor: this.anchor };
|
|
@@ -5053,13 +5053,13 @@ class M extends V {
|
|
|
5053
5053
|
static fromJSON(e, t) {
|
|
5054
5054
|
if (typeof t.anchor != "number")
|
|
5055
5055
|
throw new RangeError("Invalid input for NodeSelection.fromJSON");
|
|
5056
|
-
return new
|
|
5056
|
+
return new w(e.resolve(t.anchor));
|
|
5057
5057
|
}
|
|
5058
5058
|
/**
|
|
5059
5059
|
Create a node selection from non-resolved positions.
|
|
5060
5060
|
*/
|
|
5061
5061
|
static create(e, t) {
|
|
5062
|
-
return new
|
|
5062
|
+
return new w(e.resolve(t));
|
|
5063
5063
|
}
|
|
5064
5064
|
/**
|
|
5065
5065
|
Determines whether the given node may be selected as a node
|
|
@@ -5069,8 +5069,8 @@ class M extends V {
|
|
|
5069
5069
|
return !e.isText && e.type.spec.selectable !== !1;
|
|
5070
5070
|
}
|
|
5071
5071
|
}
|
|
5072
|
-
|
|
5073
|
-
|
|
5072
|
+
w.prototype.visible = !1;
|
|
5073
|
+
$.jsonID("node", w);
|
|
5074
5074
|
class Fo {
|
|
5075
5075
|
constructor(e) {
|
|
5076
5076
|
this.anchor = e;
|
|
@@ -5081,20 +5081,20 @@ class Fo {
|
|
|
5081
5081
|
}
|
|
5082
5082
|
resolve(e) {
|
|
5083
5083
|
let t = e.resolve(this.anchor), r = t.nodeAfter;
|
|
5084
|
-
return r &&
|
|
5084
|
+
return r && w.isSelectable(r) ? new w(t) : $.near(t);
|
|
5085
5085
|
}
|
|
5086
5086
|
}
|
|
5087
|
-
class xe extends
|
|
5087
|
+
class xe extends $ {
|
|
5088
5088
|
/**
|
|
5089
5089
|
Create an all-selection over the given document.
|
|
5090
5090
|
*/
|
|
5091
5091
|
constructor(e) {
|
|
5092
5092
|
super(e.resolve(0), e.resolve(e.content.size));
|
|
5093
5093
|
}
|
|
5094
|
-
replace(e, t =
|
|
5095
|
-
if (t ==
|
|
5094
|
+
replace(e, t = C.empty) {
|
|
5095
|
+
if (t == C.empty) {
|
|
5096
5096
|
e.delete(0, e.doc.content.size);
|
|
5097
|
-
let r =
|
|
5097
|
+
let r = $.atStart(e.doc);
|
|
5098
5098
|
r.eq(e.selection) || e.setSelection(r);
|
|
5099
5099
|
} else
|
|
5100
5100
|
super.replace(e, t);
|
|
@@ -5118,7 +5118,7 @@ class xe extends V {
|
|
|
5118
5118
|
return $d;
|
|
5119
5119
|
}
|
|
5120
5120
|
}
|
|
5121
|
-
|
|
5121
|
+
$.jsonID("all", xe);
|
|
5122
5122
|
const $d = {
|
|
5123
5123
|
map() {
|
|
5124
5124
|
return this;
|
|
@@ -5129,12 +5129,12 @@ const $d = {
|
|
|
5129
5129
|
};
|
|
5130
5130
|
function dn(n, e, t, r, s, o = !1) {
|
|
5131
5131
|
if (e.inlineContent)
|
|
5132
|
-
return
|
|
5132
|
+
return V.create(n, t);
|
|
5133
5133
|
for (let i = r - (s > 0 ? 0 : 1); s > 0 ? i < e.childCount : i >= 0; i += s) {
|
|
5134
5134
|
let l = e.child(i);
|
|
5135
5135
|
if (l.isAtom) {
|
|
5136
|
-
if (!o &&
|
|
5137
|
-
return
|
|
5136
|
+
if (!o && w.isSelectable(l))
|
|
5137
|
+
return w.create(n, t - (s < 0 ? l.nodeSize : 0));
|
|
5138
5138
|
} else {
|
|
5139
5139
|
let a = dn(n, l, t + s, s < 0 ? l.childCount : 0, s, o);
|
|
5140
5140
|
if (a)
|
|
@@ -5154,7 +5154,7 @@ function Yi(n, e, t) {
|
|
|
5154
5154
|
let o = n.mapping.maps[r], i;
|
|
5155
5155
|
o.forEach((l, a, c, u) => {
|
|
5156
5156
|
i == null && (i = u);
|
|
5157
|
-
}), n.setSelection(
|
|
5157
|
+
}), n.setSelection($.near(n.doc.resolve(i), t));
|
|
5158
5158
|
}
|
|
5159
5159
|
const Gi = 1, Xi = 2, Qi = 4;
|
|
5160
5160
|
class zd extends dc {
|
|
@@ -5269,7 +5269,7 @@ class zd extends dc {
|
|
|
5269
5269
|
let i = this.doc.resolve(t);
|
|
5270
5270
|
o = r == t ? i.marks() : i.marksAcross(this.doc.resolve(r));
|
|
5271
5271
|
}
|
|
5272
|
-
return this.replaceRangeWith(t, r, s.text(e, o)), this.selection.empty || this.setSelection(
|
|
5272
|
+
return this.replaceRangeWith(t, r, s.text(e, o)), this.selection.empty || this.setSelection($.near(this.selection.$to)), this;
|
|
5273
5273
|
}
|
|
5274
5274
|
}
|
|
5275
5275
|
/**
|
|
@@ -5327,7 +5327,7 @@ const jd = [
|
|
|
5327
5327
|
}),
|
|
5328
5328
|
new zn("selection", {
|
|
5329
5329
|
init(n, e) {
|
|
5330
|
-
return n.selection ||
|
|
5330
|
+
return n.selection || $.atStart(e.doc);
|
|
5331
5331
|
},
|
|
5332
5332
|
apply(n) {
|
|
5333
5333
|
return n.selection;
|
|
@@ -5507,7 +5507,7 @@ class ot {
|
|
|
5507
5507
|
if (i.name == "doc")
|
|
5508
5508
|
o.doc = Ne.fromJSON(e.schema, t.doc);
|
|
5509
5509
|
else if (i.name == "selection")
|
|
5510
|
-
o.selection =
|
|
5510
|
+
o.selection = $.fromJSON(o.doc, t.selection);
|
|
5511
5511
|
else if (i.name == "storedMarks")
|
|
5512
5512
|
t.storedMarks && (o.storedMarks = t.storedMarks.map(e.schema.markFromJSON));
|
|
5513
5513
|
else {
|
|
@@ -6071,13 +6071,13 @@ const th = (n, e, t) => {
|
|
|
6071
6071
|
let o = s.nodeBefore;
|
|
6072
6072
|
if (Nc(n, s, e, -1))
|
|
6073
6073
|
return !0;
|
|
6074
|
-
if (r.parent.content.size == 0 && (Nn(o, "end") ||
|
|
6074
|
+
if (r.parent.content.size == 0 && (Nn(o, "end") || w.isSelectable(o)))
|
|
6075
6075
|
for (let i = r.depth; ; i--) {
|
|
6076
|
-
let l = jo(n.doc, r.before(i), r.after(i),
|
|
6076
|
+
let l = jo(n.doc, r.before(i), r.after(i), C.empty);
|
|
6077
6077
|
if (l && l.slice.size < l.to - l.from) {
|
|
6078
6078
|
if (e) {
|
|
6079
6079
|
let a = n.tr.step(l);
|
|
6080
|
-
a.setSelection(Nn(o, "end") ?
|
|
6080
|
+
a.setSelection(Nn(o, "end") ? $.findFrom(a.doc.resolve(a.mapping.map(s.pos, -1)), -1) : w.create(a.doc, s.pos - o.nodeSize)), e(a.scrollIntoView());
|
|
6081
6081
|
}
|
|
6082
6082
|
return !0;
|
|
6083
6083
|
}
|
|
@@ -6105,7 +6105,7 @@ const nh = (n, e, t) => {
|
|
|
6105
6105
|
o = xc(r);
|
|
6106
6106
|
}
|
|
6107
6107
|
let i = o && o.nodeBefore;
|
|
6108
|
-
return !i || !
|
|
6108
|
+
return !i || !w.isSelectable(i) ? !1 : (e && e(n.tr.setSelection(w.create(n.doc, o.pos - i.nodeSize)).scrollIntoView()), !0);
|
|
6109
6109
|
};
|
|
6110
6110
|
function xc(n) {
|
|
6111
6111
|
if (!n.parent.type.spec.isolating)
|
|
@@ -6131,12 +6131,12 @@ const sh = (n, e, t) => {
|
|
|
6131
6131
|
let o = s.nodeAfter;
|
|
6132
6132
|
if (Nc(n, s, e, 1))
|
|
6133
6133
|
return !0;
|
|
6134
|
-
if (r.parent.content.size == 0 && (Nn(o, "start") ||
|
|
6135
|
-
let i = jo(n.doc, r.before(), r.after(),
|
|
6134
|
+
if (r.parent.content.size == 0 && (Nn(o, "start") || w.isSelectable(o))) {
|
|
6135
|
+
let i = jo(n.doc, r.before(), r.after(), C.empty);
|
|
6136
6136
|
if (i && i.slice.size < i.to - i.from) {
|
|
6137
6137
|
if (e) {
|
|
6138
6138
|
let l = n.tr.step(i);
|
|
6139
|
-
l.setSelection(Nn(o, "start") ?
|
|
6139
|
+
l.setSelection(Nn(o, "start") ? $.findFrom(l.doc.resolve(l.mapping.map(s.pos)), 1) : w.create(l.doc, l.mapping.map(s.pos))), e(l.scrollIntoView());
|
|
6140
6140
|
}
|
|
6141
6141
|
return !0;
|
|
6142
6142
|
}
|
|
@@ -6152,7 +6152,7 @@ const sh = (n, e, t) => {
|
|
|
6152
6152
|
o = Sc(r);
|
|
6153
6153
|
}
|
|
6154
6154
|
let i = o && o.nodeAfter;
|
|
6155
|
-
return !i || !
|
|
6155
|
+
return !i || !w.isSelectable(i) ? !1 : (e && e(n.tr.setSelection(w.create(n.doc, o.pos)).scrollIntoView()), !0);
|
|
6156
6156
|
};
|
|
6157
6157
|
function Sc(n) {
|
|
6158
6158
|
if (!n.parent.type.spec.isolating)
|
|
@@ -6166,7 +6166,7 @@ function Sc(n) {
|
|
|
6166
6166
|
return null;
|
|
6167
6167
|
}
|
|
6168
6168
|
const kc = (n, e) => {
|
|
6169
|
-
let t = n.selection, r = t instanceof
|
|
6169
|
+
let t = n.selection, r = t instanceof w, s;
|
|
6170
6170
|
if (r) {
|
|
6171
6171
|
if (t.node.isTextblock || !En(n.doc, t.from))
|
|
6172
6172
|
return !1;
|
|
@@ -6175,12 +6175,12 @@ const kc = (n, e) => {
|
|
|
6175
6175
|
return !1;
|
|
6176
6176
|
if (e) {
|
|
6177
6177
|
let o = n.tr.join(s);
|
|
6178
|
-
r && o.setSelection(
|
|
6178
|
+
r && o.setSelection(w.create(o.doc, s - n.doc.resolve(s).nodeBefore.nodeSize)), e(o.scrollIntoView());
|
|
6179
6179
|
}
|
|
6180
6180
|
return !0;
|
|
6181
6181
|
}, ih = (n, e) => {
|
|
6182
6182
|
let t = n.selection, r;
|
|
6183
|
-
if (t instanceof
|
|
6183
|
+
if (t instanceof w) {
|
|
6184
6184
|
if (t.node.isTextblock || !En(n.doc, t.to))
|
|
6185
6185
|
return !1;
|
|
6186
6186
|
r = t.to;
|
|
@@ -6212,7 +6212,7 @@ const wc = (n, e) => {
|
|
|
6212
6212
|
return !1;
|
|
6213
6213
|
if (e) {
|
|
6214
6214
|
let l = t.after(), a = n.tr.replaceWith(l, l, i.createAndFill());
|
|
6215
|
-
a.setSelection(
|
|
6215
|
+
a.setSelection($.near(a.doc.resolve(l), 1)), e(a.scrollIntoView());
|
|
6216
6216
|
}
|
|
6217
6217
|
return !0;
|
|
6218
6218
|
}, ah = (n, e) => {
|
|
@@ -6224,7 +6224,7 @@ const wc = (n, e) => {
|
|
|
6224
6224
|
return !1;
|
|
6225
6225
|
if (e) {
|
|
6226
6226
|
let i = (!r.parentOffset && s.index() < s.parent.childCount ? r : s).pos, l = n.tr.insert(i, o.createAndFill());
|
|
6227
|
-
l.setSelection(
|
|
6227
|
+
l.setSelection(V.create(l.doc, i + 1)), e(l.scrollIntoView());
|
|
6228
6228
|
}
|
|
6229
6229
|
return !0;
|
|
6230
6230
|
}, ch = (n, e) => {
|
|
@@ -6242,7 +6242,7 @@ const wc = (n, e) => {
|
|
|
6242
6242
|
function uh(n) {
|
|
6243
6243
|
return (e, t) => {
|
|
6244
6244
|
let { $from: r, $to: s } = e.selection;
|
|
6245
|
-
if (e.selection instanceof
|
|
6245
|
+
if (e.selection instanceof w && e.selection.node.isBlock)
|
|
6246
6246
|
return !r.parentOffset || !bn(e.doc, r.pos) ? !1 : (t && t(e.tr.split(r.pos).scrollIntoView()), !0);
|
|
6247
6247
|
if (!r.depth)
|
|
6248
6248
|
return !1;
|
|
@@ -6257,7 +6257,7 @@ function uh(n) {
|
|
|
6257
6257
|
o.unshift(null);
|
|
6258
6258
|
}
|
|
6259
6259
|
let u = e.tr;
|
|
6260
|
-
(e.selection instanceof
|
|
6260
|
+
(e.selection instanceof V || e.selection instanceof xe) && u.deleteSelection();
|
|
6261
6261
|
let f = u.mapping.map(r.pos), d = bn(u.doc, f, o.length, o);
|
|
6262
6262
|
if (d || (o[0] = l ? { type: l } : null, d = bn(u.doc, f, o.length, o)), !d)
|
|
6263
6263
|
return !1;
|
|
@@ -6270,7 +6270,7 @@ function uh(n) {
|
|
|
6270
6270
|
}
|
|
6271
6271
|
const fh = uh(), Mc = (n, e) => {
|
|
6272
6272
|
let { $from: t, to: r } = n.selection, s, o = t.sharedDepth(r);
|
|
6273
|
-
return o == 0 ? !1 : (s = t.before(o), e && e(n.tr.setSelection(
|
|
6273
|
+
return o == 0 ? !1 : (s = t.before(o), e && e(n.tr.setSelection(w.create(n.doc, s))), !0);
|
|
6274
6274
|
}, dh = (n, e) => (e && e(n.tr.setSelection(new xe(n.doc))), !0);
|
|
6275
6275
|
function hh(n, e, t) {
|
|
6276
6276
|
let r = e.nodeBefore, s = e.nodeAfter, o = e.index();
|
|
@@ -6287,12 +6287,12 @@ function Nc(n, e, t, r) {
|
|
|
6287
6287
|
for (let x = i.length - 1; x >= 0; x--)
|
|
6288
6288
|
p = S.from(i[x].create(null, p));
|
|
6289
6289
|
p = S.from(s.copy(p));
|
|
6290
|
-
let y = n.tr.step(new se(e.pos - 1, h, e.pos, h, new
|
|
6290
|
+
let y = n.tr.step(new se(e.pos - 1, h, e.pos, h, new C(p, 1, 0), i.length, !0)), m = y.doc.resolve(h + 2 * i.length);
|
|
6291
6291
|
m.nodeAfter && m.nodeAfter.type == s.type && En(y.doc, m.pos) && y.join(m.pos), t(y.scrollIntoView());
|
|
6292
6292
|
}
|
|
6293
6293
|
return !0;
|
|
6294
6294
|
}
|
|
6295
|
-
let u = o.type.spec.isolating || r > 0 && a ? null :
|
|
6295
|
+
let u = o.type.spec.isolating || r > 0 && a ? null : $.findFrom(e, 1), f = u && u.$from.blockRange(u.$to), d = f && lr(f);
|
|
6296
6296
|
if (d != null && d >= e.depth)
|
|
6297
6297
|
return t && t(n.tr.lift(f, d).scrollIntoView()), !0;
|
|
6298
6298
|
if (c && Nn(o, "start", !0) && Nn(s, "end")) {
|
|
@@ -6305,9 +6305,9 @@ function Nc(n, e, t, r) {
|
|
|
6305
6305
|
if (h.canReplace(h.childCount, h.childCount, y.content)) {
|
|
6306
6306
|
if (t) {
|
|
6307
6307
|
let x = S.empty;
|
|
6308
|
-
for (let
|
|
6309
|
-
x = S.from(p[
|
|
6310
|
-
let k = n.tr.step(new se(e.pos - p.length, e.pos + o.nodeSize, e.pos + m, e.pos + o.nodeSize - m, new
|
|
6308
|
+
for (let M = p.length - 1; M >= 0; M--)
|
|
6309
|
+
x = S.from(p[M].copy(x));
|
|
6310
|
+
let k = n.tr.step(new se(e.pos - p.length, e.pos + o.nodeSize, e.pos + m, e.pos + o.nodeSize - m, new C(x, p.length, 0), 0, !0));
|
|
6311
6311
|
t(k.scrollIntoView());
|
|
6312
6312
|
}
|
|
6313
6313
|
return !0;
|
|
@@ -6323,7 +6323,7 @@ function Dc(n) {
|
|
|
6323
6323
|
return !1;
|
|
6324
6324
|
o--;
|
|
6325
6325
|
}
|
|
6326
|
-
return s.node(o).isTextblock ? (t && t(e.tr.setSelection(
|
|
6326
|
+
return s.node(o).isTextblock ? (t && t(e.tr.setSelection(V.create(e.doc, n < 0 ? s.start(o) : s.end(o)))), !0) : !1;
|
|
6327
6327
|
};
|
|
6328
6328
|
}
|
|
6329
6329
|
const ph = Dc(-1), mh = Dc(1);
|
|
@@ -7452,7 +7452,7 @@ let ur = class {
|
|
|
7452
7452
|
}
|
|
7453
7453
|
localCompositionInfo(e, t) {
|
|
7454
7454
|
let { from: r, to: s } = e.state.selection;
|
|
7455
|
-
if (!(e.state.selection instanceof
|
|
7455
|
+
if (!(e.state.selection instanceof V) || r < t || s > t + this.node.content.size)
|
|
7456
7456
|
return null;
|
|
7457
7457
|
let o = e.input.compositionNode;
|
|
7458
7458
|
if (!o || !this.dom.contains(o.parentNode))
|
|
@@ -7967,9 +7967,9 @@ function Ho(n, e = null) {
|
|
|
7967
7967
|
for (a = i; s && !s.node; )
|
|
7968
7968
|
s = s.parent;
|
|
7969
7969
|
let f = s.node;
|
|
7970
|
-
if (s && f.isAtom &&
|
|
7970
|
+
if (s && f.isAtom && w.isSelectable(f) && s.parent && !(f.isInline && Nh(t.focusNode, t.focusOffset, s.dom))) {
|
|
7971
7971
|
let d = s.posBefore;
|
|
7972
|
-
c = new
|
|
7972
|
+
c = new w(i == d ? l : r.resolve(d));
|
|
7973
7973
|
}
|
|
7974
7974
|
} else {
|
|
7975
7975
|
if (t instanceof n.dom.ownerDocument.defaultView.Selection && t.rangeCount > 1) {
|
|
@@ -8010,7 +8010,7 @@ function at(n, e = !1) {
|
|
|
8010
8010
|
tp(n);
|
|
8011
8011
|
else {
|
|
8012
8012
|
let { anchor: r, head: s } = t, o, i;
|
|
8013
|
-
hl && !(t instanceof
|
|
8013
|
+
hl && !(t instanceof V) && (t.$from.parent.inlineContent || (o = pl(n, t.from)), !t.empty && !t.$from.parent.inlineContent && (i = pl(n, t.to))), n.docView.setSelection(r, s, n, e), hl && (o && ml(o), i && ml(i)), t.visible ? n.dom.classList.remove("ProseMirror-hideselection") : (n.dom.classList.add("ProseMirror-hideselection"), "onselectionchange" in document && ep(n));
|
|
8014
8014
|
}
|
|
8015
8015
|
n.domObserver.setCurSelection(), n.domObserver.connectSelection();
|
|
8016
8016
|
}
|
|
@@ -8051,7 +8051,7 @@ function tp(n) {
|
|
|
8051
8051
|
s ? t.setStart(r.parentNode, ne(r) + 1) : t.setStart(r, 0), t.collapse(!0), e.removeAllRanges(), e.addRange(t), !s && !n.state.selection.visible && Se && Ot <= 11 && (r.disabled = !0, r.disabled = !1);
|
|
8052
8052
|
}
|
|
8053
8053
|
function Jc(n, e) {
|
|
8054
|
-
if (e instanceof
|
|
8054
|
+
if (e instanceof w) {
|
|
8055
8055
|
let t = n.docView.descAt(e.from);
|
|
8056
8056
|
t != n.lastSelectedViewDesc && (gl(n), t && t.selectNode(), n.lastSelectedViewDesc = t);
|
|
8057
8057
|
} else
|
|
@@ -8061,7 +8061,7 @@ function gl(n) {
|
|
|
8061
8061
|
n.lastSelectedViewDesc && (n.lastSelectedViewDesc.parent && n.lastSelectedViewDesc.deselectNode(), n.lastSelectedViewDesc = void 0);
|
|
8062
8062
|
}
|
|
8063
8063
|
function Jo(n, e, t, r) {
|
|
8064
|
-
return n.someProp("createSelectionBetween", (s) => s(n, e, t)) ||
|
|
8064
|
+
return n.someProp("createSelectionBetween", (s) => s(n, e, t)) || V.between(e, t, r);
|
|
8065
8065
|
}
|
|
8066
8066
|
function yl(n) {
|
|
8067
8067
|
return n.editable && !n.hasFocus() ? !1 : Kc(n);
|
|
@@ -8082,35 +8082,35 @@ function np(n) {
|
|
|
8082
8082
|
}
|
|
8083
8083
|
function ho(n, e) {
|
|
8084
8084
|
let { $anchor: t, $head: r } = n.selection, s = e > 0 ? t.max(r) : t.min(r), o = s.parent.inlineContent ? s.depth ? n.doc.resolve(e > 0 ? s.after() : s.before()) : null : s;
|
|
8085
|
-
return o &&
|
|
8085
|
+
return o && $.findFrom(o, e);
|
|
8086
8086
|
}
|
|
8087
8087
|
function yt(n, e) {
|
|
8088
8088
|
return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()), !0;
|
|
8089
8089
|
}
|
|
8090
8090
|
function bl(n, e, t) {
|
|
8091
8091
|
let r = n.state.selection;
|
|
8092
|
-
if (r instanceof
|
|
8092
|
+
if (r instanceof V)
|
|
8093
8093
|
if (t.indexOf("s") > -1) {
|
|
8094
8094
|
let { $head: s } = r, o = s.textOffset ? null : e < 0 ? s.nodeBefore : s.nodeAfter;
|
|
8095
8095
|
if (!o || o.isText || !o.isLeaf)
|
|
8096
8096
|
return !1;
|
|
8097
8097
|
let i = n.state.doc.resolve(s.pos + o.nodeSize * (e < 0 ? -1 : 1));
|
|
8098
|
-
return yt(n, new
|
|
8098
|
+
return yt(n, new V(r.$anchor, i));
|
|
8099
8099
|
} else if (r.empty) {
|
|
8100
8100
|
if (n.endOfTextblock(e > 0 ? "forward" : "backward")) {
|
|
8101
8101
|
let s = ho(n.state, e);
|
|
8102
|
-
return s && s instanceof
|
|
8102
|
+
return s && s instanceof w ? yt(n, s) : !1;
|
|
8103
8103
|
} else if (!(Re && t.indexOf("m") > -1)) {
|
|
8104
8104
|
let s = r.$head, o = s.textOffset ? null : e < 0 ? s.nodeBefore : s.nodeAfter, i;
|
|
8105
8105
|
if (!o || o.isText)
|
|
8106
8106
|
return !1;
|
|
8107
8107
|
let l = e < 0 ? s.pos - o.nodeSize : s.pos;
|
|
8108
|
-
return o.isAtom || (i = n.docView.descAt(l)) && !i.contentDOM ?
|
|
8108
|
+
return o.isAtom || (i = n.docView.descAt(l)) && !i.contentDOM ? w.isSelectable(o) ? yt(n, new w(e < 0 ? n.state.doc.resolve(s.pos - o.nodeSize) : s)) : cr ? yt(n, new V(n.state.doc.resolve(e < 0 ? l : l + o.nodeSize))) : !1 : !1;
|
|
8109
8109
|
}
|
|
8110
8110
|
} else return !1;
|
|
8111
8111
|
else {
|
|
8112
|
-
if (r instanceof
|
|
8113
|
-
return yt(n, new
|
|
8112
|
+
if (r instanceof w && r.node.isInline)
|
|
8113
|
+
return yt(n, new V(e > 0 ? r.$to : r.$from));
|
|
8114
8114
|
{
|
|
8115
8115
|
let s = ho(n.state, e);
|
|
8116
8116
|
return s ? yt(n, s) : !1;
|
|
@@ -8260,22 +8260,22 @@ function xl(n, e) {
|
|
|
8260
8260
|
}
|
|
8261
8261
|
function Sl(n, e, t) {
|
|
8262
8262
|
let r = n.state.selection;
|
|
8263
|
-
if (r instanceof
|
|
8263
|
+
if (r instanceof V && !r.empty || t.indexOf("s") > -1 || Re && t.indexOf("m") > -1)
|
|
8264
8264
|
return !1;
|
|
8265
8265
|
let { $from: s, $to: o } = r;
|
|
8266
8266
|
if (!s.parent.inlineContent || n.endOfTextblock(e < 0 ? "up" : "down")) {
|
|
8267
8267
|
let i = ho(n.state, e);
|
|
8268
|
-
if (i && i instanceof
|
|
8268
|
+
if (i && i instanceof w)
|
|
8269
8269
|
return yt(n, i);
|
|
8270
8270
|
}
|
|
8271
8271
|
if (!s.parent.inlineContent) {
|
|
8272
|
-
let i = e < 0 ? s : o, l = r instanceof xe ?
|
|
8272
|
+
let i = e < 0 ? s : o, l = r instanceof xe ? $.near(i, e) : $.findFrom(i, e);
|
|
8273
8273
|
return l ? yt(n, l) : !1;
|
|
8274
8274
|
}
|
|
8275
8275
|
return !1;
|
|
8276
8276
|
}
|
|
8277
8277
|
function kl(n, e) {
|
|
8278
|
-
if (!(n.state.selection instanceof
|
|
8278
|
+
if (!(n.state.selection instanceof V))
|
|
8279
8279
|
return !0;
|
|
8280
8280
|
let { $head: t, $anchor: r, empty: s } = n.state.selection;
|
|
8281
8281
|
if (!t.sameParent(r))
|
|
@@ -8369,8 +8369,8 @@ function Gc(n, e, t, r, s) {
|
|
|
8369
8369
|
if (n.someProp("transformPastedText", (d) => {
|
|
8370
8370
|
e = d(e, o || r, n);
|
|
8371
8371
|
}), o)
|
|
8372
|
-
return e ? new
|
|
8373
|
-
`))), 0, 0) :
|
|
8372
|
+
return e ? new C(S.from(n.state.schema.text(e.replace(/\r\n?/g, `
|
|
8373
|
+
`))), 0, 0) : C.empty;
|
|
8374
8374
|
let f = n.someProp("clipboardTextParser", (d) => d(e, s, r, n));
|
|
8375
8375
|
if (f)
|
|
8376
8376
|
l = f;
|
|
@@ -8403,7 +8403,7 @@ function Gc(n, e, t, r, s) {
|
|
|
8403
8403
|
}
|
|
8404
8404
|
})), u)
|
|
8405
8405
|
l = mp(wl(l, +u[1], +u[2]), u[4]);
|
|
8406
|
-
else if (l =
|
|
8406
|
+
else if (l = C.maxOpen(fp(l.content, s), !0), l.openStart || l.openEnd) {
|
|
8407
8407
|
let f = 0, d = 0;
|
|
8408
8408
|
for (let h = l.content.firstChild; f < l.openStart && !h.type.spec.isolating; f++, h = h.firstChild)
|
|
8409
8409
|
;
|
|
@@ -8464,7 +8464,7 @@ function mo(n, e, t, r, s, o) {
|
|
|
8464
8464
|
return n.childCount > 1 && (o = 0), s < r - 1 && (l = mo(l, e, t, r, s + 1, o)), s >= t && (l = e < 0 ? i.contentMatchAt(0).fillBefore(l, o <= s).append(l) : l.append(i.contentMatchAt(i.childCount).fillBefore(S.empty, !0))), n.replaceChild(e < 0 ? 0 : n.childCount - 1, i.copy(l));
|
|
8465
8465
|
}
|
|
8466
8466
|
function wl(n, e, t) {
|
|
8467
|
-
return e < n.openStart && (n = new
|
|
8467
|
+
return e < n.openStart && (n = new C(mo(n.content, -1, e, n.openStart, 0, n.openEnd), e, n.openEnd)), t < n.openEnd && (n = new C(mo(n.content, 1, t, n.openEnd, 0, 0), n.openStart, t)), n;
|
|
8468
8468
|
}
|
|
8469
8469
|
const eu = {
|
|
8470
8470
|
thead: ["table"],
|
|
@@ -8518,7 +8518,7 @@ function mp(n, e) {
|
|
|
8518
8518
|
break;
|
|
8519
8519
|
s = S.from(a.create(r[l + 1], s)), o++, i++;
|
|
8520
8520
|
}
|
|
8521
|
-
return new
|
|
8521
|
+
return new C(s, o, i);
|
|
8522
8522
|
}
|
|
8523
8523
|
const ge = {}, ye = {}, gp = { touchstart: !0, touchmove: !0 };
|
|
8524
8524
|
class yp {
|
|
@@ -8591,7 +8591,7 @@ ye.keypress = (n, e) => {
|
|
|
8591
8591
|
return;
|
|
8592
8592
|
}
|
|
8593
8593
|
let r = n.state.selection;
|
|
8594
|
-
if (!(r instanceof
|
|
8594
|
+
if (!(r instanceof V) || !r.$from.sameParent(r.$to)) {
|
|
8595
8595
|
let s = String.fromCharCode(t.charCode);
|
|
8596
8596
|
!/[\r\n]/.test(s) && !n.someProp("handleTextInput", (o) => o(n, r.$from.pos, r.$to.pos, s)) && n.dispatch(n.state.tr.insertText(s).scrollIntoView()), t.preventDefault();
|
|
8597
8597
|
}
|
|
@@ -8622,22 +8622,22 @@ function wp(n, e) {
|
|
|
8622
8622
|
if (e == -1)
|
|
8623
8623
|
return !1;
|
|
8624
8624
|
let t = n.state.doc.resolve(e), r = t.nodeAfter;
|
|
8625
|
-
return r && r.isAtom &&
|
|
8625
|
+
return r && r.isAtom && w.isSelectable(r) ? (Cn(n, new w(t)), !0) : !1;
|
|
8626
8626
|
}
|
|
8627
8627
|
function Mp(n, e) {
|
|
8628
8628
|
if (e == -1)
|
|
8629
8629
|
return !1;
|
|
8630
8630
|
let t = n.state.selection, r, s;
|
|
8631
|
-
t instanceof
|
|
8631
|
+
t instanceof w && (r = t.node);
|
|
8632
8632
|
let o = n.state.doc.resolve(e);
|
|
8633
8633
|
for (let i = o.depth + 1; i > 0; i--) {
|
|
8634
8634
|
let l = i > o.depth ? o.nodeAfter : o.node(i);
|
|
8635
|
-
if (
|
|
8635
|
+
if (w.isSelectable(l)) {
|
|
8636
8636
|
r && t.$from.depth > 0 && i >= t.$from.depth && o.before(t.$from.depth + 1) == t.$from.pos ? s = o.before(t.$from.depth) : s = o.before(i);
|
|
8637
8637
|
break;
|
|
8638
8638
|
}
|
|
8639
8639
|
}
|
|
8640
|
-
return s != null ? (Cn(n,
|
|
8640
|
+
return s != null ? (Cn(n, w.create(n.state.doc, s)), !0) : !1;
|
|
8641
8641
|
}
|
|
8642
8642
|
function Np(n, e, t, r, s) {
|
|
8643
8643
|
return Uo(n, "handleClickOn", e, t, r) || n.someProp("handleClick", (o) => o(n, e, r)) || (s ? Mp(n, t) : wp(n, t));
|
|
@@ -8653,14 +8653,14 @@ function Ep(n, e, t) {
|
|
|
8653
8653
|
return !1;
|
|
8654
8654
|
let r = n.state.doc;
|
|
8655
8655
|
if (e == -1)
|
|
8656
|
-
return r.inlineContent ? (Cn(n,
|
|
8656
|
+
return r.inlineContent ? (Cn(n, V.create(r, 0, r.content.size)), !0) : !1;
|
|
8657
8657
|
let s = r.resolve(e);
|
|
8658
8658
|
for (let o = s.depth + 1; o > 0; o--) {
|
|
8659
8659
|
let i = o > s.depth ? s.nodeAfter : s.node(o), l = s.before(o);
|
|
8660
8660
|
if (i.inlineContent)
|
|
8661
|
-
Cn(n,
|
|
8662
|
-
else if (
|
|
8663
|
-
Cn(n,
|
|
8661
|
+
Cn(n, V.create(r, l + 1, l + 1 + i.content.size));
|
|
8662
|
+
else if (w.isSelectable(i))
|
|
8663
|
+
Cn(n, w.create(r, l));
|
|
8664
8664
|
else
|
|
8665
8665
|
continue;
|
|
8666
8666
|
return !0;
|
|
@@ -8691,7 +8691,7 @@ let Tp = class {
|
|
|
8691
8691
|
const l = s ? null : r.target, a = l ? e.docView.nearestDesc(l, !0) : null;
|
|
8692
8692
|
this.target = a && a.dom.nodeType == 1 ? a.dom : null;
|
|
8693
8693
|
let { selection: c } = e.state;
|
|
8694
|
-
(r.button == 0 && o.type.spec.draggable && o.type.spec.selectable !== !1 || c instanceof
|
|
8694
|
+
(r.button == 0 && o.type.spec.draggable && o.type.spec.selectable !== !1 || c instanceof w && c.from <= i && c.to > i) && (this.mightDrag = {
|
|
8695
8695
|
node: o,
|
|
8696
8696
|
pos: i,
|
|
8697
8697
|
addAttr: !!(this.target && !this.target.draggable),
|
|
@@ -8715,7 +8715,7 @@ let Tp = class {
|
|
|
8715
8715
|
// (hidden) cursor is doesn't change the selection, and
|
|
8716
8716
|
// thus doesn't get a reaction from ProseMirror. This
|
|
8717
8717
|
// works around that.
|
|
8718
|
-
ce && !this.view.state.selection.visible && Math.min(Math.abs(t.pos - this.view.state.selection.from), Math.abs(t.pos - this.view.state.selection.to)) <= 2) ? (Cn(this.view,
|
|
8718
|
+
ce && !this.view.state.selection.visible && Math.min(Math.abs(t.pos - this.view.state.selection.from), Math.abs(t.pos - this.view.state.selection.to)) <= 2) ? (Cn(this.view, $.near(this.view.state.doc.resolve(t.pos))), e.preventDefault()) : wt(this.view, "pointer");
|
|
8719
8719
|
}
|
|
8720
8720
|
move(e) {
|
|
8721
8721
|
this.updateAllowDefault(e), wt(this.view, "pointer"), e.buttons == 0 && this.done();
|
|
@@ -8739,7 +8739,7 @@ ye.compositionstart = ye.compositionupdate = (n) => {
|
|
|
8739
8739
|
if (!n.composing) {
|
|
8740
8740
|
n.domObserver.flush();
|
|
8741
8741
|
let { state: e } = n, t = e.selection.$to;
|
|
8742
|
-
if (e.selection instanceof
|
|
8742
|
+
if (e.selection instanceof V && (e.storedMarks || !t.textOffset && t.parentOffset && t.nodeBefore.marks.some((r) => r.type.spec.inclusive === !1)))
|
|
8743
8743
|
n.markCursor = n.state.storedMarks || t.marks(), Hr(n, !0), n.markCursor = null;
|
|
8744
8744
|
else if (Hr(n, !e.selection.empty), je && e.selection.empty && t.parentOffset && !t.textOffset && t.nodeBefore.marks.length) {
|
|
8745
8745
|
let r = n.domSelectionRange();
|
|
@@ -8834,7 +8834,7 @@ function Vp(n, e) {
|
|
|
8834
8834
|
}
|
|
8835
8835
|
function Qn(n, e, t, r, s) {
|
|
8836
8836
|
let o = Gc(n, e, t, r, n.state.selection.$from);
|
|
8837
|
-
if (n.someProp("handlePaste", (a) => a(n, s, o ||
|
|
8837
|
+
if (n.someProp("handlePaste", (a) => a(n, s, o || C.empty)))
|
|
8838
8838
|
return !0;
|
|
8839
8839
|
if (!o)
|
|
8840
8840
|
return !1;
|
|
@@ -8866,12 +8866,12 @@ ge.dragstart = (n, e) => {
|
|
|
8866
8866
|
if (r && r.done(), !t.dataTransfer)
|
|
8867
8867
|
return;
|
|
8868
8868
|
let s = n.state.selection, o = s.empty ? null : n.posAtCoords(us(t)), i;
|
|
8869
|
-
if (!(o && o.pos >= s.from && o.pos <= (s instanceof
|
|
8869
|
+
if (!(o && o.pos >= s.from && o.pos <= (s instanceof w ? s.to - 1 : s.to))) {
|
|
8870
8870
|
if (r && r.mightDrag)
|
|
8871
|
-
i =
|
|
8871
|
+
i = w.create(n.state.doc, r.mightDrag.pos);
|
|
8872
8872
|
else if (t.target && t.target.nodeType == 1) {
|
|
8873
8873
|
let f = n.docView.nearestDesc(t.target, !0);
|
|
8874
|
-
f && f.node.type.spec.draggable && f != n.docView && (i =
|
|
8874
|
+
f && f.node.type.spec.draggable && f != n.docView && (i = w.create(n.state.doc, f.posBefore));
|
|
8875
8875
|
}
|
|
8876
8876
|
}
|
|
8877
8877
|
let l = (i || n.state.selection).content(), { dom: a, text: c, slice: u } = Yc(n, l);
|
|
@@ -8896,7 +8896,7 @@ ye.drop = (n, e) => {
|
|
|
8896
8896
|
i = p(i, n);
|
|
8897
8897
|
}) : i = Gc(n, iu(t.dataTransfer), Xn ? null : t.dataTransfer.getData("text/html"), !1, o);
|
|
8898
8898
|
let l = !!(r && !t[au]);
|
|
8899
|
-
if (n.someProp("handleDrop", (p) => p(n, t, i ||
|
|
8899
|
+
if (n.someProp("handleDrop", (p) => p(n, t, i || C.empty, l))) {
|
|
8900
8900
|
t.preventDefault();
|
|
8901
8901
|
return;
|
|
8902
8902
|
}
|
|
@@ -8914,8 +8914,8 @@ ye.drop = (n, e) => {
|
|
|
8914
8914
|
if (f ? c.replaceRangeWith(u, u, i.content.firstChild) : c.replaceRange(u, u, i), c.doc.eq(d))
|
|
8915
8915
|
return;
|
|
8916
8916
|
let h = c.doc.resolve(u);
|
|
8917
|
-
if (f &&
|
|
8918
|
-
c.setSelection(new
|
|
8917
|
+
if (f && w.isSelectable(i.content.firstChild) && h.nodeAfter && h.nodeAfter.sameMarkup(i.content.firstChild))
|
|
8918
|
+
c.setSelection(new w(h));
|
|
8919
8919
|
else {
|
|
8920
8920
|
let p = c.mapping.map(a);
|
|
8921
8921
|
c.mapping.maps[c.mapping.maps.length - 1].forEach((y, m, x, k) => p = k), c.setSelection(Jo(n, h, c.doc.resolve(p)));
|
|
@@ -9326,8 +9326,8 @@ function zp(n, e, t, r, s, o, i) {
|
|
|
9326
9326
|
let k = l[x + 1];
|
|
9327
9327
|
if (k < 0 || d > k + u - f)
|
|
9328
9328
|
continue;
|
|
9329
|
-
let
|
|
9330
|
-
h >=
|
|
9329
|
+
let M = l[x] + u - f;
|
|
9330
|
+
h >= M ? l[x + 1] = d <= M ? -2 : -1 : d >= u && m && (l[x] += m, l[x + 1] += m);
|
|
9331
9331
|
}
|
|
9332
9332
|
f += m;
|
|
9333
9333
|
}), u = t.maps[c].map(u, -1);
|
|
@@ -9579,7 +9579,7 @@ class Wp {
|
|
|
9579
9579
|
}
|
|
9580
9580
|
}
|
|
9581
9581
|
let c = null;
|
|
9582
|
-
o < 0 && s && e.input.lastFocus > Date.now() - 200 && Math.max(e.input.lastTouch, e.input.lastClick.time) < Date.now() - 300 && cs(r) && (c = Ho(e)) && c.eq(
|
|
9582
|
+
o < 0 && s && e.input.lastFocus > Date.now() - 200 && Math.max(e.input.lastTouch, e.input.lastClick.time) < Date.now() - 300 && cs(r) && (c = Ho(e)) && c.eq($.near(e.state.doc.resolve(0), 1)) ? (e.input.lastFocus = 0, at(e), this.currentSelection.set(r), e.scrollToSelection()) : (o > -1 || s) && (o > -1 && (e.docView.markDirty(o, i), _p(e)), this.handleDOMChange(o, i, l, a), e.docView && e.docView.dirty ? e.updateState(e.state) : this.currentSelection.eq(r) || at(e), this.currentSelection.set(r));
|
|
9583
9583
|
}
|
|
9584
9584
|
registerMutation(e, t) {
|
|
9585
9585
|
if (t.indexOf(e.target) > -1)
|
|
@@ -9693,12 +9693,12 @@ const Up = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|df
|
|
|
9693
9693
|
function Yp(n, e, t, r, s) {
|
|
9694
9694
|
let o = n.input.compositionPendingChanges || (n.composing ? n.input.compositionID : 0);
|
|
9695
9695
|
if (n.input.compositionPendingChanges = 0, e < 0) {
|
|
9696
|
-
let
|
|
9696
|
+
let R = n.input.lastSelectionTime > Date.now() - 50 ? n.input.lastSelectionOrigin : null, _ = Ho(n, R);
|
|
9697
9697
|
if (_ && !n.state.selection.eq(_)) {
|
|
9698
9698
|
if (ce && it && n.input.lastKeyCode === 13 && Date.now() - 100 < n.input.lastKeyCodeTime && n.someProp("handleKeyDown", (dt) => dt(n, Lt(13, "Enter"))))
|
|
9699
9699
|
return;
|
|
9700
9700
|
let ke = n.state.tr.setSelection(_);
|
|
9701
|
-
|
|
9701
|
+
R == "pointer" ? ke.setMeta("pointer", !0) : R == "key" && ke.scrollIntoView(), o && ke.setMeta("composition", o), n.dispatch(ke);
|
|
9702
9702
|
}
|
|
9703
9703
|
return;
|
|
9704
9704
|
}
|
|
@@ -9707,59 +9707,59 @@ function Yp(n, e, t, r, s) {
|
|
|
9707
9707
|
let a = n.state.selection, c = Jp(n, e, t), u = n.state.doc, f = u.slice(c.from, c.to), d, h;
|
|
9708
9708
|
n.input.lastKeyCode === 8 && Date.now() - 100 < n.input.lastKeyCodeTime ? (d = n.state.selection.to, h = "end") : (d = n.state.selection.from, h = "start"), n.input.lastKeyCode = null;
|
|
9709
9709
|
let p = Qp(f.content, c.doc.content, c.from, d, h);
|
|
9710
|
-
if (p && n.input.domChangeCount++, (Dn && n.input.lastIOSEnter > Date.now() - 225 || it) && s.some((
|
|
9710
|
+
if (p && n.input.domChangeCount++, (Dn && n.input.lastIOSEnter > Date.now() - 225 || it) && s.some((R) => R.nodeType == 1 && !Up.test(R.nodeName)) && (!p || p.endA >= p.endB) && n.someProp("handleKeyDown", (R) => R(n, Lt(13, "Enter")))) {
|
|
9711
9711
|
n.input.lastIOSEnter = 0;
|
|
9712
9712
|
return;
|
|
9713
9713
|
}
|
|
9714
9714
|
if (!p)
|
|
9715
|
-
if (r && a instanceof
|
|
9715
|
+
if (r && a instanceof V && !a.empty && a.$head.sameParent(a.$anchor) && !n.composing && !(c.sel && c.sel.anchor != c.sel.head))
|
|
9716
9716
|
p = { start: a.from, endA: a.to, endB: a.to };
|
|
9717
9717
|
else {
|
|
9718
9718
|
if (c.sel) {
|
|
9719
|
-
let
|
|
9720
|
-
if (
|
|
9721
|
-
let _ = n.state.tr.setSelection(
|
|
9719
|
+
let R = Al(n, n.state.doc, c.sel);
|
|
9720
|
+
if (R && !R.eq(n.state.selection)) {
|
|
9721
|
+
let _ = n.state.tr.setSelection(R);
|
|
9722
9722
|
o && _.setMeta("composition", o), n.dispatch(_);
|
|
9723
9723
|
}
|
|
9724
9724
|
}
|
|
9725
9725
|
return;
|
|
9726
9726
|
}
|
|
9727
|
-
n.state.selection.from < n.state.selection.to && p.start == p.endB && n.state.selection instanceof
|
|
9728
|
-
let y = c.doc.resolveNoCache(p.start - c.from), m = c.doc.resolveNoCache(p.endB - c.from), x = u.resolve(p.start), k = y.sameParent(m) && y.parent.inlineContent && x.end() >= p.endA,
|
|
9729
|
-
if ((Dn && n.input.lastIOSEnter > Date.now() - 225 && (!k || s.some((
|
|
9727
|
+
n.state.selection.from < n.state.selection.to && p.start == p.endB && n.state.selection instanceof V && (p.start > n.state.selection.from && p.start <= n.state.selection.from + 2 && n.state.selection.from >= c.from ? p.start = n.state.selection.from : p.endA < n.state.selection.to && p.endA >= n.state.selection.to - 2 && n.state.selection.to <= c.to && (p.endB += n.state.selection.to - p.endA, p.endA = n.state.selection.to)), Se && Ot <= 11 && p.endB == p.start + 1 && p.endA == p.start && p.start > c.from && c.doc.textBetween(p.start - c.from - 1, p.start - c.from + 1) == " " && (p.start--, p.endA--, p.endB--);
|
|
9728
|
+
let y = c.doc.resolveNoCache(p.start - c.from), m = c.doc.resolveNoCache(p.endB - c.from), x = u.resolve(p.start), k = y.sameParent(m) && y.parent.inlineContent && x.end() >= p.endA, M;
|
|
9729
|
+
if ((Dn && n.input.lastIOSEnter > Date.now() - 225 && (!k || s.some((R) => R.nodeName == "DIV" || R.nodeName == "P")) || !k && y.pos < c.doc.content.size && !y.sameParent(m) && (M = $.findFrom(c.doc.resolve(y.pos + 1), 1, !0)) && M.head == m.pos) && n.someProp("handleKeyDown", (R) => R(n, Lt(13, "Enter")))) {
|
|
9730
9730
|
n.input.lastIOSEnter = 0;
|
|
9731
9731
|
return;
|
|
9732
9732
|
}
|
|
9733
|
-
if (n.state.selection.anchor > p.start && Xp(u, p.start, p.endA, y, m) && n.someProp("handleKeyDown", (
|
|
9733
|
+
if (n.state.selection.anchor > p.start && Xp(u, p.start, p.endA, y, m) && n.someProp("handleKeyDown", (R) => R(n, Lt(8, "Backspace")))) {
|
|
9734
9734
|
it && ce && n.domObserver.suppressSelectionUpdates();
|
|
9735
9735
|
return;
|
|
9736
9736
|
}
|
|
9737
9737
|
ce && p.endB == p.start && (n.input.lastChromeDelete = Date.now()), it && !k && y.start() != m.start() && m.parentOffset == 0 && y.depth == m.depth && c.sel && c.sel.anchor == c.sel.head && c.sel.head == p.endA && (p.endB -= 2, m = c.doc.resolveNoCache(p.endB - c.from), setTimeout(() => {
|
|
9738
|
-
n.someProp("handleKeyDown", function(
|
|
9739
|
-
return
|
|
9738
|
+
n.someProp("handleKeyDown", function(R) {
|
|
9739
|
+
return R(n, Lt(13, "Enter"));
|
|
9740
9740
|
});
|
|
9741
9741
|
}, 20));
|
|
9742
|
-
let
|
|
9742
|
+
let v = p.start, P = p.endA, D, B, z;
|
|
9743
9743
|
if (k) {
|
|
9744
9744
|
if (y.pos == m.pos)
|
|
9745
|
-
Se && Ot <= 11 && y.parentOffset == 0 && (n.domObserver.suppressSelectionUpdates(), setTimeout(() => at(n), 20)),
|
|
9745
|
+
Se && Ot <= 11 && y.parentOffset == 0 && (n.domObserver.suppressSelectionUpdates(), setTimeout(() => at(n), 20)), D = n.state.tr.delete(v, P), B = u.resolve(p.start).marksAcross(u.resolve(p.endA));
|
|
9746
9746
|
else if (
|
|
9747
9747
|
// Adding or removing a mark
|
|
9748
|
-
p.endA == p.endB && (
|
|
9748
|
+
p.endA == p.endB && (z = Gp(y.parent.content.cut(y.parentOffset, m.parentOffset), x.parent.content.cut(x.parentOffset, p.endA - x.start())))
|
|
9749
9749
|
)
|
|
9750
|
-
|
|
9750
|
+
D = n.state.tr, z.type == "add" ? D.addMark(v, P, z.mark) : D.removeMark(v, P, z.mark);
|
|
9751
9751
|
else if (y.parent.child(y.index()).isText && y.index() == m.index() - (m.textOffset ? 0 : 1)) {
|
|
9752
|
-
let
|
|
9753
|
-
if (n.someProp("handleTextInput", (_) => _(n,
|
|
9752
|
+
let R = y.parent.textBetween(y.parentOffset, m.parentOffset);
|
|
9753
|
+
if (n.someProp("handleTextInput", (_) => _(n, v, P, R)))
|
|
9754
9754
|
return;
|
|
9755
|
-
|
|
9755
|
+
D = n.state.tr.insertText(R, v, P);
|
|
9756
9756
|
}
|
|
9757
9757
|
}
|
|
9758
|
-
if (
|
|
9759
|
-
let
|
|
9760
|
-
|
|
9758
|
+
if (D || (D = n.state.tr.replace(v, P, c.doc.slice(p.start - c.from, p.endB - c.from))), c.sel) {
|
|
9759
|
+
let R = Al(n, D.doc, c.sel);
|
|
9760
|
+
R && !(ce && n.composing && R.empty && (p.start != p.endB || n.input.lastChromeDelete < Date.now() - 100) && (R.head == v || R.head == D.mapping.map(P) - 1) || Se && R.empty && R.head == v) && D.setSelection(R);
|
|
9761
9761
|
}
|
|
9762
|
-
|
|
9762
|
+
B && D.ensureMarks(B), o && D.setMeta("composition", o), n.dispatch(D.scrollIntoView());
|
|
9763
9763
|
}
|
|
9764
9764
|
function Al(n, e, t) {
|
|
9765
9765
|
return Math.max(t.anchor, t.head) > e.content.size ? null : Jo(n, e.resolve(t.anchor), e.resolve(t.head));
|
|
@@ -9925,7 +9925,7 @@ class Zp {
|
|
|
9925
9925
|
*/
|
|
9926
9926
|
scrollToSelection() {
|
|
9927
9927
|
let e = this.domSelectionRange().focusNode;
|
|
9928
|
-
if (!this.someProp("handleScrollToSelection", (t) => t(this))) if (this.state.selection instanceof
|
|
9928
|
+
if (!this.someProp("handleScrollToSelection", (t) => t(this))) if (this.state.selection instanceof w) {
|
|
9929
9929
|
let t = this.docView.domAfterPos(this.state.selection.from);
|
|
9930
9930
|
t.nodeType == 1 && ol(this, t.getBoundingClientRect(), e);
|
|
9931
9931
|
} else
|
|
@@ -9961,7 +9961,7 @@ class Zp {
|
|
|
9961
9961
|
let o = r.from + (this.state.doc.content.size - t.doc.content.size);
|
|
9962
9962
|
(o > 0 && this.state.doc.nodeAt(o)) == r.node && (s = o);
|
|
9963
9963
|
}
|
|
9964
|
-
this.dragging = new lu(e.slice, e.move, s < 0 ? void 0 :
|
|
9964
|
+
this.dragging = new lu(e.slice, e.move, s < 0 ? void 0 : w.create(this.state.doc, s));
|
|
9965
9965
|
}
|
|
9966
9966
|
someProp(e, t) {
|
|
9967
9967
|
let r = this._props && this._props[e], s;
|
|
@@ -10211,7 +10211,7 @@ function $l(n) {
|
|
|
10211
10211
|
if (n.spec.state || n.spec.filterTransaction || n.spec.appendTransaction)
|
|
10212
10212
|
throw new RangeError("Plugins passed directly to the view must not have a state component");
|
|
10213
10213
|
}
|
|
10214
|
-
class K extends
|
|
10214
|
+
class K extends $ {
|
|
10215
10215
|
/**
|
|
10216
10216
|
Create a gap cursor.
|
|
10217
10217
|
*/
|
|
@@ -10220,10 +10220,10 @@ class K extends V {
|
|
|
10220
10220
|
}
|
|
10221
10221
|
map(e, t) {
|
|
10222
10222
|
let r = e.resolve(t.map(this.head));
|
|
10223
|
-
return K.valid(r) ? new K(r) :
|
|
10223
|
+
return K.valid(r) ? new K(r) : $.near(r);
|
|
10224
10224
|
}
|
|
10225
10225
|
content() {
|
|
10226
|
-
return
|
|
10226
|
+
return C.empty;
|
|
10227
10227
|
}
|
|
10228
10228
|
eq(e) {
|
|
10229
10229
|
return e instanceof K && e.head == this.head;
|
|
@@ -10281,7 +10281,7 @@ class K extends V {
|
|
|
10281
10281
|
for (; ; ) {
|
|
10282
10282
|
let i = t > 0 ? o.firstChild : o.lastChild;
|
|
10283
10283
|
if (!i) {
|
|
10284
|
-
if (o.isAtom && !o.isText && !
|
|
10284
|
+
if (o.isAtom && !o.isText && !w.isSelectable(o)) {
|
|
10285
10285
|
e = e.doc.resolve(s + o.nodeSize * t), r = !1;
|
|
10286
10286
|
continue e;
|
|
10287
10287
|
}
|
|
@@ -10298,7 +10298,7 @@ class K extends V {
|
|
|
10298
10298
|
}
|
|
10299
10299
|
K.prototype.visible = !1;
|
|
10300
10300
|
K.findFrom = K.findGapCursorFrom;
|
|
10301
|
-
|
|
10301
|
+
$.jsonID("gapcursor", K);
|
|
10302
10302
|
class Xo {
|
|
10303
10303
|
constructor(e) {
|
|
10304
10304
|
this.pos = e;
|
|
@@ -10308,7 +10308,7 @@ class Xo {
|
|
|
10308
10308
|
}
|
|
10309
10309
|
resolve(e) {
|
|
10310
10310
|
let t = e.resolve(this.pos);
|
|
10311
|
-
return K.valid(t) ? new K(t) :
|
|
10311
|
+
return K.valid(t) ? new K(t) : $.near(t);
|
|
10312
10312
|
}
|
|
10313
10313
|
}
|
|
10314
10314
|
function nm(n) {
|
|
@@ -10368,7 +10368,7 @@ function xr(n, e) {
|
|
|
10368
10368
|
const t = n == "vert" ? e > 0 ? "down" : "up" : e > 0 ? "right" : "left";
|
|
10369
10369
|
return function(r, s, o) {
|
|
10370
10370
|
let i = r.selection, l = e > 0 ? i.$to : i.$from, a = i.empty;
|
|
10371
|
-
if (i instanceof
|
|
10371
|
+
if (i instanceof V) {
|
|
10372
10372
|
if (!o.endOfTextblock(t) || l.depth == 0)
|
|
10373
10373
|
return !1;
|
|
10374
10374
|
a = !1, l = r.doc.resolve(e > 0 ? l.after() : l.before());
|
|
@@ -10384,7 +10384,7 @@ function im(n, e, t) {
|
|
|
10384
10384
|
if (!K.valid(r))
|
|
10385
10385
|
return !1;
|
|
10386
10386
|
let s = n.posAtCoords({ left: t.clientX, top: t.clientY });
|
|
10387
|
-
return s && s.inside > -1 &&
|
|
10387
|
+
return s && s.inside > -1 && w.isSelectable(n.state.doc.nodeAt(s.inside)) ? !1 : (n.dispatch(n.state.tr.setSelection(new K(r))), !0);
|
|
10388
10388
|
}
|
|
10389
10389
|
function lm(n, e) {
|
|
10390
10390
|
if (e.inputType != "insertCompositionText" || !(n.state.selection instanceof K))
|
|
@@ -10395,8 +10395,8 @@ function lm(n, e) {
|
|
|
10395
10395
|
let s = S.empty;
|
|
10396
10396
|
for (let i = r.length - 1; i >= 0; i--)
|
|
10397
10397
|
s = S.from(r[i].createAndFill(null, s));
|
|
10398
|
-
let o = n.state.tr.replace(t.pos, t.pos, new
|
|
10399
|
-
return o.setSelection(
|
|
10398
|
+
let o = n.state.tr.replace(t.pos, t.pos, new C(s, 0, 0));
|
|
10399
|
+
return o.setSelection(V.near(o.doc.resolve(t.pos + 1))), n.dispatch(o), !1;
|
|
10400
10400
|
}
|
|
10401
10401
|
function am(n) {
|
|
10402
10402
|
if (!(n.selection instanceof K))
|
|
@@ -10463,7 +10463,7 @@ function ym(n, e, t, r, s) {
|
|
|
10463
10463
|
let o = S.empty;
|
|
10464
10464
|
for (let u = t.length - 1; u >= 0; u--)
|
|
10465
10465
|
o = S.from(t[u].type.create(t[u].attrs, o));
|
|
10466
|
-
n.step(new se(e.start - (r ? 2 : 0), e.end, e.start, e.end, new
|
|
10466
|
+
n.step(new se(e.start - (r ? 2 : 0), e.end, e.start, e.end, new C(o, 0, 0), t.length, !0));
|
|
10467
10467
|
let i = 0;
|
|
10468
10468
|
for (let u = 0; u < t.length; u++)
|
|
10469
10469
|
t[u].type == s && (i = u + 1);
|
|
@@ -10489,12 +10489,12 @@ function bm(n, e) {
|
|
|
10489
10489
|
f = S.from(s.node(x).copy(f));
|
|
10490
10490
|
let h = s.indexAfter(-1) < s.node(-2).childCount ? 1 : s.indexAfter(-2) < s.node(-3).childCount ? 2 : 3;
|
|
10491
10491
|
f = f.append(S.from(n.createAndFill()));
|
|
10492
|
-
let p = s.before(s.depth - (d - 1)), y = t.tr.replace(p, s.after(-h), new
|
|
10492
|
+
let p = s.before(s.depth - (d - 1)), y = t.tr.replace(p, s.after(-h), new C(f, 4 - d, 0)), m = -1;
|
|
10493
10493
|
y.doc.nodesBetween(p, y.doc.content.size, (x, k) => {
|
|
10494
10494
|
if (m > -1)
|
|
10495
10495
|
return !1;
|
|
10496
10496
|
x.isTextblock && x.content.size == 0 && (m = k + 1);
|
|
10497
|
-
}), m > -1 && y.setSelection(
|
|
10497
|
+
}), m > -1 && y.setSelection($.near(y.doc.resolve(m))), r(y.scrollIntoView());
|
|
10498
10498
|
}
|
|
10499
10499
|
return !0;
|
|
10500
10500
|
}
|
|
@@ -10510,7 +10510,7 @@ function xm(n) {
|
|
|
10510
10510
|
}
|
|
10511
10511
|
function Sm(n, e, t, r) {
|
|
10512
10512
|
let s = n.tr, o = r.end, i = r.$to.end(r.depth);
|
|
10513
|
-
o < i && (s.step(new se(o - 1, i, o, i, new
|
|
10513
|
+
o < i && (s.step(new se(o - 1, i, o, i, new C(S.from(t.create(null, r.parent.copy())), 1, 0), 1, !0)), r = new zr(s.doc.resolve(r.$from.pos), s.doc.resolve(i), r.depth));
|
|
10514
10514
|
const l = lr(r);
|
|
10515
10515
|
if (l == null)
|
|
10516
10516
|
return !1;
|
|
@@ -10529,7 +10529,7 @@ function km(n, e, t) {
|
|
|
10529
10529
|
if (!c.canReplace(u + (l ? 0 : 1), u + 1, i.content.append(a ? S.empty : S.from(s))))
|
|
10530
10530
|
return !1;
|
|
10531
10531
|
let f = o.pos, d = f + i.nodeSize;
|
|
10532
|
-
return r.step(new se(f - (l ? 1 : 0), d + (a ? 1 : 0), f + 1, d - 1, new
|
|
10532
|
+
return r.step(new se(f - (l ? 1 : 0), d + (a ? 1 : 0), f + 1, d - 1, new C((l ? S.empty : S.from(s.copy(S.empty))).append(a ? S.empty : S.from(s.copy(S.empty))), l ? 0 : 1, a ? 0 : 1), l ? 0 : 1)), e(r.scrollIntoView()), !0;
|
|
10533
10533
|
}
|
|
10534
10534
|
function Cm(n) {
|
|
10535
10535
|
return function(e, t) {
|
|
@@ -10543,7 +10543,7 @@ function Cm(n) {
|
|
|
10543
10543
|
if (a.type != n)
|
|
10544
10544
|
return !1;
|
|
10545
10545
|
if (t) {
|
|
10546
|
-
let c = a.lastChild && a.lastChild.type == l.type, u = S.from(c ? n.create() : null), f = new
|
|
10546
|
+
let c = a.lastChild && a.lastChild.type == l.type, u = S.from(c ? n.create() : null), f = new C(S.from(n.create(null, S.from(l.type.create(null, u)))), c ? 3 : 1, 0), d = o.start, h = o.end;
|
|
10547
10547
|
t(e.tr.step(new se(d - (c ? 3 : 1), h, d, h, f, 1, !0)).scrollIntoView());
|
|
10548
10548
|
}
|
|
10549
10549
|
return !0;
|
|
@@ -10734,30 +10734,30 @@ const lt = new At("ImagePluginKey"), Lm = (n) => new ut({
|
|
|
10734
10734
|
}), Wm = (n, e) => {
|
|
10735
10735
|
const t = lt.getState(n).set, r = t == null ? void 0 : t.find(void 0, void 0, (s) => s.id == e);
|
|
10736
10736
|
return r != null && r.length ? r[0].from : null;
|
|
10737
|
-
}, _m = async (n, e, t) => {
|
|
10737
|
+
}, _m = async (n, e, t, r) => {
|
|
10738
10738
|
if (!e) return;
|
|
10739
|
-
const
|
|
10740
|
-
|
|
10739
|
+
const s = Date.now(), o = n.state.tr;
|
|
10740
|
+
r === void 0 && (o.selection.empty || o.deleteSelection(), r = o.selection.from), o.setMeta(lt, { add: { id: s, pos: r } }), n.dispatch(o);
|
|
10741
10741
|
try {
|
|
10742
|
-
const
|
|
10743
|
-
if (!
|
|
10744
|
-
const
|
|
10745
|
-
if (typeof
|
|
10746
|
-
const
|
|
10747
|
-
if (
|
|
10742
|
+
const i = lt.getState(n.state), l = i.schema, a = i.upload;
|
|
10743
|
+
if (!a) throw new Error("uploadImage: Image upload function not defined");
|
|
10744
|
+
const c = await a(e);
|
|
10745
|
+
if (typeof c == "string") throw new Error(c);
|
|
10746
|
+
const u = Wm(n.state, s);
|
|
10747
|
+
if (u === null) {
|
|
10748
10748
|
console.warn("uploadImage: The image was removed from the document during upload");
|
|
10749
10749
|
return;
|
|
10750
10750
|
}
|
|
10751
|
-
n.dispatch(n.state.tr.replaceWith(
|
|
10752
|
-
} catch (
|
|
10753
|
-
n.dispatch(n.state.tr.setMeta(lt, { remove: { id:
|
|
10751
|
+
n.dispatch(n.state.tr.replaceWith(u, u, l.nodes.image.create({ fid: c, title: t })).setMeta(lt, { remove: { id: s } }));
|
|
10752
|
+
} catch (i) {
|
|
10753
|
+
n.dispatch(n.state.tr.setMeta(lt, { remove: { id: s } })), console.error(`uploadImage: ${i}`);
|
|
10754
10754
|
}
|
|
10755
|
-
}, qm = (n, e, t) => {
|
|
10755
|
+
}, qm = (n, e, t, r) => {
|
|
10756
10756
|
if (!e) return;
|
|
10757
|
-
const
|
|
10758
|
-
r.selection.empty ||
|
|
10759
|
-
const
|
|
10760
|
-
n.dispatch(n.state.tr.replaceWith(
|
|
10757
|
+
const s = n.state.tr;
|
|
10758
|
+
r === void 0 && (s.selection.empty || s.deleteSelection(), r = s.selection.from);
|
|
10759
|
+
const o = lt.getState(n.state).schema;
|
|
10760
|
+
n.dispatch(n.state.tr.replaceWith(r, r, o.nodes.image.create({ src: e, title: t })));
|
|
10761
10761
|
}, tn = function(n) {
|
|
10762
10762
|
for (var e = 0; ; e++)
|
|
10763
10763
|
if (n = n.previousSibling, !n)
|
|
@@ -10823,9 +10823,9 @@ function Ym(n, e = null) {
|
|
|
10823
10823
|
for (a = i; s && !s.node; )
|
|
10824
10824
|
s = s.parent;
|
|
10825
10825
|
let f = s.node;
|
|
10826
|
-
if (s && f.isAtom &&
|
|
10826
|
+
if (s && f.isAtom && w.isSelectable(f) && s.parent && !(f.isInline && Jm(t.focusNode, t.focusOffset, s.dom))) {
|
|
10827
10827
|
let d = s.posBefore;
|
|
10828
|
-
c = new
|
|
10828
|
+
c = new w(i == d ? l : r.resolve(d));
|
|
10829
10829
|
}
|
|
10830
10830
|
} else {
|
|
10831
10831
|
if (t instanceof n.dom.ownerDocument.defaultView.Selection && t.rangeCount > 1) {
|
|
@@ -10866,7 +10866,7 @@ function ni(n, e = !1) {
|
|
|
10866
10866
|
Xm(n);
|
|
10867
10867
|
else {
|
|
10868
10868
|
let { anchor: r, head: s } = t, o, i;
|
|
10869
|
-
Ll && !(t instanceof
|
|
10869
|
+
Ll && !(t instanceof V) && (t.$from.parent.inlineContent || (o = Wl(n, t.from)), !t.empty && !t.$from.parent.inlineContent && (i = Wl(n, t.to))), n.docView.setSelection(r, s, n, e), Ll && (o && _l(o), i && _l(i)), t.visible ? n.dom.classList.remove("ProseMirror-hideselection") : (n.dom.classList.add("ProseMirror-hideselection"), "onselectionchange" in document && Gm(n));
|
|
10870
10870
|
}
|
|
10871
10871
|
n.domObserver.setCurSelection(), n.domObserver.connectSelection();
|
|
10872
10872
|
}
|
|
@@ -10907,7 +10907,7 @@ function Xm(n) {
|
|
|
10907
10907
|
s ? t.setStart(r.parentNode, tn(r) + 1) : t.setStart(r, 0), t.collapse(!0), e.removeAllRanges(), e.addRange(t), !s && !n.state.selection.visible && fr && Su <= 11 && (r.disabled = !0, r.disabled = !1);
|
|
10908
10908
|
}
|
|
10909
10909
|
function Qm(n, e) {
|
|
10910
|
-
if (e instanceof
|
|
10910
|
+
if (e instanceof w) {
|
|
10911
10911
|
let t = n.docView.descAt(e.from);
|
|
10912
10912
|
t != n.lastSelectedViewDesc && (ql(n), t && t.selectNode(), n.lastSelectedViewDesc = t);
|
|
10913
10913
|
} else
|
|
@@ -10917,7 +10917,7 @@ function ql(n) {
|
|
|
10917
10917
|
n.lastSelectedViewDesc && (n.lastSelectedViewDesc.parent && n.lastSelectedViewDesc.deselectNode(), n.lastSelectedViewDesc = void 0);
|
|
10918
10918
|
}
|
|
10919
10919
|
function wu(n, e, t, r) {
|
|
10920
|
-
return n.someProp("createSelectionBetween", (s) => s(n, e, t)) ||
|
|
10920
|
+
return n.someProp("createSelectionBetween", (s) => s(n, e, t)) || V.between(e, t, r);
|
|
10921
10921
|
}
|
|
10922
10922
|
function Zm(n) {
|
|
10923
10923
|
let e = n.domSelectionRange();
|
|
@@ -10931,35 +10931,35 @@ function Zm(n) {
|
|
|
10931
10931
|
}
|
|
10932
10932
|
function ko(n, e) {
|
|
10933
10933
|
let { $anchor: t, $head: r } = n.selection, s = e > 0 ? t.max(r) : t.min(r), o = s.parent.inlineContent ? s.depth ? n.doc.resolve(e > 0 ? s.after() : s.before()) : null : s;
|
|
10934
|
-
return o &&
|
|
10934
|
+
return o && $.findFrom(o, e);
|
|
10935
10935
|
}
|
|
10936
10936
|
function bt(n, e) {
|
|
10937
10937
|
return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()), !0;
|
|
10938
10938
|
}
|
|
10939
10939
|
function Hl(n, e, t) {
|
|
10940
10940
|
let r = n.state.selection;
|
|
10941
|
-
if (r instanceof
|
|
10941
|
+
if (r instanceof V)
|
|
10942
10942
|
if (t.indexOf("s") > -1) {
|
|
10943
10943
|
let { $head: s } = r, o = s.textOffset ? null : e < 0 ? s.nodeBefore : s.nodeAfter;
|
|
10944
10944
|
if (!o || o.isText || !o.isLeaf)
|
|
10945
10945
|
return !1;
|
|
10946
10946
|
let i = n.state.doc.resolve(s.pos + o.nodeSize * (e < 0 ? -1 : 1));
|
|
10947
|
-
return bt(n, new
|
|
10947
|
+
return bt(n, new V(r.$anchor, i));
|
|
10948
10948
|
} else if (r.empty) {
|
|
10949
10949
|
if (n.endOfTextblock(e > 0 ? "forward" : "backward")) {
|
|
10950
10950
|
let s = ko(n.state, e);
|
|
10951
|
-
return s && s instanceof
|
|
10951
|
+
return s && s instanceof w ? bt(n, s) : !1;
|
|
10952
10952
|
} else if (!(Ie && t.indexOf("m") > -1)) {
|
|
10953
10953
|
let s = r.$head, o = s.textOffset ? null : e < 0 ? s.nodeBefore : s.nodeAfter, i;
|
|
10954
10954
|
if (!o || o.isText)
|
|
10955
10955
|
return !1;
|
|
10956
10956
|
let l = e < 0 ? s.pos - o.nodeSize : s.pos;
|
|
10957
|
-
return o.isAtom || (i = n.docView.descAt(l)) && !i.contentDOM ?
|
|
10957
|
+
return o.isAtom || (i = n.docView.descAt(l)) && !i.contentDOM ? w.isSelectable(o) ? bt(n, new w(e < 0 ? n.state.doc.resolve(s.pos - o.nodeSize) : s)) : ti ? bt(n, new V(n.state.doc.resolve(e < 0 ? l : l + o.nodeSize))) : !1 : !1;
|
|
10958
10958
|
}
|
|
10959
10959
|
} else return !1;
|
|
10960
10960
|
else {
|
|
10961
|
-
if (r instanceof
|
|
10962
|
-
return bt(n, new
|
|
10961
|
+
if (r instanceof w && r.node.isInline)
|
|
10962
|
+
return bt(n, new V(e > 0 ? r.$to : r.$from));
|
|
10963
10963
|
{
|
|
10964
10964
|
let s = ko(n.state, e);
|
|
10965
10965
|
return s ? bt(n, s) : !1;
|
|
@@ -11109,22 +11109,22 @@ function Jl(n, e) {
|
|
|
11109
11109
|
}
|
|
11110
11110
|
function Kl(n, e, t) {
|
|
11111
11111
|
let r = n.state.selection;
|
|
11112
|
-
if (r instanceof
|
|
11112
|
+
if (r instanceof V && !r.empty || t.indexOf("s") > -1 || Ie && t.indexOf("m") > -1)
|
|
11113
11113
|
return !1;
|
|
11114
11114
|
let { $from: s, $to: o } = r;
|
|
11115
11115
|
if (!s.parent.inlineContent || n.endOfTextblock(e < 0 ? "up" : "down")) {
|
|
11116
11116
|
let i = ko(n.state, e);
|
|
11117
|
-
if (i && i instanceof
|
|
11117
|
+
if (i && i instanceof w)
|
|
11118
11118
|
return bt(n, i);
|
|
11119
11119
|
}
|
|
11120
11120
|
if (!s.parent.inlineContent) {
|
|
11121
|
-
let i = e < 0 ? s : o, l = r instanceof xe ?
|
|
11121
|
+
let i = e < 0 ? s : o, l = r instanceof xe ? $.near(i, e) : $.findFrom(i, e);
|
|
11122
11122
|
return l ? bt(n, l) : !1;
|
|
11123
11123
|
}
|
|
11124
11124
|
return !1;
|
|
11125
11125
|
}
|
|
11126
11126
|
function Ul(n, e) {
|
|
11127
|
-
if (!(n.state.selection instanceof
|
|
11127
|
+
if (!(n.state.selection instanceof V))
|
|
11128
11128
|
return !0;
|
|
11129
11129
|
let { $head: t, $anchor: r, empty: s } = n.state.selection;
|
|
11130
11130
|
if (!t.sameParent(r))
|
|
@@ -11218,8 +11218,8 @@ function Du(n, e, t, r, s) {
|
|
|
11218
11218
|
if (n.someProp("transformPastedText", (d) => {
|
|
11219
11219
|
e = d(e, o || r, n);
|
|
11220
11220
|
}), o)
|
|
11221
|
-
return e ? new
|
|
11222
|
-
`))), 0, 0) :
|
|
11221
|
+
return e ? new C(S.from(n.state.schema.text(e.replace(/\r\n?/g, `
|
|
11222
|
+
`))), 0, 0) : C.empty;
|
|
11223
11223
|
let f = n.someProp("clipboardTextParser", (d) => d(e, s, r, n));
|
|
11224
11224
|
if (f)
|
|
11225
11225
|
l = f;
|
|
@@ -11252,7 +11252,7 @@ function Du(n, e, t, r, s) {
|
|
|
11252
11252
|
}
|
|
11253
11253
|
})), u)
|
|
11254
11254
|
l = dg(Gl(l, +u[1], +u[2]), u[4]);
|
|
11255
|
-
else if (l =
|
|
11255
|
+
else if (l = C.maxOpen(ag(l.content, s), !0), l.openStart || l.openEnd) {
|
|
11256
11256
|
let f = 0, d = 0;
|
|
11257
11257
|
for (let h = l.content.firstChild; f < l.openStart && !h.type.spec.isolating; f++, h = h.firstChild)
|
|
11258
11258
|
;
|
|
@@ -11313,7 +11313,7 @@ function wo(n, e, t, r, s, o) {
|
|
|
11313
11313
|
return n.childCount > 1 && (o = 0), s < r - 1 && (l = wo(l, e, t, r, s + 1, o)), s >= t && (l = e < 0 ? i.contentMatchAt(0).fillBefore(l, o <= s).append(l) : l.append(i.contentMatchAt(i.childCount).fillBefore(S.empty, !0))), n.replaceChild(e < 0 ? 0 : n.childCount - 1, i.copy(l));
|
|
11314
11314
|
}
|
|
11315
11315
|
function Gl(n, e, t) {
|
|
11316
|
-
return e < n.openStart && (n = new
|
|
11316
|
+
return e < n.openStart && (n = new C(wo(n.content, -1, e, n.openStart, 0, n.openEnd), e, n.openEnd)), t < n.openEnd && (n = new C(wo(n.content, 1, t, n.openEnd, 0, 0), n.openStart, t)), n;
|
|
11317
11317
|
}
|
|
11318
11318
|
const Au = {
|
|
11319
11319
|
thead: ["table"],
|
|
@@ -11367,7 +11367,7 @@ function dg(n, e) {
|
|
|
11367
11367
|
break;
|
|
11368
11368
|
s = S.from(a.create(r[l + 1], s)), o++, i++;
|
|
11369
11369
|
}
|
|
11370
|
-
return new
|
|
11370
|
+
return new C(s, o, i);
|
|
11371
11371
|
}
|
|
11372
11372
|
const Le = {}, De = {};
|
|
11373
11373
|
function Mt(n, e) {
|
|
@@ -11395,7 +11395,7 @@ De.keypress = (n, e) => {
|
|
|
11395
11395
|
return;
|
|
11396
11396
|
}
|
|
11397
11397
|
let r = n.state.selection;
|
|
11398
|
-
if (!(r instanceof
|
|
11398
|
+
if (!(r instanceof V) || !r.$from.sameParent(r.$to)) {
|
|
11399
11399
|
let s = String.fromCharCode(t.charCode);
|
|
11400
11400
|
!/[\r\n]/.test(s) && !n.someProp("handleTextInput", (o) => o(n, r.$from.pos, r.$to.pos, s)) && n.dispatch(n.state.tr.insertText(s).scrollIntoView()), t.preventDefault();
|
|
11401
11401
|
}
|
|
@@ -11426,22 +11426,22 @@ function pg(n, e) {
|
|
|
11426
11426
|
if (e == -1)
|
|
11427
11427
|
return !1;
|
|
11428
11428
|
let t = n.state.doc.resolve(e), r = t.nodeAfter;
|
|
11429
|
-
return r && r.isAtom &&
|
|
11429
|
+
return r && r.isAtom && w.isSelectable(r) ? (wn(n, new w(t)), !0) : !1;
|
|
11430
11430
|
}
|
|
11431
11431
|
function mg(n, e) {
|
|
11432
11432
|
if (e == -1)
|
|
11433
11433
|
return !1;
|
|
11434
11434
|
let t = n.state.selection, r, s;
|
|
11435
|
-
t instanceof
|
|
11435
|
+
t instanceof w && (r = t.node);
|
|
11436
11436
|
let o = n.state.doc.resolve(e);
|
|
11437
11437
|
for (let i = o.depth + 1; i > 0; i--) {
|
|
11438
11438
|
let l = i > o.depth ? o.nodeAfter : o.node(i);
|
|
11439
|
-
if (
|
|
11439
|
+
if (w.isSelectable(l)) {
|
|
11440
11440
|
r && t.$from.depth > 0 && i >= t.$from.depth && o.before(t.$from.depth + 1) == t.$from.pos ? s = o.before(t.$from.depth) : s = o.before(i);
|
|
11441
11441
|
break;
|
|
11442
11442
|
}
|
|
11443
11443
|
}
|
|
11444
|
-
return s != null ? (wn(n,
|
|
11444
|
+
return s != null ? (wn(n, w.create(n.state.doc, s)), !0) : !1;
|
|
11445
11445
|
}
|
|
11446
11446
|
function gg(n, e, t, r, s) {
|
|
11447
11447
|
return ri(n, "handleClickOn", e, t, r) || n.someProp("handleClick", (o) => o(n, e, r)) || (s ? mg(n, t) : pg(n, t));
|
|
@@ -11457,14 +11457,14 @@ function xg(n, e, t) {
|
|
|
11457
11457
|
return !1;
|
|
11458
11458
|
let r = n.state.doc;
|
|
11459
11459
|
if (e == -1)
|
|
11460
|
-
return r.inlineContent ? (wn(n,
|
|
11460
|
+
return r.inlineContent ? (wn(n, V.create(r, 0, r.content.size)), !0) : !1;
|
|
11461
11461
|
let s = r.resolve(e);
|
|
11462
11462
|
for (let o = s.depth + 1; o > 0; o--) {
|
|
11463
11463
|
let i = o > s.depth ? s.nodeAfter : s.node(o), l = s.before(o);
|
|
11464
11464
|
if (i.inlineContent)
|
|
11465
|
-
wn(n,
|
|
11466
|
-
else if (
|
|
11467
|
-
wn(n,
|
|
11465
|
+
wn(n, V.create(r, l + 1, l + 1 + i.content.size));
|
|
11466
|
+
else if (w.isSelectable(i))
|
|
11467
|
+
wn(n, w.create(r, l));
|
|
11468
11468
|
else
|
|
11469
11469
|
continue;
|
|
11470
11470
|
return !0;
|
|
@@ -11495,7 +11495,7 @@ class Sg {
|
|
|
11495
11495
|
const l = s ? null : r.target, a = l ? e.docView.nearestDesc(l, !0) : null;
|
|
11496
11496
|
this.target = a && a.dom.nodeType == 1 ? a.dom : null;
|
|
11497
11497
|
let { selection: c } = e.state;
|
|
11498
|
-
(r.button == 0 && o.type.spec.draggable && o.type.spec.selectable !== !1 || c instanceof
|
|
11498
|
+
(r.button == 0 && o.type.spec.draggable && o.type.spec.selectable !== !1 || c instanceof w && c.from <= i && c.to > i) && (this.mightDrag = {
|
|
11499
11499
|
node: o,
|
|
11500
11500
|
pos: i,
|
|
11501
11501
|
addAttr: !!(this.target && !this.target.draggable),
|
|
@@ -11519,7 +11519,7 @@ class Sg {
|
|
|
11519
11519
|
// (hidden) cursor is doesn't change the selection, and
|
|
11520
11520
|
// thus doesn't get a reaction from ProseMirror. This
|
|
11521
11521
|
// works around that.
|
|
11522
|
-
vt && !this.view.state.selection.visible && Math.min(Math.abs(t.pos - this.view.state.selection.from), Math.abs(t.pos - this.view.state.selection.to)) <= 2) ? (wn(this.view,
|
|
11522
|
+
vt && !this.view.state.selection.visible && Math.min(Math.abs(t.pos - this.view.state.selection.from), Math.abs(t.pos - this.view.state.selection.to)) <= 2) ? (wn(this.view, $.near(this.view.state.doc.resolve(t.pos))), e.preventDefault()) : Mt(this.view, "pointer");
|
|
11523
11523
|
}
|
|
11524
11524
|
move(e) {
|
|
11525
11525
|
this.updateAllowDefault(e), Mt(this.view, "pointer"), e.buttons == 0 && this.done();
|
|
@@ -11543,7 +11543,7 @@ De.compositionstart = De.compositionupdate = (n) => {
|
|
|
11543
11543
|
if (!n.composing) {
|
|
11544
11544
|
n.domObserver.flush();
|
|
11545
11545
|
let { state: e } = n, t = e.selection.$to;
|
|
11546
|
-
if (e.selection instanceof
|
|
11546
|
+
if (e.selection instanceof V && (e.storedMarks || !t.textOffset && t.parentOffset && t.nodeBefore.marks.some((r) => r.type.spec.inclusive === !1)))
|
|
11547
11547
|
n.markCursor = n.state.storedMarks || t.marks(), Gr(n, !0), n.markCursor = null;
|
|
11548
11548
|
else if (Gr(n, !e.selection.empty), fs && e.selection.empty && t.parentOffset && !t.textOffset && t.nodeBefore.marks.length) {
|
|
11549
11549
|
let r = n.domSelectionRange();
|
|
@@ -11619,7 +11619,7 @@ function Dg(n, e) {
|
|
|
11619
11619
|
}
|
|
11620
11620
|
function Mo(n, e, t, r, s) {
|
|
11621
11621
|
let o = Du(n, e, t, r, n.state.selection.$from);
|
|
11622
|
-
if (n.someProp("handlePaste", (a) => a(n, s, o ||
|
|
11622
|
+
if (n.someProp("handlePaste", (a) => a(n, s, o || C.empty)))
|
|
11623
11623
|
return !0;
|
|
11624
11624
|
if (!o)
|
|
11625
11625
|
return !1;
|
|
@@ -11655,12 +11655,12 @@ Le.dragstart = (n, e) => {
|
|
|
11655
11655
|
if (r && r.done(), !t.dataTransfer)
|
|
11656
11656
|
return;
|
|
11657
11657
|
let s = n.state.selection, o = s.empty ? null : n.posAtCoords(ds(t)), i;
|
|
11658
|
-
if (!(o && o.pos >= s.from && o.pos <= (s instanceof
|
|
11658
|
+
if (!(o && o.pos >= s.from && o.pos <= (s instanceof w ? s.to - 1 : s.to))) {
|
|
11659
11659
|
if (r && r.mightDrag)
|
|
11660
|
-
i =
|
|
11660
|
+
i = w.create(n.state.doc, r.mightDrag.pos);
|
|
11661
11661
|
else if (t.target && t.target.nodeType == 1) {
|
|
11662
11662
|
let f = n.docView.nearestDesc(t.target, !0);
|
|
11663
|
-
f && f.node.type.spec.draggable && f != n.docView && (i =
|
|
11663
|
+
f && f.node.type.spec.draggable && f != n.docView && (i = w.create(n.state.doc, f.posBefore));
|
|
11664
11664
|
}
|
|
11665
11665
|
}
|
|
11666
11666
|
let l = (i || n.state.selection).content(), { dom: a, text: c, slice: u } = Nu(n, l);
|
|
@@ -11685,7 +11685,7 @@ De.drop = (n, e) => {
|
|
|
11685
11685
|
i = p(i, n);
|
|
11686
11686
|
}) : i = Du(n, Vu(t.dataTransfer), er ? null : t.dataTransfer.getData("text/html"), !1, o);
|
|
11687
11687
|
let l = !!(r && $u(n, t));
|
|
11688
|
-
if (n.someProp("handleDrop", (p) => p(n, t, i ||
|
|
11688
|
+
if (n.someProp("handleDrop", (p) => p(n, t, i || C.empty, l))) {
|
|
11689
11689
|
t.preventDefault();
|
|
11690
11690
|
return;
|
|
11691
11691
|
}
|
|
@@ -11703,8 +11703,8 @@ De.drop = (n, e) => {
|
|
|
11703
11703
|
if (f ? c.replaceRangeWith(u, u, i.content.firstChild) : c.replaceRange(u, u, i), c.doc.eq(d))
|
|
11704
11704
|
return;
|
|
11705
11705
|
let h = c.doc.resolve(u);
|
|
11706
|
-
if (f &&
|
|
11707
|
-
c.setSelection(new
|
|
11706
|
+
if (f && w.isSelectable(i.content.firstChild) && h.nodeAfter && h.nodeAfter.sameMarkup(i.content.firstChild))
|
|
11707
|
+
c.setSelection(new w(h));
|
|
11708
11708
|
else {
|
|
11709
11709
|
let p = c.mapping.map(a);
|
|
11710
11710
|
c.mapping.maps[c.mapping.maps.length - 1].forEach((y, m, x, k) => p = k), c.setSelection(wu(n, h, c.doc.resolve(p)));
|
|
@@ -11889,7 +11889,7 @@ class Q {
|
|
|
11889
11889
|
you must make a copy if you want need to preserve that.
|
|
11890
11890
|
*/
|
|
11891
11891
|
static create(e, t) {
|
|
11892
|
-
return t.length ? Qr(t, e, 0, Ut) :
|
|
11892
|
+
return t.length ? Qr(t, e, 0, Ut) : he;
|
|
11893
11893
|
}
|
|
11894
11894
|
/**
|
|
11895
11895
|
Find all decorations in this set which touch the given range
|
|
@@ -11919,7 +11919,7 @@ class Q {
|
|
|
11919
11919
|
document.
|
|
11920
11920
|
*/
|
|
11921
11921
|
map(e, t, r) {
|
|
11922
|
-
return this ==
|
|
11922
|
+
return this == he || e.maps.length == 0 ? this : this.mapInner(e, t, 0, 0, r || Ut);
|
|
11923
11923
|
}
|
|
11924
11924
|
/**
|
|
11925
11925
|
@internal
|
|
@@ -11930,7 +11930,7 @@ class Q {
|
|
|
11930
11930
|
let a = this.local[l].map(e, r, s);
|
|
11931
11931
|
a && a.type.valid(t, a) ? (i || (i = [])).push(a) : o.onRemove && o.onRemove(this.local[l].spec);
|
|
11932
11932
|
}
|
|
11933
|
-
return this.children.length ? Ag(this.children, i || [], e, t, r, s, o) : i ? new Q(i.sort(Yt), mn) :
|
|
11933
|
+
return this.children.length ? Ag(this.children, i || [], e, t, r, s, o) : i ? new Q(i.sort(Yt), mn) : he;
|
|
11934
11934
|
}
|
|
11935
11935
|
/**
|
|
11936
11936
|
Add the given array of decorations to the ones in the set,
|
|
@@ -11939,7 +11939,7 @@ class Q {
|
|
|
11939
11939
|
structure.
|
|
11940
11940
|
*/
|
|
11941
11941
|
add(e, t) {
|
|
11942
|
-
return t.length ? this ==
|
|
11942
|
+
return t.length ? this == he ? Q.create(e, t) : this.addInner(e, t, 0) : this;
|
|
11943
11943
|
}
|
|
11944
11944
|
addInner(e, t, r) {
|
|
11945
11945
|
let s, o = 0;
|
|
@@ -11961,7 +11961,7 @@ class Q {
|
|
|
11961
11961
|
the ones in the given array.
|
|
11962
11962
|
*/
|
|
11963
11963
|
remove(e) {
|
|
11964
|
-
return e.length == 0 || this ==
|
|
11964
|
+
return e.length == 0 || this == he ? this : this.removeInner(e, 0);
|
|
11965
11965
|
}
|
|
11966
11966
|
removeInner(e, t) {
|
|
11967
11967
|
let r = this.children, s = this.local;
|
|
@@ -11973,7 +11973,7 @@ class Q {
|
|
|
11973
11973
|
continue;
|
|
11974
11974
|
r == this.children && (r = this.children.slice());
|
|
11975
11975
|
let c = r[o + 2].removeInner(i, l + 1);
|
|
11976
|
-
c !=
|
|
11976
|
+
c != he ? r[o + 2] = c : (r.splice(o, 3), o -= 3);
|
|
11977
11977
|
}
|
|
11978
11978
|
if (s.length) {
|
|
11979
11979
|
for (let o = 0, i; o < e.length; o++)
|
|
@@ -11981,10 +11981,10 @@ class Q {
|
|
|
11981
11981
|
for (let l = 0; l < s.length; l++)
|
|
11982
11982
|
s[l].eq(i, t) && (s == this.local && (s = this.local.slice()), s.splice(l--, 1));
|
|
11983
11983
|
}
|
|
11984
|
-
return r == this.children && s == this.local ? this : s.length || r.length ? new Q(s, r) :
|
|
11984
|
+
return r == this.children && s == this.local ? this : s.length || r.length ? new Q(s, r) : he;
|
|
11985
11985
|
}
|
|
11986
11986
|
forChild(e, t) {
|
|
11987
|
-
if (this ==
|
|
11987
|
+
if (this == he)
|
|
11988
11988
|
return this;
|
|
11989
11989
|
if (t.isLeaf)
|
|
11990
11990
|
return Q.empty;
|
|
@@ -12006,7 +12006,7 @@ class Q {
|
|
|
12006
12006
|
let l = new Q(s.sort(Yt), mn);
|
|
12007
12007
|
return r ? new Tg([l, r]) : l;
|
|
12008
12008
|
}
|
|
12009
|
-
return r ||
|
|
12009
|
+
return r || he;
|
|
12010
12010
|
}
|
|
12011
12011
|
/**
|
|
12012
12012
|
@internal
|
|
@@ -12034,7 +12034,7 @@ class Q {
|
|
|
12034
12034
|
@internal
|
|
12035
12035
|
*/
|
|
12036
12036
|
localsInner(e) {
|
|
12037
|
-
if (this ==
|
|
12037
|
+
if (this == he)
|
|
12038
12038
|
return mn;
|
|
12039
12039
|
if (e.inlineContent || !this.local.some(Et.is))
|
|
12040
12040
|
return this.local;
|
|
@@ -12049,7 +12049,7 @@ class Q {
|
|
|
12049
12049
|
}
|
|
12050
12050
|
Q.empty = new Q([], []);
|
|
12051
12051
|
Q.removeOverlap = ii;
|
|
12052
|
-
const
|
|
12052
|
+
const he = Q.empty;
|
|
12053
12053
|
let Tg = class gn {
|
|
12054
12054
|
constructor(e) {
|
|
12055
12055
|
this.members = e;
|
|
@@ -12064,7 +12064,7 @@ let Tg = class gn {
|
|
|
12064
12064
|
let r = [];
|
|
12065
12065
|
for (let s = 0; s < this.members.length; s++) {
|
|
12066
12066
|
let o = this.members[s].forChild(e, t);
|
|
12067
|
-
o !=
|
|
12067
|
+
o != he && (o instanceof gn ? r = r.concat(o.members) : r.push(o));
|
|
12068
12068
|
}
|
|
12069
12069
|
return gn.from(r);
|
|
12070
12070
|
}
|
|
@@ -12096,7 +12096,7 @@ let Tg = class gn {
|
|
|
12096
12096
|
static from(e) {
|
|
12097
12097
|
switch (e.length) {
|
|
12098
12098
|
case 0:
|
|
12099
|
-
return
|
|
12099
|
+
return he;
|
|
12100
12100
|
case 1:
|
|
12101
12101
|
return e[0];
|
|
12102
12102
|
default:
|
|
@@ -12118,8 +12118,8 @@ function Ag(n, e, t, r, s, o, i) {
|
|
|
12118
12118
|
let k = l[x + 1];
|
|
12119
12119
|
if (k < 0 || d > k + u - f)
|
|
12120
12120
|
continue;
|
|
12121
|
-
let
|
|
12122
|
-
h >=
|
|
12121
|
+
let M = l[x] + u - f;
|
|
12122
|
+
h >= M ? l[x + 1] = d <= M ? -2 : -1 : d >= u && m && (l[x] += m, l[x + 1] += m);
|
|
12123
12123
|
}
|
|
12124
12124
|
f += m;
|
|
12125
12125
|
}), u = t.maps[c].map(u, -1);
|
|
@@ -12139,7 +12139,7 @@ function Ag(n, e, t, r, s, o, i) {
|
|
|
12139
12139
|
let d = t.map(n[c + 1] + o, -1), h = d - s, { index: p, offset: y } = r.content.findIndex(f), m = r.maybeChild(p);
|
|
12140
12140
|
if (m && y == f && y + m.nodeSize == h) {
|
|
12141
12141
|
let x = l[c + 2].mapInner(t, m, u + 1, n[c] + o + 1, i);
|
|
12142
|
-
x !=
|
|
12142
|
+
x != he ? (l[c] = f, l[c + 1] = h, l[c + 2] = x) : (l[c + 1] = -2, a = !0);
|
|
12143
12143
|
} else
|
|
12144
12144
|
a = !0;
|
|
12145
12145
|
}
|
|
@@ -12201,13 +12201,13 @@ function Qr(n, e, t, r) {
|
|
|
12201
12201
|
if (c) {
|
|
12202
12202
|
o = !0;
|
|
12203
12203
|
let u = Qr(c, l, t + a + 1, r);
|
|
12204
|
-
u !=
|
|
12204
|
+
u != he && s.push(a, a + l.nodeSize, u);
|
|
12205
12205
|
}
|
|
12206
12206
|
});
|
|
12207
12207
|
let i = zu(o ? Fu(n) : n, -t).sort(Yt);
|
|
12208
12208
|
for (let l = 0; l < i.length; l++)
|
|
12209
12209
|
i[l].type.valid(e, i[l]) || (r.onRemove && r.onRemove(i[l].spec), i.splice(l--, 1));
|
|
12210
|
-
return i.length || s.length ? new Q(i, s) :
|
|
12210
|
+
return i.length || s.length ? new Q(i, s) : he;
|
|
12211
12211
|
}
|
|
12212
12212
|
function Yt(n, e) {
|
|
12213
12213
|
return n.from - e.from || n.to - e.to;
|
|
@@ -12343,27 +12343,27 @@ function Ig(n) {
|
|
|
12343
12343
|
for (; s < r.length && r[s] != 0; ) s++;
|
|
12344
12344
|
if (p == f.childCount) break;
|
|
12345
12345
|
const y = f.child(p), { colspan: m, rowspan: x, colwidth: k } = y.attrs;
|
|
12346
|
-
for (let
|
|
12347
|
-
if (
|
|
12346
|
+
for (let M = 0; M < x; M++) {
|
|
12347
|
+
if (M + c >= t) {
|
|
12348
12348
|
(o || (o = [])).push({
|
|
12349
12349
|
type: "overlong_rowspan",
|
|
12350
12350
|
pos: u,
|
|
12351
|
-
n: x -
|
|
12351
|
+
n: x - M
|
|
12352
12352
|
});
|
|
12353
12353
|
break;
|
|
12354
12354
|
}
|
|
12355
|
-
const
|
|
12356
|
-
for (let
|
|
12357
|
-
r[
|
|
12355
|
+
const v = s + M * e;
|
|
12356
|
+
for (let P = 0; P < m; P++) {
|
|
12357
|
+
r[v + P] == 0 ? r[v + P] = u : (o || (o = [])).push({
|
|
12358
12358
|
type: "collision",
|
|
12359
12359
|
row: c,
|
|
12360
12360
|
pos: u,
|
|
12361
|
-
n: m -
|
|
12361
|
+
n: m - P
|
|
12362
12362
|
});
|
|
12363
|
-
const
|
|
12364
|
-
if (
|
|
12365
|
-
const
|
|
12366
|
-
|
|
12363
|
+
const D = k && k[P];
|
|
12364
|
+
if (D) {
|
|
12365
|
+
const B = (v + P) % e * 2, z = i[B];
|
|
12366
|
+
z == null || z != D && i[B + 1] == 1 ? (i[B] = D, i[B + 1] = 1) : z == D && i[B + 1]++;
|
|
12367
12367
|
}
|
|
12368
12368
|
}
|
|
12369
12369
|
}
|
|
@@ -12604,7 +12604,7 @@ function Lg(n, e, t) {
|
|
|
12604
12604
|
return !1;
|
|
12605
12605
|
return !0;
|
|
12606
12606
|
}
|
|
12607
|
-
var H = class nt extends
|
|
12607
|
+
var H = class nt extends $ {
|
|
12608
12608
|
// A table selection is identified by its anchor and head cells. The
|
|
12609
12609
|
// positions given to this constructor should point _before_ two
|
|
12610
12610
|
// cells in the same table. They may be the same, to select a single
|
|
@@ -12633,7 +12633,7 @@ var H = class nt extends V {
|
|
|
12633
12633
|
const o = this.$anchorCell.node(-1) != r.node(-1);
|
|
12634
12634
|
return o && this.isRowSelection() ? nt.rowSelection(r, s) : o && this.isColSelection() ? nt.colSelection(r, s) : new nt(r, s);
|
|
12635
12635
|
}
|
|
12636
|
-
return
|
|
12636
|
+
return V.between(r, s);
|
|
12637
12637
|
}
|
|
12638
12638
|
// Returns a rectangular slice of table rows containing the selected
|
|
12639
12639
|
// cells.
|
|
@@ -12679,26 +12679,26 @@ var H = class nt extends V {
|
|
|
12679
12679
|
i.push(e.child(a).copy(S.from(c)));
|
|
12680
12680
|
}
|
|
12681
12681
|
const l = this.isColSelection() && this.isRowSelection() ? e : i;
|
|
12682
|
-
return new
|
|
12682
|
+
return new C(S.from(l), 1, 1);
|
|
12683
12683
|
}
|
|
12684
|
-
replace(e, t =
|
|
12684
|
+
replace(e, t = C.empty) {
|
|
12685
12685
|
const r = e.steps.length, s = this.ranges;
|
|
12686
12686
|
for (let i = 0; i < s.length; i++) {
|
|
12687
12687
|
const { $from: l, $to: a } = s[i], c = e.mapping.slice(r);
|
|
12688
12688
|
e.replace(
|
|
12689
12689
|
c.map(l.pos),
|
|
12690
12690
|
c.map(a.pos),
|
|
12691
|
-
i ?
|
|
12691
|
+
i ? C.empty : t
|
|
12692
12692
|
);
|
|
12693
12693
|
}
|
|
12694
|
-
const o =
|
|
12694
|
+
const o = $.findFrom(
|
|
12695
12695
|
e.doc.resolve(e.mapping.slice(r).map(this.to)),
|
|
12696
12696
|
-1
|
|
12697
12697
|
);
|
|
12698
12698
|
o && e.setSelection(o);
|
|
12699
12699
|
}
|
|
12700
12700
|
replaceWith(e, t) {
|
|
12701
|
-
this.replace(e, new
|
|
12701
|
+
this.replace(e, new C(S.from(t), 0, 0));
|
|
12702
12702
|
}
|
|
12703
12703
|
forEachCell(e) {
|
|
12704
12704
|
const t = this.$anchorCell.node(-1), r = re.get(t), s = this.$anchorCell.start(-1), o = r.cellsInRect(
|
|
@@ -12769,7 +12769,7 @@ var H = class nt extends V {
|
|
|
12769
12769
|
}
|
|
12770
12770
|
};
|
|
12771
12771
|
H.prototype.visible = !1;
|
|
12772
|
-
|
|
12772
|
+
$.jsonID("cell", H);
|
|
12773
12773
|
var Wg = class Wu {
|
|
12774
12774
|
constructor(e, t) {
|
|
12775
12775
|
this.anchor = e, this.head = t;
|
|
@@ -12779,7 +12779,7 @@ var Wg = class Wu {
|
|
|
12779
12779
|
}
|
|
12780
12780
|
resolve(e) {
|
|
12781
12781
|
const t = e.resolve(this.anchor), r = e.resolve(this.head);
|
|
12782
|
-
return t.parent.type.spec.tableRole == "row" && r.parent.type.spec.tableRole == "row" && t.index() < t.parent.childCount && r.index() < r.parent.childCount && li(t, r) ? new H(t, r) :
|
|
12782
|
+
return t.parent.type.spec.tableRole == "row" && r.parent.type.spec.tableRole == "row" && t.index() < t.parent.childCount && r.index() < r.parent.childCount && li(t, r) ? new H(t, r) : $.near(r, 1);
|
|
12783
12783
|
}
|
|
12784
12784
|
};
|
|
12785
12785
|
function _g(n) {
|
|
@@ -12821,7 +12821,7 @@ function Hg({ $from: n, $to: e }) {
|
|
|
12821
12821
|
function Jg(n, e, t) {
|
|
12822
12822
|
const r = (e || n).selection, s = (e || n).doc;
|
|
12823
12823
|
let o, i;
|
|
12824
|
-
if (r instanceof
|
|
12824
|
+
if (r instanceof w && (i = r.node.type.spec.tableRole)) {
|
|
12825
12825
|
if (i == "cell" || i == "header_cell")
|
|
12826
12826
|
o = H.create(s, r.from);
|
|
12827
12827
|
else if (i == "row") {
|
|
@@ -12831,7 +12831,7 @@ function Jg(n, e, t) {
|
|
|
12831
12831
|
const l = re.get(r.node), a = r.from + 1, c = a + l.map[l.width * l.height - 1];
|
|
12832
12832
|
o = H.create(s, a + 1, c);
|
|
12833
12833
|
}
|
|
12834
|
-
} else r instanceof
|
|
12834
|
+
} else r instanceof V && qg(r) ? o = V.create(s, r.from) : r instanceof V && Hg(r) && (o = V.create(s, r.$from.start(), r.$from.end()));
|
|
12835
12835
|
return o && (e || (e = n.tr)).setSelection(o), e;
|
|
12836
12836
|
}
|
|
12837
12837
|
var Kg = new At("fix-tables");
|
|
@@ -13316,7 +13316,7 @@ function sa(n) {
|
|
|
13316
13316
|
if (t) {
|
|
13317
13317
|
const s = e.doc.resolve(r);
|
|
13318
13318
|
t(
|
|
13319
|
-
e.tr.setSelection(
|
|
13319
|
+
e.tr.setSelection(V.between(s, Bg(s))).scrollIntoView()
|
|
13320
13320
|
);
|
|
13321
13321
|
}
|
|
13322
13322
|
return !0;
|
|
@@ -13340,7 +13340,7 @@ function Sr(n, e) {
|
|
|
13340
13340
|
o.content.eq(s) || r.replace(
|
|
13341
13341
|
r.mapping.map(i + 1),
|
|
13342
13342
|
r.mapping.map(i + o.nodeSize - 1),
|
|
13343
|
-
new
|
|
13343
|
+
new C(s, 0, 0)
|
|
13344
13344
|
);
|
|
13345
13345
|
}), r.docChanged && e(r);
|
|
13346
13346
|
}
|
|
@@ -13358,14 +13358,14 @@ function py(n) {
|
|
|
13358
13358
|
const u = a ? 0 : Math.max(0, t - 1), f = a < e.childCount - 1 ? 0 : Math.max(0, r - 1);
|
|
13359
13359
|
(u || f) && (c = Oo(
|
|
13360
13360
|
be(i).row,
|
|
13361
|
-
new
|
|
13361
|
+
new C(c, u, f)
|
|
13362
13362
|
).content), l.push(c);
|
|
13363
13363
|
}
|
|
13364
13364
|
else if (o == "cell" || o == "header_cell")
|
|
13365
13365
|
l.push(
|
|
13366
13366
|
t || r ? Oo(
|
|
13367
13367
|
be(i).row,
|
|
13368
|
-
new
|
|
13368
|
+
new C(e, t, r)
|
|
13369
13369
|
).content : e
|
|
13370
13370
|
);
|
|
13371
13371
|
else
|
|
@@ -13532,7 +13532,7 @@ function la(n, e, t, r, s) {
|
|
|
13532
13532
|
f.replace(
|
|
13533
13533
|
f.mapping.slice(d).map(y + t),
|
|
13534
13534
|
f.mapping.slice(d).map(m + t),
|
|
13535
|
-
new
|
|
13535
|
+
new C(s.rows[p - l], 0, 0)
|
|
13536
13536
|
);
|
|
13537
13537
|
}
|
|
13538
13538
|
h(), f.setSelection(
|
|
@@ -13567,7 +13567,7 @@ function kr(n, e) {
|
|
|
13567
13567
|
return Ar(
|
|
13568
13568
|
t,
|
|
13569
13569
|
r,
|
|
13570
|
-
|
|
13570
|
+
$.near(o.$headCell, e)
|
|
13571
13571
|
);
|
|
13572
13572
|
if (n != "horiz" && !o.empty) return !1;
|
|
13573
13573
|
const i = Ju(s, n, e);
|
|
@@ -13576,12 +13576,12 @@ function kr(n, e) {
|
|
|
13576
13576
|
return Ar(
|
|
13577
13577
|
t,
|
|
13578
13578
|
r,
|
|
13579
|
-
|
|
13579
|
+
$.near(t.doc.resolve(o.head + e), e)
|
|
13580
13580
|
);
|
|
13581
13581
|
{
|
|
13582
13582
|
const l = t.doc.resolve(i), a = Bu(l, n, e);
|
|
13583
13583
|
let c;
|
|
13584
|
-
return a ? c =
|
|
13584
|
+
return a ? c = $.near(a, 1) : e < 0 ? c = $.near(t.doc.resolve(l.before(-1)), -1) : c = $.near(t.doc.resolve(l.after(-1)), 1), Ar(t, r, c);
|
|
13585
13585
|
}
|
|
13586
13586
|
};
|
|
13587
13587
|
}
|
|
@@ -13678,7 +13678,7 @@ function ky(n, e) {
|
|
|
13678
13678
|
n.root.addEventListener("mouseup", i), n.root.addEventListener("dragstart", i), n.root.addEventListener("mousemove", l);
|
|
13679
13679
|
}
|
|
13680
13680
|
function Ju(n, e, t) {
|
|
13681
|
-
if (!(n.state.selection instanceof
|
|
13681
|
+
if (!(n.state.selection instanceof V)) return null;
|
|
13682
13682
|
const { $head: r } = n.state.selection;
|
|
13683
13683
|
for (let s = r.depth - 1; s >= 0; s--) {
|
|
13684
13684
|
const o = r.node(s);
|
|
@@ -13777,7 +13777,7 @@ function My(n) {
|
|
|
13777
13777
|
const Ny = [], Dy = {}, Eo = U.empty;
|
|
13778
13778
|
let ca = class yn {
|
|
13779
13779
|
constructor(e) {
|
|
13780
|
-
|
|
13780
|
+
F(this, "members");
|
|
13781
13781
|
this.members = e;
|
|
13782
13782
|
}
|
|
13783
13783
|
map(e, t) {
|
|
@@ -13953,13 +13953,13 @@ function ft(n, e) {
|
|
|
13953
13953
|
}
|
|
13954
13954
|
const vy = /* @__PURE__ */ Ge(function(e, t) {
|
|
13955
13955
|
let { widget: r, getPos: s, ...o } = e;
|
|
13956
|
-
const [i, l] = N(!0), a =
|
|
13956
|
+
const [i, l] = N(!0), a = I(null);
|
|
13957
13957
|
return ns(t, () => a.current, []), ft((c) => {
|
|
13958
13958
|
if (!c || !a.current) return;
|
|
13959
13959
|
c.domObserver.disconnectSelection();
|
|
13960
13960
|
const u = c.domSelection(), f = document.createRange(), d = a.current;
|
|
13961
13961
|
d.nodeName == "IMG" && d.parentNode ? f.setEnd(d.parentNode, ui(d) + 1) : f.setEnd(d, 0), f.collapse(!1), u.removeAllRanges(), u.addRange(f), l(!1), c.domObserver.connectSelection();
|
|
13962
|
-
}, []), i ? /* @__PURE__ */
|
|
13962
|
+
}, []), i ? /* @__PURE__ */ A.createElement("img", {
|
|
13963
13963
|
ref: a,
|
|
13964
13964
|
className: "ProseMirror-separator",
|
|
13965
13965
|
// eslint-disable-next-line react/no-unknown-property
|
|
@@ -13979,9 +13979,9 @@ const $y = {
|
|
|
13979
13979
|
};
|
|
13980
13980
|
class nr {
|
|
13981
13981
|
constructor(e, t) {
|
|
13982
|
-
|
|
13983
|
-
|
|
13984
|
-
|
|
13982
|
+
F(this, "Component");
|
|
13983
|
+
F(this, "side");
|
|
13984
|
+
F(this, "spec");
|
|
13985
13985
|
this.Component = e, this.spec = t ?? $y, this.side = this.spec.side ?? 0;
|
|
13986
13986
|
}
|
|
13987
13987
|
map(e, t, r, s) {
|
|
@@ -14133,7 +14133,7 @@ function qy(n) {
|
|
|
14133
14133
|
}
|
|
14134
14134
|
}
|
|
14135
14135
|
function Hy(n, e, t, r) {
|
|
14136
|
-
return n.someProp("createSelectionBetween", (s) => s(n, e, t)) ||
|
|
14136
|
+
return n.someProp("createSelectionBetween", (s) => s(n, e, t)) || V.between(e, t, r);
|
|
14137
14137
|
}
|
|
14138
14138
|
function ma(n) {
|
|
14139
14139
|
let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
|
|
@@ -14147,9 +14147,9 @@ function ma(n) {
|
|
|
14147
14147
|
if (Gu(t)) {
|
|
14148
14148
|
for (a = i; s && !s.node; ) s = s.parent;
|
|
14149
14149
|
const f = s.node;
|
|
14150
|
-
if (s && f.isAtom &&
|
|
14150
|
+
if (s && f.isAtom && w.isSelectable(f) && s.parent && !(f.isInline && Ry(t.focusNode, t.focusOffset, s.dom))) {
|
|
14151
14151
|
const d = s.posBefore;
|
|
14152
|
-
c = new
|
|
14152
|
+
c = new w(i == d ? l : r.resolve(d));
|
|
14153
14153
|
}
|
|
14154
14154
|
} else {
|
|
14155
14155
|
if (
|
|
@@ -14226,7 +14226,7 @@ function ya(n) {
|
|
|
14226
14226
|
}
|
|
14227
14227
|
function Uy(n, e) {
|
|
14228
14228
|
const t = n;
|
|
14229
|
-
if (e instanceof
|
|
14229
|
+
if (e instanceof w) {
|
|
14230
14230
|
const r = t.docView.descAt(e.from);
|
|
14231
14231
|
r != t.lastSelectedViewDesc && (ba(t), r && r.selectNode(), t.lastSelectedViewDesc = r);
|
|
14232
14232
|
} else
|
|
@@ -14298,17 +14298,17 @@ function Mr(n) {
|
|
|
14298
14298
|
else {
|
|
14299
14299
|
const { anchor: s, head: o } = r;
|
|
14300
14300
|
let i, l;
|
|
14301
|
-
ka && !(r instanceof
|
|
14301
|
+
ka && !(r instanceof V) && (r.$from.parent.inlineContent || (i = xa(t, r.from)), !r.empty && !r.$from.parent.inlineContent && (l = xa(t, r.to))), t.docView.setSelection(s, o, t, e), ka && (i && Sa(i), l && Sa(l)), r.visible ? t.dom.classList.remove("ProseMirror-hideselection") : (t.dom.classList.add("ProseMirror-hideselection"), "onselectionchange" in document && Xy(t));
|
|
14302
14302
|
}
|
|
14303
14303
|
t.domObserver.setCurSelection(), t.domObserver.connectSelection();
|
|
14304
14304
|
}
|
|
14305
14305
|
}
|
|
14306
14306
|
let Qy = class {
|
|
14307
14307
|
constructor() {
|
|
14308
|
-
|
|
14309
|
-
|
|
14310
|
-
|
|
14311
|
-
|
|
14308
|
+
F(this, "anchorNode", null);
|
|
14309
|
+
F(this, "anchorOffset", 0);
|
|
14310
|
+
F(this, "focusNode", null);
|
|
14311
|
+
F(this, "focusOffset", 0);
|
|
14312
14312
|
}
|
|
14313
14313
|
set(e) {
|
|
14314
14314
|
this.anchorNode = e.anchorNode, this.anchorOffset = e.anchorOffset, this.focusNode = e.focusNode, this.focusOffset = e.focusOffset;
|
|
@@ -14322,10 +14322,10 @@ let Qy = class {
|
|
|
14322
14322
|
};
|
|
14323
14323
|
class Zy {
|
|
14324
14324
|
constructor(e) {
|
|
14325
|
-
|
|
14326
|
-
|
|
14327
|
-
|
|
14328
|
-
|
|
14325
|
+
F(this, "view");
|
|
14326
|
+
F(this, "flushingSoon");
|
|
14327
|
+
F(this, "currentSelection");
|
|
14328
|
+
F(this, "suppressingSelectionUpdates");
|
|
14329
14329
|
this.view = e, this.flushingSoon = -1, this.currentSelection = new Qy(), this.suppressingSelectionUpdates = !1, this.view = e, this.onSelectionChange = this.onSelectionChange.bind(this);
|
|
14330
14330
|
}
|
|
14331
14331
|
connectSelection() {
|
|
@@ -14398,7 +14398,7 @@ class Zy {
|
|
|
14398
14398
|
let s = null;
|
|
14399
14399
|
r && // @ts-expect-error Internal property (input)
|
|
14400
14400
|
e.input.lastFocus > Date.now() - 200 && // @ts-expect-error Internal property (input)
|
|
14401
|
-
Math.max(e.input.lastTouch, e.input.lastClick.time) < Date.now() - 300 && Gu(t) && (s = ma(e)) && s.eq(
|
|
14401
|
+
Math.max(e.input.lastTouch, e.input.lastClick.time) < Date.now() - 300 && Gu(t) && (s = ma(e)) && s.eq($.near(e.state.doc.resolve(0), 1)) ? (e.input.lastFocus = 0, Mr(e), this.currentSelection.set(t), e.scrollToSelection()) : r && (this.updateSelection(), this.currentSelection.eq(t) || Mr(e), this.currentSelection.set(t));
|
|
14402
14402
|
}
|
|
14403
14403
|
forceFlush() {
|
|
14404
14404
|
this.flushingSoon > -1 && (window.clearTimeout(this.flushingSoon), this.flushingSoon = -1, this.flush());
|
|
@@ -14427,8 +14427,8 @@ let eb = class {
|
|
|
14427
14427
|
}
|
|
14428
14428
|
}, Ca = class Rr {
|
|
14429
14429
|
constructor() {
|
|
14430
|
-
|
|
14431
|
-
|
|
14430
|
+
F(this, "nodeName", "div");
|
|
14431
|
+
F(this, "style", {});
|
|
14432
14432
|
}
|
|
14433
14433
|
get parent() {
|
|
14434
14434
|
return new Rr();
|
|
@@ -14486,13 +14486,13 @@ function sn(n, e) {
|
|
|
14486
14486
|
const On = 0, wa = 1, Nr = 2, rr = 3;
|
|
14487
14487
|
class pr {
|
|
14488
14488
|
constructor(e, t, r, s, o) {
|
|
14489
|
-
|
|
14490
|
-
|
|
14491
|
-
|
|
14492
|
-
|
|
14493
|
-
|
|
14494
|
-
|
|
14495
|
-
|
|
14489
|
+
F(this, "parent");
|
|
14490
|
+
F(this, "children");
|
|
14491
|
+
F(this, "getPos");
|
|
14492
|
+
F(this, "dom");
|
|
14493
|
+
F(this, "contentDOM");
|
|
14494
|
+
F(this, "dirty");
|
|
14495
|
+
F(this, "node");
|
|
14496
14496
|
this.parent = e, this.children = t, this.getPos = r, this.dom = s, this.contentDOM = o, this.dirty = On, s.pmViewDesc = this;
|
|
14497
14497
|
}
|
|
14498
14498
|
// Used to check whether a given description corresponds to a
|
|
@@ -14833,7 +14833,7 @@ class pr {
|
|
|
14833
14833
|
class fi extends pr {
|
|
14834
14834
|
constructor(t, r, s, o) {
|
|
14835
14835
|
super(t, [], r, o, null);
|
|
14836
|
-
|
|
14836
|
+
F(this, "widget");
|
|
14837
14837
|
this.widget = s, this.widget = s;
|
|
14838
14838
|
}
|
|
14839
14839
|
matchesWidget(t) {
|
|
@@ -14861,8 +14861,8 @@ class fi extends pr {
|
|
|
14861
14861
|
class ts extends pr {
|
|
14862
14862
|
constructor(t, r, s, o, i) {
|
|
14863
14863
|
super(t, [], r, s, null);
|
|
14864
|
-
|
|
14865
|
-
|
|
14864
|
+
F(this, "textDOM");
|
|
14865
|
+
F(this, "text");
|
|
14866
14866
|
this.textDOM = o, this.text = i;
|
|
14867
14867
|
}
|
|
14868
14868
|
get size() {
|
|
@@ -14884,8 +14884,8 @@ class ts extends pr {
|
|
|
14884
14884
|
class tb extends pr {
|
|
14885
14885
|
constructor(t, r, s, o, i, l, a) {
|
|
14886
14886
|
super(t, r, s, i, l);
|
|
14887
|
-
|
|
14888
|
-
|
|
14887
|
+
F(this, "mark");
|
|
14888
|
+
F(this, "spec");
|
|
14889
14889
|
this.mark = o, this.spec = a;
|
|
14890
14890
|
}
|
|
14891
14891
|
parseRule() {
|
|
@@ -14915,14 +14915,14 @@ class tb extends pr {
|
|
|
14915
14915
|
class di extends pr {
|
|
14916
14916
|
constructor(t, r, s, o, i, l, a, c, u, f, d, h, p) {
|
|
14917
14917
|
super(t, r, s, a, c);
|
|
14918
|
-
|
|
14919
|
-
|
|
14920
|
-
|
|
14921
|
-
|
|
14922
|
-
|
|
14923
|
-
|
|
14924
|
-
|
|
14925
|
-
|
|
14918
|
+
F(this, "node");
|
|
14919
|
+
F(this, "outerDeco");
|
|
14920
|
+
F(this, "innerDeco");
|
|
14921
|
+
F(this, "nodeDOM");
|
|
14922
|
+
F(this, "stopEvent");
|
|
14923
|
+
F(this, "selectNode");
|
|
14924
|
+
F(this, "deselectNode");
|
|
14925
|
+
F(this, "ignoreMutation");
|
|
14926
14926
|
this.node = o, this.outerDeco = i, this.innerDeco = l, this.nodeDOM = u, this.stopEvent = f, this.selectNode = d, this.deselectNode = h, this.ignoreMutation = p;
|
|
14927
14927
|
}
|
|
14928
14928
|
updateOuterDeco() {
|
|
@@ -15104,9 +15104,9 @@ class Na extends Zp {
|
|
|
15104
15104
|
}),
|
|
15105
15105
|
plugins: r.plugins
|
|
15106
15106
|
});
|
|
15107
|
-
|
|
15108
|
-
|
|
15109
|
-
|
|
15107
|
+
F(this, "shouldUpdatePluginViews", !1);
|
|
15108
|
+
F(this, "oldProps");
|
|
15109
|
+
F(this, "_props");
|
|
15110
15110
|
s(), this.shouldUpdatePluginViews = !0, this._props = r, this.oldProps = {
|
|
15111
15111
|
state: r.state
|
|
15112
15112
|
}, this.state = r.state, this.domObserver.stop(), this.domObserver = new Zy(this), this.domObserver.start(), this.editable = Ma(this), this.docView.dom.replaceChildren(), this.docView = r.docView;
|
|
@@ -15179,9 +15179,9 @@ const cb = new is({
|
|
|
15179
15179
|
let Da = !1;
|
|
15180
15180
|
function fb(n, e) {
|
|
15181
15181
|
process.env.NODE_ENV !== "production" && e.defaultState !== void 0 && e.state !== void 0 && !Da && (console.error("A component contains a ProseMirror editor with both value and defaultValue props. ProseMirror editors must be either controlled or uncontrolled (specify either the state prop, or the defaultState prop, but not both). Decide between using a controlled or uncontrolled ProseMirror editor and remove one of these props. More info: https://reactjs.org/link/controlled-components"), Da = !0);
|
|
15182
|
-
const t =
|
|
15182
|
+
const t = I(!0), [r, s] = N(null), o = hi(), i = e.defaultState ?? ub, [l, a] = N(i), c = e.state ?? l, { componentEventListenersPlugin: u, registerEventListener: f, unregisterEventListener: d } = ob(), h = He((B) => {
|
|
15183
15183
|
Ri(() => {
|
|
15184
|
-
s(
|
|
15184
|
+
s(B);
|
|
15185
15185
|
});
|
|
15186
15186
|
}, []), p = Me(() => [
|
|
15187
15187
|
...e.plugins ?? [],
|
|
@@ -15191,60 +15191,60 @@ function fb(n, e) {
|
|
|
15191
15191
|
e.plugins,
|
|
15192
15192
|
u,
|
|
15193
15193
|
h
|
|
15194
|
-
]), y = He(function(
|
|
15194
|
+
]), y = He(function(z) {
|
|
15195
15195
|
t.current ? Ri(() => {
|
|
15196
|
-
e.state || a((
|
|
15197
|
-
}) : (e.state || a((
|
|
15196
|
+
e.state || a((R) => R.apply(z)), e.dispatchTransaction && e.dispatchTransaction.call(this, z);
|
|
15197
|
+
}) : (e.state || a((R) => R.apply(z)), e.dispatchTransaction && e.dispatchTransaction.call(this, z));
|
|
15198
15198
|
}, [
|
|
15199
15199
|
e.dispatchTransaction,
|
|
15200
15200
|
e.state
|
|
15201
15201
|
]), m = rf(), x = document.createElement("div");
|
|
15202
15202
|
m();
|
|
15203
|
-
const k =
|
|
15203
|
+
const k = I(new di(void 0, [], () => -1, c.doc, [], U.empty, x, null, x, () => !1, () => {
|
|
15204
15204
|
}, () => {
|
|
15205
|
-
}, () => !1)),
|
|
15205
|
+
}, () => !1)), M = {
|
|
15206
15206
|
...e,
|
|
15207
15207
|
state: c,
|
|
15208
15208
|
plugins: p,
|
|
15209
15209
|
dispatchTransaction: y,
|
|
15210
15210
|
docView: k.current
|
|
15211
|
-
}, [
|
|
15211
|
+
}, [v, P] = N(
|
|
15212
15212
|
// During the initial render, we create something of a dummy
|
|
15213
15213
|
// EditorView. This allows us to ensure that the first render actually
|
|
15214
15214
|
// renders the document, which is necessary for SSR.
|
|
15215
|
-
() => new Na(null,
|
|
15215
|
+
() => new Na(null, M)
|
|
15216
15216
|
);
|
|
15217
15217
|
return X(() => () => {
|
|
15218
|
-
|
|
15218
|
+
v == null || v.destroy();
|
|
15219
15219
|
}, [
|
|
15220
|
-
|
|
15220
|
+
v
|
|
15221
15221
|
]), X(() => {
|
|
15222
15222
|
if (!n) {
|
|
15223
|
-
|
|
15223
|
+
P(null);
|
|
15224
15224
|
return;
|
|
15225
15225
|
}
|
|
15226
|
-
if (!
|
|
15227
|
-
const
|
|
15226
|
+
if (!v || v.dom !== n) {
|
|
15227
|
+
const B = new Na({
|
|
15228
15228
|
mount: n
|
|
15229
|
-
},
|
|
15230
|
-
|
|
15229
|
+
}, M);
|
|
15230
|
+
P(B), B.dom.addEventListener("compositionend", o);
|
|
15231
15231
|
return;
|
|
15232
15232
|
}
|
|
15233
|
-
if (
|
|
15234
|
-
|
|
15233
|
+
if (v.needsRedraw) {
|
|
15234
|
+
P(null);
|
|
15235
15235
|
return;
|
|
15236
15236
|
}
|
|
15237
|
-
|
|
15238
|
-
}),
|
|
15237
|
+
v == null || v.domObserver.selectionToDOM(), v == null || v.runPendingEffects();
|
|
15238
|
+
}), v == null || v.pureSetProps(M), {
|
|
15239
15239
|
editor: Me(() => ({
|
|
15240
|
-
view:
|
|
15240
|
+
view: v,
|
|
15241
15241
|
registerEventListener: f,
|
|
15242
15242
|
unregisterEventListener: d,
|
|
15243
15243
|
cursorWrapper: r,
|
|
15244
15244
|
docViewDescRef: k,
|
|
15245
15245
|
flushSyncRef: t
|
|
15246
15246
|
}), [
|
|
15247
|
-
|
|
15247
|
+
v,
|
|
15248
15248
|
f,
|
|
15249
15249
|
d,
|
|
15250
15250
|
r
|
|
@@ -15254,7 +15254,7 @@ function fb(n, e) {
|
|
|
15254
15254
|
}
|
|
15255
15255
|
function db(n) {
|
|
15256
15256
|
let { children: e } = n;
|
|
15257
|
-
const t =
|
|
15257
|
+
const t = I(/* @__PURE__ */ new Set()).current, r = I(/* @__PURE__ */ new Set()).current, s = I(!1), o = hi(), i = I(!0), l = He(() => {
|
|
15258
15258
|
i.current || (o(), i.current = !0);
|
|
15259
15259
|
}, [
|
|
15260
15260
|
o
|
|
@@ -15275,7 +15275,7 @@ function db(n) {
|
|
|
15275
15275
|
r.forEach((c) => c()), r.clear();
|
|
15276
15276
|
})), X(() => (s.current = !0, () => {
|
|
15277
15277
|
s.current = !1;
|
|
15278
|
-
}), []), /* @__PURE__ */
|
|
15278
|
+
}), []), /* @__PURE__ */ A.createElement(Xu.Provider, {
|
|
15279
15279
|
value: a
|
|
15280
15280
|
}, e);
|
|
15281
15281
|
}
|
|
@@ -15288,53 +15288,53 @@ const Oe = ct({
|
|
|
15288
15288
|
}
|
|
15289
15289
|
});
|
|
15290
15290
|
function pi(n, e, t, r, s, o, i, l) {
|
|
15291
|
-
const { view: a } = oe(Vt), [c, u] = N(!0), f =
|
|
15292
|
-
d.current =
|
|
15293
|
-
}, []), p =
|
|
15294
|
-
p.current =
|
|
15295
|
-
}, []), m =
|
|
15291
|
+
const { view: a } = oe(Vt), [c, u] = N(!0), f = I(i), d = I(() => !1), h = He((D) => {
|
|
15292
|
+
d.current = D;
|
|
15293
|
+
}, []), p = I(() => !1), y = He((D) => {
|
|
15294
|
+
p.current = D;
|
|
15295
|
+
}, []), m = I(() => {
|
|
15296
15296
|
!r.current || !n || (r.current.nodeType == 1 && r.current.classList.add("ProseMirror-selectednode"), (l != null && l.current || !n.type.spec.draggable) && (((t == null ? void 0 : t.current) ?? r.current).draggable = !0));
|
|
15297
|
-
}), x =
|
|
15297
|
+
}), x = I(() => {
|
|
15298
15298
|
!r.current || !n || r.current.nodeType == 1 && (r.current.classList.remove("ProseMirror-selectednode"), (l != null && l.current || !n.type.spec.draggable) && ((t == null ? void 0 : t.current) ?? r.current).removeAttribute("draggable"));
|
|
15299
|
-
}), k = He((
|
|
15300
|
-
m.current =
|
|
15301
|
-
}, []), { siblingsRef:
|
|
15299
|
+
}), k = He((D, B) => {
|
|
15300
|
+
m.current = D, x.current = B;
|
|
15301
|
+
}, []), { siblingsRef: M, parentRef: v } = oe(Oe), P = I([]);
|
|
15302
15302
|
return X(() => {
|
|
15303
|
-
const
|
|
15303
|
+
const D = M.current;
|
|
15304
15304
|
return () => {
|
|
15305
|
-
if (f.current &&
|
|
15306
|
-
const
|
|
15307
|
-
|
|
15305
|
+
if (f.current && D.includes(f.current)) {
|
|
15306
|
+
const B = D.indexOf(f.current);
|
|
15307
|
+
D.splice(B, 1);
|
|
15308
15308
|
}
|
|
15309
15309
|
};
|
|
15310
15310
|
}, [
|
|
15311
|
-
|
|
15311
|
+
M
|
|
15312
15312
|
]), X(() => {
|
|
15313
|
-
var
|
|
15313
|
+
var B;
|
|
15314
15314
|
if (!n || !r.current) return;
|
|
15315
|
-
const
|
|
15316
|
-
f.current ? (f.current.parent =
|
|
15315
|
+
const D = P.current[0];
|
|
15316
|
+
f.current ? (f.current.parent = v.current, f.current.children = P.current, f.current.node = n, f.current.getPos = e, f.current.outerDeco = o, f.current.innerDeco = s, f.current.dom = (t == null ? void 0 : t.current) ?? r.current, f.current.dom.pmViewDesc = f.current, f.current.contentDOM = // If there's already a contentDOM, we can just
|
|
15317
15317
|
// keep it; it won't have changed. This is especially
|
|
15318
15318
|
// important during compositions, where the
|
|
15319
15319
|
// firstChildDesc might not have a correct dom node set yet.
|
|
15320
|
-
(l == null ? void 0 : l.current) ?? f.current.contentDOM ?? (
|
|
15321
|
-
for (const
|
|
15322
|
-
if (
|
|
15323
|
-
const
|
|
15324
|
-
if (!
|
|
15325
|
-
let _ =
|
|
15320
|
+
(l == null ? void 0 : l.current) ?? f.current.contentDOM ?? (D == null ? void 0 : D.dom.parentElement) ?? null, f.current.nodeDOM = r.current) : f.current = new di(v.current, P.current, e, n, o, s, (t == null ? void 0 : t.current) ?? r.current, (D == null ? void 0 : D.dom.parentElement) ?? null, r.current, (z) => !!d.current(z), () => m.current(), () => x.current(), (z) => p.current(z)), u(f.current.contentDOM !== null), M.current.includes(f.current) || M.current.push(f.current), M.current.sort(sn);
|
|
15321
|
+
for (const z of P.current)
|
|
15322
|
+
if (z.parent = f.current, z instanceof ts) {
|
|
15323
|
+
const R = (B = f.current.contentDOM) == null ? void 0 : B.firstChild;
|
|
15324
|
+
if (!R) throw new Error("Started a composition but couldn't find the text node it belongs to.");
|
|
15325
|
+
let _ = R;
|
|
15326
15326
|
for (; _.firstChild; )
|
|
15327
15327
|
_ = _.firstChild;
|
|
15328
15328
|
if (!_ || !(_ instanceof Text)) throw new Error("Started a composition but couldn't find the text node it belongs to.");
|
|
15329
|
-
|
|
15329
|
+
z.dom = R, z.textDOM = _, z.text = _.data, z.textDOM.pmViewDesc = z, a == null || a.input.compositionNodes.push(z);
|
|
15330
15330
|
}
|
|
15331
15331
|
return () => {
|
|
15332
|
-
var
|
|
15333
|
-
((
|
|
15332
|
+
var z, R, _, ke;
|
|
15333
|
+
((z = f.current) == null ? void 0 : z.children[0]) instanceof ts && !(a != null && a.composing) && ((ke = (R = f.current) == null ? void 0 : R.children[0].dom.parentNode) == null || ke.removeChild((_ = f.current) == null ? void 0 : _.children[0].dom));
|
|
15334
15334
|
};
|
|
15335
15335
|
}), {
|
|
15336
15336
|
hasContentDOM: c,
|
|
15337
|
-
childDescriptors:
|
|
15337
|
+
childDescriptors: P,
|
|
15338
15338
|
nodeViewDescRef: f,
|
|
15339
15339
|
setStopEvent: h,
|
|
15340
15340
|
setSelectNode: k,
|
|
@@ -15651,7 +15651,7 @@ function af(n) {
|
|
|
15651
15651
|
const mi = /* @__PURE__ */ Fe(/* @__PURE__ */ Ge(function(e, t) {
|
|
15652
15652
|
let { outputSpec: r, isMark: s, children: o, ...i } = e;
|
|
15653
15653
|
if (typeof r == "string")
|
|
15654
|
-
return /* @__PURE__ */
|
|
15654
|
+
return /* @__PURE__ */ A.createElement(A.Fragment, null, r);
|
|
15655
15655
|
if (!Array.isArray(r))
|
|
15656
15656
|
throw new Error("@handlewithcare/react-prosemirror only supports strings and arrays in toDOM");
|
|
15657
15657
|
const a = r[0].replace(" ", ":"), c = r[1];
|
|
@@ -15668,14 +15668,14 @@ const mi = /* @__PURE__ */ Fe(/* @__PURE__ */ Ge(function(e, t) {
|
|
|
15668
15668
|
throw new RangeError("Content hole must be the only child of its parent node");
|
|
15669
15669
|
return /* @__PURE__ */ Hn(a, u, o);
|
|
15670
15670
|
}
|
|
15671
|
-
d.push(/* @__PURE__ */
|
|
15671
|
+
d.push(/* @__PURE__ */ A.createElement(mi, {
|
|
15672
15672
|
outputSpec: p
|
|
15673
15673
|
}, o));
|
|
15674
15674
|
}
|
|
15675
15675
|
return s && !af(r) && d.push(o), /* @__PURE__ */ Hn(a, u, ...d);
|
|
15676
15676
|
})), cf = /* @__PURE__ */ Fe(/* @__PURE__ */ Ge(function(e, t) {
|
|
15677
15677
|
let { mark: r, getPos: s, children: o } = e;
|
|
15678
|
-
const { siblingsRef: i, parentRef: l } = oe(Oe), a =
|
|
15678
|
+
const { siblingsRef: i, parentRef: l } = oe(Oe), a = I(void 0), c = I([]), u = I(null);
|
|
15679
15679
|
ns(t, () => u.current, []);
|
|
15680
15680
|
const f = Me(() => {
|
|
15681
15681
|
var h, p;
|
|
@@ -15711,17 +15711,17 @@ const mi = /* @__PURE__ */ Fe(/* @__PURE__ */ Ge(function(e, t) {
|
|
|
15711
15711
|
c,
|
|
15712
15712
|
a
|
|
15713
15713
|
]);
|
|
15714
|
-
return /* @__PURE__ */
|
|
15714
|
+
return /* @__PURE__ */ A.createElement(mi, {
|
|
15715
15715
|
ref: u,
|
|
15716
15716
|
outputSpec: f,
|
|
15717
15717
|
isMark: !0
|
|
15718
|
-
}, /* @__PURE__ */
|
|
15718
|
+
}, /* @__PURE__ */ A.createElement(Oe.Provider, {
|
|
15719
15719
|
value: d
|
|
15720
15720
|
}, o));
|
|
15721
15721
|
}));
|
|
15722
15722
|
function Sb(n) {
|
|
15723
15723
|
let { widget: e, getPos: t } = n;
|
|
15724
|
-
const { siblingsRef: r, parentRef: s } = oe(Oe), o =
|
|
15724
|
+
const { siblingsRef: r, parentRef: s } = oe(Oe), o = I(null), i = I(null);
|
|
15725
15725
|
return X(() => {
|
|
15726
15726
|
const l = r.current;
|
|
15727
15727
|
return () => {
|
|
@@ -15746,7 +15746,7 @@ function Sb(n) {
|
|
|
15746
15746
|
i.current.firstElementChild !== c && i.current.replaceChildren(c);
|
|
15747
15747
|
}), X(() => {
|
|
15748
15748
|
i.current && (o.current ? (o.current.parent = s.current, o.current.widget = e, o.current.getPos = () => t.current(), o.current.dom = i.current) : o.current = new fi(s.current, () => t.current(), e, i.current), r.current.includes(o.current) || r.current.push(o.current), r.current.sort(sn));
|
|
15749
|
-
}), /* @__PURE__ */
|
|
15749
|
+
}), /* @__PURE__ */ A.createElement("span", {
|
|
15750
15750
|
ref: i
|
|
15751
15751
|
});
|
|
15752
15752
|
}
|
|
@@ -15761,13 +15761,13 @@ function wb() {
|
|
|
15761
15761
|
const Mb = /* @__PURE__ */ Fe(function(e) {
|
|
15762
15762
|
var dt;
|
|
15763
15763
|
let { customNodeView: t, node: r, getPos: s, innerDeco: o, outerDeco: i } = e;
|
|
15764
|
-
const { view: l } = oe(Vt), a =
|
|
15764
|
+
const { view: l } = oe(Vt), a = I(null), c = I(null), u = I(null), f = I(() => s.current()).current, d = I(r);
|
|
15765
15765
|
d.current = r;
|
|
15766
|
-
const h =
|
|
15766
|
+
const h = I(i);
|
|
15767
15767
|
h.current = i;
|
|
15768
|
-
const p =
|
|
15768
|
+
const p = I(o);
|
|
15769
15769
|
p.current = o;
|
|
15770
|
-
const y =
|
|
15770
|
+
const y = I(null), m = I(null), x = hi(), k = wb();
|
|
15771
15771
|
X(() => {
|
|
15772
15772
|
var $t, on, Tn;
|
|
15773
15773
|
if (m.current || (m.current = t(
|
|
@@ -15779,12 +15779,12 @@ const Mb = /* @__PURE__ */ Fe(function(e) {
|
|
|
15779
15779
|
f,
|
|
15780
15780
|
h.current,
|
|
15781
15781
|
p.current
|
|
15782
|
-
), m.current.stopEvent &&
|
|
15783
|
-
})), m.current.ignoreMutation &&
|
|
15782
|
+
), m.current.stopEvent && P(m.current.stopEvent.bind(m.current)), m.current.selectNode && D(m.current.selectNode.bind(m.current), (($t = m.current.deselectNode) == null ? void 0 : $t.bind(m.current)) ?? (() => {
|
|
15783
|
+
})), m.current.ignoreMutation && B(m.current.ignoreMutation.bind(m.current)), x()), !y.current) return;
|
|
15784
15784
|
const { dom: Ee } = m.current;
|
|
15785
15785
|
if (y.current.firstChild === Ee)
|
|
15786
15786
|
return;
|
|
15787
|
-
c.current = y.current, y.current.appendChild(Ee), (l == null ? void 0 : l.state.selection) instanceof
|
|
15787
|
+
c.current = y.current, y.current.appendChild(Ee), (l == null ? void 0 : l.state.selection) instanceof w && l.state.selection.node === d.current && ((Tn = (on = m.current).selectNode) == null || Tn.call(on));
|
|
15788
15788
|
const $e = m.current;
|
|
15789
15789
|
return () => {
|
|
15790
15790
|
var mr;
|
|
@@ -15819,12 +15819,12 @@ const Mb = /* @__PURE__ */ Fe(function(e) {
|
|
|
15819
15819
|
s,
|
|
15820
15820
|
f
|
|
15821
15821
|
]);
|
|
15822
|
-
const { childDescriptors:
|
|
15823
|
-
parentRef:
|
|
15824
|
-
siblingsRef:
|
|
15822
|
+
const { childDescriptors: M, nodeViewDescRef: v, setStopEvent: P, setSelectNode: D, setIgnoreMutation: B } = pi(r, f, a, c, o, i, void 0, u), z = Me(() => ({
|
|
15823
|
+
parentRef: v,
|
|
15824
|
+
siblingsRef: M
|
|
15825
15825
|
}), [
|
|
15826
|
-
|
|
15827
|
-
|
|
15826
|
+
M,
|
|
15827
|
+
v
|
|
15828
15828
|
]);
|
|
15829
15829
|
if (!k) return null;
|
|
15830
15830
|
m.current || (m.current = t(
|
|
@@ -15836,19 +15836,19 @@ const Mb = /* @__PURE__ */ Fe(function(e) {
|
|
|
15836
15836
|
() => s.current(),
|
|
15837
15837
|
h.current,
|
|
15838
15838
|
p.current
|
|
15839
|
-
), m.current.stopEvent &&
|
|
15840
|
-
})), m.current.ignoreMutation &&
|
|
15841
|
-
const { contentDOM:
|
|
15842
|
-
u.current =
|
|
15839
|
+
), m.current.stopEvent && P(m.current.stopEvent.bind(m.current)), m.current.selectNode && D(m.current.selectNode.bind(m.current), ((dt = m.current.deselectNode) == null ? void 0 : dt.bind(m.current)) ?? (() => {
|
|
15840
|
+
})), m.current.ignoreMutation && B(m.current.ignoreMutation.bind(m.current)));
|
|
15841
|
+
const { contentDOM: R } = m.current;
|
|
15842
|
+
u.current = R ?? null;
|
|
15843
15843
|
const _ = /* @__PURE__ */ Hn(r.isInline ? "span" : "div", {
|
|
15844
15844
|
ref: y,
|
|
15845
|
-
contentEditable: !!
|
|
15845
|
+
contentEditable: !!R,
|
|
15846
15846
|
suppressContentEditableWarning: !0
|
|
15847
|
-
},
|
|
15847
|
+
}, R && /* @__PURE__ */ jf(/* @__PURE__ */ A.createElement(or, {
|
|
15848
15848
|
getPos: s,
|
|
15849
15849
|
node: r,
|
|
15850
15850
|
innerDecorations: o
|
|
15851
|
-
}),
|
|
15851
|
+
}), R)), ke = /* @__PURE__ */ rs(
|
|
15852
15852
|
i.reduce(ms, _),
|
|
15853
15853
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15854
15854
|
i.some((Ee) => Ee.type.attrs.nodeName) ? {
|
|
@@ -15859,24 +15859,24 @@ const Mb = /* @__PURE__ */ Fe(function(e) {
|
|
|
15859
15859
|
void 0
|
|
15860
15860
|
)
|
|
15861
15861
|
);
|
|
15862
|
-
return /* @__PURE__ */
|
|
15863
|
-
value:
|
|
15862
|
+
return /* @__PURE__ */ A.createElement(Oe.Provider, {
|
|
15863
|
+
value: z
|
|
15864
15864
|
}, ke);
|
|
15865
15865
|
}), Nb = ct(null), Db = ct(null), uf = ct(null), Ob = /* @__PURE__ */ Fe(function(e) {
|
|
15866
15866
|
let { outerDeco: t, getPos: r, node: s, innerDeco: o, ...i } = e;
|
|
15867
|
-
const l =
|
|
15867
|
+
const l = I(null), a = I(null), c = I(null), u = I(() => r.current()).current, { nodeViews: f } = oe(Uu);
|
|
15868
15868
|
let d = null;
|
|
15869
15869
|
const h = f[s.type.name], p = Me(() => {
|
|
15870
|
-
var
|
|
15871
|
-
return (_ = (
|
|
15870
|
+
var R, _;
|
|
15871
|
+
return (_ = (R = s.type.spec).toDOM) == null ? void 0 : _.call(R, s);
|
|
15872
15872
|
}, [
|
|
15873
15873
|
s
|
|
15874
|
-
]), { hasContentDOM: y, childDescriptors: m, setStopEvent: x, setSelectNode: k, setIgnoreMutation:
|
|
15874
|
+
]), { hasContentDOM: y, childDescriptors: m, setStopEvent: x, setSelectNode: k, setIgnoreMutation: M, nodeViewDescRef: v } = pi(s, () => r.current(), l, a, o, t, void 0, c), P = {
|
|
15875
15875
|
...i,
|
|
15876
15876
|
...!y && {
|
|
15877
15877
|
contentEditable: !1
|
|
15878
15878
|
}
|
|
15879
|
-
},
|
|
15879
|
+
}, D = Me(() => ({
|
|
15880
15880
|
node: s,
|
|
15881
15881
|
getPos: u,
|
|
15882
15882
|
decorations: t,
|
|
@@ -15887,60 +15887,60 @@ const Mb = /* @__PURE__ */ Fe(function(e) {
|
|
|
15887
15887
|
s,
|
|
15888
15888
|
t
|
|
15889
15889
|
]);
|
|
15890
|
-
if (h ? d = /* @__PURE__ */
|
|
15891
|
-
|
|
15890
|
+
if (h ? d = /* @__PURE__ */ A.createElement(h, {
|
|
15891
|
+
...P,
|
|
15892
15892
|
ref: a,
|
|
15893
|
-
nodeProps:
|
|
15894
|
-
}, /* @__PURE__ */
|
|
15893
|
+
nodeProps: D
|
|
15894
|
+
}, /* @__PURE__ */ A.createElement(or, {
|
|
15895
15895
|
getPos: r,
|
|
15896
15896
|
node: s,
|
|
15897
15897
|
innerDecorations: o
|
|
15898
|
-
})) : p && (d = /* @__PURE__ */
|
|
15899
|
-
|
|
15898
|
+
})) : p && (d = /* @__PURE__ */ A.createElement(mi, {
|
|
15899
|
+
...P,
|
|
15900
15900
|
ref: a,
|
|
15901
15901
|
outputSpec: p
|
|
15902
|
-
}, /* @__PURE__ */
|
|
15902
|
+
}, /* @__PURE__ */ A.createElement(or, {
|
|
15903
15903
|
getPos: r,
|
|
15904
15904
|
node: s,
|
|
15905
15905
|
innerDecorations: o
|
|
15906
15906
|
}))), !d)
|
|
15907
15907
|
throw new Error(`Node spec for ${s.type.name} is missing toDOM`);
|
|
15908
|
-
const
|
|
15908
|
+
const B = /* @__PURE__ */ rs(
|
|
15909
15909
|
t.reduce(ms, d),
|
|
15910
15910
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15911
|
-
t.some((
|
|
15911
|
+
t.some((R) => R.type.attrs.nodeName) ? {
|
|
15912
15912
|
ref: l
|
|
15913
15913
|
} : (
|
|
15914
15914
|
// we've already passed the domRef to the NodeView component
|
|
15915
15915
|
// as a prop
|
|
15916
15916
|
void 0
|
|
15917
15917
|
)
|
|
15918
|
-
),
|
|
15919
|
-
parentRef:
|
|
15918
|
+
), z = Me(() => ({
|
|
15919
|
+
parentRef: v,
|
|
15920
15920
|
siblingsRef: m
|
|
15921
15921
|
}), [
|
|
15922
15922
|
m,
|
|
15923
|
-
|
|
15923
|
+
v
|
|
15924
15924
|
]);
|
|
15925
|
-
return /* @__PURE__ */
|
|
15925
|
+
return /* @__PURE__ */ A.createElement(Db.Provider, {
|
|
15926
15926
|
value: k
|
|
15927
|
-
}, /* @__PURE__ */
|
|
15927
|
+
}, /* @__PURE__ */ A.createElement(uf.Provider, {
|
|
15928
15928
|
value: x
|
|
15929
|
-
}, /* @__PURE__ */
|
|
15930
|
-
value:
|
|
15931
|
-
}, /* @__PURE__ */
|
|
15932
|
-
value:
|
|
15933
|
-
},
|
|
15929
|
+
}, /* @__PURE__ */ A.createElement(Nb.Provider, {
|
|
15930
|
+
value: M
|
|
15931
|
+
}, /* @__PURE__ */ A.createElement(Oe.Provider, {
|
|
15932
|
+
value: z
|
|
15933
|
+
}, B))));
|
|
15934
15934
|
}), ff = /* @__PURE__ */ Fe(function(e) {
|
|
15935
15935
|
let { outerDeco: t, getPos: r, node: s, innerDeco: o, ...i } = e;
|
|
15936
15936
|
const { view: l } = oe(Vt), a = l == null ? void 0 : l.someProp("nodeViews", (c) => c == null ? void 0 : c[s.type.name]);
|
|
15937
|
-
return a ? /* @__PURE__ */
|
|
15937
|
+
return a ? /* @__PURE__ */ A.createElement(Mb, {
|
|
15938
15938
|
customNodeView: a,
|
|
15939
15939
|
node: s,
|
|
15940
15940
|
innerDeco: o,
|
|
15941
15941
|
outerDeco: t,
|
|
15942
15942
|
getPos: r
|
|
15943
|
-
}) : /* @__PURE__ */
|
|
15943
|
+
}) : /* @__PURE__ */ A.createElement(Ob, {
|
|
15944
15944
|
node: s,
|
|
15945
15945
|
innerDeco: o,
|
|
15946
15946
|
outerDeco: t,
|
|
@@ -15950,7 +15950,7 @@ const Mb = /* @__PURE__ */ Fe(function(e) {
|
|
|
15950
15950
|
});
|
|
15951
15951
|
function Eb(n) {
|
|
15952
15952
|
let { getPos: e } = n;
|
|
15953
|
-
const { siblingsRef: t, parentRef: r } = oe(Oe), s =
|
|
15953
|
+
const { siblingsRef: t, parentRef: r } = oe(Oe), s = I(null), o = I(null), [i, l] = N(!1);
|
|
15954
15954
|
return X(() => {
|
|
15955
15955
|
const a = t.current;
|
|
15956
15956
|
return () => {
|
|
@@ -15969,7 +15969,7 @@ function Eb(n) {
|
|
|
15969
15969
|
return;
|
|
15970
15970
|
}
|
|
15971
15971
|
o.current && (s.current ? (s.current.parent = r.current, s.current.dom = o.current, s.current.getPos = () => e.current()) : s.current = new sr(r.current, [], () => e.current(), o.current, null), t.current.includes(s.current) || t.current.push(s.current), t.current.sort(sn));
|
|
15972
|
-
}), i ? /* @__PURE__ */
|
|
15972
|
+
}), i ? /* @__PURE__ */ A.createElement("img", {
|
|
15973
15973
|
ref: o,
|
|
15974
15974
|
className: "ProseMirror-separator"
|
|
15975
15975
|
}) : null;
|
|
@@ -16298,8 +16298,8 @@ function Vb(n, e) {
|
|
|
16298
16298
|
class $b extends $f {
|
|
16299
16299
|
constructor() {
|
|
16300
16300
|
super(...arguments);
|
|
16301
|
-
|
|
16302
|
-
|
|
16301
|
+
F(this, "viewDescRef", null);
|
|
16302
|
+
F(this, "renderRef", null);
|
|
16303
16303
|
}
|
|
16304
16304
|
updateEffect() {
|
|
16305
16305
|
const { view: t, decorations: r, siblingsRef: s, parentRef: o, getPos: i, node: l } = this.props, a = vb(this);
|
|
@@ -16347,7 +16347,7 @@ class $b extends $f {
|
|
|
16347
16347
|
}
|
|
16348
16348
|
function zb(n) {
|
|
16349
16349
|
let { getPos: e } = n;
|
|
16350
|
-
const { siblingsRef: t, parentRef: r } = oe(Oe), s =
|
|
16350
|
+
const { siblingsRef: t, parentRef: r } = oe(Oe), s = I(null), o = I(null);
|
|
16351
16351
|
return X(() => {
|
|
16352
16352
|
const i = t.current;
|
|
16353
16353
|
return () => {
|
|
@@ -16360,14 +16360,14 @@ function zb(n) {
|
|
|
16360
16360
|
t
|
|
16361
16361
|
]), X(() => {
|
|
16362
16362
|
o.current && (s.current ? (s.current.parent = r.current, s.current.dom = o.current, s.current.getPos = () => e.current()) : s.current = new sr(r.current, [], () => e.current(), o.current, null), t.current.includes(s.current) || t.current.push(s.current), t.current.sort(sn));
|
|
16363
|
-
}), /* @__PURE__ */
|
|
16363
|
+
}), /* @__PURE__ */ A.createElement("br", {
|
|
16364
16364
|
ref: o,
|
|
16365
16365
|
className: "ProseMirror-trailingBreak"
|
|
16366
16366
|
});
|
|
16367
16367
|
}
|
|
16368
16368
|
function jb(n) {
|
|
16369
16369
|
let { widget: e, getPos: t } = n;
|
|
16370
|
-
const { siblingsRef: r, parentRef: s } = oe(Oe), o =
|
|
16370
|
+
const { siblingsRef: r, parentRef: s } = oe(Oe), o = I(null), i = I(() => t.current()).current, l = I(null);
|
|
16371
16371
|
X(() => {
|
|
16372
16372
|
const c = r.current;
|
|
16373
16373
|
return () => {
|
|
@@ -16382,7 +16382,7 @@ function jb(n) {
|
|
|
16382
16382
|
l.current && (o.current ? (o.current.parent = s.current, o.current.widget = e, o.current.getPos = () => t.current(), o.current.dom = l.current) : o.current = new fi(s.current, () => t.current(), e, l.current), r.current.includes(o.current) || r.current.push(o.current), r.current.sort(sn));
|
|
16383
16383
|
});
|
|
16384
16384
|
const { Component: a } = e.type;
|
|
16385
|
-
return a && /* @__PURE__ */
|
|
16385
|
+
return a && /* @__PURE__ */ A.createElement(a, {
|
|
16386
16386
|
ref: l,
|
|
16387
16387
|
widget: e,
|
|
16388
16388
|
getPos: i,
|
|
@@ -16402,20 +16402,20 @@ function Gs(n, e) {
|
|
|
16402
16402
|
}
|
|
16403
16403
|
const Fb = /* @__PURE__ */ Fe(function(e) {
|
|
16404
16404
|
let { child: t, getInnerPos: r } = e;
|
|
16405
|
-
const { view: s } = oe(Vt), o =
|
|
16406
|
-
return o.current = () => r.current() + t.offset, t.type === "widget" ? /* @__PURE__ */
|
|
16405
|
+
const { view: s } = oe(Vt), o = I(() => r.current() + t.offset);
|
|
16406
|
+
return o.current = () => r.current() + t.offset, t.type === "widget" ? /* @__PURE__ */ A.createElement(jb, {
|
|
16407
16407
|
key: t.key,
|
|
16408
16408
|
widget: t.widget,
|
|
16409
16409
|
getPos: o
|
|
16410
|
-
}) : t.type === "native-widget" ? /* @__PURE__ */
|
|
16410
|
+
}) : t.type === "native-widget" ? /* @__PURE__ */ A.createElement(Sb, {
|
|
16411
16411
|
key: t.key,
|
|
16412
16412
|
widget: t.widget,
|
|
16413
16413
|
getPos: o
|
|
16414
|
-
}) : t.node.isText ? /* @__PURE__ */
|
|
16414
|
+
}) : t.node.isText ? /* @__PURE__ */ A.createElement(Oe.Consumer, {
|
|
16415
16415
|
key: t.key
|
|
16416
16416
|
}, (i) => {
|
|
16417
16417
|
let { siblingsRef: l, parentRef: a } = i;
|
|
16418
|
-
return /* @__PURE__ */
|
|
16418
|
+
return /* @__PURE__ */ A.createElement($b, {
|
|
16419
16419
|
view: s,
|
|
16420
16420
|
node: t.node,
|
|
16421
16421
|
getPos: o,
|
|
@@ -16423,7 +16423,7 @@ const Fb = /* @__PURE__ */ Fe(function(e) {
|
|
|
16423
16423
|
parentRef: a,
|
|
16424
16424
|
decorations: t.outerDeco
|
|
16425
16425
|
});
|
|
16426
|
-
}) : /* @__PURE__ */
|
|
16426
|
+
}) : /* @__PURE__ */ A.createElement(ff, {
|
|
16427
16427
|
key: t.key,
|
|
16428
16428
|
node: t.node,
|
|
16429
16429
|
getPos: o,
|
|
@@ -16432,21 +16432,21 @@ const Fb = /* @__PURE__ */ Fe(function(e) {
|
|
|
16432
16432
|
});
|
|
16433
16433
|
}), Bb = /* @__PURE__ */ Fe(function(e) {
|
|
16434
16434
|
let { childViews: t, getInnerPos: r } = e;
|
|
16435
|
-
const s = t[0], o =
|
|
16435
|
+
const s = t[0], o = I(() => r.current() + s.offset);
|
|
16436
16436
|
o.current = () => r.current() + s.offset;
|
|
16437
16437
|
const i = s.marks[0];
|
|
16438
|
-
return i ? /* @__PURE__ */
|
|
16438
|
+
return i ? /* @__PURE__ */ A.createElement(cf, {
|
|
16439
16439
|
getPos: o,
|
|
16440
16440
|
key: s.key,
|
|
16441
16441
|
mark: i
|
|
16442
|
-
}, /* @__PURE__ */
|
|
16442
|
+
}, /* @__PURE__ */ A.createElement(gi, {
|
|
16443
16443
|
key: s.key,
|
|
16444
16444
|
getInnerPos: r,
|
|
16445
16445
|
childViews: t.map((l) => ({
|
|
16446
16446
|
...l,
|
|
16447
16447
|
marks: l.marks.slice(1)
|
|
16448
16448
|
}))
|
|
16449
|
-
})) : /* @__PURE__ */
|
|
16449
|
+
})) : /* @__PURE__ */ A.createElement(A.Fragment, null, t.map((l) => /* @__PURE__ */ A.createElement(Fb, {
|
|
16450
16450
|
key: l.key,
|
|
16451
16451
|
child: l,
|
|
16452
16452
|
getInnerPos: r
|
|
@@ -16482,9 +16482,9 @@ const Fb = /* @__PURE__ */ Fe(function(e) {
|
|
|
16482
16482
|
]
|
|
16483
16483
|
];
|
|
16484
16484
|
}, []);
|
|
16485
|
-
return /* @__PURE__ */
|
|
16485
|
+
return /* @__PURE__ */ A.createElement(A.Fragment, null, s.map((o) => {
|
|
16486
16486
|
const i = o[0];
|
|
16487
|
-
return i ? /* @__PURE__ */
|
|
16487
|
+
return i ? /* @__PURE__ */ A.createElement(Bb, {
|
|
16488
16488
|
key: i.key,
|
|
16489
16489
|
childViews: o,
|
|
16490
16490
|
getInnerPos: t
|
|
@@ -16518,17 +16518,17 @@ function Wb(n, e) {
|
|
|
16518
16518
|
}
|
|
16519
16519
|
const _b = /* @__PURE__ */ Fe(function(e) {
|
|
16520
16520
|
let { child: t, getInnerPos: r } = e;
|
|
16521
|
-
const s =
|
|
16522
|
-
return s.current = () => r.current() + t.offset, t.type === "node" ? t.marks.reduce((o, i) => /* @__PURE__ */
|
|
16521
|
+
const s = I(() => r.current() + t.offset);
|
|
16522
|
+
return s.current = () => r.current() + t.offset, t.type === "node" ? t.marks.reduce((o, i) => /* @__PURE__ */ A.createElement(cf, {
|
|
16523
16523
|
getPos: s,
|
|
16524
16524
|
mark: i
|
|
16525
|
-
}, o), /* @__PURE__ */
|
|
16525
|
+
}, o), /* @__PURE__ */ A.createElement(ff, {
|
|
16526
16526
|
key: t.key,
|
|
16527
16527
|
outerDeco: t.outerDeco,
|
|
16528
16528
|
node: t.node,
|
|
16529
16529
|
innerDeco: t.innerDeco,
|
|
16530
16530
|
getPos: s
|
|
16531
|
-
})) : /* @__PURE__ */
|
|
16531
|
+
})) : /* @__PURE__ */ A.createElement(gi, {
|
|
16532
16532
|
key: t.key,
|
|
16533
16533
|
childViews: [
|
|
16534
16534
|
t
|
|
@@ -16538,13 +16538,13 @@ const _b = /* @__PURE__ */ Fe(function(e) {
|
|
|
16538
16538
|
});
|
|
16539
16539
|
function qb(n, e) {
|
|
16540
16540
|
return n.length ? n.every((t) => t.type !== "node" || t.node.isInline) ? [
|
|
16541
|
-
/* @__PURE__ */
|
|
16541
|
+
/* @__PURE__ */ A.createElement(gi, {
|
|
16542
16542
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
16543
16543
|
key: n[0].key,
|
|
16544
16544
|
childViews: n,
|
|
16545
16545
|
getInnerPos: e
|
|
16546
16546
|
})
|
|
16547
|
-
] : n.map((t) => /* @__PURE__ */
|
|
16547
|
+
] : n.map((t) => /* @__PURE__ */ A.createElement(_b, {
|
|
16548
16548
|
key: t.key,
|
|
16549
16549
|
child: t,
|
|
16550
16550
|
getInnerPos: e
|
|
@@ -16552,40 +16552,40 @@ function qb(n, e) {
|
|
|
16552
16552
|
}
|
|
16553
16553
|
const or = /* @__PURE__ */ Fe(function(e) {
|
|
16554
16554
|
let { getPos: t, node: r, innerDecorations: s } = e;
|
|
16555
|
-
const o = mb(), i =
|
|
16555
|
+
const o = mb(), i = I(() => t.current() + 1), l = I(/* @__PURE__ */ new Map()).current;
|
|
16556
16556
|
if (!r) return null;
|
|
16557
16557
|
const a = /* @__PURE__ */ new Set();
|
|
16558
16558
|
let c = [], u = null;
|
|
16559
16559
|
pb(r, s, (p, y, m, x) => {
|
|
16560
16560
|
const k = p.type.spec.marks ?? [];
|
|
16561
|
-
let
|
|
16561
|
+
let M;
|
|
16562
16562
|
if (y) {
|
|
16563
|
-
|
|
16564
|
-
const
|
|
16563
|
+
M = Xs(i.current(), m, "native-widget", o == null ? void 0 : o.posToKey, p, x);
|
|
16564
|
+
const P = {
|
|
16565
16565
|
type: "native-widget",
|
|
16566
16566
|
widget: p,
|
|
16567
16567
|
marks: k,
|
|
16568
16568
|
offset: m,
|
|
16569
16569
|
index: x,
|
|
16570
|
-
key:
|
|
16571
|
-
},
|
|
16572
|
-
|
|
16570
|
+
key: M
|
|
16571
|
+
}, D = l.get(M);
|
|
16572
|
+
D && Gs(D, P) ? D.offset = m : l.set(M, P), a.add(M);
|
|
16573
16573
|
} else {
|
|
16574
|
-
|
|
16575
|
-
const
|
|
16574
|
+
M = Xs(i.current(), m, "widget", o == null ? void 0 : o.posToKey, p, x);
|
|
16575
|
+
const P = {
|
|
16576
16576
|
type: "widget",
|
|
16577
16577
|
widget: p,
|
|
16578
16578
|
marks: k,
|
|
16579
16579
|
offset: m,
|
|
16580
16580
|
index: x,
|
|
16581
|
-
key:
|
|
16582
|
-
},
|
|
16583
|
-
|
|
16581
|
+
key: M
|
|
16582
|
+
}, D = l.get(M);
|
|
16583
|
+
D && Gs(D, P) ? D.offset = m : l.set(M, P), a.add(M);
|
|
16584
16584
|
}
|
|
16585
|
-
const
|
|
16586
|
-
c.push(
|
|
16585
|
+
const v = l.get(M);
|
|
16586
|
+
c.push(v), Lb(u, l.get(M));
|
|
16587
16587
|
}, (p, y, m, x) => {
|
|
16588
|
-
const k = Xs(i.current(), x, "node", o == null ? void 0 : o.posToKey),
|
|
16588
|
+
const k = Xs(i.current(), x, "node", o == null ? void 0 : o.posToKey), M = {
|
|
16589
16589
|
type: "node",
|
|
16590
16590
|
node: p,
|
|
16591
16591
|
marks: p.marks,
|
|
@@ -16593,28 +16593,28 @@ const or = /* @__PURE__ */ Fe(function(e) {
|
|
|
16593
16593
|
outerDeco: y,
|
|
16594
16594
|
offset: x,
|
|
16595
16595
|
key: k
|
|
16596
|
-
},
|
|
16597
|
-
|
|
16596
|
+
}, v = l.get(k);
|
|
16597
|
+
v && Gs(v, M) ? (v.offset = x, u = v) : (l.set(k, M), u = M), a.add(k), Wb(c, u), c = [];
|
|
16598
16598
|
});
|
|
16599
16599
|
for (const p of l.keys())
|
|
16600
16600
|
a.has(p) || l.delete(p);
|
|
16601
16601
|
const f = Array.from(l.values()).sort((p, y) => p.offset - y.offset), d = qb(f, i), h = f[f.length - 1];
|
|
16602
16602
|
return (!h || h.type !== "node" || h.node.isInline && !h.node.isText || // RegExp.test actually handles undefined just fine
|
|
16603
16603
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
16604
|
-
/\n$/.test(h.node.text)) && d.push(/* @__PURE__ */
|
|
16604
|
+
/\n$/.test(h.node.text)) && d.push(/* @__PURE__ */ A.createElement(Eb, {
|
|
16605
16605
|
getPos: i,
|
|
16606
16606
|
key: "trailing-hack-img"
|
|
16607
|
-
}), /* @__PURE__ */
|
|
16607
|
+
}), /* @__PURE__ */ A.createElement(zb, {
|
|
16608
16608
|
getPos: i,
|
|
16609
16609
|
key: "trailing-hack-br"
|
|
16610
|
-
})), /* @__PURE__ */
|
|
16610
|
+
})), /* @__PURE__ */ A.createElement(A.Fragment, null, d);
|
|
16611
16611
|
}), Qs = {
|
|
16612
16612
|
current() {
|
|
16613
16613
|
return -1;
|
|
16614
16614
|
}
|
|
16615
16615
|
}, Hb = /* @__PURE__ */ Fe(/* @__PURE__ */ Ge(function(e, t) {
|
|
16616
16616
|
let { className: r, node: s, innerDeco: o, outerDeco: i, as: l, viewDesc: a, ...c } = e;
|
|
16617
|
-
const u =
|
|
16617
|
+
const u = I(null);
|
|
16618
16618
|
ns(t, () => u.current, []);
|
|
16619
16619
|
const { childDescriptors: f, nodeViewDescRef: d } = pi(s, () => Qs.current(), u, u, o, i, a), h = Me(() => ({
|
|
16620
16620
|
parentRef: d,
|
|
@@ -16627,15 +16627,15 @@ const or = /* @__PURE__ */ Fe(function(e) {
|
|
|
16627
16627
|
ref: u,
|
|
16628
16628
|
className: r,
|
|
16629
16629
|
suppressContentEditableWarning: !0
|
|
16630
|
-
}, y = l ? /* @__PURE__ */ rs(l, p, /* @__PURE__ */
|
|
16630
|
+
}, y = l ? /* @__PURE__ */ rs(l, p, /* @__PURE__ */ A.createElement(Oe.Provider, {
|
|
16631
16631
|
value: h
|
|
16632
|
-
}, /* @__PURE__ */
|
|
16632
|
+
}, /* @__PURE__ */ A.createElement(or, {
|
|
16633
16633
|
getPos: Qs,
|
|
16634
16634
|
node: s,
|
|
16635
16635
|
innerDecorations: o
|
|
16636
|
-
}))) : /* @__PURE__ */ Hn("div", p, /* @__PURE__ */
|
|
16636
|
+
}))) : /* @__PURE__ */ Hn("div", p, /* @__PURE__ */ A.createElement(Oe.Provider, {
|
|
16637
16637
|
value: h
|
|
16638
|
-
}, /* @__PURE__ */
|
|
16638
|
+
}, /* @__PURE__ */ A.createElement(or, {
|
|
16639
16639
|
getPos: Qs,
|
|
16640
16640
|
node: s,
|
|
16641
16641
|
innerDecorations: o
|
|
@@ -16646,7 +16646,7 @@ const or = /* @__PURE__ */ Fe(function(e) {
|
|
|
16646
16646
|
})), df = /* @__PURE__ */ ct(null);
|
|
16647
16647
|
function Jb(n, e) {
|
|
16648
16648
|
let { as: t, ...r } = n;
|
|
16649
|
-
const s =
|
|
16649
|
+
const s = I([]), o = I(null), { setMount: i, ...l } = oe(df), a = I(void 0);
|
|
16650
16650
|
ns(e, () => o.current, []);
|
|
16651
16651
|
const c = Me(() => ({
|
|
16652
16652
|
parentRef: a,
|
|
@@ -16655,9 +16655,9 @@ function Jb(n, e) {
|
|
|
16655
16655
|
s,
|
|
16656
16656
|
a
|
|
16657
16657
|
]);
|
|
16658
|
-
return /* @__PURE__ */
|
|
16658
|
+
return /* @__PURE__ */ A.createElement(Oe.Provider, {
|
|
16659
16659
|
value: c
|
|
16660
|
-
}, /* @__PURE__ */
|
|
16660
|
+
}, /* @__PURE__ */ A.createElement(Hb, {
|
|
16661
16661
|
ref: (u) => {
|
|
16662
16662
|
o.current = u, i(u);
|
|
16663
16663
|
},
|
|
@@ -16694,21 +16694,21 @@ function Ub(n) {
|
|
|
16694
16694
|
u,
|
|
16695
16695
|
f
|
|
16696
16696
|
]);
|
|
16697
|
-
return /* @__PURE__ */
|
|
16697
|
+
return /* @__PURE__ */ A.createElement(Vt.Provider, {
|
|
16698
16698
|
value: a
|
|
16699
|
-
}, /* @__PURE__ */
|
|
16699
|
+
}, /* @__PURE__ */ A.createElement(wy.Provider, {
|
|
16700
16700
|
value: c
|
|
16701
|
-
}, /* @__PURE__ */
|
|
16701
|
+
}, /* @__PURE__ */ A.createElement(Uu.Provider, {
|
|
16702
16702
|
value: d
|
|
16703
|
-
}, /* @__PURE__ */
|
|
16703
|
+
}, /* @__PURE__ */ A.createElement(df.Provider, {
|
|
16704
16704
|
value: h
|
|
16705
16705
|
}, t))));
|
|
16706
16706
|
}
|
|
16707
16707
|
function pf(n) {
|
|
16708
|
-
return /* @__PURE__ */
|
|
16708
|
+
return /* @__PURE__ */ A.createElement(db, null, /* @__PURE__ */ A.createElement(Ub, n));
|
|
16709
16709
|
}
|
|
16710
|
-
function
|
|
16711
|
-
const e =
|
|
16710
|
+
function pe(n) {
|
|
16711
|
+
const e = I(n), { view: t } = oe(Vt);
|
|
16712
16712
|
return ft(() => {
|
|
16713
16713
|
e.current = n;
|
|
16714
16714
|
}, [
|
|
@@ -16722,7 +16722,7 @@ function fe(n) {
|
|
|
16722
16722
|
]);
|
|
16723
16723
|
}
|
|
16724
16724
|
function yi(n) {
|
|
16725
|
-
const e = oe(uf), t =
|
|
16725
|
+
const e = oe(uf), t = pe(n);
|
|
16726
16726
|
ft(() => {
|
|
16727
16727
|
e(t);
|
|
16728
16728
|
}, [
|
|
@@ -17018,7 +17018,6 @@ const Yb = ["p", 0], Gb = ["blockquote", 0], Xb = ["hr"], Qb = ["pre", ["code",
|
|
|
17018
17018
|
title: { default: null, validate: "string|null" }
|
|
17019
17019
|
},
|
|
17020
17020
|
group: "block",
|
|
17021
|
-
draggable: !0,
|
|
17022
17021
|
parseDOM: [{ tag: "img[src]", getAttrs(n) {
|
|
17023
17022
|
return {
|
|
17024
17023
|
fid: n.getAttribute("fid"),
|
|
@@ -17038,7 +17037,6 @@ const Yb = ["p", 0], Gb = ["blockquote", 0], Xb = ["hr"], Qb = ["pre", ["code",
|
|
|
17038
17037
|
title: { default: null, validate: "string|null" }
|
|
17039
17038
|
},
|
|
17040
17039
|
group: "block",
|
|
17041
|
-
draggable: !0,
|
|
17042
17040
|
parseDOM: [{ tag: "iframe[src]", getAttrs(n) {
|
|
17043
17041
|
return {
|
|
17044
17042
|
src: n.getAttribute("src"),
|
|
@@ -17068,7 +17066,6 @@ const Yb = ["p", 0], Gb = ["blockquote", 0], Xb = ["hr"], Qb = ["pre", ["code",
|
|
|
17068
17066
|
content: "inline*",
|
|
17069
17067
|
marks: "underline strikethrough",
|
|
17070
17068
|
group: "block",
|
|
17071
|
-
defining: !0,
|
|
17072
17069
|
parseDOM: [
|
|
17073
17070
|
{ tag: "h1", attrs: { level: 1 } },
|
|
17074
17071
|
{ tag: "h2", attrs: { level: 2 } },
|
|
@@ -17093,7 +17090,8 @@ const Yb = ["p", 0], Gb = ["blockquote", 0], Xb = ["hr"], Qb = ["pre", ["code",
|
|
|
17093
17090
|
}), h0 = bf.remove("heading").remove("paragraph").prepend({ paragraph: u0 }).append({ heading: f0 }).append({ carousel: d0 }).append(zg(
|
|
17094
17091
|
{
|
|
17095
17092
|
tableGroup: "block",
|
|
17096
|
-
cellContent: "(paragraph | ordered_list | bullet_list)
|
|
17093
|
+
cellContent: "(paragraph | ordered_list | bullet_list)+",
|
|
17094
|
+
// важно использовать + а не * !
|
|
17097
17095
|
cellAttributes: {
|
|
17098
17096
|
halign: {
|
|
17099
17097
|
default: null,
|
|
@@ -17133,7 +17131,7 @@ const Yb = ["p", 0], Gb = ["blockquote", 0], Xb = ["hr"], Qb = ["pre", ["code",
|
|
|
17133
17131
|
ft((c) => {
|
|
17134
17132
|
c && (r(e.isActive && e.isActive(c.state)), l(e.isSelected && !e.isSelected(c.state)), e.isDisabled ? o(e.isDisabled(c.state)) : o(!e.command(c.state)));
|
|
17135
17133
|
});
|
|
17136
|
-
const a =
|
|
17134
|
+
const a = pe((c) => {
|
|
17137
17135
|
c && (s || e.command(c.state, c.dispatch, c), c.focus());
|
|
17138
17136
|
});
|
|
17139
17137
|
return i ? null : /* @__PURE__ */ g.jsx(
|
|
@@ -17169,7 +17167,7 @@ const Yb = ["p", 0], Gb = ["blockquote", 0], Xb = ["hr"], Qb = ["pre", ["code",
|
|
|
17169
17167
|
r && /* @__PURE__ */ g.jsx(ir, { item: r })
|
|
17170
17168
|
] });
|
|
17171
17169
|
}, xs = ({ items: n }) => /* @__PURE__ */ g.jsx("div", { className: "MenuBlock", children: n.map((e, t) => /* @__PURE__ */ g.jsx(ir, { item: e }, t)) }), m0 = ({ schema: n, isOpen: e, onClose: t }) => {
|
|
17172
|
-
const r =
|
|
17170
|
+
const r = pe((s, o) => {
|
|
17173
17171
|
s && (Ce(n.marks.link, { href: o })(s.state, s.dispatch), t(), s.focus());
|
|
17174
17172
|
});
|
|
17175
17173
|
return /* @__PURE__ */ g.jsx(
|
|
@@ -17283,34 +17281,34 @@ const kf = () => /* @__PURE__ */ g.jsxs("div", { className: "MenuBlock", childre
|
|
|
17283
17281
|
}
|
|
17284
17282
|
t(r);
|
|
17285
17283
|
}, [n]), e.length < 1 ? null : /* @__PURE__ */ g.jsx(xs, { items: e });
|
|
17286
|
-
}, wf = ({
|
|
17287
|
-
const [
|
|
17284
|
+
}, wf = ({ pos: n, isOpen: e, onClose: t }) => {
|
|
17285
|
+
const [r, s] = N(""), [o, i] = N(), [l, a] = N(""), [c, u] = N(!1);
|
|
17288
17286
|
q(() => {
|
|
17289
|
-
|
|
17290
|
-
}, [
|
|
17291
|
-
if (!
|
|
17292
|
-
const
|
|
17293
|
-
|
|
17294
|
-
}, [
|
|
17295
|
-
const
|
|
17296
|
-
|
|
17287
|
+
s(""), a(""), i(void 0);
|
|
17288
|
+
}, [e]), ft((d) => {
|
|
17289
|
+
if (!d || !e) return;
|
|
17290
|
+
const h = lt.getState(d.state);
|
|
17291
|
+
u(h.upload !== void 0);
|
|
17292
|
+
}, [e]);
|
|
17293
|
+
const f = pe((d) => {
|
|
17294
|
+
d && (c ? _m(d, o, l, n) : qm(d, r, l, n), d.focus(), t());
|
|
17297
17295
|
});
|
|
17298
|
-
return /* @__PURE__ */ g.jsxs(Pa, { isOpen:
|
|
17296
|
+
return /* @__PURE__ */ g.jsxs(Pa, { isOpen: e, onClose: t, children: [
|
|
17299
17297
|
/* @__PURE__ */ g.jsx("h1", { children: "Вставка картинки" }),
|
|
17300
17298
|
/* @__PURE__ */ g.jsxs(
|
|
17301
17299
|
va,
|
|
17302
17300
|
{
|
|
17303
17301
|
submit: "Вставить",
|
|
17304
17302
|
submitType: "Success",
|
|
17305
|
-
onSubmit:
|
|
17306
|
-
onCancel:
|
|
17303
|
+
onSubmit: f,
|
|
17304
|
+
onCancel: t,
|
|
17307
17305
|
children: [
|
|
17308
|
-
|
|
17306
|
+
c ? /* @__PURE__ */ g.jsx(
|
|
17309
17307
|
Bf,
|
|
17310
17308
|
{
|
|
17311
17309
|
id: "image",
|
|
17312
|
-
value:
|
|
17313
|
-
onChange:
|
|
17310
|
+
value: o,
|
|
17311
|
+
onChange: i,
|
|
17314
17312
|
text: /* @__PURE__ */ g.jsxs("span", { children: [
|
|
17315
17313
|
/* @__PURE__ */ g.jsx(O.Image, {}),
|
|
17316
17314
|
/* @__PURE__ */ g.jsx("br", {}),
|
|
@@ -17323,8 +17321,8 @@ const kf = () => /* @__PURE__ */ g.jsxs("div", { className: "MenuBlock", childre
|
|
|
17323
17321
|
Pr,
|
|
17324
17322
|
{
|
|
17325
17323
|
id: "href",
|
|
17326
|
-
value:
|
|
17327
|
-
onChange:
|
|
17324
|
+
value: r,
|
|
17325
|
+
onChange: s,
|
|
17328
17326
|
required: !0,
|
|
17329
17327
|
label: "Ссылка на картинку"
|
|
17330
17328
|
}
|
|
@@ -17333,8 +17331,8 @@ const kf = () => /* @__PURE__ */ g.jsxs("div", { className: "MenuBlock", childre
|
|
|
17333
17331
|
Pr,
|
|
17334
17332
|
{
|
|
17335
17333
|
id: "value",
|
|
17336
|
-
value:
|
|
17337
|
-
onChange:
|
|
17334
|
+
value: l,
|
|
17335
|
+
onChange: a,
|
|
17338
17336
|
label: "Подпись"
|
|
17339
17337
|
}
|
|
17340
17338
|
)
|
|
@@ -17347,7 +17345,7 @@ const kf = () => /* @__PURE__ */ g.jsxs("div", { className: "MenuBlock", childre
|
|
|
17347
17345
|
q(() => {
|
|
17348
17346
|
s(""), i("");
|
|
17349
17347
|
}, [e]);
|
|
17350
|
-
const l =
|
|
17348
|
+
const l = pe((a) => {
|
|
17351
17349
|
const c = n.nodes.video;
|
|
17352
17350
|
if (!a || !r || !c) return;
|
|
17353
17351
|
const u = bs(r);
|
|
@@ -17450,7 +17448,7 @@ function y0() {
|
|
|
17450
17448
|
);
|
|
17451
17449
|
return e && e(
|
|
17452
17450
|
r.replaceSelectionWith(o).scrollIntoView().setSelection(
|
|
17453
|
-
|
|
17451
|
+
V.near(
|
|
17454
17452
|
r.doc.resolve(t)
|
|
17455
17453
|
)
|
|
17456
17454
|
)
|
|
@@ -17481,21 +17479,21 @@ const Nf = () => /* @__PURE__ */ g.jsx(xs, { items: [{
|
|
|
17481
17479
|
const y = t.getPos(), m = p.state.doc.resolve(y).parent;
|
|
17482
17480
|
if (a(m.type.name !== "carousel"), m.type.name === "carousel") {
|
|
17483
17481
|
let x = 0;
|
|
17484
|
-
m.forEach((k,
|
|
17485
|
-
k === t.node && (x =
|
|
17482
|
+
m.forEach((k, M) => {
|
|
17483
|
+
k === t.node && (x = M + 1);
|
|
17486
17484
|
}), u(x ? `${x} / ${m.childCount}` : "");
|
|
17487
17485
|
}
|
|
17488
17486
|
});
|
|
17489
|
-
const f =
|
|
17487
|
+
const f = pe((p, y) => {
|
|
17490
17488
|
if (!p) return;
|
|
17491
17489
|
i(y);
|
|
17492
17490
|
const m = p.state.tr, x = t.getPos();
|
|
17493
17491
|
p.dispatch(m.setNodeMarkup(x, null, { ...t.node.attrs, title: y })), p.focus();
|
|
17494
|
-
}), d =
|
|
17492
|
+
}), d = pe((p) => {
|
|
17495
17493
|
if (!p) return;
|
|
17496
|
-
const y = t.getPos(), m = t.node.nodeSize, x = t.node.attrs, k = p.state.schema,
|
|
17497
|
-
p.dispatch(p.state.tr.replaceWith(y, y + m,
|
|
17498
|
-
}), h =
|
|
17494
|
+
const y = t.getPos(), m = t.node.nodeSize, x = t.node.attrs, k = p.state.schema, M = k.nodes.carousel.create(null, k.nodes.image.create(x));
|
|
17495
|
+
p.dispatch(p.state.tr.replaceWith(y, y + m, M));
|
|
17496
|
+
}), h = pe((p) => {
|
|
17499
17497
|
if (!p) return;
|
|
17500
17498
|
const y = p.state.tr, m = t.getPos(), x = t.node.nodeSize, k = p.state.doc.resolve(m).parent;
|
|
17501
17499
|
k.type.name === "carousel" && k.childCount === 1 ? p.dispatch(y.delete(m - 1, m - 1 + k.nodeSize)) : p.dispatch(y.delete(m, m + x));
|
|
@@ -17544,15 +17542,15 @@ const Nf = () => /* @__PURE__ */ g.jsx(xs, { items: [{
|
|
|
17544
17542
|
yi(() => !0), q(() => {
|
|
17545
17543
|
i(bs(t.node.attrs.src));
|
|
17546
17544
|
}, [t]);
|
|
17547
|
-
const u =
|
|
17545
|
+
const u = pe((f, d) => {
|
|
17548
17546
|
if (!f) return;
|
|
17549
17547
|
a(d);
|
|
17550
17548
|
const { $from: h, $to: p } = f.state.selection, y = h.blockRange(p);
|
|
17551
17549
|
if (y) {
|
|
17552
17550
|
const m = f.state.doc;
|
|
17553
17551
|
let x = f.state.tr;
|
|
17554
|
-
m.nodesBetween(y.start, y.end, (k,
|
|
17555
|
-
k.type.name === "video" && (x = x.setNodeMarkup(
|
|
17552
|
+
m.nodesBetween(y.start, y.end, (k, M) => {
|
|
17553
|
+
k.type.name === "video" && (x = x.setNodeMarkup(M, null, { ...t.node.attrs, title: d }));
|
|
17556
17554
|
}), f.dispatch(x);
|
|
17557
17555
|
}
|
|
17558
17556
|
f.focus();
|
|
@@ -17590,7 +17588,7 @@ const Nf = () => /* @__PURE__ */ g.jsx(xs, { items: [{
|
|
|
17590
17588
|
const c = l.state.doc, u = !!c.textBetween(0, c.content.size, void 0, " ").length, f = !!Lo(l.state);
|
|
17591
17589
|
r && t ? a = u && f : r ? a = f : t && (a = u), o(a);
|
|
17592
17590
|
});
|
|
17593
|
-
const i =
|
|
17591
|
+
const i = pe((l) => {
|
|
17594
17592
|
try {
|
|
17595
17593
|
let a;
|
|
17596
17594
|
const c = ai(l.state);
|
|
@@ -17665,7 +17663,7 @@ const Nf = () => /* @__PURE__ */ g.jsx(xs, { items: [{
|
|
|
17665
17663
|
)
|
|
17666
17664
|
] }) : null;
|
|
17667
17665
|
}, x0 = ({ schema: n }) => {
|
|
17668
|
-
const e =
|
|
17666
|
+
const e = I(null), [t, r] = N([]), [s, o] = N([]), [i, l] = N(!1);
|
|
17669
17667
|
ft((c) => {
|
|
17670
17668
|
const u = n.nodes.heading;
|
|
17671
17669
|
if (!c || !u || !i) return;
|
|
@@ -17681,7 +17679,7 @@ const Nf = () => /* @__PURE__ */ g.jsx(xs, { items: [{
|
|
|
17681
17679
|
}
|
|
17682
17680
|
r(f), o(d);
|
|
17683
17681
|
}, [i]);
|
|
17684
|
-
const a =
|
|
17682
|
+
const a = pe((c, u) => {
|
|
17685
17683
|
!c || !u.id || (s[u.id](c.state, c.dispatch, c), l(!1), c.focus());
|
|
17686
17684
|
});
|
|
17687
17685
|
return n.nodes.heading ? /* @__PURE__ */ g.jsxs(g.Fragment, { children: [
|
|
@@ -17738,7 +17736,7 @@ const Nf = () => /* @__PURE__ */ g.jsx(xs, { items: [{
|
|
|
17738
17736
|
icon: /* @__PURE__ */ g.jsx(O.AlignJustify, {}),
|
|
17739
17737
|
text: "Выровнять по краям"
|
|
17740
17738
|
}], C0 = ({ schema: n }) => {
|
|
17741
|
-
const e =
|
|
17739
|
+
const e = I(null), [t, r] = N(!1), s = pe((o, i) => {
|
|
17742
17740
|
if (!o || !i.id) return;
|
|
17743
17741
|
const l = i.id === "left" ? null : i.id, { $from: a, $to: c } = o.state.selection, u = a.blockRange(c);
|
|
17744
17742
|
if (u) {
|
|
@@ -17828,7 +17826,7 @@ const Nf = () => /* @__PURE__ */ g.jsx(xs, { items: [{
|
|
|
17828
17826
|
q(() => {
|
|
17829
17827
|
i(M0(t.node));
|
|
17830
17828
|
}, [t]);
|
|
17831
|
-
const l =
|
|
17829
|
+
const l = pe((a) => {
|
|
17832
17830
|
hy(a.state, a.dispatch);
|
|
17833
17831
|
});
|
|
17834
17832
|
return /* @__PURE__ */ g.jsxs("table", { ref: s, ...r, children: [
|
|
@@ -17914,7 +17912,7 @@ const Nf = () => /* @__PURE__ */ g.jsx(xs, { items: [{
|
|
|
17914
17912
|
onCellMenuClose: o,
|
|
17915
17913
|
onColumnMenuClose: i
|
|
17916
17914
|
}) => {
|
|
17917
|
-
const l =
|
|
17915
|
+
const l = pe((a, c) => {
|
|
17918
17916
|
if (a) {
|
|
17919
17917
|
switch (c.id) {
|
|
17920
17918
|
case "toggleHeaderRow":
|
|
@@ -18037,22 +18035,22 @@ const Nf = () => /* @__PURE__ */ g.jsx(xs, { items: [{
|
|
|
18037
18035
|
);
|
|
18038
18036
|
}, Ia = Ge(
|
|
18039
18037
|
function({ children: e, nodeProps: t, ...r }, s) {
|
|
18040
|
-
const o =
|
|
18038
|
+
const o = I(null), [i, l] = N(!1), [a, c] = N(!1), [u, f] = N(!1), [d, h] = N(!1), [p, y] = N();
|
|
18041
18039
|
q(() => {
|
|
18042
|
-
const k = (
|
|
18043
|
-
o.current !==
|
|
18040
|
+
const k = (M) => {
|
|
18041
|
+
o.current !== M.target && (l(!1), c(!1), f(!1));
|
|
18044
18042
|
};
|
|
18045
18043
|
return document.addEventListener("contextmenu", k, !0), () => document.removeEventListener("contextmenu", k, !0);
|
|
18046
18044
|
}, []), q(() => {
|
|
18047
18045
|
const k = o.current;
|
|
18048
18046
|
if (!k || !k.parentNode) return;
|
|
18049
|
-
const
|
|
18050
|
-
h(
|
|
18047
|
+
const M = Array.prototype.indexOf.call(k.parentNode.children, k);
|
|
18048
|
+
h(M < k.parentNode.children.length - 1), h(!1);
|
|
18051
18049
|
}, [o]);
|
|
18052
18050
|
const m = (k) => {
|
|
18053
18051
|
k.preventDefault(), k.stopPropagation(), l(!1), c(!1), f(!1);
|
|
18054
|
-
const
|
|
18055
|
-
k.clientY <
|
|
18052
|
+
const M = k.currentTarget.getBoundingClientRect();
|
|
18053
|
+
k.clientY < M.y ? f(!0) : k.clientX < M.x ? l(!0) : c(!0);
|
|
18056
18054
|
}, x = (k) => {
|
|
18057
18055
|
y(k);
|
|
18058
18056
|
};
|
|
@@ -18138,40 +18136,38 @@ const Nf = () => /* @__PURE__ */ g.jsx(xs, { items: [{
|
|
|
18138
18136
|
}
|
|
18139
18137
|
), A0 = Ge(
|
|
18140
18138
|
function({ children: e, nodeProps: t, ...r }, s) {
|
|
18141
|
-
const o =
|
|
18142
|
-
const D =
|
|
18143
|
-
f(D > 0), h(D <
|
|
18139
|
+
const o = I(null), [i, l] = N(!1), [a, c] = N(!1), [u, f] = N(!1), [d, h] = N(!1), [p, y] = N(), m = (P) => {
|
|
18140
|
+
const D = P.scrollLeft, B = P.clientWidth, z = P.scrollWidth;
|
|
18141
|
+
f(D > 0), h(D < z - B * 1.5);
|
|
18144
18142
|
};
|
|
18145
18143
|
yi(() => !0), q(() => {
|
|
18146
|
-
c(t.node.childCount > 1), o.current && t.node.childCount > 1 &&
|
|
18144
|
+
y(t.getPos() + t.node.nodeSize - 1), c(t.node.childCount > 1), o.current && t.node.childCount > 1 && m(o.current);
|
|
18147
18145
|
}, [t, o]);
|
|
18148
|
-
const
|
|
18149
|
-
if (!
|
|
18150
|
-
const D = t.getPos(),
|
|
18151
|
-
|
|
18152
|
-
}),
|
|
18153
|
-
|
|
18154
|
-
|
|
18155
|
-
|
|
18156
|
-
}
|
|
18157
|
-
|
|
18158
|
-
|
|
18159
|
-
|
|
18160
|
-
|
|
18161
|
-
let E = o.current.scrollLeft + D * $;
|
|
18162
|
-
o.current.scrollLeft = E;
|
|
18146
|
+
const x = pe((P) => {
|
|
18147
|
+
if (!P) return;
|
|
18148
|
+
const D = t.getPos(), B = t.node.nodeSize;
|
|
18149
|
+
P.dispatch(P.state.tr.delete(D, D + B));
|
|
18150
|
+
}), k = () => {
|
|
18151
|
+
l(!0);
|
|
18152
|
+
}, M = (P) => {
|
|
18153
|
+
m(P.currentTarget);
|
|
18154
|
+
}, v = (P, D) => {
|
|
18155
|
+
if (P.stopPropagation(), !o.current) return;
|
|
18156
|
+
const B = o.current.clientWidth;
|
|
18157
|
+
let z = o.current.scrollLeft + D * B;
|
|
18158
|
+
o.current.scrollLeft = z;
|
|
18163
18159
|
};
|
|
18164
18160
|
return /* @__PURE__ */ g.jsxs("div", { ref: s, ...r, className: "carousel", children: [
|
|
18165
|
-
/* @__PURE__ */ g.jsx("div", { className: "carousel-list", ref: o, onScroll:
|
|
18161
|
+
/* @__PURE__ */ g.jsx("div", { className: "carousel-list", ref: o, onScroll: M, children: e }),
|
|
18166
18162
|
/* @__PURE__ */ g.jsxs("div", { className: "carousel-buttons", children: [
|
|
18167
|
-
/* @__PURE__ */ g.jsx("div", { onClick:
|
|
18168
|
-
/* @__PURE__ */ g.jsx("div", { onClick:
|
|
18163
|
+
/* @__PURE__ */ g.jsx("div", { onClick: x, className: "text-button", children: "Удалить карусель" }),
|
|
18164
|
+
/* @__PURE__ */ g.jsx("div", { onClick: k, children: /* @__PURE__ */ g.jsx(O.Plus, {}) })
|
|
18169
18165
|
] }),
|
|
18170
18166
|
a && /* @__PURE__ */ g.jsxs(g.Fragment, { children: [
|
|
18171
|
-
u && /* @__PURE__ */ g.jsx("div", { className: "carousel-prev", onClick: (
|
|
18172
|
-
d && /* @__PURE__ */ g.jsx("div", { className: "carousel-next", onClick: (
|
|
18167
|
+
u && /* @__PURE__ */ g.jsx("div", { className: "carousel-prev", onClick: (P) => v(P, -1), children: /* @__PURE__ */ g.jsx(O.ChevronLeft, {}) }),
|
|
18168
|
+
d && /* @__PURE__ */ g.jsx("div", { className: "carousel-next", onClick: (P) => v(P, 1), children: /* @__PURE__ */ g.jsx(O.ChevronRight, {}) })
|
|
18173
18169
|
] }),
|
|
18174
|
-
/* @__PURE__ */ g.jsx(wf, { isOpen: i, onClose: () => l(!1) })
|
|
18170
|
+
/* @__PURE__ */ g.jsx(wf, { pos: p, isOpen: i, onClose: () => l(!1) })
|
|
18175
18171
|
] });
|
|
18176
18172
|
}
|
|
18177
18173
|
), c1 = ({ content: n, onSave: e, onChange: t, onUpload: r }) => {
|
|
@@ -18246,7 +18242,7 @@ const Nf = () => /* @__PURE__ */ g.jsx(xs, { items: [{
|
|
|
18246
18242
|
};
|
|
18247
18243
|
return e(n.marks, n.text);
|
|
18248
18244
|
}, P0 = ({ node: n, className: e }) => /* @__PURE__ */ g.jsx("div", { className: e, children: Array.isArray(n.content) && n.content.map((t, r) => /* @__PURE__ */ g.jsx(G, { node: t }, r)) }), v0 = ({ node: n }) => {
|
|
18249
|
-
const e =
|
|
18245
|
+
const e = I(null), [t, r] = N(""), [s, o] = N(""), [i, l] = N(!1);
|
|
18250
18246
|
q(() => {
|
|
18251
18247
|
const c = () => {
|
|
18252
18248
|
l(!!document.fullscreenElement);
|
|
@@ -18327,9 +18323,9 @@ const Nf = () => /* @__PURE__ */ g.jsx(xs, { items: [{
|
|
|
18327
18323
|
t((i = n.attrs) != null && i.src ? `${(l = n.attrs) == null ? void 0 : l.src}` : ""), s((a = n.attrs) != null && a.title ? `${(c = n.attrs) == null ? void 0 : c.title}` : "");
|
|
18328
18324
|
}, [n]), bs(e) ? /* @__PURE__ */ g.jsx("div", { title: r, className: "video", children: /* @__PURE__ */ g.jsx("iframe", { src: e, allow: o }) }) : /* @__PURE__ */ g.jsx("div", { title: r, className: "image", children: /* @__PURE__ */ g.jsx("img", { src: ys }) });
|
|
18329
18325
|
}, H0 = () => /* @__PURE__ */ g.jsx("br", {}), J0 = ({ node: n }) => {
|
|
18330
|
-
const e =
|
|
18331
|
-
const x = m.scrollLeft, k = m.clientWidth,
|
|
18332
|
-
i(x > k / 2), a(x <
|
|
18326
|
+
const e = I(null), t = I(null), [r, s] = N(!1), [o, i] = N(!1), [l, a] = N(!1), [c, u] = N(1), [f, d] = N(1), h = (m) => {
|
|
18327
|
+
const x = m.scrollLeft, k = m.clientWidth, M = m.scrollWidth;
|
|
18328
|
+
i(x > k / 2), a(x < M - k * 1.5), u(Math.round(x / k + 1));
|
|
18333
18329
|
};
|
|
18334
18330
|
q(() => {
|
|
18335
18331
|
var m;
|
|
@@ -18352,8 +18348,8 @@ const Nf = () => /* @__PURE__ */ g.jsx(xs, { items: [{
|
|
|
18352
18348
|
}, y = (m, x) => {
|
|
18353
18349
|
if (m == null || m.stopPropagation(), !e.current) return;
|
|
18354
18350
|
const k = e.current.clientWidth;
|
|
18355
|
-
let
|
|
18356
|
-
e.current.scrollLeft =
|
|
18351
|
+
let M = e.current.scrollLeft + x * k;
|
|
18352
|
+
e.current.scrollLeft = M;
|
|
18357
18353
|
};
|
|
18358
18354
|
return Array.isArray(n.content) ? /* @__PURE__ */ g.jsxs("div", { className: "carousel", ref: t, children: [
|
|
18359
18355
|
/* @__PURE__ */ g.jsx("div", { className: "carousel-list", ref: e, onScroll: (m) => h(m.currentTarget), children: n.content.map((m, x) => /* @__PURE__ */ g.jsx(K0, { node: m, onClick: p }, x)) }),
|
|
@@ -18424,7 +18420,7 @@ const Nf = () => /* @__PURE__ */ g.jsx(xs, { items: [{
|
|
|
18424
18420
|
}
|
|
18425
18421
|
}, [n]), r ? /* @__PURE__ */ g.jsx("div", { className: "error", children: "ОШИБКА" }) : /* @__PURE__ */ g.jsx(G, { node: e, className: "ProseViewer" });
|
|
18426
18422
|
}, f1 = ({ content: n }) => {
|
|
18427
|
-
const e =
|
|
18423
|
+
const e = I(null), [t, r] = N(!1);
|
|
18428
18424
|
return q(() => {
|
|
18429
18425
|
var s;
|
|
18430
18426
|
try {
|