zt-react-milkdown 0.1.0 → 0.1.2
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/{dist-Cxaq2crg.js → commands-BJpevWrH.js} +123 -123
- package/dist/commands-BmZHd6RL.js +2 -0
- package/dist/{dist-CPVooDwj.cjs → commands-CM7IuhpT.cjs} +2 -2
- package/dist/commands-f4yOm8DQ.cjs +1 -0
- package/dist/{debounce-Bqj_3iJs.cjs → debounce-C_TNzOFT.cjs} +1 -1
- package/dist/{dist-DaM7GJv6.js → dist-CLTsQjPD.js} +319 -318
- package/dist/{dist-CxZn1qUo.js → dist-CZTw9GLV.js} +198 -198
- package/dist/dist-DQnWlYyo.cjs +5 -0
- package/dist/dist-ZPtYoqTI.cjs +1 -0
- package/dist/floating-ui.dom-CV-TLBRq.cjs +1 -0
- package/dist/floating-ui.dom-CoOubeUs.js +762 -0
- package/dist/index.cjs +25 -149
- package/dist/index.mjs +6235 -15737
- package/dist/{lib-C8xOD1Bp.cjs → lib-5pUyY-Tl.cjs} +1 -1
- package/dist/{lib-DkE7Uq2b.js → lib-Bhr5EVOu.js} +110 -112
- package/dist/lib-BmAQCwSQ.cjs +1 -0
- package/dist/{lib-wmHesNI0.js → lib-C1A-pN4b.js} +574 -575
- package/dist/lib-CVebEyb8.cjs +4 -0
- package/dist/lib-ChwoE6v5.js +331 -0
- package/dist/lib-DIx8C5AZ.cjs +1 -0
- package/dist/lib-DVE2k9i1.js +387 -0
- package/dist/{lib-DzK_kn7a.js → lib-D_0WAhKU.js} +3 -3
- package/dist/{lib-m8lKZKxK.js → lib-Dd20rlmV.js} +28 -28
- package/dist/lib-De0djIEV.cjs +5 -0
- package/dist/{lib-D4HMdvmK.cjs → lib-DgEwQN1U.cjs} +1 -1
- package/dist/{dist-Dhukmh4L.js → lib-DmD940Fq.js} +2849 -1735
- package/dist/lib-Dplx6t-N.cjs +3 -0
- package/dist/lib-DzY83R_P.cjs +39 -0
- package/dist/lib-F08NY8fk.cjs +1 -0
- package/dist/{lib-B0rHJ9lJ.js → lib-_NDReOAt.js} +3 -3
- package/dist/{lib-CK9MEMX-.js → lib-bsXGz3fj.js} +28 -27
- package/dist/schema-list-D9Q6QKgo.cjs +1 -0
- package/dist/schema-list-DooYP5HM.js +110 -0
- package/dist/src/core/createEditor.d.ts.map +1 -1
- package/dist/src/local/en-US.d.ts.map +1 -1
- package/dist/src/local/zh-CN.d.ts.map +1 -1
- package/dist/src/plugins/custom/block-transform/block-transform.d.ts +15 -0
- package/dist/src/plugins/custom/block-transform/block-transform.d.ts.map +1 -0
- package/dist/src/plugins/custom/block-transform/index.d.ts +2 -0
- package/dist/src/plugins/custom/block-transform/index.d.ts.map +1 -0
- package/dist/src/plugins/custom/math/index.d.ts +6 -0
- package/dist/src/plugins/custom/math/index.d.ts.map +1 -1
- package/dist/src/plugins/custom/math/math-block-editable.d.ts.map +1 -1
- package/dist/src/plugins/custom/math/math-inline-arrow-navigation.d.ts +5 -0
- package/dist/src/plugins/custom/math/math-inline-arrow-navigation.d.ts.map +1 -0
- package/dist/src/plugins/custom/math/math-inline-edit-plugin.d.ts +29 -0
- package/dist/src/plugins/custom/math/math-inline-edit-plugin.d.ts.map +1 -0
- package/dist/src/plugins/custom/math/math-inline-editable.d.ts +7 -0
- package/dist/src/plugins/custom/math/math-inline-editable.d.ts.map +1 -0
- package/dist/src/plugins/custom/math/math-plugin.d.ts.map +1 -1
- package/dist/src/plugins/custom/selection-tooltip/constants.d.ts +5 -1
- package/dist/src/plugins/custom/selection-tooltip/constants.d.ts.map +1 -1
- package/dist/src/plugins/custom/selection-tooltip/index.d.ts.map +1 -1
- package/dist/src/plugins/custom/selection-tooltip/tooltip-view.d.ts +34 -3
- package/dist/src/plugins/custom/selection-tooltip/tooltip-view.d.ts.map +1 -1
- package/dist/src/plugins/custom/selection-tooltip/types.d.ts +16 -1
- package/dist/src/plugins/custom/selection-tooltip/types.d.ts.map +1 -1
- package/dist/src/plugins/custom/slash-menu/slash-menu-commands.d.ts.map +1 -1
- package/dist/src/plugins/custom/slash-menu/slash-menu-logic.d.ts +4 -0
- package/dist/src/plugins/custom/slash-menu/slash-menu-logic.d.ts.map +1 -1
- package/dist/src/plugins/custom/slash-menu/slash-menu-view.d.ts.map +1 -1
- package/dist/src/plugins/custom/slash-menu/slash-menu.d.ts.map +1 -1
- package/dist/src/plugins/preset-common.d.ts +6 -0
- package/dist/src/plugins/preset-common.d.ts.map +1 -1
- package/dist/src/react/hooks/useMilkdownEditor.d.ts +2 -2
- package/dist/src/react/hooks/useMilkdownEditor.d.ts.map +1 -1
- package/dist/src/types/editor.d.ts +35 -5
- package/dist/src/types/editor.d.ts.map +1 -1
- package/dist/state-BC1dqWPQ.cjs +1 -0
- package/dist/state-BvRk9kiK.cjs +0 -0
- package/dist/state-BvRk9kiK.js +0 -0
- package/dist/state-rTW_1XVf.js +3 -0
- package/dist/style.css +2 -2
- package/package.json +1 -1
- package/dist/commands-CDrea4WB.cjs +0 -1
- package/dist/commands-DoqeX5uJ.js +0 -36
- package/dist/dist-BCCSKc3M.cjs +0 -5
- package/dist/dist-C0PSMrs7.cjs +0 -37
- package/dist/dist-mOpTMw1E.cjs +0 -1
- package/dist/floating-ui.dom-CKbcbmJV.js +0 -883
- package/dist/floating-ui.dom-VaZZ2gzS.cjs +0 -1
- package/dist/index.browser-5LtNN9G9.cjs +0 -1
- package/dist/index.browser-D2DmEB8o.js +0 -26
- package/dist/lib-38nxOnTd.cjs +0 -4
- package/dist/lib-8Tr6mAln.cjs +0 -1
- package/dist/lib-BJgvZywM.cjs +0 -3
- package/dist/lib-BNOSyYeU.cjs +0 -3
- package/dist/lib-C5AzmhNY.cjs +0 -5
- package/dist/lib-CCUU16r8.js +0 -1081
- package/dist/lib-DWZA8C0h.cjs +0 -1
- package/dist/lib-Dbe-cVjv.js +0 -367
- package/dist/lib-IahjxPWM.cjs +0 -3
- package/dist/lib-r5eNG0sa.js +0 -754
- package/dist/rolldown-runtime-CerMd-t8.cjs +0 -1
- package/dist/rolldown-runtime-DnwLefa7.js +0 -23
- package/dist/schema-list-DSdBEAWW.js +0 -171
- package/dist/schema-list-bL8FNes5.cjs +0 -1
- package/dist/state-CHAiIqOA.cjs +0 -1
- package/dist/state-DNxqltZl.js +0 -16
- /package/dist/{debounce-Cuk3VGPr.js → debounce-Z8-khnlZ.js} +0 -0
|
@@ -64,7 +64,7 @@ e.prototype = {
|
|
|
64
64
|
return new e(n);
|
|
65
65
|
};
|
|
66
66
|
//#endregion
|
|
67
|
-
//#region node_modules/.pnpm/prosemirror-model@1.25.
|
|
67
|
+
//#region node_modules/.pnpm/prosemirror-model@1.25.7/node_modules/prosemirror-model/dist/index.js
|
|
68
68
|
function t(e, n, r) {
|
|
69
69
|
for (let i = 0;; i++) {
|
|
70
70
|
if (i == e.childCount || i == n.childCount) return e.childCount == n.childCount ? null : r;
|
|
@@ -226,7 +226,7 @@ var r = class e {
|
|
|
226
226
|
static fromJSON(t, n) {
|
|
227
227
|
if (!n) return e.empty;
|
|
228
228
|
if (!Array.isArray(n)) throw RangeError("Invalid input for Fragment.fromJSON");
|
|
229
|
-
return
|
|
229
|
+
return e.fromArray(n.map(t.nodeFromJSON));
|
|
230
230
|
}
|
|
231
231
|
static fromArray(t) {
|
|
232
232
|
if (!t.length) return e.empty;
|
|
@@ -330,7 +330,7 @@ var c = class extends Error {}, l = class e {
|
|
|
330
330
|
return this.content.size - this.openStart - this.openEnd;
|
|
331
331
|
}
|
|
332
332
|
insertAt(t, n) {
|
|
333
|
-
let r = d(this.content, t + this.openStart, n);
|
|
333
|
+
let r = d(this.content, t + this.openStart, n, this.openStart + 1, this.openEnd + 1);
|
|
334
334
|
return r && new e(r, this.openStart, this.openEnd);
|
|
335
335
|
}
|
|
336
336
|
removeBetween(t, n) {
|
|
@@ -370,11 +370,11 @@ function u(e, t, n) {
|
|
|
370
370
|
if (r != o) throw RangeError("Removing non-flat range");
|
|
371
371
|
return e.replaceChild(r, a.copy(u(a.content, t - i - 1, n - i - 1)));
|
|
372
372
|
}
|
|
373
|
-
function d(e, t, n, r) {
|
|
374
|
-
let { index:
|
|
375
|
-
if (
|
|
376
|
-
let
|
|
377
|
-
return
|
|
373
|
+
function d(e, t, n, r, i, a) {
|
|
374
|
+
let { index: o, offset: s } = e.findIndex(t), c = e.maybeChild(o);
|
|
375
|
+
if (s == t || c.isText) return a && r <= 0 && i <= 0 && !a.canReplace(o, o, n) ? null : e.cut(0, t).append(n).append(e.cut(t));
|
|
376
|
+
let l = d(c.content, t - s - 1, n, o == 0 ? r - 1 : 0, o == e.childCount - 1 ? i - 1 : 0, c);
|
|
377
|
+
return l && e.replaceChild(o, c.copy(l));
|
|
378
378
|
}
|
|
379
379
|
function f(e, t, n) {
|
|
380
380
|
if (n.openStart > e.depth) throw new c("Inserted content deeper than insertion position");
|
|
@@ -1123,10 +1123,10 @@ function Te(e, t, n, r) {
|
|
|
1123
1123
|
}
|
|
1124
1124
|
function Ee(e, t) {
|
|
1125
1125
|
let n = Object.create(null);
|
|
1126
|
-
if (t) for (let r in t) n[r] = new
|
|
1126
|
+
if (t) for (let r in t) n[r] = new ke(e, r, t[r]);
|
|
1127
1127
|
return n;
|
|
1128
1128
|
}
|
|
1129
|
-
var
|
|
1129
|
+
var De = class e {
|
|
1130
1130
|
constructor(e, t, n) {
|
|
1131
1131
|
this.name = e, this.schema = t, this.spec = n, this.markSet = null, this.groups = n.group ? n.group.split(" ") : [], this.attrs = Ee(e, n.attrs), this.defaultAttrs = Ce(this.attrs), this.contentMatch = null, this.inlineContent = null, this.isBlock = !(n.inline || e == "text"), this.isText = e == "text";
|
|
1132
1132
|
}
|
|
@@ -1210,21 +1210,21 @@ var S = class e {
|
|
|
1210
1210
|
return r;
|
|
1211
1211
|
}
|
|
1212
1212
|
};
|
|
1213
|
-
function
|
|
1213
|
+
function Oe(e, t, n) {
|
|
1214
1214
|
let r = n.split("|");
|
|
1215
1215
|
return (n) => {
|
|
1216
1216
|
let i = n === null ? "null" : typeof n;
|
|
1217
1217
|
if (r.indexOf(i) < 0) throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`);
|
|
1218
1218
|
};
|
|
1219
1219
|
}
|
|
1220
|
-
var
|
|
1220
|
+
var ke = class {
|
|
1221
1221
|
constructor(e, t, n) {
|
|
1222
|
-
this.hasDefault = Object.prototype.hasOwnProperty.call(n, "default"), this.default = n.default, this.validate = typeof n.validate == "string" ?
|
|
1222
|
+
this.hasDefault = Object.prototype.hasOwnProperty.call(n, "default"), this.default = n.default, this.validate = typeof n.validate == "string" ? Oe(e, t, n.validate) : n.validate;
|
|
1223
1223
|
}
|
|
1224
1224
|
get isRequired() {
|
|
1225
1225
|
return !this.hasDefault;
|
|
1226
1226
|
}
|
|
1227
|
-
},
|
|
1227
|
+
}, Ae = class e {
|
|
1228
1228
|
constructor(e, t, n, r) {
|
|
1229
1229
|
this.name = e, this.rank = t, this.schema = n, this.spec = r, this.attrs = Ee(e, r.attrs), this.excluded = null;
|
|
1230
1230
|
let i = Ce(this.attrs);
|
|
@@ -1250,12 +1250,12 @@ var Oe = class {
|
|
|
1250
1250
|
excludes(e) {
|
|
1251
1251
|
return this.excluded.indexOf(e) > -1;
|
|
1252
1252
|
}
|
|
1253
|
-
},
|
|
1253
|
+
}, je = class {
|
|
1254
1254
|
constructor(t) {
|
|
1255
1255
|
this.linebreakReplacement = null, this.cached = Object.create(null);
|
|
1256
1256
|
let n = this.spec = {};
|
|
1257
1257
|
for (let e in t) n[e] = t[e];
|
|
1258
|
-
n.nodes = e.from(t.nodes), n.marks = e.from(t.marks || {}), this.nodes =
|
|
1258
|
+
n.nodes = e.from(t.nodes), n.marks = e.from(t.marks || {}), this.nodes = De.compile(this.spec.nodes, this), this.marks = Ae.compile(this.spec.marks, this);
|
|
1259
1259
|
let r = Object.create(null);
|
|
1260
1260
|
for (let e in this.nodes) {
|
|
1261
1261
|
if (e in this.marks) throw RangeError(e + " can not be both a node and a mark");
|
|
@@ -1265,17 +1265,17 @@ var Oe = class {
|
|
|
1265
1265
|
if (!t.isInline || !t.isLeaf) throw RangeError("Linebreak replacement nodes must be inline leaf nodes");
|
|
1266
1266
|
this.linebreakReplacement = t;
|
|
1267
1267
|
}
|
|
1268
|
-
t.markSet = i == "_" ? null : i ?
|
|
1268
|
+
t.markSet = i == "_" ? null : i ? Me(this, i.split(" ")) : i == "" || !t.inlineContent ? [] : null;
|
|
1269
1269
|
}
|
|
1270
1270
|
for (let e in this.marks) {
|
|
1271
1271
|
let t = this.marks[e], n = t.spec.excludes;
|
|
1272
|
-
t.excluded = n == null ? [t] : n == "" ? [] :
|
|
1272
|
+
t.excluded = n == null ? [t] : n == "" ? [] : Me(this, n.split(" "));
|
|
1273
1273
|
}
|
|
1274
1274
|
this.nodeFromJSON = (e) => b.fromJSON(this, e), this.markFromJSON = (e) => s.fromJSON(this, e), this.topNodeType = this.nodes[this.spec.topNode || "doc"], this.cached.wrappings = Object.create(null);
|
|
1275
1275
|
}
|
|
1276
1276
|
node(e, t = null, n, r) {
|
|
1277
1277
|
if (typeof e == "string") e = this.nodeType(e);
|
|
1278
|
-
else if (!(e instanceof
|
|
1278
|
+
else if (!(e instanceof De)) throw RangeError("Invalid node type: " + e);
|
|
1279
1279
|
else if (e.schema != this) throw RangeError("Node type from different schema used (" + e.name + ")");
|
|
1280
1280
|
return e.createChecked(t, n, r);
|
|
1281
1281
|
}
|
|
@@ -1292,7 +1292,7 @@ var Oe = class {
|
|
|
1292
1292
|
return t;
|
|
1293
1293
|
}
|
|
1294
1294
|
};
|
|
1295
|
-
function
|
|
1295
|
+
function Me(e, t) {
|
|
1296
1296
|
let n = [];
|
|
1297
1297
|
for (let r = 0; r < t.length; r++) {
|
|
1298
1298
|
let i = t[r], a = e.marks[i], o = a;
|
|
@@ -1305,19 +1305,19 @@ function je(e, t) {
|
|
|
1305
1305
|
}
|
|
1306
1306
|
return n;
|
|
1307
1307
|
}
|
|
1308
|
-
function
|
|
1308
|
+
function Ne(e) {
|
|
1309
1309
|
return e.tag != null;
|
|
1310
1310
|
}
|
|
1311
|
-
function
|
|
1311
|
+
function Pe(e) {
|
|
1312
1312
|
return e.style != null;
|
|
1313
1313
|
}
|
|
1314
|
-
var
|
|
1314
|
+
var Fe = class e {
|
|
1315
1315
|
constructor(e, t) {
|
|
1316
1316
|
this.schema = e, this.rules = t, this.tags = [], this.styles = [];
|
|
1317
1317
|
let n = this.matchedStyles = [];
|
|
1318
1318
|
t.forEach((e) => {
|
|
1319
|
-
if (
|
|
1320
|
-
else if (
|
|
1319
|
+
if (Ne(e)) this.tags.push(e);
|
|
1320
|
+
else if (Pe(e)) {
|
|
1321
1321
|
let t = /[^=]*/.exec(e.style)[0];
|
|
1322
1322
|
n.indexOf(t) < 0 && n.push(t), this.styles.push(e);
|
|
1323
1323
|
}
|
|
@@ -1328,17 +1328,17 @@ var Pe = class e {
|
|
|
1328
1328
|
});
|
|
1329
1329
|
}
|
|
1330
1330
|
parse(e, t = {}) {
|
|
1331
|
-
let n = new
|
|
1331
|
+
let n = new Ve(this, t, !1);
|
|
1332
1332
|
return n.addAll(e, s.none, t.from, t.to), n.finish();
|
|
1333
1333
|
}
|
|
1334
1334
|
parseSlice(e, t = {}) {
|
|
1335
|
-
let n = new
|
|
1335
|
+
let n = new Ve(this, t, !0);
|
|
1336
1336
|
return n.addAll(e, s.none, t.from, t.to), l.maxOpen(n.finish());
|
|
1337
1337
|
}
|
|
1338
1338
|
matchTag(e, t, n) {
|
|
1339
1339
|
for (let r = n ? this.tags.indexOf(n) + 1 : 0; r < this.tags.length; r++) {
|
|
1340
1340
|
let n = this.tags[r];
|
|
1341
|
-
if (
|
|
1341
|
+
if (Ue(e, n.tag) && (n.namespace === void 0 || e.namespaceURI == n.namespace) && (!n.context || t.matchesContext(n.context))) {
|
|
1342
1342
|
if (n.getAttrs) {
|
|
1343
1343
|
let t = n.getAttrs(e);
|
|
1344
1344
|
if (t === !1) continue;
|
|
@@ -1374,13 +1374,13 @@ var Pe = class e {
|
|
|
1374
1374
|
for (let t in e.marks) {
|
|
1375
1375
|
let r = e.marks[t].spec.parseDOM;
|
|
1376
1376
|
r && r.forEach((e) => {
|
|
1377
|
-
n(e =
|
|
1377
|
+
n(e = We(e)), e.mark || e.ignore || e.clearMark || (e.mark = t);
|
|
1378
1378
|
});
|
|
1379
1379
|
}
|
|
1380
1380
|
for (let t in e.nodes) {
|
|
1381
1381
|
let r = e.nodes[t].spec.parseDOM;
|
|
1382
1382
|
r && r.forEach((e) => {
|
|
1383
|
-
n(e =
|
|
1383
|
+
n(e = We(e)), e.node || e.ignore || e.mark || (e.node = t);
|
|
1384
1384
|
});
|
|
1385
1385
|
}
|
|
1386
1386
|
return t;
|
|
@@ -1388,7 +1388,7 @@ var Pe = class e {
|
|
|
1388
1388
|
static fromSchema(t) {
|
|
1389
1389
|
return t.cached.domParser || (t.cached.domParser = new e(t, e.schemaRules(t)));
|
|
1390
1390
|
}
|
|
1391
|
-
},
|
|
1391
|
+
}, Ie = {
|
|
1392
1392
|
address: !0,
|
|
1393
1393
|
article: !0,
|
|
1394
1394
|
aside: !0,
|
|
@@ -1421,23 +1421,23 @@ var Pe = class e {
|
|
|
1421
1421
|
table: !0,
|
|
1422
1422
|
tfoot: !0,
|
|
1423
1423
|
ul: !0
|
|
1424
|
-
},
|
|
1424
|
+
}, Le = {
|
|
1425
1425
|
head: !0,
|
|
1426
1426
|
noscript: !0,
|
|
1427
1427
|
object: !0,
|
|
1428
1428
|
script: !0,
|
|
1429
1429
|
style: !0,
|
|
1430
1430
|
title: !0
|
|
1431
|
-
},
|
|
1431
|
+
}, Re = {
|
|
1432
1432
|
ol: !0,
|
|
1433
1433
|
ul: !0
|
|
1434
|
-
},
|
|
1435
|
-
function
|
|
1436
|
-
return t == null ? e && e.whitespace == "pre" ?
|
|
1434
|
+
}, S = 1, ze = 2, C = 4;
|
|
1435
|
+
function Be(e, t, n) {
|
|
1436
|
+
return t == null ? e && e.whitespace == "pre" ? 3 : n & -5 : (t ? S : 0) | (t === "full" ? ze : 0);
|
|
1437
1437
|
}
|
|
1438
|
-
var
|
|
1438
|
+
var w = class {
|
|
1439
1439
|
constructor(e, t, n, r, i, a) {
|
|
1440
|
-
this.type = e, this.attrs = t, this.marks = n, this.solid = r, this.options = a, this.content = [], this.activeMarks = s.none, this.match = i || (a &
|
|
1440
|
+
this.type = e, this.attrs = t, this.marks = n, this.solid = r, this.options = a, this.content = [], this.activeMarks = s.none, this.match = i || (a & C ? null : e.contentMatch);
|
|
1441
1441
|
}
|
|
1442
1442
|
findWrapping(e) {
|
|
1443
1443
|
if (!this.match) {
|
|
@@ -1452,7 +1452,7 @@ var E = class {
|
|
|
1452
1452
|
return this.match.findWrapping(e.type);
|
|
1453
1453
|
}
|
|
1454
1454
|
finish(e) {
|
|
1455
|
-
if (!(this.options &
|
|
1455
|
+
if (!(this.options & S)) {
|
|
1456
1456
|
let e = this.content[this.content.length - 1], t;
|
|
1457
1457
|
if (e && e.isText && (t = /[ \t\r\n\u000c]+$/.exec(e.text))) {
|
|
1458
1458
|
let n = e;
|
|
@@ -1463,13 +1463,13 @@ var E = class {
|
|
|
1463
1463
|
return !e && this.match && (t = t.append(this.match.fillBefore(r.empty, !0))), this.type ? this.type.create(this.attrs, t, this.marks) : t;
|
|
1464
1464
|
}
|
|
1465
1465
|
inlineContext(e) {
|
|
1466
|
-
return this.type ? this.type.inlineContent : this.content.length ? this.content[0].isInline : e.parentNode && !
|
|
1466
|
+
return this.type ? this.type.inlineContent : this.content.length ? this.content[0].isInline : e.parentNode && !Ie.hasOwnProperty(e.parentNode.nodeName.toLowerCase());
|
|
1467
1467
|
}
|
|
1468
|
-
},
|
|
1468
|
+
}, Ve = class {
|
|
1469
1469
|
constructor(e, t, n) {
|
|
1470
1470
|
this.parser = e, this.options = t, this.isOpen = n, this.open = 0, this.localPreserveWS = !1;
|
|
1471
|
-
let r = t.topNode, i, a =
|
|
1472
|
-
i = r ? new
|
|
1471
|
+
let r = t.topNode, i, a = Be(null, t.preserveWhitespace, 0) | (n ? C : 0);
|
|
1472
|
+
i = r ? new w(r.type, r.attrs, s.none, !0, t.topMatch || r.type.contentMatch, a) : n ? new w(null, null, s.none, !0, null, a) : new w(e.schema.topNodeType, null, s.none, !0, null, a), this.nodes = [i], this.find = t.findPositions, this.needsBlock = !1;
|
|
1473
1473
|
}
|
|
1474
1474
|
get top() {
|
|
1475
1475
|
return this.nodes[this.open];
|
|
@@ -1478,7 +1478,7 @@ var E = class {
|
|
|
1478
1478
|
e.nodeType == 3 ? this.addTextNode(e, t) : e.nodeType == 1 && this.addElement(e, t);
|
|
1479
1479
|
}
|
|
1480
1480
|
addTextNode(e, t) {
|
|
1481
|
-
let n = e.nodeValue, r = this.top, i = r.options &
|
|
1481
|
+
let n = e.nodeValue, r = this.top, i = r.options & ze ? "full" : this.localPreserveWS || (r.options & S) > 0, { schema: a } = this.parser;
|
|
1482
1482
|
if (i === "full" || r.inlineContext(e) || /[^ \t\r\n\u000c]/.test(n)) {
|
|
1483
1483
|
if (!i) {
|
|
1484
1484
|
if (n = n.replace(/[ \t\r\n\u000c]+/g, " "), /^[ \t\r\n\u000c]/.test(n) && this.open == this.nodes.length - 1) {
|
|
@@ -1498,13 +1498,13 @@ var E = class {
|
|
|
1498
1498
|
let r = this.localPreserveWS, i = this.top;
|
|
1499
1499
|
(e.tagName == "PRE" || /pre/.test(e.style && e.style.whiteSpace)) && (this.localPreserveWS = !0);
|
|
1500
1500
|
let a = e.nodeName.toLowerCase(), o;
|
|
1501
|
-
|
|
1501
|
+
Re.hasOwnProperty(a) && this.parser.normalizeLists && He(e);
|
|
1502
1502
|
let s = this.options.ruleFromNode && this.options.ruleFromNode(e) || (o = this.parser.matchTag(e, this, n));
|
|
1503
|
-
out: if (s ? s.ignore :
|
|
1503
|
+
out: if (s ? s.ignore : Le.hasOwnProperty(a)) this.findInside(e), this.ignoreFallback(e, t);
|
|
1504
1504
|
else if (!s || s.skip || s.closeParent) {
|
|
1505
1505
|
s && s.closeParent ? this.open = Math.max(0, this.open - 1) : s && s.skip.nodeType && (e = s.skip);
|
|
1506
1506
|
let n, r = this.needsBlock;
|
|
1507
|
-
if (
|
|
1507
|
+
if (Ie.hasOwnProperty(a)) i.content.length && i.content[0].isInline && this.open && (this.open--, i = this.top), n = !0, i.type || (this.needsBlock = !0);
|
|
1508
1508
|
else if (!e.firstChild) {
|
|
1509
1509
|
this.leafFallback(e, t);
|
|
1510
1510
|
break out;
|
|
@@ -1589,7 +1589,7 @@ var E = class {
|
|
|
1589
1589
|
let t = this.top;
|
|
1590
1590
|
t.match &&= t.match.matchType(e.type);
|
|
1591
1591
|
let n = s.none;
|
|
1592
|
-
for (let i of r.concat(e.marks)) (t.type ? t.type.allowsMarkType(i.type) :
|
|
1592
|
+
for (let i of r.concat(e.marks)) (t.type ? t.type.allowsMarkType(i.type) : Ge(i.type, e.type)) && (n = i.addToSet(n));
|
|
1593
1593
|
return t.content.push(e.mark(n)), !0;
|
|
1594
1594
|
}
|
|
1595
1595
|
return !1;
|
|
@@ -1602,10 +1602,10 @@ var E = class {
|
|
|
1602
1602
|
this.closeExtra();
|
|
1603
1603
|
let a = this.top;
|
|
1604
1604
|
a.match = a.match && a.match.matchType(e);
|
|
1605
|
-
let o =
|
|
1606
|
-
a.options &
|
|
1605
|
+
let o = Be(e, i, a.options);
|
|
1606
|
+
a.options & C && a.content.length == 0 && (o |= C);
|
|
1607
1607
|
let c = s.none;
|
|
1608
|
-
return n = n.filter((t) => (a.type ? a.type.allowsMarkType(t.type) :
|
|
1608
|
+
return n = n.filter((t) => (a.type ? a.type.allowsMarkType(t.type) : Ge(t.type, e)) ? (c = t.addToSet(c), !1) : !0), this.nodes.push(new w(e, t, c, r, null, o)), this.open++, n;
|
|
1609
1609
|
}
|
|
1610
1610
|
closeExtra(e = !1) {
|
|
1611
1611
|
let t = this.nodes.length - 1;
|
|
@@ -1619,7 +1619,7 @@ var E = class {
|
|
|
1619
1619
|
}
|
|
1620
1620
|
sync(e) {
|
|
1621
1621
|
for (let t = this.open; t >= 0; t--) if (this.nodes[t] == e) return this.open = t, !0;
|
|
1622
|
-
else this.localPreserveWS && (this.nodes[t].options |=
|
|
1622
|
+
else this.localPreserveWS && (this.nodes[t].options |= S);
|
|
1623
1623
|
return !1;
|
|
1624
1624
|
}
|
|
1625
1625
|
get currentPos() {
|
|
@@ -1675,21 +1675,21 @@ var E = class {
|
|
|
1675
1675
|
}
|
|
1676
1676
|
}
|
|
1677
1677
|
};
|
|
1678
|
-
function
|
|
1678
|
+
function He(e) {
|
|
1679
1679
|
for (let t = e.firstChild, n = null; t; t = t.nextSibling) {
|
|
1680
1680
|
let e = t.nodeType == 1 ? t.nodeName.toLowerCase() : null;
|
|
1681
|
-
e &&
|
|
1681
|
+
e && Re.hasOwnProperty(e) && n ? (n.appendChild(t), t = n) : e == "li" ? n = t : e && (n = null);
|
|
1682
1682
|
}
|
|
1683
1683
|
}
|
|
1684
|
-
function
|
|
1684
|
+
function Ue(e, t) {
|
|
1685
1685
|
return (e.matches || e.msMatchesSelector || e.webkitMatchesSelector || e.mozMatchesSelector).call(e, t);
|
|
1686
1686
|
}
|
|
1687
|
-
function
|
|
1687
|
+
function We(e) {
|
|
1688
1688
|
let t = {};
|
|
1689
1689
|
for (let n in e) t[n] = e[n];
|
|
1690
1690
|
return t;
|
|
1691
1691
|
}
|
|
1692
|
-
function
|
|
1692
|
+
function Ge(e, t) {
|
|
1693
1693
|
let n = t.schema.nodes;
|
|
1694
1694
|
for (let r in n) {
|
|
1695
1695
|
let i = n[r];
|
|
@@ -1704,12 +1704,12 @@ function Ue(e, t) {
|
|
|
1704
1704
|
if (o(i.contentMatch)) return !0;
|
|
1705
1705
|
}
|
|
1706
1706
|
}
|
|
1707
|
-
var
|
|
1707
|
+
var Ke = class e {
|
|
1708
1708
|
constructor(e, t) {
|
|
1709
1709
|
this.nodes = e, this.marks = t;
|
|
1710
1710
|
}
|
|
1711
1711
|
serializeFragment(e, t = {}, n) {
|
|
1712
|
-
n ||=
|
|
1712
|
+
n ||= T(t).createDocumentFragment();
|
|
1713
1713
|
let r = n, i = [];
|
|
1714
1714
|
return e.forEach((e) => {
|
|
1715
1715
|
if (i.length || e.marks.length) {
|
|
@@ -1733,7 +1733,8 @@ var We = class e {
|
|
|
1733
1733
|
}), n;
|
|
1734
1734
|
}
|
|
1735
1735
|
serializeNodeInner(e, t) {
|
|
1736
|
-
|
|
1736
|
+
if (e.isText) return T(t).createTextNode(e.text);
|
|
1737
|
+
let { dom: n, contentDOM: r } = E(T(t), this.nodes[e.type.name](e), null, e.attrs);
|
|
1737
1738
|
if (r) {
|
|
1738
1739
|
if (e.isLeaf) throw RangeError("Content hole not allowed in a leaf node spec");
|
|
1739
1740
|
this.serializeFragment(e.content, t, r);
|
|
@@ -1750,23 +1751,23 @@ var We = class e {
|
|
|
1750
1751
|
}
|
|
1751
1752
|
serializeMark(e, t, n = {}) {
|
|
1752
1753
|
let r = this.marks[e.type.name];
|
|
1753
|
-
return r &&
|
|
1754
|
+
return r && E(T(n), r(e, t), null, e.attrs);
|
|
1754
1755
|
}
|
|
1755
1756
|
static renderSpec(e, t, n = null, r) {
|
|
1756
|
-
return
|
|
1757
|
+
return typeof t == "string" ? { dom: e.createTextNode(t) } : E(e, t, n, r);
|
|
1757
1758
|
}
|
|
1758
1759
|
static fromSchema(t) {
|
|
1759
1760
|
return t.cached.domSerializer || (t.cached.domSerializer = new e(this.nodesFromSchema(t), this.marksFromSchema(t)));
|
|
1760
1761
|
}
|
|
1761
1762
|
static nodesFromSchema(e) {
|
|
1762
|
-
let t =
|
|
1763
|
+
let t = qe(e.nodes);
|
|
1763
1764
|
return t.text ||= (e) => e.text, t;
|
|
1764
1765
|
}
|
|
1765
1766
|
static marksFromSchema(e) {
|
|
1766
|
-
return
|
|
1767
|
+
return qe(e.marks);
|
|
1767
1768
|
}
|
|
1768
1769
|
};
|
|
1769
|
-
function
|
|
1770
|
+
function qe(e) {
|
|
1770
1771
|
let t = {};
|
|
1771
1772
|
for (let n in e) {
|
|
1772
1773
|
let r = e[n].spec.toDOM;
|
|
@@ -1774,15 +1775,15 @@ function Ge(e) {
|
|
|
1774
1775
|
}
|
|
1775
1776
|
return t;
|
|
1776
1777
|
}
|
|
1777
|
-
function
|
|
1778
|
+
function T(e) {
|
|
1778
1779
|
return e.document || window.document;
|
|
1779
1780
|
}
|
|
1780
|
-
var
|
|
1781
|
-
function
|
|
1782
|
-
let t =
|
|
1783
|
-
return t === void 0 &&
|
|
1781
|
+
var Je = /* @__PURE__ */ new WeakMap();
|
|
1782
|
+
function Ye(e) {
|
|
1783
|
+
let t = Je.get(e);
|
|
1784
|
+
return t === void 0 && Je.set(e, t = Xe(e)), t;
|
|
1784
1785
|
}
|
|
1785
|
-
function
|
|
1786
|
+
function Xe(e) {
|
|
1786
1787
|
let t = null;
|
|
1787
1788
|
function n(e) {
|
|
1788
1789
|
if (e && typeof e == "object") if (Array.isArray(e)) if (typeof e[0] == "string") t ||= [], t.push(e);
|
|
@@ -1791,13 +1792,12 @@ function Je(e) {
|
|
|
1791
1792
|
}
|
|
1792
1793
|
return n(e), t;
|
|
1793
1794
|
}
|
|
1794
|
-
function
|
|
1795
|
-
if (
|
|
1796
|
-
if (t.nodeType
|
|
1797
|
-
if (t.dom && t.dom.nodeType != null) return t;
|
|
1795
|
+
function E(e, t, n, r) {
|
|
1796
|
+
if (t.nodeType == 1) return { dom: t };
|
|
1797
|
+
if (t.dom && t.dom.nodeType == 1) return t;
|
|
1798
1798
|
let i = t[0], a;
|
|
1799
1799
|
if (typeof i != "string") throw RangeError("Invalid array passed to renderSpec");
|
|
1800
|
-
if (r && (a =
|
|
1800
|
+
if (r && (a = Ye(r)) && a.indexOf(t) > -1) throw RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");
|
|
1801
1801
|
let o = i.indexOf(" ");
|
|
1802
1802
|
o > 0 && (n = i.slice(0, o), i = i.slice(o + 1));
|
|
1803
1803
|
let s, c = n ? e.createElementNS(n, i) : e.createElement(i), l = t[1], u = 1;
|
|
@@ -1816,8 +1816,9 @@ function O(e, t, n, r) {
|
|
|
1816
1816
|
dom: c,
|
|
1817
1817
|
contentDOM: c
|
|
1818
1818
|
};
|
|
1819
|
-
} else
|
|
1820
|
-
|
|
1819
|
+
} else if (typeof a == "string") c.appendChild(e.createTextNode(a));
|
|
1820
|
+
else {
|
|
1821
|
+
let { dom: t, contentDOM: i } = E(e, a, n, r);
|
|
1821
1822
|
if (c.appendChild(t), i) {
|
|
1822
1823
|
if (s) throw RangeError("Multiple content holes");
|
|
1823
1824
|
s = i;
|
|
@@ -1831,40 +1832,40 @@ function O(e, t, n, r) {
|
|
|
1831
1832
|
}
|
|
1832
1833
|
//#endregion
|
|
1833
1834
|
//#region node_modules/.pnpm/prosemirror-transform@1.12.0/node_modules/prosemirror-transform/dist/index.js
|
|
1834
|
-
var
|
|
1835
|
-
function
|
|
1836
|
-
return e + t *
|
|
1835
|
+
var Ze = 65535, Qe = 2 ** 16;
|
|
1836
|
+
function $e(e, t) {
|
|
1837
|
+
return e + t * Qe;
|
|
1837
1838
|
}
|
|
1838
|
-
function
|
|
1839
|
-
return e &
|
|
1839
|
+
function et(e) {
|
|
1840
|
+
return e & Ze;
|
|
1840
1841
|
}
|
|
1841
|
-
function
|
|
1842
|
-
return (e - (e &
|
|
1842
|
+
function tt(e) {
|
|
1843
|
+
return (e - (e & Ze)) / Qe;
|
|
1843
1844
|
}
|
|
1844
|
-
var
|
|
1845
|
+
var nt = 1, rt = 2, it = 4, at = 8, D = class {
|
|
1845
1846
|
constructor(e, t, n) {
|
|
1846
1847
|
this.pos = e, this.delInfo = t, this.recover = n;
|
|
1847
1848
|
}
|
|
1848
1849
|
get deleted() {
|
|
1849
|
-
return (this.delInfo &
|
|
1850
|
+
return (this.delInfo & at) > 0;
|
|
1850
1851
|
}
|
|
1851
1852
|
get deletedBefore() {
|
|
1852
|
-
return (this.delInfo &
|
|
1853
|
+
return (this.delInfo & 5) > 0;
|
|
1853
1854
|
}
|
|
1854
1855
|
get deletedAfter() {
|
|
1855
|
-
return (this.delInfo &
|
|
1856
|
+
return (this.delInfo & 6) > 0;
|
|
1856
1857
|
}
|
|
1857
1858
|
get deletedAcross() {
|
|
1858
|
-
return (this.delInfo &
|
|
1859
|
+
return (this.delInfo & it) > 0;
|
|
1859
1860
|
}
|
|
1860
|
-
},
|
|
1861
|
+
}, O = class e {
|
|
1861
1862
|
constructor(t, n = !1) {
|
|
1862
1863
|
if (this.ranges = t, this.inverted = n, !t.length && e.empty) return e.empty;
|
|
1863
1864
|
}
|
|
1864
1865
|
recover(e) {
|
|
1865
|
-
let t = 0, n =
|
|
1866
|
+
let t = 0, n = et(e);
|
|
1866
1867
|
if (!this.inverted) for (let e = 0; e < n; e++) t += this.ranges[e * 3 + 2] - this.ranges[e * 3 + 1];
|
|
1867
|
-
return this.ranges[n * 3] + t +
|
|
1868
|
+
return this.ranges[n * 3] + t + tt(e);
|
|
1868
1869
|
}
|
|
1869
1870
|
mapResult(e, t = 1) {
|
|
1870
1871
|
return this._map(e, t, !1);
|
|
@@ -1881,15 +1882,15 @@ var et = 1, tt = 2, k = 4, nt = 8, rt = class {
|
|
|
1881
1882
|
if (e <= u) {
|
|
1882
1883
|
let i = c ? e == s ? -1 : e == u ? 1 : t : t, a = s + r + (i < 0 ? 0 : l);
|
|
1883
1884
|
if (n) return a;
|
|
1884
|
-
let d = e == (t < 0 ? s : u) ? null :
|
|
1885
|
-
return (t < 0 ? e != s : e != u) && (f |=
|
|
1885
|
+
let d = e == (t < 0 ? s : u) ? null : $e(o / 3, e - s), f = e == s ? rt : e == u ? nt : it;
|
|
1886
|
+
return (t < 0 ? e != s : e != u) && (f |= at), new D(a, f, d);
|
|
1886
1887
|
}
|
|
1887
1888
|
r += l - c;
|
|
1888
1889
|
}
|
|
1889
|
-
return n ? e + r : new
|
|
1890
|
+
return n ? e + r : new D(e + r, 0, null);
|
|
1890
1891
|
}
|
|
1891
1892
|
touches(e, t) {
|
|
1892
|
-
let n = 0, r =
|
|
1893
|
+
let n = 0, r = et(t), i = this.inverted ? 2 : 1, a = this.inverted ? 1 : 2;
|
|
1893
1894
|
for (let t = 0; t < this.ranges.length; t += 3) {
|
|
1894
1895
|
let o = this.ranges[t] - (this.inverted ? n : 0);
|
|
1895
1896
|
if (o > e) break;
|
|
@@ -1924,8 +1925,8 @@ var et = 1, tt = 2, k = 4, nt = 8, rt = class {
|
|
|
1924
1925
|
]);
|
|
1925
1926
|
}
|
|
1926
1927
|
};
|
|
1927
|
-
|
|
1928
|
-
var
|
|
1928
|
+
O.empty = new O([]);
|
|
1929
|
+
var ot = class e {
|
|
1929
1930
|
constructor(e, t, n = 0, r = e ? e.length : 0) {
|
|
1930
1931
|
this.mirror = t, this.from = n, this.to = r, this._maps = e || [], this.ownData = !(e || t);
|
|
1931
1932
|
}
|
|
@@ -1983,26 +1984,26 @@ var it = class e {
|
|
|
1983
1984
|
}
|
|
1984
1985
|
r |= i.delInfo, e = i.pos;
|
|
1985
1986
|
}
|
|
1986
|
-
return n ? e : new
|
|
1987
|
+
return n ? e : new D(e, r, null);
|
|
1987
1988
|
}
|
|
1988
|
-
},
|
|
1989
|
+
}, k = Object.create(null), A = class {
|
|
1989
1990
|
getMap() {
|
|
1990
|
-
return
|
|
1991
|
+
return O.empty;
|
|
1991
1992
|
}
|
|
1992
1993
|
merge(e) {
|
|
1993
1994
|
return null;
|
|
1994
1995
|
}
|
|
1995
1996
|
static fromJSON(e, t) {
|
|
1996
1997
|
if (!t || !t.stepType) throw RangeError("Invalid input for Step.fromJSON");
|
|
1997
|
-
let n =
|
|
1998
|
+
let n = k[t.stepType];
|
|
1998
1999
|
if (!n) throw RangeError(`No step type ${t.stepType} defined`);
|
|
1999
2000
|
return n.fromJSON(e, t);
|
|
2000
2001
|
}
|
|
2001
2002
|
static jsonID(e, t) {
|
|
2002
|
-
if (e in
|
|
2003
|
-
return
|
|
2003
|
+
if (e in k) throw RangeError("Duplicate use of step JSON ID " + e);
|
|
2004
|
+
return k[e] = t, t.prototype.jsonID = e, t;
|
|
2004
2005
|
}
|
|
2005
|
-
},
|
|
2006
|
+
}, j = class e {
|
|
2006
2007
|
constructor(e, t) {
|
|
2007
2008
|
this.doc = e, this.failed = t;
|
|
2008
2009
|
}
|
|
@@ -2021,24 +2022,24 @@ var it = class e {
|
|
|
2021
2022
|
}
|
|
2022
2023
|
}
|
|
2023
2024
|
};
|
|
2024
|
-
function
|
|
2025
|
+
function M(e, t, n) {
|
|
2025
2026
|
let i = [];
|
|
2026
2027
|
for (let r = 0; r < e.childCount; r++) {
|
|
2027
2028
|
let a = e.child(r);
|
|
2028
|
-
a.content.size && (a = a.copy(
|
|
2029
|
+
a.content.size && (a = a.copy(M(a.content, t, a))), a.isInline && (a = t(a, n, r)), i.push(a);
|
|
2029
2030
|
}
|
|
2030
2031
|
return r.fromArray(i);
|
|
2031
2032
|
}
|
|
2032
|
-
var
|
|
2033
|
+
var N = class e extends A {
|
|
2033
2034
|
constructor(e, t, n) {
|
|
2034
2035
|
super(), this.from = e, this.to = t, this.mark = n;
|
|
2035
2036
|
}
|
|
2036
2037
|
apply(e) {
|
|
2037
|
-
let t = e.slice(this.from, this.to), n = e.resolve(this.from), r = n.node(n.sharedDepth(this.to)), i = new l(
|
|
2038
|
-
return
|
|
2038
|
+
let t = e.slice(this.from, this.to), n = e.resolve(this.from), r = n.node(n.sharedDepth(this.to)), i = new l(M(t.content, (e, t) => !e.isAtom || !t.type.allowsMarkType(this.mark.type) ? e : e.mark(this.mark.addToSet(e.marks)), r), t.openStart, t.openEnd);
|
|
2039
|
+
return j.fromReplace(e, this.from, this.to, i);
|
|
2039
2040
|
}
|
|
2040
2041
|
invert() {
|
|
2041
|
-
return new
|
|
2042
|
+
return new P(this.from, this.to, this.mark);
|
|
2042
2043
|
}
|
|
2043
2044
|
map(t) {
|
|
2044
2045
|
let n = t.mapResult(this.from, 1), r = t.mapResult(this.to, -1);
|
|
@@ -2060,17 +2061,17 @@ var P = class e extends M {
|
|
|
2060
2061
|
return new e(n.from, n.to, t.markFromJSON(n.mark));
|
|
2061
2062
|
}
|
|
2062
2063
|
};
|
|
2063
|
-
|
|
2064
|
-
var
|
|
2064
|
+
A.jsonID("addMark", N);
|
|
2065
|
+
var P = class e extends A {
|
|
2065
2066
|
constructor(e, t, n) {
|
|
2066
2067
|
super(), this.from = e, this.to = t, this.mark = n;
|
|
2067
2068
|
}
|
|
2068
2069
|
apply(e) {
|
|
2069
|
-
let t = e.slice(this.from, this.to), n = new l(
|
|
2070
|
-
return
|
|
2070
|
+
let t = e.slice(this.from, this.to), n = new l(M(t.content, (e) => e.mark(this.mark.removeFromSet(e.marks)), e), t.openStart, t.openEnd);
|
|
2071
|
+
return j.fromReplace(e, this.from, this.to, n);
|
|
2071
2072
|
}
|
|
2072
2073
|
invert() {
|
|
2073
|
-
return new
|
|
2074
|
+
return new N(this.from, this.to, this.mark);
|
|
2074
2075
|
}
|
|
2075
2076
|
map(t) {
|
|
2076
2077
|
let n = t.mapResult(this.from, 1), r = t.mapResult(this.to, -1);
|
|
@@ -2092,16 +2093,16 @@ var F = class e extends M {
|
|
|
2092
2093
|
return new e(n.from, n.to, t.markFromJSON(n.mark));
|
|
2093
2094
|
}
|
|
2094
2095
|
};
|
|
2095
|
-
|
|
2096
|
-
var
|
|
2096
|
+
A.jsonID("removeMark", P);
|
|
2097
|
+
var F = class e extends A {
|
|
2097
2098
|
constructor(e, t) {
|
|
2098
2099
|
super(), this.pos = e, this.mark = t;
|
|
2099
2100
|
}
|
|
2100
2101
|
apply(e) {
|
|
2101
2102
|
let t = e.nodeAt(this.pos);
|
|
2102
|
-
if (!t) return
|
|
2103
|
+
if (!t) return j.fail("No node at mark step's position");
|
|
2103
2104
|
let n = t.type.create(t.attrs, null, this.mark.addToSet(t.marks));
|
|
2104
|
-
return
|
|
2105
|
+
return j.fromReplace(e, this.pos, this.pos + 1, new l(r.from(n), 0, +!t.isLeaf));
|
|
2105
2106
|
}
|
|
2106
2107
|
invert(t) {
|
|
2107
2108
|
let n = t.nodeAt(this.pos);
|
|
@@ -2112,7 +2113,7 @@ var I = class e extends M {
|
|
|
2112
2113
|
return new e(this.pos, this.mark);
|
|
2113
2114
|
}
|
|
2114
2115
|
}
|
|
2115
|
-
return new
|
|
2116
|
+
return new I(this.pos, this.mark);
|
|
2116
2117
|
}
|
|
2117
2118
|
map(t) {
|
|
2118
2119
|
let n = t.mapResult(this.pos, 1);
|
|
@@ -2130,20 +2131,20 @@ var I = class e extends M {
|
|
|
2130
2131
|
return new e(n.pos, t.markFromJSON(n.mark));
|
|
2131
2132
|
}
|
|
2132
2133
|
};
|
|
2133
|
-
|
|
2134
|
-
var
|
|
2134
|
+
A.jsonID("addNodeMark", F);
|
|
2135
|
+
var I = class e extends A {
|
|
2135
2136
|
constructor(e, t) {
|
|
2136
2137
|
super(), this.pos = e, this.mark = t;
|
|
2137
2138
|
}
|
|
2138
2139
|
apply(e) {
|
|
2139
2140
|
let t = e.nodeAt(this.pos);
|
|
2140
|
-
if (!t) return
|
|
2141
|
+
if (!t) return j.fail("No node at mark step's position");
|
|
2141
2142
|
let n = t.type.create(t.attrs, null, this.mark.removeFromSet(t.marks));
|
|
2142
|
-
return
|
|
2143
|
+
return j.fromReplace(e, this.pos, this.pos + 1, new l(r.from(n), 0, +!t.isLeaf));
|
|
2143
2144
|
}
|
|
2144
2145
|
invert(e) {
|
|
2145
2146
|
let t = e.nodeAt(this.pos);
|
|
2146
|
-
return !t || !this.mark.isInSet(t.marks) ? this : new
|
|
2147
|
+
return !t || !this.mark.isInSet(t.marks) ? this : new F(this.pos, this.mark);
|
|
2147
2148
|
}
|
|
2148
2149
|
map(t) {
|
|
2149
2150
|
let n = t.mapResult(this.pos, 1);
|
|
@@ -2161,16 +2162,16 @@ var L = class e extends M {
|
|
|
2161
2162
|
return new e(n.pos, t.markFromJSON(n.mark));
|
|
2162
2163
|
}
|
|
2163
2164
|
};
|
|
2164
|
-
|
|
2165
|
-
var
|
|
2165
|
+
A.jsonID("removeNodeMark", I);
|
|
2166
|
+
var L = class e extends A {
|
|
2166
2167
|
constructor(e, t, n, r = !1) {
|
|
2167
2168
|
super(), this.from = e, this.to = t, this.slice = n, this.structure = r;
|
|
2168
2169
|
}
|
|
2169
2170
|
apply(e) {
|
|
2170
|
-
return this.structure &&
|
|
2171
|
+
return this.structure && z(e, this.from, this.to) ? j.fail("Structure replace would overwrite content") : j.fromReplace(e, this.from, this.to, this.slice);
|
|
2171
2172
|
}
|
|
2172
2173
|
getMap() {
|
|
2173
|
-
return new
|
|
2174
|
+
return new O([
|
|
2174
2175
|
this.from,
|
|
2175
2176
|
this.to - this.from,
|
|
2176
2177
|
this.slice.size
|
|
@@ -2206,20 +2207,20 @@ var R = class e extends M {
|
|
|
2206
2207
|
return new e(n.from, n.to, l.fromJSON(t, n.slice), !!n.structure);
|
|
2207
2208
|
}
|
|
2208
2209
|
};
|
|
2209
|
-
|
|
2210
|
-
var
|
|
2210
|
+
L.MAP_BIAS = 1, A.jsonID("replace", L);
|
|
2211
|
+
var R = class e extends A {
|
|
2211
2212
|
constructor(e, t, n, r, i, a, o = !1) {
|
|
2212
2213
|
super(), this.from = e, this.to = t, this.gapFrom = n, this.gapTo = r, this.slice = i, this.insert = a, this.structure = o;
|
|
2213
2214
|
}
|
|
2214
2215
|
apply(e) {
|
|
2215
|
-
if (this.structure && (
|
|
2216
|
+
if (this.structure && (z(e, this.from, this.gapFrom) || z(e, this.gapTo, this.to))) return j.fail("Structure gap-replace would overwrite content");
|
|
2216
2217
|
let t = e.slice(this.gapFrom, this.gapTo);
|
|
2217
|
-
if (t.openStart || t.openEnd) return
|
|
2218
|
+
if (t.openStart || t.openEnd) return j.fail("Gap is not a flat range");
|
|
2218
2219
|
let n = this.slice.insertAt(this.insert, t.content);
|
|
2219
|
-
return n ?
|
|
2220
|
+
return n ? j.fromReplace(e, this.from, this.to, n) : j.fail("Content does not fit in gap");
|
|
2220
2221
|
}
|
|
2221
2222
|
getMap() {
|
|
2222
|
-
return new
|
|
2223
|
+
return new O([
|
|
2223
2224
|
this.from,
|
|
2224
2225
|
this.gapFrom - this.from,
|
|
2225
2226
|
this.insert,
|
|
@@ -2252,8 +2253,8 @@ var z = class e extends M {
|
|
|
2252
2253
|
return new e(n.from, n.to, n.gapFrom, n.gapTo, l.fromJSON(t, n.slice), n.insert, !!n.structure);
|
|
2253
2254
|
}
|
|
2254
2255
|
};
|
|
2255
|
-
|
|
2256
|
-
function
|
|
2256
|
+
A.jsonID("replaceAround", R);
|
|
2257
|
+
function z(e, t, n) {
|
|
2257
2258
|
let r = e.resolve(t), i = n - t, a = r.depth;
|
|
2258
2259
|
for (; i > 0 && a > 0 && r.indexAfter(a) == r.node(a).childCount;) a--, i--;
|
|
2259
2260
|
if (i > 0) {
|
|
@@ -2272,8 +2273,8 @@ function st(e, t, n, r) {
|
|
|
2272
2273
|
let u = e.marks;
|
|
2273
2274
|
if (!r.isInSet(u) && l.type.allowsMarkType(r.type)) {
|
|
2274
2275
|
let l = Math.max(c, t), d = Math.min(c + e.nodeSize, n), f = r.addToSet(u);
|
|
2275
|
-
for (let e = 0; e < u.length; e++) u[e].isInSet(f) || (o && o.to == l && o.mark.eq(u[e]) ? o.to = d : i.push(o = new
|
|
2276
|
-
s && s.to == l ? s.to = d : a.push(s = new
|
|
2276
|
+
for (let e = 0; e < u.length; e++) u[e].isInSet(f) || (o && o.to == l && o.mark.eq(u[e]) ? o.to = d : i.push(o = new P(l, d, u[e])));
|
|
2277
|
+
s && s.to == l ? s.to = d : a.push(s = new N(l, d, r));
|
|
2277
2278
|
}
|
|
2278
2279
|
}), i.forEach((t) => e.step(t)), a.forEach((t) => e.step(t));
|
|
2279
2280
|
}
|
|
@@ -2283,7 +2284,7 @@ function ct(e, t, n, r) {
|
|
|
2283
2284
|
if (!e.isInline) return;
|
|
2284
2285
|
a++;
|
|
2285
2286
|
let s = null;
|
|
2286
|
-
if (r instanceof
|
|
2287
|
+
if (r instanceof Ae) {
|
|
2287
2288
|
let t = e.marks, n;
|
|
2288
2289
|
for (; n = r.isInSet(t);) (s ||= []).push(n), t = n.removeFromSet(t);
|
|
2289
2290
|
} else r ? r.isInSet(e.marks) && (s = [r]) : s = e.marks;
|
|
@@ -2303,19 +2304,19 @@ function ct(e, t, n, r) {
|
|
|
2303
2304
|
});
|
|
2304
2305
|
}
|
|
2305
2306
|
}
|
|
2306
|
-
}), i.forEach((t) => e.step(new
|
|
2307
|
+
}), i.forEach((t) => e.step(new P(t.from, t.to, t.style)));
|
|
2307
2308
|
}
|
|
2308
|
-
function
|
|
2309
|
+
function B(e, t, n, i = n.contentMatch, a = !0) {
|
|
2309
2310
|
let o = e.doc.nodeAt(t), s = [], c = t + 1;
|
|
2310
2311
|
for (let t = 0; t < o.childCount; t++) {
|
|
2311
2312
|
let u = o.child(t), d = c + u.nodeSize, f = i.matchType(u.type);
|
|
2312
|
-
if (!f) s.push(new
|
|
2313
|
+
if (!f) s.push(new L(c, d, l.empty));
|
|
2313
2314
|
else {
|
|
2314
2315
|
i = f;
|
|
2315
|
-
for (let t = 0; t < u.marks.length; t++) n.allowsMarkType(u.marks[t].type) || e.step(new
|
|
2316
|
+
for (let t = 0; t < u.marks.length; t++) n.allowsMarkType(u.marks[t].type) || e.step(new P(c, d, u.marks[t]));
|
|
2316
2317
|
if (a && u.isText && n.whitespace != "pre") {
|
|
2317
2318
|
let e, t = /\r?\n|\r/g, i;
|
|
2318
|
-
for (; e = t.exec(u.text);) i ||= new l(r.from(n.schema.text(" ", n.allowedMarks(u.marks))), 0, 0), s.push(new
|
|
2319
|
+
for (; e = t.exec(u.text);) i ||= new l(r.from(n.schema.text(" ", n.allowedMarks(u.marks))), 0, 0), s.push(new L(c + e.index, c + e.index + e[0].length, i));
|
|
2319
2320
|
}
|
|
2320
2321
|
}
|
|
2321
2322
|
c = d;
|
|
@@ -2326,53 +2327,53 @@ function lt(e, t, n, i = n.contentMatch, a = !0) {
|
|
|
2326
2327
|
}
|
|
2327
2328
|
for (let t = s.length - 1; t >= 0; t--) e.step(s[t]);
|
|
2328
2329
|
}
|
|
2329
|
-
function
|
|
2330
|
+
function lt(e, t, n) {
|
|
2330
2331
|
return (t == 0 || e.canReplace(t, e.childCount)) && (n == e.childCount || e.canReplace(0, n));
|
|
2331
2332
|
}
|
|
2332
|
-
function
|
|
2333
|
+
function ut(e) {
|
|
2333
2334
|
let t = e.parent.content.cutByIndex(e.startIndex, e.endIndex);
|
|
2334
2335
|
for (let n = e.depth, r = 0, i = 0;; --n) {
|
|
2335
2336
|
let a = e.$from.node(n), o = e.$from.index(n) + r, s = e.$to.indexAfter(n) - i;
|
|
2336
2337
|
if (n < e.depth && a.canReplace(o, s, t)) return n;
|
|
2337
|
-
if (n == 0 || a.type.spec.isolating || !
|
|
2338
|
+
if (n == 0 || a.type.spec.isolating || !lt(a, o, s)) break;
|
|
2338
2339
|
o && (r = 1), s < a.childCount && (i = 1);
|
|
2339
2340
|
}
|
|
2340
2341
|
return null;
|
|
2341
2342
|
}
|
|
2342
|
-
function
|
|
2343
|
+
function dt(e, t, n) {
|
|
2343
2344
|
let { $from: i, $to: a, depth: o } = t, s = i.before(o + 1), c = a.after(o + 1), u = s, d = c, f = r.empty, p = 0;
|
|
2344
2345
|
for (let e = o, t = !1; e > n; e--) t || i.index(e) > 0 ? (t = !0, f = r.from(i.node(e).copy(f)), p++) : u--;
|
|
2345
2346
|
let m = r.empty, h = 0;
|
|
2346
2347
|
for (let e = o, t = !1; e > n; e--) t || a.after(e + 1) < a.end(e) ? (t = !0, m = r.from(a.node(e).copy(m)), h++) : d++;
|
|
2347
|
-
e.step(new
|
|
2348
|
+
e.step(new R(u, d, s, c, new l(f.append(m), p, h), f.size - p, !0));
|
|
2348
2349
|
}
|
|
2349
|
-
function
|
|
2350
|
-
let i =
|
|
2351
|
-
return a ? i.map(
|
|
2350
|
+
function ft(e, t, n = null, r = e) {
|
|
2351
|
+
let i = mt(e, t), a = i && ht(r, t);
|
|
2352
|
+
return a ? i.map(pt).concat({
|
|
2352
2353
|
type: t,
|
|
2353
2354
|
attrs: n
|
|
2354
|
-
}).concat(a.map(
|
|
2355
|
+
}).concat(a.map(pt)) : null;
|
|
2355
2356
|
}
|
|
2356
|
-
function
|
|
2357
|
+
function pt(e) {
|
|
2357
2358
|
return {
|
|
2358
2359
|
type: e,
|
|
2359
2360
|
attrs: null
|
|
2360
2361
|
};
|
|
2361
2362
|
}
|
|
2362
|
-
function
|
|
2363
|
+
function mt(e, t) {
|
|
2363
2364
|
let { parent: n, startIndex: r, endIndex: i } = e, a = n.contentMatchAt(r).findWrapping(t);
|
|
2364
2365
|
if (!a) return null;
|
|
2365
2366
|
let o = a.length ? a[0] : t;
|
|
2366
2367
|
return n.canReplaceWith(r, i, o) ? a : null;
|
|
2367
2368
|
}
|
|
2368
|
-
function
|
|
2369
|
+
function ht(e, t) {
|
|
2369
2370
|
let { parent: n, startIndex: r, endIndex: i } = e, a = n.child(r), o = t.contentMatch.findWrapping(a.type);
|
|
2370
2371
|
if (!o) return null;
|
|
2371
2372
|
let s = (o.length ? o[o.length - 1] : t).contentMatch;
|
|
2372
2373
|
for (let e = r; s && e < i; e++) s = s.matchType(n.child(e).type);
|
|
2373
2374
|
return !s || !s.validEnd ? null : o;
|
|
2374
2375
|
}
|
|
2375
|
-
function
|
|
2376
|
+
function gt(e, t, n) {
|
|
2376
2377
|
let i = r.empty;
|
|
2377
2378
|
for (let e = n.length - 1; e >= 0; e--) {
|
|
2378
2379
|
if (i.size) {
|
|
@@ -2382,26 +2383,26 @@ function _t(e, t, n) {
|
|
|
2382
2383
|
i = r.from(n[e].type.create(n[e].attrs, i));
|
|
2383
2384
|
}
|
|
2384
2385
|
let a = t.start, o = t.end;
|
|
2385
|
-
e.step(new
|
|
2386
|
+
e.step(new R(a, o, a, o, new l(i, 0, 0), n.length, !0));
|
|
2386
2387
|
}
|
|
2387
|
-
function
|
|
2388
|
+
function _t(e, t, n, i, a) {
|
|
2388
2389
|
if (!i.isTextblock) throw RangeError("Type given to setBlockType should be a textblock");
|
|
2389
2390
|
let o = e.steps.length;
|
|
2390
2391
|
e.doc.nodesBetween(t, n, (t, n) => {
|
|
2391
2392
|
let s = typeof a == "function" ? a(t) : a;
|
|
2392
|
-
if (t.isTextblock && !t.hasMarkup(i, s) &&
|
|
2393
|
+
if (t.isTextblock && !t.hasMarkup(i, s) && bt(e.doc, e.mapping.slice(o).map(n), i)) {
|
|
2393
2394
|
let a = null;
|
|
2394
2395
|
if (i.schema.linebreakReplacement) {
|
|
2395
2396
|
let e = i.whitespace == "pre", t = !!i.contentMatch.matchType(i.schema.linebreakReplacement);
|
|
2396
2397
|
e && !t ? a = !1 : !e && t && (a = !0);
|
|
2397
2398
|
}
|
|
2398
|
-
a === !1 &&
|
|
2399
|
+
a === !1 && yt(e, t, n, o), B(e, e.mapping.slice(o).map(n, 1), i, void 0, a === null);
|
|
2399
2400
|
let c = e.mapping.slice(o), u = c.map(n, 1), d = c.map(n + t.nodeSize, 1);
|
|
2400
|
-
return e.step(new
|
|
2401
|
+
return e.step(new R(u, d, u + 1, d - 1, new l(r.from(i.create(s, null, t.marks)), 0, 0), 1, !0)), a === !0 && vt(e, t, n, o), !1;
|
|
2401
2402
|
}
|
|
2402
2403
|
});
|
|
2403
2404
|
}
|
|
2404
|
-
function
|
|
2405
|
+
function vt(e, t, n, r) {
|
|
2405
2406
|
t.forEach((i, a) => {
|
|
2406
2407
|
if (i.isText) {
|
|
2407
2408
|
let o, s = /\r?\n|\r/g;
|
|
@@ -2412,7 +2413,7 @@ function yt(e, t, n, r) {
|
|
|
2412
2413
|
}
|
|
2413
2414
|
});
|
|
2414
2415
|
}
|
|
2415
|
-
function
|
|
2416
|
+
function yt(e, t, n, r) {
|
|
2416
2417
|
t.forEach((i, a) => {
|
|
2417
2418
|
if (i.type == i.type.schema.linebreakReplacement) {
|
|
2418
2419
|
let i = e.mapping.slice(r).map(n + 1 + a);
|
|
@@ -2420,20 +2421,20 @@ function bt(e, t, n, r) {
|
|
|
2420
2421
|
}
|
|
2421
2422
|
});
|
|
2422
2423
|
}
|
|
2423
|
-
function
|
|
2424
|
+
function bt(e, t, n) {
|
|
2424
2425
|
let r = e.resolve(t), i = r.index();
|
|
2425
2426
|
return r.parent.canReplaceWith(i, i + 1, n);
|
|
2426
2427
|
}
|
|
2427
|
-
function
|
|
2428
|
+
function xt(e, t, n, i, a) {
|
|
2428
2429
|
let o = e.doc.nodeAt(t);
|
|
2429
2430
|
if (!o) throw RangeError("No node at given position");
|
|
2430
2431
|
n ||= o.type;
|
|
2431
2432
|
let s = n.create(i, null, a || o.marks);
|
|
2432
2433
|
if (o.isLeaf) return e.replaceWith(t, t + o.nodeSize, s);
|
|
2433
2434
|
if (!n.validContent(o.content)) throw RangeError("Invalid content for node type " + n.name);
|
|
2434
|
-
e.step(new
|
|
2435
|
+
e.step(new R(t, t + o.nodeSize, t + 1, t + o.nodeSize - 1, new l(r.from(s), 0, 0), 1, !0));
|
|
2435
2436
|
}
|
|
2436
|
-
function
|
|
2437
|
+
function St(e, t, n = 1, r) {
|
|
2437
2438
|
let i = e.resolve(t), a = i.depth - n, o = r && r[r.length - 1] || i.parent;
|
|
2438
2439
|
if (a < 0 || i.parent.type.spec.isolating || !i.parent.canReplace(i.index(), i.parent.childCount) || !o.type.validContent(i.parent.content.cutByIndex(i.index(), i.parent.childCount))) return !1;
|
|
2439
2440
|
for (let e = i.depth - 1, t = n - 2; e > a; e--, t--) {
|
|
@@ -2447,20 +2448,20 @@ function Ct(e, t, n = 1, r) {
|
|
|
2447
2448
|
let s = i.indexAfter(a), c = r && r[0];
|
|
2448
2449
|
return i.node(a).canReplaceWith(s, s, c ? c.type : i.node(a + 1).type);
|
|
2449
2450
|
}
|
|
2450
|
-
function
|
|
2451
|
+
function Ct(e, t, n = 1, i) {
|
|
2451
2452
|
let a = e.doc.resolve(t), o = r.empty, s = r.empty;
|
|
2452
2453
|
for (let e = a.depth, t = a.depth - n, c = n - 1; e > t; e--, c--) {
|
|
2453
2454
|
o = r.from(a.node(e).copy(o));
|
|
2454
2455
|
let t = i && i[c];
|
|
2455
2456
|
s = r.from(t ? t.type.create(t.attrs, s) : a.node(e).copy(s));
|
|
2456
2457
|
}
|
|
2457
|
-
e.step(new
|
|
2458
|
+
e.step(new L(t, t, new l(o.append(s), n, n), !0));
|
|
2458
2459
|
}
|
|
2459
|
-
function
|
|
2460
|
+
function wt(e, t) {
|
|
2460
2461
|
let n = e.resolve(t), r = n.index();
|
|
2461
|
-
return
|
|
2462
|
+
return Et(n.nodeBefore, n.nodeAfter) && n.parent.canReplace(r, r + 1);
|
|
2462
2463
|
}
|
|
2463
|
-
function
|
|
2464
|
+
function Tt(e, t) {
|
|
2464
2465
|
t.content.size || e.type.compatibleContent(t.type);
|
|
2465
2466
|
let n = e.contentMatchAt(e.childCount), { linebreakReplacement: r } = e.type.schema;
|
|
2466
2467
|
for (let i = 0; i < t.childCount; i++) {
|
|
@@ -2469,19 +2470,19 @@ function Et(e, t) {
|
|
|
2469
2470
|
}
|
|
2470
2471
|
return n.validEnd;
|
|
2471
2472
|
}
|
|
2472
|
-
function
|
|
2473
|
-
return !!(e && t && !e.isLeaf &&
|
|
2473
|
+
function Et(e, t) {
|
|
2474
|
+
return !!(e && t && !e.isLeaf && Tt(e, t));
|
|
2474
2475
|
}
|
|
2475
|
-
function
|
|
2476
|
+
function Dt(e, t, n = -1) {
|
|
2476
2477
|
let r = e.resolve(t);
|
|
2477
2478
|
for (let e = r.depth;; e--) {
|
|
2478
2479
|
let i, a, o = r.index(e);
|
|
2479
|
-
if (e == r.depth ? (i = r.nodeBefore, a = r.nodeAfter) : n > 0 ? (i = r.node(e + 1), o++, a = r.node(e).maybeChild(o)) : (i = r.node(e).maybeChild(o - 1), a = r.node(e + 1)), i && !i.isTextblock &&
|
|
2480
|
+
if (e == r.depth ? (i = r.nodeBefore, a = r.nodeAfter) : n > 0 ? (i = r.node(e + 1), o++, a = r.node(e).maybeChild(o)) : (i = r.node(e).maybeChild(o - 1), a = r.node(e + 1)), i && !i.isTextblock && Et(i, a) && r.node(e).canReplace(o, o + 1)) return t;
|
|
2480
2481
|
if (e == 0) break;
|
|
2481
2482
|
t = n < 0 ? r.before(e) : r.after(e);
|
|
2482
2483
|
}
|
|
2483
2484
|
}
|
|
2484
|
-
function
|
|
2485
|
+
function Ot(e, t, n) {
|
|
2485
2486
|
let r = null, { linebreakReplacement: i } = e.doc.type.schema, a = e.doc.resolve(t - n), o = a.node().type;
|
|
2486
2487
|
if (i && o.inlineContent) {
|
|
2487
2488
|
let e = o.whitespace == "pre", t = !!o.contentMatch.matchType(i);
|
|
@@ -2490,17 +2491,17 @@ function kt(e, t, n) {
|
|
|
2490
2491
|
let s = e.steps.length;
|
|
2491
2492
|
if (r === !1) {
|
|
2492
2493
|
let r = e.doc.resolve(t + n);
|
|
2493
|
-
|
|
2494
|
+
yt(e, r.node(), r.before(), s);
|
|
2494
2495
|
}
|
|
2495
|
-
o.inlineContent &&
|
|
2496
|
+
o.inlineContent && B(e, t + n - 1, o, a.node().contentMatchAt(a.index()), r == null);
|
|
2496
2497
|
let c = e.mapping.slice(s), u = c.map(t - n);
|
|
2497
|
-
if (e.step(new
|
|
2498
|
+
if (e.step(new L(u, c.map(t + n, -1), l.empty, !0)), r === !0) {
|
|
2498
2499
|
let t = e.doc.resolve(u);
|
|
2499
|
-
|
|
2500
|
+
vt(e, t.node(), t.before(), e.steps.length);
|
|
2500
2501
|
}
|
|
2501
2502
|
return e;
|
|
2502
2503
|
}
|
|
2503
|
-
function
|
|
2504
|
+
function kt(e, t, n) {
|
|
2504
2505
|
let r = e.resolve(t);
|
|
2505
2506
|
if (r.parent.canReplaceWith(r.index(), r.index(), n)) return t;
|
|
2506
2507
|
if (r.parentOffset == 0) for (let e = r.depth - 1; e >= 0; e--) {
|
|
@@ -2515,7 +2516,7 @@ function At(e, t, n) {
|
|
|
2515
2516
|
}
|
|
2516
2517
|
return null;
|
|
2517
2518
|
}
|
|
2518
|
-
function
|
|
2519
|
+
function At(e, t, n) {
|
|
2519
2520
|
let r = e.resolve(t);
|
|
2520
2521
|
if (!n.content.size) return t;
|
|
2521
2522
|
let i = n.content;
|
|
@@ -2531,15 +2532,15 @@ function jt(e, t, n) {
|
|
|
2531
2532
|
}
|
|
2532
2533
|
return null;
|
|
2533
2534
|
}
|
|
2534
|
-
function
|
|
2535
|
+
function jt(e, t, n = t, r = l.empty) {
|
|
2535
2536
|
if (t == n && !r.size) return null;
|
|
2536
2537
|
let i = e.resolve(t), a = e.resolve(n);
|
|
2537
|
-
return
|
|
2538
|
+
return Mt(i, a, r) ? new L(t, n, r) : new Nt(i, a, r).fit();
|
|
2538
2539
|
}
|
|
2539
|
-
function
|
|
2540
|
+
function Mt(e, t, n) {
|
|
2540
2541
|
return !n.openStart && !n.openEnd && e.start() == t.start() && e.parent.canReplace(e.index(), t.index(), n.content);
|
|
2541
2542
|
}
|
|
2542
|
-
var
|
|
2543
|
+
var Nt = class {
|
|
2543
2544
|
constructor(e, t, n) {
|
|
2544
2545
|
this.$from = e, this.$to = t, this.unplaced = n, this.frontier = [], this.placed = r.empty;
|
|
2545
2546
|
for (let t = 0; t <= e.depth; t++) {
|
|
@@ -2564,7 +2565,7 @@ var Pt = class {
|
|
|
2564
2565
|
let i = this.placed, a = n.depth, o = r.depth;
|
|
2565
2566
|
for (; a && o && i.childCount == 1;) i = i.firstChild.content, a--, o--;
|
|
2566
2567
|
let s = new l(i, a, o);
|
|
2567
|
-
return e > -1 ? new
|
|
2568
|
+
return e > -1 ? new R(n.pos, e, this.$to.pos, this.$to.end(), s, t) : s.size || n.pos != this.$to.pos ? new L(n.pos, r.pos, s) : null;
|
|
2568
2569
|
}
|
|
2569
2570
|
findFittable() {
|
|
2570
2571
|
let e = this.unplaced.openStart;
|
|
@@ -2578,7 +2579,7 @@ var Pt = class {
|
|
|
2578
2579
|
}
|
|
2579
2580
|
for (let t = 1; t <= 2; t++) for (let n = t == 1 ? e : this.unplaced.openStart; n >= 0; n--) {
|
|
2580
2581
|
let e, i = null;
|
|
2581
|
-
n ? (i =
|
|
2582
|
+
n ? (i = U(this.unplaced.content, n - 1).firstChild, e = i.content) : e = this.unplaced.content;
|
|
2582
2583
|
let a = e.firstChild;
|
|
2583
2584
|
for (let e = this.depth; e >= 0; e--) {
|
|
2584
2585
|
let { type: o, match: s } = this.frontier[e], c, l = null;
|
|
@@ -2599,15 +2600,15 @@ var Pt = class {
|
|
|
2599
2600
|
}
|
|
2600
2601
|
}
|
|
2601
2602
|
openMore() {
|
|
2602
|
-
let { content: e, openStart: t, openEnd: n } = this.unplaced, r =
|
|
2603
|
+
let { content: e, openStart: t, openEnd: n } = this.unplaced, r = U(e, t);
|
|
2603
2604
|
return !r.childCount || r.firstChild.isLeaf ? !1 : (this.unplaced = new l(e, t + 1, Math.max(n, r.size + t >= e.size - n ? t + 1 : 0)), !0);
|
|
2604
2605
|
}
|
|
2605
2606
|
dropNode() {
|
|
2606
|
-
let { content: e, openStart: t, openEnd: n } = this.unplaced, r =
|
|
2607
|
+
let { content: e, openStart: t, openEnd: n } = this.unplaced, r = U(e, t);
|
|
2607
2608
|
if (r.childCount <= 1 && t > 0) {
|
|
2608
2609
|
let i = e.size - t <= t + r.size;
|
|
2609
|
-
this.unplaced = new l(
|
|
2610
|
-
} else this.unplaced = new l(
|
|
2610
|
+
this.unplaced = new l(V(e, t - 1, 1), t - 1, i ? t - 1 : n);
|
|
2611
|
+
} else this.unplaced = new l(V(e, t, 1), t, n);
|
|
2611
2612
|
}
|
|
2612
2613
|
placeNodes({ sliceDepth: e, frontierDepth: t, parent: n, inject: i, wrap: a }) {
|
|
2613
2614
|
for (; this.depth > t;) this.closeFrontierNode();
|
|
@@ -2621,10 +2622,10 @@ var Pt = class {
|
|
|
2621
2622
|
for (; u < s.childCount;) {
|
|
2622
2623
|
let e = s.child(u), t = f.matchType(e.type);
|
|
2623
2624
|
if (!t) break;
|
|
2624
|
-
u++, (u > 1 || c == 0 || e.content.size) && (f = t, d.push(
|
|
2625
|
+
u++, (u > 1 || c == 0 || e.content.size) && (f = t, d.push(Pt(e.mark(p.allowedMarks(e.marks)), u == 1 ? c : 0, u == s.childCount ? m : -1)));
|
|
2625
2626
|
}
|
|
2626
2627
|
let h = u == s.childCount;
|
|
2627
|
-
h || (m = -1), this.placed =
|
|
2628
|
+
h || (m = -1), this.placed = H(this.placed, t, r.from(d)), this.frontier[t].match = f, h && m < 0 && n && n.type == this.frontier[this.depth].type && this.frontier.length > 1 && this.closeFrontierNode();
|
|
2628
2629
|
for (let e = 0, t = s; e < m; e++) {
|
|
2629
2630
|
let e = t.lastChild;
|
|
2630
2631
|
this.frontier.push({
|
|
@@ -2632,22 +2633,22 @@ var Pt = class {
|
|
|
2632
2633
|
match: e.contentMatchAt(e.childCount)
|
|
2633
2634
|
}), t = e.content;
|
|
2634
2635
|
}
|
|
2635
|
-
this.unplaced = h ? e == 0 ? l.empty : new l(
|
|
2636
|
+
this.unplaced = h ? e == 0 ? l.empty : new l(V(o.content, e - 1, 1), e - 1, m < 0 ? o.openEnd : e - 1) : new l(V(o.content, e, u), o.openStart, o.openEnd);
|
|
2636
2637
|
}
|
|
2637
2638
|
mustMoveInline() {
|
|
2638
2639
|
if (!this.$to.parent.isTextblock) return -1;
|
|
2639
2640
|
let e = this.frontier[this.depth], t;
|
|
2640
|
-
if (!e.type.isTextblock || !
|
|
2641
|
+
if (!e.type.isTextblock || !W(this.$to, this.$to.depth, e.type, e.match, !1) || this.$to.depth == this.depth && (t = this.findCloseLevel(this.$to)) && t.depth == this.depth) return -1;
|
|
2641
2642
|
let { depth: n } = this.$to, r = this.$to.after(n);
|
|
2642
2643
|
for (; n > 1 && r == this.$to.end(--n);) ++r;
|
|
2643
2644
|
return r;
|
|
2644
2645
|
}
|
|
2645
2646
|
findCloseLevel(e) {
|
|
2646
2647
|
scan: for (let t = Math.min(this.depth, e.depth); t >= 0; t--) {
|
|
2647
|
-
let { match: n, type: r } = this.frontier[t], i = t < e.depth && e.end(t + 1) == e.pos + (e.depth - (t + 1)), a =
|
|
2648
|
+
let { match: n, type: r } = this.frontier[t], i = t < e.depth && e.end(t + 1) == e.pos + (e.depth - (t + 1)), a = W(e, t, r, n, i);
|
|
2648
2649
|
if (a) {
|
|
2649
2650
|
for (let n = t - 1; n >= 0; n--) {
|
|
2650
|
-
let { match: t, type: r } = this.frontier[n], i =
|
|
2651
|
+
let { match: t, type: r } = this.frontier[n], i = W(e, n, r, t, !0);
|
|
2651
2652
|
if (!i || i.childCount) continue scan;
|
|
2652
2653
|
}
|
|
2653
2654
|
return {
|
|
@@ -2662,7 +2663,7 @@ var Pt = class {
|
|
|
2662
2663
|
let t = this.findCloseLevel(e);
|
|
2663
2664
|
if (!t) return null;
|
|
2664
2665
|
for (; this.depth > t.depth;) this.closeFrontierNode();
|
|
2665
|
-
t.fit.childCount && (this.placed =
|
|
2666
|
+
t.fit.childCount && (this.placed = H(this.placed, t.depth, t.fit)), e = t.move;
|
|
2666
2667
|
for (let n = t.depth + 1; n <= e.depth; n++) {
|
|
2667
2668
|
let t = e.node(n), r = t.type.contentMatch.fillBefore(t.content, !0, e.index(n));
|
|
2668
2669
|
this.openFrontierNode(t.type, t.attrs, r);
|
|
@@ -2671,49 +2672,49 @@ var Pt = class {
|
|
|
2671
2672
|
}
|
|
2672
2673
|
openFrontierNode(e, t = null, n) {
|
|
2673
2674
|
let i = this.frontier[this.depth];
|
|
2674
|
-
i.match = i.match.matchType(e), this.placed =
|
|
2675
|
+
i.match = i.match.matchType(e), this.placed = H(this.placed, this.depth, r.from(e.create(t, n))), this.frontier.push({
|
|
2675
2676
|
type: e,
|
|
2676
2677
|
match: e.contentMatch
|
|
2677
2678
|
});
|
|
2678
2679
|
}
|
|
2679
2680
|
closeFrontierNode() {
|
|
2680
2681
|
let e = this.frontier.pop().match.fillBefore(r.empty, !0);
|
|
2681
|
-
e.childCount && (this.placed =
|
|
2682
|
+
e.childCount && (this.placed = H(this.placed, this.frontier.length, e));
|
|
2682
2683
|
}
|
|
2683
2684
|
};
|
|
2684
|
-
function B(e, t, n) {
|
|
2685
|
-
return t == 0 ? e.cutByIndex(n, e.childCount) : e.replaceChild(0, e.firstChild.copy(B(e.firstChild.content, t - 1, n)));
|
|
2686
|
-
}
|
|
2687
2685
|
function V(e, t, n) {
|
|
2688
|
-
return t == 0 ? e.
|
|
2686
|
+
return t == 0 ? e.cutByIndex(n, e.childCount) : e.replaceChild(0, e.firstChild.copy(V(e.firstChild.content, t - 1, n)));
|
|
2689
2687
|
}
|
|
2690
|
-
function H(e, t) {
|
|
2688
|
+
function H(e, t, n) {
|
|
2689
|
+
return t == 0 ? e.append(n) : e.replaceChild(e.childCount - 1, e.lastChild.copy(H(e.lastChild.content, t - 1, n)));
|
|
2690
|
+
}
|
|
2691
|
+
function U(e, t) {
|
|
2691
2692
|
for (let n = 0; n < t; n++) e = e.firstChild.content;
|
|
2692
2693
|
return e;
|
|
2693
2694
|
}
|
|
2694
|
-
function
|
|
2695
|
+
function Pt(e, t, n) {
|
|
2695
2696
|
if (t <= 0) return e;
|
|
2696
2697
|
let i = e.content;
|
|
2697
|
-
return t > 1 && (i = i.replaceChild(0,
|
|
2698
|
+
return t > 1 && (i = i.replaceChild(0, Pt(i.firstChild, t - 1, i.childCount == 1 ? n - 1 : 0))), t > 0 && (i = e.type.contentMatch.fillBefore(i).append(i), n <= 0 && (i = i.append(e.type.contentMatch.matchFragment(i).fillBefore(r.empty, !0)))), e.copy(i);
|
|
2698
2699
|
}
|
|
2699
|
-
function
|
|
2700
|
+
function W(e, t, n, r, i) {
|
|
2700
2701
|
let a = e.node(t), o = i ? e.indexAfter(t) : e.index(t);
|
|
2701
2702
|
if (o == a.childCount && !n.compatibleContent(a.type)) return null;
|
|
2702
2703
|
let s = r.fillBefore(a.content, !0, o);
|
|
2703
|
-
return s && !
|
|
2704
|
+
return s && !Ft(n, a.content, o) ? s : null;
|
|
2704
2705
|
}
|
|
2705
|
-
function
|
|
2706
|
+
function Ft(e, t, n) {
|
|
2706
2707
|
for (let r = n; r < t.childCount; r++) if (!e.allowsMarks(t.child(r).marks)) return !0;
|
|
2707
2708
|
return !1;
|
|
2708
2709
|
}
|
|
2709
|
-
function
|
|
2710
|
+
function It(e) {
|
|
2710
2711
|
return e.spec.defining || e.spec.definingForContent;
|
|
2711
2712
|
}
|
|
2712
|
-
function
|
|
2713
|
+
function Lt(e, t, n, r) {
|
|
2713
2714
|
if (!r.size) return e.deleteRange(t, n);
|
|
2714
2715
|
let i = e.doc.resolve(t), a = e.doc.resolve(n);
|
|
2715
|
-
if (
|
|
2716
|
-
let o =
|
|
2716
|
+
if (Mt(i, a, r)) return e.step(new L(t, n, r));
|
|
2717
|
+
let o = Vt(i, a);
|
|
2717
2718
|
o[o.length - 1] == 0 && o.pop();
|
|
2718
2719
|
let s = -(i.depth + 1);
|
|
2719
2720
|
o.unshift(s);
|
|
@@ -2729,7 +2730,7 @@ function Rt(e, t, n, r) {
|
|
|
2729
2730
|
e = n.content;
|
|
2730
2731
|
}
|
|
2731
2732
|
for (let e = d - 1; e >= 0; e--) {
|
|
2732
|
-
let t = u[e], n =
|
|
2733
|
+
let t = u[e], n = It(t.type);
|
|
2733
2734
|
if (n && !t.sameMarkup(i.node(Math.abs(s) - 1))) d = e;
|
|
2734
2735
|
else if (n || !t.type.isTextblock) break;
|
|
2735
2736
|
}
|
|
@@ -2739,7 +2740,7 @@ function Rt(e, t, n, r) {
|
|
|
2739
2740
|
let u = o[(t + c) % o.length], d = !0;
|
|
2740
2741
|
u < 0 && (d = !1, u = -u);
|
|
2741
2742
|
let p = i.node(u - 1), m = i.index(u - 1);
|
|
2742
|
-
if (p.canReplaceWith(m, m, f.type, f.marks)) return e.replace(i.before(u), d ? a.after(u) : n, new l(
|
|
2743
|
+
if (p.canReplaceWith(m, m, f.type, f.marks)) return e.replace(i.before(u), d ? a.after(u) : n, new l(Rt(r.content, 0, r.openStart, s), s, r.openEnd));
|
|
2743
2744
|
}
|
|
2744
2745
|
}
|
|
2745
2746
|
let f = e.steps.length;
|
|
@@ -2748,10 +2749,10 @@ function Rt(e, t, n, r) {
|
|
|
2748
2749
|
e < 0 || (t = i.before(e), n = a.after(e));
|
|
2749
2750
|
}
|
|
2750
2751
|
}
|
|
2751
|
-
function
|
|
2752
|
+
function Rt(e, t, n, i, a) {
|
|
2752
2753
|
if (t < n) {
|
|
2753
2754
|
let r = e.firstChild;
|
|
2754
|
-
e = e.replaceChild(0, r.copy(
|
|
2755
|
+
e = e.replaceChild(0, r.copy(Rt(r.content, t + 1, n, i, r)));
|
|
2755
2756
|
}
|
|
2756
2757
|
if (t > i) {
|
|
2757
2758
|
let t = a.contentMatchAt(0), n = t.fillBefore(e).append(e);
|
|
@@ -2759,14 +2760,14 @@ function zt(e, t, n, i, a) {
|
|
|
2759
2760
|
}
|
|
2760
2761
|
return e;
|
|
2761
2762
|
}
|
|
2762
|
-
function
|
|
2763
|
+
function zt(e, t, n, i) {
|
|
2763
2764
|
if (!i.isInline && t == n && e.doc.resolve(t).parent.content.size) {
|
|
2764
|
-
let r =
|
|
2765
|
+
let r = kt(e.doc, t, i.type);
|
|
2765
2766
|
r != null && (t = n = r);
|
|
2766
2767
|
}
|
|
2767
2768
|
e.replaceRange(t, n, new l(r.from(i), 0, 0));
|
|
2768
2769
|
}
|
|
2769
|
-
function
|
|
2770
|
+
function Bt(e, t, n) {
|
|
2770
2771
|
let r = e.doc.resolve(t), i = e.doc.resolve(n);
|
|
2771
2772
|
if (r.parent.isTextblock && i.parent.isTextblock && r.start() != i.start() && r.parentOffset == 0 && i.parentOffset == 0) {
|
|
2772
2773
|
let a = r.sharedDepth(n), o = !1;
|
|
@@ -2778,7 +2779,7 @@ function Vt(e, t, n) {
|
|
|
2778
2779
|
r = e.doc.resolve(t), i = e.doc.resolve(n);
|
|
2779
2780
|
}
|
|
2780
2781
|
}
|
|
2781
|
-
let a =
|
|
2782
|
+
let a = Vt(r, i);
|
|
2782
2783
|
for (let t = 0; t < a.length; t++) {
|
|
2783
2784
|
let n = a[t], o = t == a.length - 1;
|
|
2784
2785
|
if (o && n == 0 || r.node(n).type.contentMatch.validEnd) return e.delete(r.start(n), i.end(n));
|
|
@@ -2787,7 +2788,7 @@ function Vt(e, t, n) {
|
|
|
2787
2788
|
for (let a = 1; a <= r.depth && a <= i.depth; a++) if (t - r.start(a) == r.depth - a && n > r.end(a) && i.end(a) - n != i.depth - a && r.start(a - 1) == i.start(a - 1) && r.node(a - 1).canReplace(r.index(a - 1), i.index(a - 1))) return e.delete(r.before(a), n);
|
|
2788
2789
|
e.delete(t, n);
|
|
2789
2790
|
}
|
|
2790
|
-
function
|
|
2791
|
+
function Vt(e, t) {
|
|
2791
2792
|
let n = [], r = Math.min(e.depth, t.depth);
|
|
2792
2793
|
for (let i = r; i >= 0; i--) {
|
|
2793
2794
|
let r = e.start(i);
|
|
@@ -2796,21 +2797,21 @@ function Ht(e, t) {
|
|
|
2796
2797
|
}
|
|
2797
2798
|
return n;
|
|
2798
2799
|
}
|
|
2799
|
-
var
|
|
2800
|
+
var Ht = class e extends A {
|
|
2800
2801
|
constructor(e, t, n) {
|
|
2801
2802
|
super(), this.pos = e, this.attr = t, this.value = n;
|
|
2802
2803
|
}
|
|
2803
2804
|
apply(e) {
|
|
2804
2805
|
let t = e.nodeAt(this.pos);
|
|
2805
|
-
if (!t) return
|
|
2806
|
+
if (!t) return j.fail("No node at attribute step's position");
|
|
2806
2807
|
let n = Object.create(null);
|
|
2807
2808
|
for (let e in t.attrs) n[e] = t.attrs[e];
|
|
2808
2809
|
n[this.attr] = this.value;
|
|
2809
2810
|
let i = t.type.create(n, null, t.marks);
|
|
2810
|
-
return
|
|
2811
|
+
return j.fromReplace(e, this.pos, this.pos + 1, new l(r.from(i), 0, +!t.isLeaf));
|
|
2811
2812
|
}
|
|
2812
2813
|
getMap() {
|
|
2813
|
-
return
|
|
2814
|
+
return O.empty;
|
|
2814
2815
|
}
|
|
2815
2816
|
invert(t) {
|
|
2816
2817
|
return new e(this.pos, this.attr, t.nodeAt(this.pos).attrs[this.attr]);
|
|
@@ -2832,8 +2833,8 @@ var Ut = class e extends M {
|
|
|
2832
2833
|
return new e(n.pos, n.attr, n.value);
|
|
2833
2834
|
}
|
|
2834
2835
|
};
|
|
2835
|
-
|
|
2836
|
-
var
|
|
2836
|
+
A.jsonID("attr", Ht);
|
|
2837
|
+
var Ut = class e extends A {
|
|
2837
2838
|
constructor(e, t) {
|
|
2838
2839
|
super(), this.attr = e, this.value = t;
|
|
2839
2840
|
}
|
|
@@ -2842,10 +2843,10 @@ var Wt = class e extends M {
|
|
|
2842
2843
|
for (let n in e.attrs) t[n] = e.attrs[n];
|
|
2843
2844
|
t[this.attr] = this.value;
|
|
2844
2845
|
let n = e.type.create(t, e.content, e.marks);
|
|
2845
|
-
return
|
|
2846
|
+
return j.ok(n);
|
|
2846
2847
|
}
|
|
2847
2848
|
getMap() {
|
|
2848
|
-
return
|
|
2849
|
+
return O.empty;
|
|
2849
2850
|
}
|
|
2850
2851
|
invert(t) {
|
|
2851
2852
|
return new e(this.attr, t.attrs[this.attr]);
|
|
@@ -2865,22 +2866,22 @@ var Wt = class e extends M {
|
|
|
2865
2866
|
return new e(n.attr, n.value);
|
|
2866
2867
|
}
|
|
2867
2868
|
};
|
|
2868
|
-
|
|
2869
|
-
var
|
|
2870
|
-
|
|
2869
|
+
A.jsonID("docAttr", Ut);
|
|
2870
|
+
var G = class extends Error {};
|
|
2871
|
+
G = function e(t) {
|
|
2871
2872
|
let n = Error.call(this, t);
|
|
2872
2873
|
return n.__proto__ = e.prototype, n;
|
|
2873
|
-
},
|
|
2874
|
-
var
|
|
2874
|
+
}, G.prototype = Object.create(Error.prototype), G.prototype.constructor = G, G.prototype.name = "TransformError";
|
|
2875
|
+
var Wt = class {
|
|
2875
2876
|
constructor(e) {
|
|
2876
|
-
this.doc = e, this.steps = [], this.docs = [], this.mapping = new
|
|
2877
|
+
this.doc = e, this.steps = [], this.docs = [], this.mapping = new ot();
|
|
2877
2878
|
}
|
|
2878
2879
|
get before() {
|
|
2879
2880
|
return this.docs.length ? this.docs[0] : this.doc;
|
|
2880
2881
|
}
|
|
2881
2882
|
step(e) {
|
|
2882
2883
|
let t = this.maybeStep(e);
|
|
2883
|
-
if (t.failed) throw new
|
|
2884
|
+
if (t.failed) throw new G(t.failed);
|
|
2884
2885
|
return this;
|
|
2885
2886
|
}
|
|
2886
2887
|
maybeStep(e) {
|
|
@@ -2907,7 +2908,7 @@ var Gt = class {
|
|
|
2907
2908
|
this.docs.push(this.doc), this.steps.push(e), this.mapping.appendMap(e.getMap()), this.doc = t;
|
|
2908
2909
|
}
|
|
2909
2910
|
replace(e, t = e, n = l.empty) {
|
|
2910
|
-
let r =
|
|
2911
|
+
let r = jt(this.doc, e, t, n);
|
|
2911
2912
|
return r && this.step(r), this;
|
|
2912
2913
|
}
|
|
2913
2914
|
replaceWith(e, t, n) {
|
|
@@ -2920,51 +2921,51 @@ var Gt = class {
|
|
|
2920
2921
|
return this.replaceWith(e, e, t);
|
|
2921
2922
|
}
|
|
2922
2923
|
replaceRange(e, t, n) {
|
|
2923
|
-
return
|
|
2924
|
+
return Lt(this, e, t, n), this;
|
|
2924
2925
|
}
|
|
2925
2926
|
replaceRangeWith(e, t, n) {
|
|
2926
|
-
return
|
|
2927
|
+
return zt(this, e, t, n), this;
|
|
2927
2928
|
}
|
|
2928
2929
|
deleteRange(e, t) {
|
|
2929
|
-
return
|
|
2930
|
+
return Bt(this, e, t), this;
|
|
2930
2931
|
}
|
|
2931
2932
|
lift(e, t) {
|
|
2932
|
-
return
|
|
2933
|
+
return dt(this, e, t), this;
|
|
2933
2934
|
}
|
|
2934
2935
|
join(e, t = 1) {
|
|
2935
|
-
return
|
|
2936
|
+
return Ot(this, e, t), this;
|
|
2936
2937
|
}
|
|
2937
2938
|
wrap(e, t) {
|
|
2938
|
-
return
|
|
2939
|
+
return gt(this, e, t), this;
|
|
2939
2940
|
}
|
|
2940
2941
|
setBlockType(e, t = e, n, r = null) {
|
|
2941
|
-
return
|
|
2942
|
+
return _t(this, e, t, n, r), this;
|
|
2942
2943
|
}
|
|
2943
2944
|
setNodeMarkup(e, t, n = null, r) {
|
|
2944
|
-
return
|
|
2945
|
+
return xt(this, e, t, n, r), this;
|
|
2945
2946
|
}
|
|
2946
2947
|
setNodeAttribute(e, t, n) {
|
|
2947
|
-
return this.step(new
|
|
2948
|
+
return this.step(new Ht(e, t, n)), this;
|
|
2948
2949
|
}
|
|
2949
2950
|
setDocAttribute(e, t) {
|
|
2950
|
-
return this.step(new
|
|
2951
|
+
return this.step(new Ut(e, t)), this;
|
|
2951
2952
|
}
|
|
2952
2953
|
addNodeMark(e, t) {
|
|
2953
|
-
return this.step(new
|
|
2954
|
+
return this.step(new F(e, t)), this;
|
|
2954
2955
|
}
|
|
2955
2956
|
removeNodeMark(e, t) {
|
|
2956
2957
|
let n = this.doc.nodeAt(e);
|
|
2957
2958
|
if (!n) throw RangeError("No node at position " + e);
|
|
2958
|
-
if (t instanceof s) t.isInSet(n.marks) && this.step(new
|
|
2959
|
+
if (t instanceof s) t.isInSet(n.marks) && this.step(new I(e, t));
|
|
2959
2960
|
else {
|
|
2960
2961
|
let r = n.marks, i, a = [];
|
|
2961
|
-
for (; i = t.isInSet(r);) a.push(new
|
|
2962
|
+
for (; i = t.isInSet(r);) a.push(new I(e, i)), r = i.removeFromSet(r);
|
|
2962
2963
|
for (let e = a.length - 1; e >= 0; e--) this.step(a[e]);
|
|
2963
2964
|
}
|
|
2964
2965
|
return this;
|
|
2965
2966
|
}
|
|
2966
2967
|
split(e, t = 1, n) {
|
|
2967
|
-
return
|
|
2968
|
+
return Ct(this, e, t, n), this;
|
|
2968
2969
|
}
|
|
2969
2970
|
addMark(e, t, n) {
|
|
2970
2971
|
return st(this, e, t, n), this;
|
|
@@ -2973,11 +2974,11 @@ var Gt = class {
|
|
|
2973
2974
|
return ct(this, e, t, n), this;
|
|
2974
2975
|
}
|
|
2975
2976
|
clearIncompatible(e, t, n) {
|
|
2976
|
-
return
|
|
2977
|
+
return B(this, e, t, n), this;
|
|
2977
2978
|
}
|
|
2978
|
-
},
|
|
2979
|
+
}, K = Object.create(null), q = class {
|
|
2979
2980
|
constructor(e, t, n) {
|
|
2980
|
-
this.$anchor = e, this.$head = t, this.ranges = n || [new
|
|
2981
|
+
this.$anchor = e, this.$head = t, this.ranges = n || [new Gt(e.min(t), e.max(t))];
|
|
2981
2982
|
}
|
|
2982
2983
|
get anchor() {
|
|
2983
2984
|
return this.$anchor.pos;
|
|
@@ -3011,67 +3012,67 @@ var Gt = class {
|
|
|
3011
3012
|
let i = e.steps.length, a = this.ranges;
|
|
3012
3013
|
for (let o = 0; o < a.length; o++) {
|
|
3013
3014
|
let { $from: s, $to: c } = a[o], u = e.mapping.slice(i);
|
|
3014
|
-
e.replaceRange(u.map(s.pos), u.map(c.pos), o ? l.empty : t), o == 0 &&
|
|
3015
|
+
e.replaceRange(u.map(s.pos), u.map(c.pos), o ? l.empty : t), o == 0 && Zt(e, i, (n ? n.isInline : r && r.isTextblock) ? -1 : 1);
|
|
3015
3016
|
}
|
|
3016
3017
|
}
|
|
3017
3018
|
replaceWith(e, t) {
|
|
3018
3019
|
let n = e.steps.length, r = this.ranges;
|
|
3019
3020
|
for (let i = 0; i < r.length; i++) {
|
|
3020
3021
|
let { $from: a, $to: o } = r[i], s = e.mapping.slice(n), c = s.map(a.pos), l = s.map(o.pos);
|
|
3021
|
-
i ? e.deleteRange(c, l) : (e.replaceRangeWith(c, l, t),
|
|
3022
|
+
i ? e.deleteRange(c, l) : (e.replaceRangeWith(c, l, t), Zt(e, n, t.isInline ? -1 : 1));
|
|
3022
3023
|
}
|
|
3023
3024
|
}
|
|
3024
3025
|
static findFrom(e, t, n = !1) {
|
|
3025
|
-
let r = e.parent.inlineContent ? new
|
|
3026
|
+
let r = e.parent.inlineContent ? new J(e) : Z(e.node(0), e.parent, e.pos, e.index(), t, n);
|
|
3026
3027
|
if (r) return r;
|
|
3027
3028
|
for (let r = e.depth - 1; r >= 0; r--) {
|
|
3028
|
-
let i = t < 0 ?
|
|
3029
|
+
let i = t < 0 ? Z(e.node(0), e.node(r), e.before(r + 1), e.index(r), t, n) : Z(e.node(0), e.node(r), e.after(r + 1), e.index(r) + 1, t, n);
|
|
3029
3030
|
if (i) return i;
|
|
3030
3031
|
}
|
|
3031
3032
|
return null;
|
|
3032
3033
|
}
|
|
3033
3034
|
static near(e, t = 1) {
|
|
3034
|
-
return this.findFrom(e, t) || this.findFrom(e, -t) || new
|
|
3035
|
+
return this.findFrom(e, t) || this.findFrom(e, -t) || new X(e.node(0));
|
|
3035
3036
|
}
|
|
3036
3037
|
static atStart(e) {
|
|
3037
|
-
return
|
|
3038
|
+
return Z(e, e, 0, 0, 1) || new X(e);
|
|
3038
3039
|
}
|
|
3039
3040
|
static atEnd(e) {
|
|
3040
|
-
return
|
|
3041
|
+
return Z(e, e, e.content.size, e.childCount, -1) || new X(e);
|
|
3041
3042
|
}
|
|
3042
3043
|
static fromJSON(e, t) {
|
|
3043
3044
|
if (!t || !t.type) throw RangeError("Invalid input for Selection.fromJSON");
|
|
3044
|
-
let n =
|
|
3045
|
+
let n = K[t.type];
|
|
3045
3046
|
if (!n) throw RangeError(`No selection type ${t.type} defined`);
|
|
3046
3047
|
return n.fromJSON(e, t);
|
|
3047
3048
|
}
|
|
3048
3049
|
static jsonID(e, t) {
|
|
3049
|
-
if (e in
|
|
3050
|
-
return
|
|
3050
|
+
if (e in K) throw RangeError("Duplicate use of selection JSON ID " + e);
|
|
3051
|
+
return K[e] = t, t.prototype.jsonID = e, t;
|
|
3051
3052
|
}
|
|
3052
3053
|
getBookmark() {
|
|
3053
|
-
return
|
|
3054
|
+
return J.between(this.$anchor, this.$head).getBookmark();
|
|
3054
3055
|
}
|
|
3055
3056
|
};
|
|
3056
|
-
|
|
3057
|
-
var
|
|
3057
|
+
q.prototype.visible = !0;
|
|
3058
|
+
var Gt = class {
|
|
3058
3059
|
constructor(e, t) {
|
|
3059
3060
|
this.$from = e, this.$to = t;
|
|
3060
3061
|
}
|
|
3061
|
-
},
|
|
3062
|
-
function
|
|
3063
|
-
!
|
|
3062
|
+
}, Kt = !1;
|
|
3063
|
+
function qt(e) {
|
|
3064
|
+
!Kt && !e.parent.inlineContent && (Kt = !0, console.warn("TextSelection endpoint not pointing into a node with inline content (" + e.parent.type.name + ")"));
|
|
3064
3065
|
}
|
|
3065
|
-
var
|
|
3066
|
+
var J = class e extends q {
|
|
3066
3067
|
constructor(e, t = e) {
|
|
3067
|
-
|
|
3068
|
+
qt(e), qt(t), super(e, t);
|
|
3068
3069
|
}
|
|
3069
3070
|
get $cursor() {
|
|
3070
3071
|
return this.$anchor.pos == this.$head.pos ? this.$head : null;
|
|
3071
3072
|
}
|
|
3072
3073
|
map(t, n) {
|
|
3073
3074
|
let r = t.resolve(n.map(this.head));
|
|
3074
|
-
if (!r.parent.inlineContent) return
|
|
3075
|
+
if (!r.parent.inlineContent) return q.near(r);
|
|
3075
3076
|
let i = t.resolve(n.map(this.anchor));
|
|
3076
3077
|
return new e(i.parent.inlineContent ? i : r, r);
|
|
3077
3078
|
}
|
|
@@ -3085,7 +3086,7 @@ var q = class e extends K {
|
|
|
3085
3086
|
return t instanceof e && t.anchor == this.anchor && t.head == this.head;
|
|
3086
3087
|
}
|
|
3087
3088
|
getBookmark() {
|
|
3088
|
-
return new
|
|
3089
|
+
return new Jt(this.anchor, this.head);
|
|
3089
3090
|
}
|
|
3090
3091
|
toJSON() {
|
|
3091
3092
|
return {
|
|
@@ -3105,15 +3106,15 @@ var q = class e extends K {
|
|
|
3105
3106
|
static between(t, n, r) {
|
|
3106
3107
|
let i = t.pos - n.pos;
|
|
3107
3108
|
if ((!r || i) && (r = i >= 0 ? 1 : -1), !n.parent.inlineContent) {
|
|
3108
|
-
let e =
|
|
3109
|
+
let e = q.findFrom(n, r, !0) || q.findFrom(n, -r, !0);
|
|
3109
3110
|
if (e) n = e.$head;
|
|
3110
|
-
else return
|
|
3111
|
+
else return q.near(n, r);
|
|
3111
3112
|
}
|
|
3112
|
-
return t.parent.inlineContent || (i == 0 ? t = n : (t = (
|
|
3113
|
+
return t.parent.inlineContent || (i == 0 ? t = n : (t = (q.findFrom(t, -r, !0) || q.findFrom(t, r, !0)).$anchor, t.pos < n.pos != i < 0 && (t = n))), new e(t, n);
|
|
3113
3114
|
}
|
|
3114
3115
|
};
|
|
3115
|
-
|
|
3116
|
-
var
|
|
3116
|
+
q.jsonID("text", J);
|
|
3117
|
+
var Jt = class e {
|
|
3117
3118
|
constructor(e, t) {
|
|
3118
3119
|
this.anchor = e, this.head = t;
|
|
3119
3120
|
}
|
|
@@ -3121,16 +3122,16 @@ var Yt = class e {
|
|
|
3121
3122
|
return new e(t.map(this.anchor), t.map(this.head));
|
|
3122
3123
|
}
|
|
3123
3124
|
resolve(e) {
|
|
3124
|
-
return
|
|
3125
|
+
return J.between(e.resolve(this.anchor), e.resolve(this.head));
|
|
3125
3126
|
}
|
|
3126
|
-
},
|
|
3127
|
+
}, Y = class e extends q {
|
|
3127
3128
|
constructor(e) {
|
|
3128
3129
|
let t = e.nodeAfter, n = e.node(0).resolve(e.pos + t.nodeSize);
|
|
3129
3130
|
super(e, n), this.node = t;
|
|
3130
3131
|
}
|
|
3131
3132
|
map(t, n) {
|
|
3132
3133
|
let { deleted: r, pos: i } = n.mapResult(this.anchor), a = t.resolve(i);
|
|
3133
|
-
return r ?
|
|
3134
|
+
return r ? q.near(a) : new e(a);
|
|
3134
3135
|
}
|
|
3135
3136
|
content() {
|
|
3136
3137
|
return new l(r.from(this.node), 0, 0);
|
|
@@ -3145,7 +3146,7 @@ var Yt = class e {
|
|
|
3145
3146
|
};
|
|
3146
3147
|
}
|
|
3147
3148
|
getBookmark() {
|
|
3148
|
-
return new
|
|
3149
|
+
return new Yt(this.anchor);
|
|
3149
3150
|
}
|
|
3150
3151
|
static fromJSON(t, n) {
|
|
3151
3152
|
if (typeof n.anchor != "number") throw RangeError("Invalid input for NodeSelection.fromJSON");
|
|
@@ -3158,27 +3159,27 @@ var Yt = class e {
|
|
|
3158
3159
|
return !e.isText && e.type.spec.selectable !== !1;
|
|
3159
3160
|
}
|
|
3160
3161
|
};
|
|
3161
|
-
|
|
3162
|
-
var
|
|
3162
|
+
Y.prototype.visible = !1, q.jsonID("node", Y);
|
|
3163
|
+
var Yt = class e {
|
|
3163
3164
|
constructor(e) {
|
|
3164
3165
|
this.anchor = e;
|
|
3165
3166
|
}
|
|
3166
3167
|
map(t) {
|
|
3167
3168
|
let { deleted: n, pos: r } = t.mapResult(this.anchor);
|
|
3168
|
-
return n ? new
|
|
3169
|
+
return n ? new Jt(r, r) : new e(r);
|
|
3169
3170
|
}
|
|
3170
3171
|
resolve(e) {
|
|
3171
3172
|
let t = e.resolve(this.anchor), n = t.nodeAfter;
|
|
3172
|
-
return n &&
|
|
3173
|
+
return n && Y.isSelectable(n) ? new Y(t) : q.near(t);
|
|
3173
3174
|
}
|
|
3174
|
-
},
|
|
3175
|
+
}, X = class e extends q {
|
|
3175
3176
|
constructor(e) {
|
|
3176
3177
|
super(e.resolve(0), e.resolve(e.content.size));
|
|
3177
3178
|
}
|
|
3178
3179
|
replace(e, t = l.empty) {
|
|
3179
3180
|
if (t == l.empty) {
|
|
3180
3181
|
e.delete(0, e.doc.content.size);
|
|
3181
|
-
let t =
|
|
3182
|
+
let t = q.atStart(e.doc);
|
|
3182
3183
|
t.eq(e.selection) || e.setSelection(t);
|
|
3183
3184
|
} else super.replace(e, t);
|
|
3184
3185
|
}
|
|
@@ -3195,41 +3196,41 @@ var Xt = class e {
|
|
|
3195
3196
|
return t instanceof e;
|
|
3196
3197
|
}
|
|
3197
3198
|
getBookmark() {
|
|
3198
|
-
return
|
|
3199
|
+
return Xt;
|
|
3199
3200
|
}
|
|
3200
3201
|
};
|
|
3201
|
-
|
|
3202
|
-
var
|
|
3202
|
+
q.jsonID("all", X);
|
|
3203
|
+
var Xt = {
|
|
3203
3204
|
map() {
|
|
3204
3205
|
return this;
|
|
3205
3206
|
},
|
|
3206
3207
|
resolve(e) {
|
|
3207
|
-
return new
|
|
3208
|
+
return new X(e);
|
|
3208
3209
|
}
|
|
3209
3210
|
};
|
|
3210
|
-
function
|
|
3211
|
-
if (t.inlineContent) return
|
|
3211
|
+
function Z(e, t, n, r, i, a = !1) {
|
|
3212
|
+
if (t.inlineContent) return J.create(e, n);
|
|
3212
3213
|
for (let o = r - (i > 0 ? 0 : 1); i > 0 ? o < t.childCount : o >= 0; o += i) {
|
|
3213
3214
|
let r = t.child(o);
|
|
3214
3215
|
if (!r.isAtom) {
|
|
3215
|
-
let t =
|
|
3216
|
+
let t = Z(e, r, n + i, i < 0 ? r.childCount : 0, i, a);
|
|
3216
3217
|
if (t) return t;
|
|
3217
|
-
} else if (!a &&
|
|
3218
|
+
} else if (!a && Y.isSelectable(r)) return Y.create(e, n - (i < 0 ? r.nodeSize : 0));
|
|
3218
3219
|
n += r.nodeSize * i;
|
|
3219
3220
|
}
|
|
3220
3221
|
return null;
|
|
3221
3222
|
}
|
|
3222
|
-
function
|
|
3223
|
+
function Zt(e, t, n) {
|
|
3223
3224
|
let r = e.steps.length - 1;
|
|
3224
3225
|
if (r < t) return;
|
|
3225
3226
|
let i = e.steps[r];
|
|
3226
|
-
if (!(i instanceof
|
|
3227
|
+
if (!(i instanceof L || i instanceof R)) return;
|
|
3227
3228
|
let a = e.mapping.maps[r], o;
|
|
3228
3229
|
a.forEach((e, t, n, r) => {
|
|
3229
3230
|
o ??= r;
|
|
3230
|
-
}), e.setSelection(
|
|
3231
|
+
}), e.setSelection(q.near(e.doc.resolve(o), n));
|
|
3231
3232
|
}
|
|
3232
|
-
var
|
|
3233
|
+
var Qt = 1, $t = 2, en = 4, tn = class extends Wt {
|
|
3233
3234
|
constructor(e) {
|
|
3234
3235
|
super(e.doc), this.curSelectionFor = 0, this.updated = 0, this.meta = Object.create(null), this.time = Date.now(), this.curSelection = e.selection, this.storedMarks = e.storedMarks;
|
|
3235
3236
|
}
|
|
@@ -3238,13 +3239,13 @@ var $t = 1, Z = 2, en = 4, tn = class extends Gt {
|
|
|
3238
3239
|
}
|
|
3239
3240
|
setSelection(e) {
|
|
3240
3241
|
if (e.$from.doc != this.doc) throw RangeError("Selection passed to setSelection must point at the current document");
|
|
3241
|
-
return this.curSelection = e, this.curSelectionFor = this.steps.length, this.updated = (this.updated |
|
|
3242
|
+
return this.curSelection = e, this.curSelectionFor = this.steps.length, this.updated = (this.updated | Qt) & -3, this.storedMarks = null, this;
|
|
3242
3243
|
}
|
|
3243
3244
|
get selectionSet() {
|
|
3244
|
-
return (this.updated &
|
|
3245
|
+
return (this.updated & Qt) > 0;
|
|
3245
3246
|
}
|
|
3246
3247
|
setStoredMarks(e) {
|
|
3247
|
-
return this.storedMarks = e, this.updated |=
|
|
3248
|
+
return this.storedMarks = e, this.updated |= $t, this;
|
|
3248
3249
|
}
|
|
3249
3250
|
ensureMarks(e) {
|
|
3250
3251
|
return s.sameSet(this.storedMarks || this.selection.$from.marks(), e) || this.setStoredMarks(e), this;
|
|
@@ -3256,10 +3257,10 @@ var $t = 1, Z = 2, en = 4, tn = class extends Gt {
|
|
|
3256
3257
|
return this.ensureMarks(e.removeFromSet(this.storedMarks || this.selection.$head.marks()));
|
|
3257
3258
|
}
|
|
3258
3259
|
get storedMarksSet() {
|
|
3259
|
-
return (this.updated &
|
|
3260
|
+
return (this.updated & $t) > 0;
|
|
3260
3261
|
}
|
|
3261
3262
|
addStep(e, t) {
|
|
3262
|
-
super.addStep(e, t), this.updated &=
|
|
3263
|
+
super.addStep(e, t), this.updated &= -3, this.storedMarks = null;
|
|
3263
3264
|
}
|
|
3264
3265
|
setTime(e) {
|
|
3265
3266
|
return this.time = e, this;
|
|
@@ -3284,7 +3285,7 @@ var $t = 1, Z = 2, en = 4, tn = class extends Gt {
|
|
|
3284
3285
|
let e = this.doc.resolve(t);
|
|
3285
3286
|
i = n == t ? e.marks() : e.marksAcross(this.doc.resolve(n));
|
|
3286
3287
|
}
|
|
3287
|
-
return this.replaceRangeWith(t, n, r.text(e, i)), !this.selection.empty && this.selection.to == t + e.length && this.setSelection(
|
|
3288
|
+
return this.replaceRangeWith(t, n, r.text(e, i)), !this.selection.empty && this.selection.to == t + e.length && this.setSelection(q.near(this.selection.$to)), this;
|
|
3288
3289
|
}
|
|
3289
3290
|
}
|
|
3290
3291
|
setMeta(e, t) {
|
|
@@ -3322,7 +3323,7 @@ var Q = class {
|
|
|
3322
3323
|
}),
|
|
3323
3324
|
new Q("selection", {
|
|
3324
3325
|
init(e, t) {
|
|
3325
|
-
return e.selection ||
|
|
3326
|
+
return e.selection || q.atStart(t.doc);
|
|
3326
3327
|
},
|
|
3327
3328
|
apply(e) {
|
|
3328
3329
|
return e.selection;
|
|
@@ -3451,7 +3452,7 @@ var Q = class {
|
|
|
3451
3452
|
let i = new an(t.schema, t.plugins), a = new e(i);
|
|
3452
3453
|
return i.fields.forEach((e) => {
|
|
3453
3454
|
if (e.name == "doc") a.doc = b.fromJSON(t.schema, n.doc);
|
|
3454
|
-
else if (e.name == "selection") a.selection =
|
|
3455
|
+
else if (e.name == "selection") a.selection = q.fromJSON(a.doc, n.selection);
|
|
3455
3456
|
else if (e.name == "storedMarks") n.storedMarks && (a.storedMarks = n.storedMarks.map(t.schema.markFromJSON));
|
|
3456
3457
|
else {
|
|
3457
3458
|
if (r) for (let i in r) {
|
|
@@ -3496,4 +3497,4 @@ var un = class {
|
|
|
3496
3497
|
}
|
|
3497
3498
|
};
|
|
3498
3499
|
//#endregion
|
|
3499
|
-
export {
|
|
3500
|
+
export { l as A, Ke as C, oe as D, b as E, De as O, Fe as S, s as T, At as _, un as a, ut as b, J as c, ot as d, R as f, St as g, wt as h, cn as i, je as k, tn as l, Wt as m, on as n, q as o, L as p, Y as r, Gt as s, X as t, N as u, ft as v, r as w, jt as x, Dt as y };
|