@bagelink/vue 0.0.587 → 0.0.589
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/components/ModalForm.vue.d.ts.map +1 -1
- package/dist/components/Popover.vue.d.ts +10 -0
- package/dist/components/Popover.vue.d.ts.map +1 -0
- package/dist/components/form/ItemRef.vue.d.ts +0 -1
- package/dist/components/form/ItemRef.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/SelectField.vue.d.ts +4 -1
- package/dist/components/form/inputs/SelectField.vue.d.ts.map +1 -1
- package/dist/index.cjs +258 -569
- package/dist/index.mjs +258 -569
- package/dist/style.css +16 -2
- package/dist/types/BagelForm.d.ts +1 -0
- package/dist/types/BagelForm.d.ts.map +1 -1
- package/dist/types/materialIcon.d.ts +2 -0
- package/dist/types/materialIcon.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/components/ModalForm.vue +5 -0
- package/src/styles/appearance.css +17 -0
- package/src/types/BagelForm.ts +1 -0
- package/dist/components/Drop.vue.d.ts +0 -34
- package/dist/components/Drop.vue.d.ts.map +0 -1
- package/dist/components/FileUploader.vue.d.ts +0 -60
- package/dist/components/FileUploader.vue.d.ts.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -5790,13 +5790,17 @@ const _sfc_main$K = /* @__PURE__ */ vue.defineComponent({
|
|
|
5790
5790
|
var _a2;
|
|
5791
5791
|
return (_a2 = modal.value) == null ? void 0 : _a2.closeModal();
|
|
5792
5792
|
};
|
|
5793
|
+
let submitting = vue.ref(false);
|
|
5793
5794
|
async function runSubmit() {
|
|
5794
5795
|
var _a2, _b, _c, _d;
|
|
5796
|
+
if (submitting.value) return;
|
|
5797
|
+
submitting.value = true;
|
|
5795
5798
|
if (((_b = (_a2 = form.value) == null ? void 0 : _a2.validateForm) == null ? void 0 : _b.call(_a2)) === false) return;
|
|
5796
5799
|
try {
|
|
5797
5800
|
await ((_c = props2.onSubmit) == null ? void 0 : _c.call(props2, formData.value));
|
|
5798
5801
|
closeModal();
|
|
5799
5802
|
} catch (err) {
|
|
5803
|
+
submitting.value = false;
|
|
5800
5804
|
if (props2.onError) props2.onError(err);
|
|
5801
5805
|
else (_d = bagel.onError) == null ? void 0 : _d.call(bagel, err);
|
|
5802
5806
|
}
|
|
@@ -5864,7 +5868,7 @@ const _sfc_main$K = /* @__PURE__ */ vue.defineComponent({
|
|
|
5864
5868
|
};
|
|
5865
5869
|
}
|
|
5866
5870
|
});
|
|
5867
|
-
const ModalForm = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["__scopeId", "data-v-
|
|
5871
|
+
const ModalForm = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["__scopeId", "data-v-b0a25141"]]);
|
|
5868
5872
|
const _hoisted_1$G = { class: "accordion-item" };
|
|
5869
5873
|
const _hoisted_2$x = ["aria-expanded", "aria-controls"];
|
|
5870
5874
|
const _hoisted_3$l = { class: "accordion-label" };
|
|
@@ -29523,7 +29527,7 @@ class Fragment {
|
|
|
29523
29527
|
/**
|
|
29524
29528
|
Find the index and inner offset corresponding to a given relative
|
|
29525
29529
|
position in this fragment. The result object will be reused
|
|
29526
|
-
(overwritten) the next time the function is called.
|
|
29530
|
+
(overwritten) the next time the function is called. (Not public.)
|
|
29527
29531
|
*/
|
|
29528
29532
|
findIndex(pos, round2 = -1) {
|
|
29529
29533
|
if (pos == 0)
|
|
@@ -29729,9 +29733,7 @@ let Mark$1 = class Mark2 {
|
|
|
29729
29733
|
let type3 = schema.marks[json.type];
|
|
29730
29734
|
if (!type3)
|
|
29731
29735
|
throw new RangeError(`There is no mark type ${json.type} in this schema`);
|
|
29732
|
-
|
|
29733
|
-
type3.checkAttrs(mark.attrs);
|
|
29734
|
-
return mark;
|
|
29736
|
+
return type3.create(json.attrs);
|
|
29735
29737
|
}
|
|
29736
29738
|
/**
|
|
29737
29739
|
Test whether two sets of marks are identical.
|
|
@@ -30228,28 +30230,17 @@ class ResolvedPos {
|
|
|
30228
30230
|
@internal
|
|
30229
30231
|
*/
|
|
30230
30232
|
static resolveCached(doc2, pos) {
|
|
30231
|
-
let
|
|
30232
|
-
|
|
30233
|
-
|
|
30234
|
-
|
|
30235
|
-
if (elt.pos == pos)
|
|
30236
|
-
return elt;
|
|
30237
|
-
}
|
|
30238
|
-
} else {
|
|
30239
|
-
resolveCache.set(doc2, cache = new ResolveCache());
|
|
30233
|
+
for (let i2 = 0; i2 < resolveCache.length; i2++) {
|
|
30234
|
+
let cached2 = resolveCache[i2];
|
|
30235
|
+
if (cached2.pos == pos && cached2.doc == doc2)
|
|
30236
|
+
return cached2;
|
|
30240
30237
|
}
|
|
30241
|
-
let result2 =
|
|
30242
|
-
|
|
30238
|
+
let result2 = resolveCache[resolveCachePos] = ResolvedPos.resolve(doc2, pos);
|
|
30239
|
+
resolveCachePos = (resolveCachePos + 1) % resolveCacheSize;
|
|
30243
30240
|
return result2;
|
|
30244
30241
|
}
|
|
30245
30242
|
}
|
|
30246
|
-
|
|
30247
|
-
constructor() {
|
|
30248
|
-
this.elts = [];
|
|
30249
|
-
this.i = 0;
|
|
30250
|
-
}
|
|
30251
|
-
}
|
|
30252
|
-
const resolveCacheSize = 12, resolveCache = /* @__PURE__ */ new WeakMap();
|
|
30243
|
+
let resolveCache = [], resolveCachePos = 0, resolveCacheSize = 12;
|
|
30253
30244
|
class NodeRange {
|
|
30254
30245
|
/**
|
|
30255
30246
|
Construct a node range. `$from` and `$to` should point into the
|
|
@@ -30635,17 +30626,13 @@ let Node$3 = class Node2 {
|
|
|
30635
30626
|
}
|
|
30636
30627
|
/**
|
|
30637
30628
|
Check whether this node and its descendants conform to the
|
|
30638
|
-
schema, and raise
|
|
30629
|
+
schema, and raise error when they do not.
|
|
30639
30630
|
*/
|
|
30640
30631
|
check() {
|
|
30641
30632
|
this.type.checkContent(this.content);
|
|
30642
|
-
this.type.checkAttrs(this.attrs);
|
|
30643
30633
|
let copy2 = Mark$1.none;
|
|
30644
|
-
for (let i2 = 0; i2 < this.marks.length; i2++)
|
|
30645
|
-
|
|
30646
|
-
mark.type.checkAttrs(mark.attrs);
|
|
30647
|
-
copy2 = mark.addToSet(copy2);
|
|
30648
|
-
}
|
|
30634
|
+
for (let i2 = 0; i2 < this.marks.length; i2++)
|
|
30635
|
+
copy2 = this.marks[i2].addToSet(copy2);
|
|
30649
30636
|
if (!Mark$1.sameSet(copy2, this.marks))
|
|
30650
30637
|
throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((m2) => m2.type.name)}`);
|
|
30651
30638
|
this.content.forEach((node) => node.check());
|
|
@@ -30671,7 +30658,7 @@ let Node$3 = class Node2 {
|
|
|
30671
30658
|
static fromJSON(schema, json) {
|
|
30672
30659
|
if (!json)
|
|
30673
30660
|
throw new RangeError("Invalid input for Node.fromJSON");
|
|
30674
|
-
let marks =
|
|
30661
|
+
let marks = null;
|
|
30675
30662
|
if (json.marks) {
|
|
30676
30663
|
if (!Array.isArray(json.marks))
|
|
30677
30664
|
throw new RangeError("Invalid mark data for Node.fromJSON");
|
|
@@ -30683,9 +30670,7 @@ let Node$3 = class Node2 {
|
|
|
30683
30670
|
return schema.text(json.text, marks);
|
|
30684
30671
|
}
|
|
30685
30672
|
let content = Fragment.fromJSON(schema, json.content);
|
|
30686
|
-
|
|
30687
|
-
node.type.checkAttrs(node.attrs);
|
|
30688
|
-
return node;
|
|
30673
|
+
return schema.nodeType(json.type).create(json.attrs, content, marks);
|
|
30689
30674
|
}
|
|
30690
30675
|
};
|
|
30691
30676
|
Node$3.prototype.text = void 0;
|
|
@@ -31167,16 +31152,6 @@ function computeAttrs(attrs, value) {
|
|
|
31167
31152
|
}
|
|
31168
31153
|
return built;
|
|
31169
31154
|
}
|
|
31170
|
-
function checkAttrs(attrs, values3, type3, name) {
|
|
31171
|
-
for (let name2 in values3)
|
|
31172
|
-
if (!(name2 in attrs))
|
|
31173
|
-
throw new RangeError(`Unsupported attribute ${name2} for ${type3} of type ${name2}`);
|
|
31174
|
-
for (let name2 in attrs) {
|
|
31175
|
-
let attr = attrs[name2];
|
|
31176
|
-
if (attr.validate)
|
|
31177
|
-
attr.validate(values3[name2]);
|
|
31178
|
-
}
|
|
31179
|
-
}
|
|
31180
31155
|
function initAttrs(attrs) {
|
|
31181
31156
|
let result2 = /* @__PURE__ */ Object.create(null);
|
|
31182
31157
|
if (attrs)
|
|
@@ -31306,7 +31281,7 @@ let NodeType$1 = class NodeType2 {
|
|
|
31306
31281
|
}
|
|
31307
31282
|
/**
|
|
31308
31283
|
Returns true if the given fragment is valid content for this node
|
|
31309
|
-
type.
|
|
31284
|
+
type with the given attributes.
|
|
31310
31285
|
*/
|
|
31311
31286
|
validContent(content) {
|
|
31312
31287
|
let result2 = this.contentMatch.matchFragment(content);
|
|
@@ -31327,12 +31302,6 @@ let NodeType$1 = class NodeType2 {
|
|
|
31327
31302
|
throw new RangeError(`Invalid content for node ${this.name}: ${content.toString().slice(0, 50)}`);
|
|
31328
31303
|
}
|
|
31329
31304
|
/**
|
|
31330
|
-
@internal
|
|
31331
|
-
*/
|
|
31332
|
-
checkAttrs(attrs) {
|
|
31333
|
-
checkAttrs(this.attrs, attrs, "node", this.name);
|
|
31334
|
-
}
|
|
31335
|
-
/**
|
|
31336
31305
|
Check whether the given mark type is allowed in this node.
|
|
31337
31306
|
*/
|
|
31338
31307
|
allowsMarkType(markType) {
|
|
@@ -31382,19 +31351,10 @@ let NodeType$1 = class NodeType2 {
|
|
|
31382
31351
|
return result2;
|
|
31383
31352
|
}
|
|
31384
31353
|
};
|
|
31385
|
-
function validateType(type3) {
|
|
31386
|
-
let types = type3.split("|");
|
|
31387
|
-
return (value) => {
|
|
31388
|
-
let name = value === null ? "null" : typeof value;
|
|
31389
|
-
if (types.indexOf(name) < 0)
|
|
31390
|
-
throw new RangeError(`Expected value of type ${types}, got ${name}`);
|
|
31391
|
-
};
|
|
31392
|
-
}
|
|
31393
31354
|
class Attribute {
|
|
31394
31355
|
constructor(options) {
|
|
31395
31356
|
this.hasDefault = Object.prototype.hasOwnProperty.call(options, "default");
|
|
31396
31357
|
this.default = options.default;
|
|
31397
|
-
this.validate = typeof options.validate == "string" ? validateType(options.validate) : options.validate;
|
|
31398
31358
|
}
|
|
31399
31359
|
get isRequired() {
|
|
31400
31360
|
return !this.hasDefault;
|
|
@@ -31453,12 +31413,6 @@ class MarkType {
|
|
|
31453
31413
|
return set2[i2];
|
|
31454
31414
|
}
|
|
31455
31415
|
/**
|
|
31456
|
-
@internal
|
|
31457
|
-
*/
|
|
31458
|
-
checkAttrs(attrs) {
|
|
31459
|
-
checkAttrs(this.attrs, attrs, "mark", this.name);
|
|
31460
|
-
}
|
|
31461
|
-
/**
|
|
31462
31416
|
Queries whether a given mark type is
|
|
31463
31417
|
[excluded](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) by this one.
|
|
31464
31418
|
*/
|
|
@@ -31471,7 +31425,6 @@ class Schema {
|
|
|
31471
31425
|
Construct a schema from a schema [specification](https://prosemirror.net/docs/ref/#model.SchemaSpec).
|
|
31472
31426
|
*/
|
|
31473
31427
|
constructor(spec) {
|
|
31474
|
-
this.linebreakReplacement = null;
|
|
31475
31428
|
this.cached = /* @__PURE__ */ Object.create(null);
|
|
31476
31429
|
let instanceSpec = this.spec = {};
|
|
31477
31430
|
for (let prop3 in spec)
|
|
@@ -31485,13 +31438,6 @@ class Schema {
|
|
|
31485
31438
|
let type3 = this.nodes[prop3], contentExpr = type3.spec.content || "", markExpr = type3.spec.marks;
|
|
31486
31439
|
type3.contentMatch = contentExprCache[contentExpr] || (contentExprCache[contentExpr] = ContentMatch.parse(contentExpr, this.nodes));
|
|
31487
31440
|
type3.inlineContent = type3.contentMatch.inlineContent;
|
|
31488
|
-
if (type3.spec.linebreakReplacement) {
|
|
31489
|
-
if (this.linebreakReplacement)
|
|
31490
|
-
throw new RangeError("Multiple linebreak nodes defined");
|
|
31491
|
-
if (!type3.isInline || !type3.isLeaf)
|
|
31492
|
-
throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");
|
|
31493
|
-
this.linebreakReplacement = type3;
|
|
31494
|
-
}
|
|
31495
31441
|
type3.markSet = markExpr == "_" ? null : markExpr ? gatherMarks(this, markExpr.split(" ")) : markExpr == "" || !type3.inlineContent ? [] : null;
|
|
31496
31442
|
}
|
|
31497
31443
|
for (let prop3 in this.marks) {
|
|
@@ -31576,12 +31522,6 @@ function gatherMarks(schema, marks) {
|
|
|
31576
31522
|
}
|
|
31577
31523
|
return found2;
|
|
31578
31524
|
}
|
|
31579
|
-
function isTagRule(rule) {
|
|
31580
|
-
return rule.tag != null;
|
|
31581
|
-
}
|
|
31582
|
-
function isStyleRule(rule) {
|
|
31583
|
-
return rule.style != null;
|
|
31584
|
-
}
|
|
31585
31525
|
class DOMParser {
|
|
31586
31526
|
/**
|
|
31587
31527
|
Create a parser that targets the given schema, using the given
|
|
@@ -31592,16 +31532,11 @@ class DOMParser {
|
|
|
31592
31532
|
this.rules = rules;
|
|
31593
31533
|
this.tags = [];
|
|
31594
31534
|
this.styles = [];
|
|
31595
|
-
let matchedStyles = this.matchedStyles = [];
|
|
31596
31535
|
rules.forEach((rule) => {
|
|
31597
|
-
if (
|
|
31536
|
+
if (rule.tag)
|
|
31598
31537
|
this.tags.push(rule);
|
|
31599
|
-
|
|
31600
|
-
let prop3 = /[^=]*/.exec(rule.style)[0];
|
|
31601
|
-
if (matchedStyles.indexOf(prop3) < 0)
|
|
31602
|
-
matchedStyles.push(prop3);
|
|
31538
|
+
else if (rule.style)
|
|
31603
31539
|
this.styles.push(rule);
|
|
31604
|
-
}
|
|
31605
31540
|
});
|
|
31606
31541
|
this.normalizeLists = !this.tags.some((r2) => {
|
|
31607
31542
|
if (!/^(ul|ol)\b/.test(r2.tag) || !r2.node)
|
|
@@ -31861,10 +31796,10 @@ class ParseContext {
|
|
|
31861
31796
|
this.addElement(dom);
|
|
31862
31797
|
}
|
|
31863
31798
|
withStyleRules(dom, f2) {
|
|
31864
|
-
let style2 = dom.style;
|
|
31865
|
-
if (!style2
|
|
31799
|
+
let style2 = dom.getAttribute("style");
|
|
31800
|
+
if (!style2)
|
|
31866
31801
|
return f2();
|
|
31867
|
-
let marks = this.readStyles(
|
|
31802
|
+
let marks = this.readStyles(parseStyles(style2));
|
|
31868
31803
|
if (!marks)
|
|
31869
31804
|
return;
|
|
31870
31805
|
let [addMarks, removeMarks] = marks, top2 = this.top;
|
|
@@ -31958,30 +31893,27 @@ class ParseContext {
|
|
|
31958
31893
|
// had a rule with `ignore` set.
|
|
31959
31894
|
readStyles(styles) {
|
|
31960
31895
|
let add2 = Mark$1.none, remove2 = Mark$1.none;
|
|
31961
|
-
|
|
31962
|
-
for (let
|
|
31963
|
-
let
|
|
31964
|
-
if (
|
|
31965
|
-
|
|
31966
|
-
|
|
31967
|
-
|
|
31968
|
-
|
|
31969
|
-
|
|
31970
|
-
|
|
31971
|
-
|
|
31972
|
-
|
|
31973
|
-
|
|
31974
|
-
|
|
31975
|
-
|
|
31976
|
-
|
|
31977
|
-
|
|
31978
|
-
|
|
31979
|
-
|
|
31980
|
-
after = rule;
|
|
31981
|
-
else
|
|
31982
|
-
break;
|
|
31983
|
-
}
|
|
31896
|
+
for (let i2 = 0; i2 < styles.length; i2 += 2) {
|
|
31897
|
+
for (let after = void 0; ; ) {
|
|
31898
|
+
let rule = this.parser.matchStyle(styles[i2], styles[i2 + 1], this, after);
|
|
31899
|
+
if (!rule)
|
|
31900
|
+
break;
|
|
31901
|
+
if (rule.ignore)
|
|
31902
|
+
return null;
|
|
31903
|
+
if (rule.clearMark) {
|
|
31904
|
+
this.top.pendingMarks.concat(this.top.activeMarks).forEach((m2) => {
|
|
31905
|
+
if (rule.clearMark(m2))
|
|
31906
|
+
remove2 = m2.addToSet(remove2);
|
|
31907
|
+
});
|
|
31908
|
+
} else {
|
|
31909
|
+
add2 = this.parser.schema.marks[rule.mark].create(rule.attrs).addToSet(add2);
|
|
31910
|
+
}
|
|
31911
|
+
if (rule.consuming === false)
|
|
31912
|
+
after = rule;
|
|
31913
|
+
else
|
|
31914
|
+
break;
|
|
31984
31915
|
}
|
|
31916
|
+
}
|
|
31985
31917
|
return [add2, remove2];
|
|
31986
31918
|
}
|
|
31987
31919
|
// Look up a handler for the given node. If none are found, return
|
|
@@ -32250,6 +32182,12 @@ function normalizeList(dom) {
|
|
|
32250
32182
|
function matches(dom, selector2) {
|
|
32251
32183
|
return (dom.matches || dom.msMatchesSelector || dom.webkitMatchesSelector || dom.mozMatchesSelector).call(dom, selector2);
|
|
32252
32184
|
}
|
|
32185
|
+
function parseStyles(style2) {
|
|
32186
|
+
let re2 = /\s*([\w-]+)\s*:\s*([^;]+)/g, m2, result2 = [];
|
|
32187
|
+
while (m2 = re2.exec(style2))
|
|
32188
|
+
result2.push(m2[1], m2[2].trim());
|
|
32189
|
+
return result2;
|
|
32190
|
+
}
|
|
32253
32191
|
function copy$2(obj) {
|
|
32254
32192
|
let copy2 = {};
|
|
32255
32193
|
for (let prop3 in obj)
|
|
@@ -32340,7 +32278,7 @@ class DOMSerializer {
|
|
|
32340
32278
|
@internal
|
|
32341
32279
|
*/
|
|
32342
32280
|
serializeNodeInner(node, options) {
|
|
32343
|
-
let { dom, contentDOM } = renderSpec(doc$1(options), this.nodes[node.type.name](node)
|
|
32281
|
+
let { dom, contentDOM } = DOMSerializer.renderSpec(doc$1(options), this.nodes[node.type.name](node));
|
|
32344
32282
|
if (contentDOM) {
|
|
32345
32283
|
if (node.isLeaf)
|
|
32346
32284
|
throw new RangeError("Content hole not allowed in a leaf node spec");
|
|
@@ -32371,7 +32309,7 @@ class DOMSerializer {
|
|
|
32371
32309
|
*/
|
|
32372
32310
|
serializeMark(mark, inline, options = {}) {
|
|
32373
32311
|
let toDOM = this.marks[mark.type.name];
|
|
32374
|
-
return toDOM && renderSpec(doc$1(options), toDOM(mark, inline)
|
|
32312
|
+
return toDOM && DOMSerializer.renderSpec(doc$1(options), toDOM(mark, inline));
|
|
32375
32313
|
}
|
|
32376
32314
|
/**
|
|
32377
32315
|
Render an [output spec](https://prosemirror.net/docs/ref/#model.DOMOutputSpec) to a DOM node. If
|
|
@@ -32379,7 +32317,48 @@ class DOMSerializer {
|
|
|
32379
32317
|
node with the hole.
|
|
32380
32318
|
*/
|
|
32381
32319
|
static renderSpec(doc2, structure, xmlNS = null) {
|
|
32382
|
-
|
|
32320
|
+
if (typeof structure == "string")
|
|
32321
|
+
return { dom: doc2.createTextNode(structure) };
|
|
32322
|
+
if (structure.nodeType != null)
|
|
32323
|
+
return { dom: structure };
|
|
32324
|
+
if (structure.dom && structure.dom.nodeType != null)
|
|
32325
|
+
return structure;
|
|
32326
|
+
let tagName = structure[0], space = tagName.indexOf(" ");
|
|
32327
|
+
if (space > 0) {
|
|
32328
|
+
xmlNS = tagName.slice(0, space);
|
|
32329
|
+
tagName = tagName.slice(space + 1);
|
|
32330
|
+
}
|
|
32331
|
+
let contentDOM;
|
|
32332
|
+
let dom = xmlNS ? doc2.createElementNS(xmlNS, tagName) : doc2.createElement(tagName);
|
|
32333
|
+
let attrs = structure[1], start2 = 1;
|
|
32334
|
+
if (attrs && typeof attrs == "object" && attrs.nodeType == null && !Array.isArray(attrs)) {
|
|
32335
|
+
start2 = 2;
|
|
32336
|
+
for (let name in attrs)
|
|
32337
|
+
if (attrs[name] != null) {
|
|
32338
|
+
let space2 = name.indexOf(" ");
|
|
32339
|
+
if (space2 > 0)
|
|
32340
|
+
dom.setAttributeNS(name.slice(0, space2), name.slice(space2 + 1), attrs[name]);
|
|
32341
|
+
else
|
|
32342
|
+
dom.setAttribute(name, attrs[name]);
|
|
32343
|
+
}
|
|
32344
|
+
}
|
|
32345
|
+
for (let i2 = start2; i2 < structure.length; i2++) {
|
|
32346
|
+
let child = structure[i2];
|
|
32347
|
+
if (child === 0) {
|
|
32348
|
+
if (i2 < structure.length - 1 || i2 > start2)
|
|
32349
|
+
throw new RangeError("Content hole must be the only child of its parent node");
|
|
32350
|
+
return { dom, contentDOM: dom };
|
|
32351
|
+
} else {
|
|
32352
|
+
let { dom: inner, contentDOM: innerContent } = DOMSerializer.renderSpec(doc2, child, xmlNS);
|
|
32353
|
+
dom.appendChild(inner);
|
|
32354
|
+
if (innerContent) {
|
|
32355
|
+
if (contentDOM)
|
|
32356
|
+
throw new RangeError("Multiple content holes");
|
|
32357
|
+
contentDOM = innerContent;
|
|
32358
|
+
}
|
|
32359
|
+
}
|
|
32360
|
+
}
|
|
32361
|
+
return { dom, contentDOM };
|
|
32383
32362
|
}
|
|
32384
32363
|
/**
|
|
32385
32364
|
Build a serializer using the [`toDOM`](https://prosemirror.net/docs/ref/#model.NodeSpec.toDOM)
|
|
@@ -32417,84 +32396,6 @@ function gatherToDOM(obj) {
|
|
|
32417
32396
|
function doc$1(options) {
|
|
32418
32397
|
return options.document || window.document;
|
|
32419
32398
|
}
|
|
32420
|
-
const suspiciousAttributeCache = /* @__PURE__ */ new WeakMap();
|
|
32421
|
-
function suspiciousAttributes(attrs) {
|
|
32422
|
-
let value = suspiciousAttributeCache.get(attrs);
|
|
32423
|
-
if (value === void 0)
|
|
32424
|
-
suspiciousAttributeCache.set(attrs, value = suspiciousAttributesInner(attrs));
|
|
32425
|
-
return value;
|
|
32426
|
-
}
|
|
32427
|
-
function suspiciousAttributesInner(attrs) {
|
|
32428
|
-
let result2 = null;
|
|
32429
|
-
function scan(value) {
|
|
32430
|
-
if (value && typeof value == "object") {
|
|
32431
|
-
if (Array.isArray(value)) {
|
|
32432
|
-
if (typeof value[0] == "string") {
|
|
32433
|
-
if (!result2)
|
|
32434
|
-
result2 = [];
|
|
32435
|
-
result2.push(value);
|
|
32436
|
-
} else {
|
|
32437
|
-
for (let i2 = 0; i2 < value.length; i2++)
|
|
32438
|
-
scan(value[i2]);
|
|
32439
|
-
}
|
|
32440
|
-
} else {
|
|
32441
|
-
for (let prop3 in value)
|
|
32442
|
-
scan(value[prop3]);
|
|
32443
|
-
}
|
|
32444
|
-
}
|
|
32445
|
-
}
|
|
32446
|
-
scan(attrs);
|
|
32447
|
-
return result2;
|
|
32448
|
-
}
|
|
32449
|
-
function renderSpec(doc2, structure, xmlNS, blockArraysIn) {
|
|
32450
|
-
if (typeof structure == "string")
|
|
32451
|
-
return { dom: doc2.createTextNode(structure) };
|
|
32452
|
-
if (structure.nodeType != null)
|
|
32453
|
-
return { dom: structure };
|
|
32454
|
-
if (structure.dom && structure.dom.nodeType != null)
|
|
32455
|
-
return structure;
|
|
32456
|
-
let tagName = structure[0], suspicious;
|
|
32457
|
-
if (typeof tagName != "string")
|
|
32458
|
-
throw new RangeError("Invalid array passed to renderSpec");
|
|
32459
|
-
if (blockArraysIn && (suspicious = suspiciousAttributes(blockArraysIn)) && suspicious.indexOf(structure) > -1)
|
|
32460
|
-
throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");
|
|
32461
|
-
let space = tagName.indexOf(" ");
|
|
32462
|
-
if (space > 0) {
|
|
32463
|
-
xmlNS = tagName.slice(0, space);
|
|
32464
|
-
tagName = tagName.slice(space + 1);
|
|
32465
|
-
}
|
|
32466
|
-
let contentDOM;
|
|
32467
|
-
let dom = xmlNS ? doc2.createElementNS(xmlNS, tagName) : doc2.createElement(tagName);
|
|
32468
|
-
let attrs = structure[1], start2 = 1;
|
|
32469
|
-
if (attrs && typeof attrs == "object" && attrs.nodeType == null && !Array.isArray(attrs)) {
|
|
32470
|
-
start2 = 2;
|
|
32471
|
-
for (let name in attrs)
|
|
32472
|
-
if (attrs[name] != null) {
|
|
32473
|
-
let space2 = name.indexOf(" ");
|
|
32474
|
-
if (space2 > 0)
|
|
32475
|
-
dom.setAttributeNS(name.slice(0, space2), name.slice(space2 + 1), attrs[name]);
|
|
32476
|
-
else
|
|
32477
|
-
dom.setAttribute(name, attrs[name]);
|
|
32478
|
-
}
|
|
32479
|
-
}
|
|
32480
|
-
for (let i2 = start2; i2 < structure.length; i2++) {
|
|
32481
|
-
let child = structure[i2];
|
|
32482
|
-
if (child === 0) {
|
|
32483
|
-
if (i2 < structure.length - 1 || i2 > start2)
|
|
32484
|
-
throw new RangeError("Content hole must be the only child of its parent node");
|
|
32485
|
-
return { dom, contentDOM: dom };
|
|
32486
|
-
} else {
|
|
32487
|
-
let { dom: inner, contentDOM: innerContent } = renderSpec(doc2, child, xmlNS, blockArraysIn);
|
|
32488
|
-
dom.appendChild(inner);
|
|
32489
|
-
if (innerContent) {
|
|
32490
|
-
if (contentDOM)
|
|
32491
|
-
throw new RangeError("Multiple content holes");
|
|
32492
|
-
contentDOM = innerContent;
|
|
32493
|
-
}
|
|
32494
|
-
}
|
|
32495
|
-
}
|
|
32496
|
-
return { dom, contentDOM };
|
|
32497
|
-
}
|
|
32498
32399
|
const lower16 = 65535;
|
|
32499
32400
|
const factor16 = Math.pow(2, 16);
|
|
32500
32401
|
function makeRecover(index2, offset2) {
|
|
@@ -33154,8 +33055,7 @@ class ReplaceAroundStep extends Step$1 {
|
|
|
33154
33055
|
}
|
|
33155
33056
|
map(mapping) {
|
|
33156
33057
|
let from2 = mapping.mapResult(this.from, 1), to2 = mapping.mapResult(this.to, -1);
|
|
33157
|
-
let gapFrom =
|
|
33158
|
-
let gapTo = this.to == this.gapTo ? to2.pos : mapping.map(this.gapTo, 1);
|
|
33058
|
+
let gapFrom = mapping.map(this.gapFrom, -1), gapTo = mapping.map(this.gapTo, 1);
|
|
33159
33059
|
if (from2.deletedAcross && to2.deletedAcross || gapFrom < from2.pos || gapTo > to2.pos)
|
|
33160
33060
|
return null;
|
|
33161
33061
|
return new ReplaceAroundStep(from2.pos, to2.pos, gapFrom, gapTo, this.slice, this.insert, this.structure);
|
|
@@ -33268,7 +33168,7 @@ function removeMark(tr2, from2, to2, mark) {
|
|
|
33268
33168
|
});
|
|
33269
33169
|
matched.forEach((m2) => tr2.step(new RemoveMarkStep(m2.from, m2.to, m2.style)));
|
|
33270
33170
|
}
|
|
33271
|
-
function clearIncompatible(tr2, pos, parentType, match2 = parentType.contentMatch
|
|
33171
|
+
function clearIncompatible(tr2, pos, parentType, match2 = parentType.contentMatch) {
|
|
33272
33172
|
let node = tr2.doc.nodeAt(pos);
|
|
33273
33173
|
let replSteps = [], cur = pos + 1;
|
|
33274
33174
|
for (let i2 = 0; i2 < node.childCount; i2++) {
|
|
@@ -33281,7 +33181,7 @@ function clearIncompatible(tr2, pos, parentType, match2 = parentType.contentMatc
|
|
|
33281
33181
|
for (let j2 = 0; j2 < child.marks.length; j2++)
|
|
33282
33182
|
if (!parentType.allowsMarkType(child.marks[j2].type))
|
|
33283
33183
|
tr2.step(new RemoveMarkStep(cur, end2, child.marks[j2]));
|
|
33284
|
-
if (
|
|
33184
|
+
if (child.isText && !parentType.spec.code) {
|
|
33285
33185
|
let m2, newline = /\r?\n|\r/g, slice4;
|
|
33286
33186
|
while (m2 = newline.exec(child.text)) {
|
|
33287
33187
|
if (!slice4)
|
|
@@ -33390,45 +33290,14 @@ function setBlockType$1(tr2, from2, to2, type3, attrs) {
|
|
|
33390
33290
|
let mapFrom = tr2.steps.length;
|
|
33391
33291
|
tr2.doc.nodesBetween(from2, to2, (node, pos) => {
|
|
33392
33292
|
if (node.isTextblock && !node.hasMarkup(type3, attrs) && canChangeType(tr2.doc, tr2.mapping.slice(mapFrom).map(pos), type3)) {
|
|
33393
|
-
|
|
33394
|
-
if (type3.schema.linebreakReplacement) {
|
|
33395
|
-
let pre = type3.whitespace == "pre", supportLinebreak = !!type3.contentMatch.matchType(type3.schema.linebreakReplacement);
|
|
33396
|
-
if (pre && !supportLinebreak)
|
|
33397
|
-
convertNewlines = false;
|
|
33398
|
-
else if (!pre && supportLinebreak)
|
|
33399
|
-
convertNewlines = true;
|
|
33400
|
-
}
|
|
33401
|
-
if (convertNewlines === false)
|
|
33402
|
-
replaceLinebreaks(tr2, node, pos, mapFrom);
|
|
33403
|
-
clearIncompatible(tr2, tr2.mapping.slice(mapFrom).map(pos, 1), type3, void 0, convertNewlines === null);
|
|
33293
|
+
tr2.clearIncompatible(tr2.mapping.slice(mapFrom).map(pos, 1), type3);
|
|
33404
33294
|
let mapping = tr2.mapping.slice(mapFrom);
|
|
33405
33295
|
let startM = mapping.map(pos, 1), endM = mapping.map(pos + node.nodeSize, 1);
|
|
33406
33296
|
tr2.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new Slice(Fragment.from(type3.create(attrs, null, node.marks)), 0, 0), 1, true));
|
|
33407
|
-
if (convertNewlines === true)
|
|
33408
|
-
replaceNewlines(tr2, node, pos, mapFrom);
|
|
33409
33297
|
return false;
|
|
33410
33298
|
}
|
|
33411
33299
|
});
|
|
33412
33300
|
}
|
|
33413
|
-
function replaceNewlines(tr2, node, pos, mapFrom) {
|
|
33414
|
-
node.forEach((child, offset2) => {
|
|
33415
|
-
if (child.isText) {
|
|
33416
|
-
let m2, newline = /\r?\n|\r/g;
|
|
33417
|
-
while (m2 = newline.exec(child.text)) {
|
|
33418
|
-
let start2 = tr2.mapping.slice(mapFrom).map(pos + 1 + offset2 + m2.index);
|
|
33419
|
-
tr2.replaceWith(start2, start2 + 1, node.type.schema.linebreakReplacement.create());
|
|
33420
|
-
}
|
|
33421
|
-
}
|
|
33422
|
-
});
|
|
33423
|
-
}
|
|
33424
|
-
function replaceLinebreaks(tr2, node, pos, mapFrom) {
|
|
33425
|
-
node.forEach((child, offset2) => {
|
|
33426
|
-
if (child.type == child.type.schema.linebreakReplacement) {
|
|
33427
|
-
let start2 = tr2.mapping.slice(mapFrom).map(pos + 1 + offset2);
|
|
33428
|
-
tr2.replaceWith(start2, start2 + 1, node.type.schema.text("\n"));
|
|
33429
|
-
}
|
|
33430
|
-
});
|
|
33431
|
-
}
|
|
33432
33301
|
function canChangeType(doc2, pos, type3) {
|
|
33433
33302
|
let $pos = doc2.resolve(pos), index2 = $pos.index();
|
|
33434
33303
|
return $pos.parent.canReplaceWith(index2, index2 + 1, type3);
|
|
@@ -35194,9 +35063,6 @@ const textRange = function(node, from2, to2) {
|
|
|
35194
35063
|
range2.setStart(node, from2 || 0);
|
|
35195
35064
|
return range2;
|
|
35196
35065
|
};
|
|
35197
|
-
const clearReusedRange = function() {
|
|
35198
|
-
reusedRange = null;
|
|
35199
|
-
};
|
|
35200
35066
|
const isEquivalentPosition = function(node, off2, targetNode, targetOff) {
|
|
35201
35067
|
return targetNode && (scanFor(node, off2, targetNode, targetOff, -1) || scanFor(node, off2, targetNode, targetOff, 1));
|
|
35202
35068
|
};
|
|
@@ -35224,40 +35090,6 @@ function scanFor(node, off2, targetNode, targetOff, dir) {
|
|
|
35224
35090
|
function nodeSize(node) {
|
|
35225
35091
|
return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length;
|
|
35226
35092
|
}
|
|
35227
|
-
function textNodeBefore$1(node, offset2) {
|
|
35228
|
-
for (; ; ) {
|
|
35229
|
-
if (node.nodeType == 3 && offset2)
|
|
35230
|
-
return node;
|
|
35231
|
-
if (node.nodeType == 1 && offset2 > 0) {
|
|
35232
|
-
if (node.contentEditable == "false")
|
|
35233
|
-
return null;
|
|
35234
|
-
node = node.childNodes[offset2 - 1];
|
|
35235
|
-
offset2 = nodeSize(node);
|
|
35236
|
-
} else if (node.parentNode && !hasBlockDesc(node)) {
|
|
35237
|
-
offset2 = domIndex(node);
|
|
35238
|
-
node = node.parentNode;
|
|
35239
|
-
} else {
|
|
35240
|
-
return null;
|
|
35241
|
-
}
|
|
35242
|
-
}
|
|
35243
|
-
}
|
|
35244
|
-
function textNodeAfter$1(node, offset2) {
|
|
35245
|
-
for (; ; ) {
|
|
35246
|
-
if (node.nodeType == 3 && offset2 < node.nodeValue.length)
|
|
35247
|
-
return node;
|
|
35248
|
-
if (node.nodeType == 1 && offset2 < node.childNodes.length) {
|
|
35249
|
-
if (node.contentEditable == "false")
|
|
35250
|
-
return null;
|
|
35251
|
-
node = node.childNodes[offset2];
|
|
35252
|
-
offset2 = 0;
|
|
35253
|
-
} else if (node.parentNode && !hasBlockDesc(node)) {
|
|
35254
|
-
offset2 = domIndex(node) + 1;
|
|
35255
|
-
node = node.parentNode;
|
|
35256
|
-
} else {
|
|
35257
|
-
return null;
|
|
35258
|
-
}
|
|
35259
|
-
}
|
|
35260
|
-
}
|
|
35261
35093
|
function isOnEdge(node, offset2, parent) {
|
|
35262
35094
|
for (let atStart = offset2 == 0, atEnd = offset2 == nodeSize(node); atStart || atEnd; ) {
|
|
35263
35095
|
if (node == parent)
|
|
@@ -35329,14 +35161,6 @@ const android = /Android \d/.test(agent);
|
|
|
35329
35161
|
const webkit = !!doc && "webkitFontSmoothing" in doc.documentElement.style;
|
|
35330
35162
|
const webkit_version = webkit ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
|
|
35331
35163
|
function windowRect(doc2) {
|
|
35332
|
-
let vp = doc2.defaultView && doc2.defaultView.visualViewport;
|
|
35333
|
-
if (vp)
|
|
35334
|
-
return {
|
|
35335
|
-
left: 0,
|
|
35336
|
-
right: vp.width,
|
|
35337
|
-
top: 0,
|
|
35338
|
-
bottom: vp.height
|
|
35339
|
-
};
|
|
35340
35164
|
return {
|
|
35341
35165
|
left: 0,
|
|
35342
35166
|
right: doc2.documentElement.clientWidth,
|
|
@@ -35538,14 +35362,14 @@ function posFromCaret(view, node, offset2, coords) {
|
|
|
35538
35362
|
let desc = view.docView.nearestDesc(cur, true);
|
|
35539
35363
|
if (!desc)
|
|
35540
35364
|
return null;
|
|
35541
|
-
if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent || !desc.contentDOM)) {
|
|
35365
|
+
if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent && !sawBlock || !desc.contentDOM)) {
|
|
35542
35366
|
let rect = desc.dom.getBoundingClientRect();
|
|
35543
|
-
if (desc.node.isBlock && desc.parent) {
|
|
35544
|
-
|
|
35367
|
+
if (desc.node.isBlock && desc.parent && !sawBlock) {
|
|
35368
|
+
sawBlock = true;
|
|
35369
|
+
if (rect.left > coords.left || rect.top > coords.top)
|
|
35545
35370
|
outsideBlock = desc.posBefore;
|
|
35546
|
-
else if (
|
|
35371
|
+
else if (rect.right < coords.left || rect.bottom < coords.top)
|
|
35547
35372
|
outsideBlock = desc.posAfter;
|
|
35548
|
-
sawBlock = true;
|
|
35549
35373
|
}
|
|
35550
35374
|
if (!desc.contentDOM && outsideBlock < 0 && !desc.node.isText) {
|
|
35551
35375
|
let before = desc.node.isBlock ? coords.top < (rect.top + rect.bottom) / 2 : coords.left < (rect.left + rect.right) / 2;
|
|
@@ -36160,9 +35984,6 @@ class ViewDesc {
|
|
|
36160
35984
|
get ignoreForCoords() {
|
|
36161
35985
|
return false;
|
|
36162
35986
|
}
|
|
36163
|
-
isText(text) {
|
|
36164
|
-
return false;
|
|
36165
|
-
}
|
|
36166
35987
|
}
|
|
36167
35988
|
class WidgetViewDesc extends ViewDesc {
|
|
36168
35989
|
constructor(parent, widget, view, pos) {
|
|
@@ -36401,7 +36222,8 @@ class NodeViewDesc extends ViewDesc {
|
|
|
36401
36222
|
let { from: from2, to: to2 } = view.state.selection;
|
|
36402
36223
|
if (!(view.state.selection instanceof TextSelection) || from2 < pos || to2 > pos + this.node.content.size)
|
|
36403
36224
|
return null;
|
|
36404
|
-
let
|
|
36225
|
+
let sel = view.domSelectionRange();
|
|
36226
|
+
let textNode = nearbyTextNode(sel.focusNode, sel.focusOffset);
|
|
36405
36227
|
if (!textNode || !this.dom.contains(textNode.parentNode))
|
|
36406
36228
|
return null;
|
|
36407
36229
|
if (this.node.inlineContent) {
|
|
@@ -36467,11 +36289,10 @@ class NodeViewDesc extends ViewDesc {
|
|
|
36467
36289
|
}
|
|
36468
36290
|
// Remove selected node marking from this node.
|
|
36469
36291
|
deselectNode() {
|
|
36470
|
-
if (this.nodeDOM.nodeType == 1)
|
|
36292
|
+
if (this.nodeDOM.nodeType == 1)
|
|
36471
36293
|
this.nodeDOM.classList.remove("ProseMirror-selectednode");
|
|
36472
|
-
|
|
36473
|
-
|
|
36474
|
-
}
|
|
36294
|
+
if (this.contentDOM || !this.node.type.spec.draggable)
|
|
36295
|
+
this.dom.removeAttribute("draggable");
|
|
36475
36296
|
}
|
|
36476
36297
|
get domAtom() {
|
|
36477
36298
|
return this.node.isAtom;
|
|
@@ -36537,9 +36358,6 @@ class TextViewDesc extends NodeViewDesc {
|
|
|
36537
36358
|
get domAtom() {
|
|
36538
36359
|
return false;
|
|
36539
36360
|
}
|
|
36540
|
-
isText(text) {
|
|
36541
|
-
return this.node.text == text;
|
|
36542
|
-
}
|
|
36543
36361
|
}
|
|
36544
36362
|
class TrailingHackViewDesc extends ViewDesc {
|
|
36545
36363
|
parseRule() {
|
|
@@ -37055,6 +36873,23 @@ function iosHacks(dom) {
|
|
|
37055
36873
|
dom.style.cssText = oldCSS;
|
|
37056
36874
|
}
|
|
37057
36875
|
}
|
|
36876
|
+
function nearbyTextNode(node, offset2) {
|
|
36877
|
+
for (; ; ) {
|
|
36878
|
+
if (node.nodeType == 3)
|
|
36879
|
+
return node;
|
|
36880
|
+
if (node.nodeType == 1 && offset2 > 0) {
|
|
36881
|
+
if (node.childNodes.length > offset2 && node.childNodes[offset2].nodeType == 3)
|
|
36882
|
+
return node.childNodes[offset2];
|
|
36883
|
+
node = node.childNodes[offset2 - 1];
|
|
36884
|
+
offset2 = nodeSize(node);
|
|
36885
|
+
} else if (node.nodeType == 1 && offset2 < node.childNodes.length) {
|
|
36886
|
+
node = node.childNodes[offset2];
|
|
36887
|
+
offset2 = 0;
|
|
36888
|
+
} else {
|
|
36889
|
+
return null;
|
|
36890
|
+
}
|
|
36891
|
+
}
|
|
36892
|
+
}
|
|
37058
36893
|
function findTextInFragment(frag, text, from2, to2) {
|
|
37059
36894
|
for (let i2 = 0, pos = 0; i2 < frag.childCount && pos <= to2; ) {
|
|
37060
36895
|
let child = frag.child(i2++), childStart = pos;
|
|
@@ -37629,7 +37464,7 @@ function serializeForClipboard(view, slice4) {
|
|
|
37629
37464
|
if (firstChild && firstChild.nodeType == 1)
|
|
37630
37465
|
firstChild.setAttribute("data-pm-slice", `${openStart} ${openEnd}${wrappers ? ` -${wrappers}` : ""} ${JSON.stringify(context)}`);
|
|
37631
37466
|
let text = view.someProp("clipboardTextSerializer", (f2) => f2(slice4, view)) || slice4.content.textBetween(0, slice4.content.size, "\n\n");
|
|
37632
|
-
return { dom: wrap2, text
|
|
37467
|
+
return { dom: wrap2, text };
|
|
37633
37468
|
}
|
|
37634
37469
|
function parseFromClipboard(view, text, html, plainText, $context) {
|
|
37635
37470
|
let inCode = $context.parent.type.spec.code;
|
|
@@ -37849,7 +37684,6 @@ class InputState {
|
|
|
37849
37684
|
this.lastTouch = 0;
|
|
37850
37685
|
this.lastAndroidDelete = 0;
|
|
37851
37686
|
this.composing = false;
|
|
37852
|
-
this.compositionNode = null;
|
|
37853
37687
|
this.composingTimeout = -1;
|
|
37854
37688
|
this.compositionNodes = [];
|
|
37855
37689
|
this.compositionEndedAt = -2e8;
|
|
@@ -38099,7 +37933,7 @@ class MouseDown {
|
|
|
38099
37933
|
}
|
|
38100
37934
|
const target = flushed ? null : event.target;
|
|
38101
37935
|
const targetDesc = target ? view.docView.nearestDesc(target, true) : null;
|
|
38102
|
-
this.target = targetDesc
|
|
37936
|
+
this.target = targetDesc ? targetDesc.dom : null;
|
|
38103
37937
|
let { selection } = view.state;
|
|
38104
37938
|
if (event.button == 0 && targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false || selection instanceof NodeSelection && selection.from <= targetPos && selection.to > targetPos)
|
|
38105
37939
|
this.mightDrag = {
|
|
@@ -38231,7 +38065,6 @@ editHandlers.compositionend = (view, event) => {
|
|
|
38231
38065
|
view.input.composing = false;
|
|
38232
38066
|
view.input.compositionEndedAt = event.timeStamp;
|
|
38233
38067
|
view.input.compositionPendingChanges = view.domObserver.pendingRecords().length ? view.input.compositionID : 0;
|
|
38234
|
-
view.input.compositionNode = null;
|
|
38235
38068
|
if (view.input.compositionPendingChanges)
|
|
38236
38069
|
Promise.resolve().then(() => view.domObserver.flush());
|
|
38237
38070
|
view.input.compositionID++;
|
|
@@ -38251,26 +38084,6 @@ function clearComposition(view) {
|
|
|
38251
38084
|
while (view.input.compositionNodes.length > 0)
|
|
38252
38085
|
view.input.compositionNodes.pop().markParentsDirty();
|
|
38253
38086
|
}
|
|
38254
|
-
function findCompositionNode(view) {
|
|
38255
|
-
let sel = view.domSelectionRange();
|
|
38256
|
-
if (!sel.focusNode)
|
|
38257
|
-
return null;
|
|
38258
|
-
let textBefore = textNodeBefore$1(sel.focusNode, sel.focusOffset);
|
|
38259
|
-
let textAfter = textNodeAfter$1(sel.focusNode, sel.focusOffset);
|
|
38260
|
-
if (textBefore && textAfter && textBefore != textAfter) {
|
|
38261
|
-
let descAfter = textAfter.pmViewDesc, lastChanged = view.domObserver.lastChangedTextNode;
|
|
38262
|
-
if (textBefore == lastChanged || textAfter == lastChanged)
|
|
38263
|
-
return lastChanged;
|
|
38264
|
-
if (!descAfter || !descAfter.isText(textAfter.nodeValue)) {
|
|
38265
|
-
return textAfter;
|
|
38266
|
-
} else if (view.input.compositionNode == textAfter) {
|
|
38267
|
-
let descBefore = textBefore.pmViewDesc;
|
|
38268
|
-
if (!(!descBefore || !descBefore.isText(textBefore.nodeValue)))
|
|
38269
|
-
return textAfter;
|
|
38270
|
-
}
|
|
38271
|
-
}
|
|
38272
|
-
return textBefore || textAfter;
|
|
38273
|
-
}
|
|
38274
38087
|
function timestampFromCustomEvent() {
|
|
38275
38088
|
let event = document.createEvent("Event");
|
|
38276
38089
|
event.initEvent("event", true, true);
|
|
@@ -38405,8 +38218,7 @@ handlers.dragstart = (view, _event) => {
|
|
|
38405
38218
|
if (desc && desc.node.type.spec.draggable && desc != view.docView)
|
|
38406
38219
|
node = NodeSelection.create(view.state.doc, desc.posBefore);
|
|
38407
38220
|
}
|
|
38408
|
-
let
|
|
38409
|
-
let { dom, text, slice: slice4 } = serializeForClipboard(view, draggedSlice);
|
|
38221
|
+
let slice4 = (node || view.state.selection).content(), { dom, text } = serializeForClipboard(view, slice4);
|
|
38410
38222
|
event.dataTransfer.clearData();
|
|
38411
38223
|
event.dataTransfer.setData(brokenClipboardAPI ? "Text" : "text/html", dom.innerHTML);
|
|
38412
38224
|
event.dataTransfer.effectAllowed = "copyMove";
|
|
@@ -38826,6 +38638,9 @@ class DecorationSet {
|
|
|
38826
38638
|
return this;
|
|
38827
38639
|
return local.length || children2.length ? new DecorationSet(local, children2) : empty$1;
|
|
38828
38640
|
}
|
|
38641
|
+
/**
|
|
38642
|
+
@internal
|
|
38643
|
+
*/
|
|
38829
38644
|
forChild(offset2, node) {
|
|
38830
38645
|
if (this == empty$1)
|
|
38831
38646
|
return this;
|
|
@@ -39179,7 +38994,6 @@ class DOMObserver {
|
|
|
39179
38994
|
this.currentSelection = new SelectionState();
|
|
39180
38995
|
this.onCharData = null;
|
|
39181
38996
|
this.suppressingSelectionUpdates = false;
|
|
39182
|
-
this.lastChangedTextNode = null;
|
|
39183
38997
|
this.observer = window.MutationObserver && new window.MutationObserver((mutations) => {
|
|
39184
38998
|
for (let i2 = 0; i2 < mutations.length; i2++)
|
|
39185
38999
|
this.queue.push(mutations[i2]);
|
|
@@ -39305,21 +39119,14 @@ class DOMObserver {
|
|
|
39305
39119
|
}
|
|
39306
39120
|
}
|
|
39307
39121
|
}
|
|
39308
|
-
if (gecko && added.length) {
|
|
39122
|
+
if (gecko && added.length > 1) {
|
|
39309
39123
|
let brs = added.filter((n2) => n2.nodeName == "BR");
|
|
39310
39124
|
if (brs.length == 2) {
|
|
39311
|
-
let [
|
|
39125
|
+
let a2 = brs[0], b2 = brs[1];
|
|
39312
39126
|
if (a2.parentNode && a2.parentNode.parentNode == b2.parentNode)
|
|
39313
39127
|
b2.remove();
|
|
39314
39128
|
else
|
|
39315
39129
|
a2.remove();
|
|
39316
|
-
} else {
|
|
39317
|
-
let { focusNode } = this.currentSelection;
|
|
39318
|
-
for (let br2 of brs) {
|
|
39319
|
-
let parent = br2.parentNode;
|
|
39320
|
-
if (parent && parent.nodeName == "LI" && (!focusNode || blockParent(view, focusNode) != parent))
|
|
39321
|
-
br2.remove();
|
|
39322
|
-
}
|
|
39323
39130
|
}
|
|
39324
39131
|
}
|
|
39325
39132
|
let readSel = null;
|
|
@@ -39351,12 +39158,8 @@ class DOMObserver {
|
|
|
39351
39158
|
if (!desc || desc.ignoreMutation(mut))
|
|
39352
39159
|
return null;
|
|
39353
39160
|
if (mut.type == "childList") {
|
|
39354
|
-
for (let i2 = 0; i2 < mut.addedNodes.length; i2++)
|
|
39355
|
-
|
|
39356
|
-
added.push(node);
|
|
39357
|
-
if (node.nodeType == 3)
|
|
39358
|
-
this.lastChangedTextNode = node;
|
|
39359
|
-
}
|
|
39161
|
+
for (let i2 = 0; i2 < mut.addedNodes.length; i2++)
|
|
39162
|
+
added.push(mut.addedNodes[i2]);
|
|
39360
39163
|
if (desc.contentDOM && desc.contentDOM != desc.dom && !desc.contentDOM.contains(mut.target))
|
|
39361
39164
|
return { from: desc.posBefore, to: desc.posAfter };
|
|
39362
39165
|
let prev = mut.previousSibling, next = mut.nextSibling;
|
|
@@ -39377,7 +39180,6 @@ class DOMObserver {
|
|
|
39377
39180
|
} else if (mut.type == "attributes") {
|
|
39378
39181
|
return { from: desc.posAtStart - desc.border, to: desc.posAtEnd + desc.border };
|
|
39379
39182
|
} else {
|
|
39380
|
-
this.lastChangedTextNode = mut.target;
|
|
39381
39183
|
return {
|
|
39382
39184
|
from: desc.posAtStart,
|
|
39383
39185
|
to: desc.posAtEnd,
|
|
@@ -39404,20 +39206,7 @@ function checkCSS(view) {
|
|
|
39404
39206
|
cssCheckWarned = true;
|
|
39405
39207
|
}
|
|
39406
39208
|
}
|
|
39407
|
-
function
|
|
39408
|
-
let anchorNode = range2.startContainer, anchorOffset = range2.startOffset;
|
|
39409
|
-
let focusNode = range2.endContainer, focusOffset = range2.endOffset;
|
|
39410
|
-
let currentAnchor = view.domAtPos(view.state.selection.anchor);
|
|
39411
|
-
if (isEquivalentPosition(currentAnchor.node, currentAnchor.offset, focusNode, focusOffset))
|
|
39412
|
-
[anchorNode, anchorOffset, focusNode, focusOffset] = [focusNode, focusOffset, anchorNode, anchorOffset];
|
|
39413
|
-
return { anchorNode, anchorOffset, focusNode, focusOffset };
|
|
39414
|
-
}
|
|
39415
|
-
function safariShadowSelectionRange(view, selection) {
|
|
39416
|
-
if (selection.getComposedRanges) {
|
|
39417
|
-
let range2 = selection.getComposedRanges(view.root)[0];
|
|
39418
|
-
if (range2)
|
|
39419
|
-
return rangeToSelectionRange(view, range2);
|
|
39420
|
-
}
|
|
39209
|
+
function safariShadowSelectionRange(view) {
|
|
39421
39210
|
let found2;
|
|
39422
39211
|
function read2(event) {
|
|
39423
39212
|
event.preventDefault();
|
|
@@ -39427,15 +39216,12 @@ function safariShadowSelectionRange(view, selection) {
|
|
|
39427
39216
|
view.dom.addEventListener("beforeinput", read2, true);
|
|
39428
39217
|
document.execCommand("indent");
|
|
39429
39218
|
view.dom.removeEventListener("beforeinput", read2, true);
|
|
39430
|
-
|
|
39431
|
-
|
|
39432
|
-
|
|
39433
|
-
|
|
39434
|
-
|
|
39435
|
-
|
|
39436
|
-
return p2;
|
|
39437
|
-
}
|
|
39438
|
-
return null;
|
|
39219
|
+
let anchorNode = found2.startContainer, anchorOffset = found2.startOffset;
|
|
39220
|
+
let focusNode = found2.endContainer, focusOffset = found2.endOffset;
|
|
39221
|
+
let currentAnchor = view.domAtPos(view.state.selection.anchor);
|
|
39222
|
+
if (isEquivalentPosition(currentAnchor.node, currentAnchor.offset, focusNode, focusOffset))
|
|
39223
|
+
[anchorNode, anchorOffset, focusNode, focusOffset] = [focusNode, focusOffset, anchorNode, anchorOffset];
|
|
39224
|
+
return { anchorNode, anchorOffset, focusNode, focusOffset };
|
|
39439
39225
|
}
|
|
39440
39226
|
function parseBetween(view, from_, to_) {
|
|
39441
39227
|
let { node: parent, fromOffset, toOffset, from: from2, to: to2 } = view.docView.parseRange(from_, to_);
|
|
@@ -39555,6 +39341,10 @@ function readDOMChange(view, from2, to2, typeOver, addedNodes) {
|
|
|
39555
39341
|
return;
|
|
39556
39342
|
}
|
|
39557
39343
|
}
|
|
39344
|
+
if (chrome && view.cursorWrapper && parse2.sel && parse2.sel.anchor == view.cursorWrapper.deco.from && parse2.sel.head == parse2.sel.anchor) {
|
|
39345
|
+
let size2 = change.endB - change.start;
|
|
39346
|
+
parse2.sel = { anchor: parse2.sel.anchor + size2, head: parse2.sel.anchor + size2 };
|
|
39347
|
+
}
|
|
39558
39348
|
view.input.domChangeCount++;
|
|
39559
39349
|
if (view.state.selection.from < view.state.selection.to && change.start == change.endB && view.state.selection instanceof TextSelection) {
|
|
39560
39350
|
if (change.start > view.state.selection.from && change.start <= view.state.selection.from + 2 && view.state.selection.from >= parse2.from) {
|
|
@@ -39578,7 +39368,7 @@ function readDOMChange(view, from2, to2, typeOver, addedNodes) {
|
|
|
39578
39368
|
view.input.lastIOSEnter = 0;
|
|
39579
39369
|
return;
|
|
39580
39370
|
}
|
|
39581
|
-
if (view.state.selection.anchor > change.start &&
|
|
39371
|
+
if (view.state.selection.anchor > change.start && looksLikeJoin(doc2, change.start, change.endA, $from, $to) && view.someProp("handleKeyDown", (f2) => f2(view, keyEvent(8, "Backspace")))) {
|
|
39582
39372
|
if (android && chrome)
|
|
39583
39373
|
view.domObserver.suppressSelectionUpdates();
|
|
39584
39374
|
return;
|
|
@@ -39662,18 +39452,12 @@ function isMarkChange(cur, prev) {
|
|
|
39662
39452
|
if (Fragment.from(updated).eq(cur))
|
|
39663
39453
|
return { mark, type: type3 };
|
|
39664
39454
|
}
|
|
39665
|
-
function
|
|
39666
|
-
if (
|
|
39667
|
-
|
|
39668
|
-
|
|
39669
|
-
skipClosingAndOpening($newStart, true, false) < $newEnd.pos
|
|
39670
|
-
)
|
|
39455
|
+
function looksLikeJoin(old, start2, end2, $newStart, $newEnd) {
|
|
39456
|
+
if (!$newStart.parent.isTextblock || // The content must have shrunk
|
|
39457
|
+
end2 - start2 <= $newEnd.pos - $newStart.pos || // newEnd must point directly at or after the end of the block that newStart points into
|
|
39458
|
+
skipClosingAndOpening($newStart, true, false) < $newEnd.pos)
|
|
39671
39459
|
return false;
|
|
39672
39460
|
let $start = old.resolve(start2);
|
|
39673
|
-
if (!$newStart.parent.isTextblock) {
|
|
39674
|
-
let after = $start.nodeAfter;
|
|
39675
|
-
return after != null && end2 == start2 + after.nodeSize;
|
|
39676
|
-
}
|
|
39677
39461
|
if ($start.parentOffset < $start.parent.content.size || !$start.parent.isTextblock)
|
|
39678
39462
|
return false;
|
|
39679
39463
|
let $next = old.resolve(skipClosingAndOpening($start, true, true));
|
|
@@ -39862,10 +39646,8 @@ class EditorView {
|
|
|
39862
39646
|
let forceSelUpdate = updateDoc && (ie$1 || chrome) && !this.composing && !prev.selection.empty && !state2.selection.empty && selectionContextChanged(prev.selection, state2.selection);
|
|
39863
39647
|
if (updateDoc) {
|
|
39864
39648
|
let chromeKludge = chrome ? this.trackWrites = this.domSelectionRange().focusNode : null;
|
|
39865
|
-
if (this.composing)
|
|
39866
|
-
this.input.compositionNode = findCompositionNode(this);
|
|
39867
39649
|
if (redraw || !this.docView.update(state2.doc, outerDeco, innerDeco, this)) {
|
|
39868
|
-
this.docView.updateOuterDeco(
|
|
39650
|
+
this.docView.updateOuterDeco([]);
|
|
39869
39651
|
this.docView.destroy();
|
|
39870
39652
|
this.docView = docViewDesc(state2.doc, outerDeco, innerDeco, this.dom, this);
|
|
39871
39653
|
}
|
|
@@ -40124,7 +39906,6 @@ class EditorView {
|
|
|
40124
39906
|
}
|
|
40125
39907
|
this.docView.destroy();
|
|
40126
39908
|
this.docView = null;
|
|
40127
|
-
clearReusedRange();
|
|
40128
39909
|
}
|
|
40129
39910
|
/**
|
|
40130
39911
|
This is true when the view has been
|
|
@@ -40160,8 +39941,7 @@ class EditorView {
|
|
|
40160
39941
|
@internal
|
|
40161
39942
|
*/
|
|
40162
39943
|
domSelectionRange() {
|
|
40163
|
-
|
|
40164
|
-
return safari && this.root.nodeType === 11 && deepActiveElement(this.dom.ownerDocument) == this.dom && safariShadowSelectionRange(this, sel) || sel;
|
|
39944
|
+
return safari && this.root.nodeType === 11 && deepActiveElement(this.dom.ownerDocument) == this.dom ? safariShadowSelectionRange(this) : this.domSelection();
|
|
40165
39945
|
}
|
|
40166
39946
|
/**
|
|
40167
39947
|
@internal
|
|
@@ -41152,8 +40932,7 @@ function getAttributesFromExtensions(extensions) {
|
|
|
41152
40932
|
const context = {
|
|
41153
40933
|
name: extension.name,
|
|
41154
40934
|
options: extension.options,
|
|
41155
|
-
storage: extension.storage
|
|
41156
|
-
extensions: nodeAndMarkExtensions
|
|
40935
|
+
storage: extension.storage
|
|
41157
40936
|
};
|
|
41158
40937
|
const addGlobalAttributes = getExtensionField(extension, "addGlobalAttributes", context);
|
|
41159
40938
|
if (!addGlobalAttributes) {
|
|
@@ -41279,7 +41058,7 @@ function fromString(value) {
|
|
|
41279
41058
|
return value;
|
|
41280
41059
|
}
|
|
41281
41060
|
function injectExtensionAttributesToParseRule(parseRule, extensionAttributes) {
|
|
41282
|
-
if (
|
|
41061
|
+
if (parseRule.style) {
|
|
41283
41062
|
return parseRule;
|
|
41284
41063
|
}
|
|
41285
41064
|
return {
|
|
@@ -41344,7 +41123,6 @@ function getSchemaByResolvedExtensions(extensions, editor) {
|
|
|
41344
41123
|
selectable: callOrReturn(getExtensionField(extension, "selectable", context)),
|
|
41345
41124
|
draggable: callOrReturn(getExtensionField(extension, "draggable", context)),
|
|
41346
41125
|
code: callOrReturn(getExtensionField(extension, "code", context)),
|
|
41347
|
-
whitespace: callOrReturn(getExtensionField(extension, "whitespace", context)),
|
|
41348
41126
|
defining: callOrReturn(getExtensionField(extension, "defining", context)),
|
|
41349
41127
|
isolating: callOrReturn(getExtensionField(extension, "isolating", context)),
|
|
41350
41128
|
attrs: Object.fromEntries(extensionAttributes.map((extensionAttribute) => {
|
|
@@ -41900,7 +41678,7 @@ class ExtensionManager {
|
|
|
41900
41678
|
const plugins2 = [];
|
|
41901
41679
|
const addKeyboardShortcuts = getExtensionField(extension, "addKeyboardShortcuts", context);
|
|
41902
41680
|
let defaultBindings = {};
|
|
41903
|
-
if (extension.type === "mark" &&
|
|
41681
|
+
if (extension.type === "mark" && extension.config.exitable) {
|
|
41904
41682
|
defaultBindings.ArrowRight = () => Mark.handleExit({ editor, mark: extension });
|
|
41905
41683
|
}
|
|
41906
41684
|
if (addKeyboardShortcuts) {
|
|
@@ -42048,10 +41826,14 @@ function mergeDeep(target, source) {
|
|
|
42048
41826
|
const output = { ...target };
|
|
42049
41827
|
if (isPlainObject(target) && isPlainObject(source)) {
|
|
42050
41828
|
Object.keys(source).forEach((key) => {
|
|
42051
|
-
if (isPlainObject(source[key])
|
|
42052
|
-
|
|
41829
|
+
if (isPlainObject(source[key])) {
|
|
41830
|
+
if (!(key in target)) {
|
|
41831
|
+
Object.assign(output, { [key]: source[key] });
|
|
41832
|
+
} else {
|
|
41833
|
+
output[key] = mergeDeep(target[key], source[key]);
|
|
41834
|
+
}
|
|
42053
41835
|
} else {
|
|
42054
|
-
output[key]
|
|
41836
|
+
Object.assign(output, { [key]: source[key] });
|
|
42055
41837
|
}
|
|
42056
41838
|
});
|
|
42057
41839
|
}
|
|
@@ -42090,15 +41872,13 @@ class Extension {
|
|
|
42090
41872
|
return new Extension(config);
|
|
42091
41873
|
}
|
|
42092
41874
|
configure(options = {}) {
|
|
42093
|
-
const extension = this.extend(
|
|
42094
|
-
...this.config,
|
|
42095
|
-
addOptions() {
|
|
42096
|
-
var _a2;
|
|
42097
|
-
return mergeDeep(((_a2 = this.parent) === null || _a2 === void 0 ? void 0 : _a2.call(this)) || {}, options);
|
|
42098
|
-
}
|
|
42099
|
-
});
|
|
42100
|
-
extension.name = this.name;
|
|
41875
|
+
const extension = this.extend();
|
|
42101
41876
|
extension.parent = this.parent;
|
|
41877
|
+
extension.options = mergeDeep(this.options, options);
|
|
41878
|
+
extension.storage = callOrReturn(getExtensionField(extension, "addStorage", {
|
|
41879
|
+
name: extension.name,
|
|
41880
|
+
options: extension.options
|
|
41881
|
+
}));
|
|
42102
41882
|
return extension;
|
|
42103
41883
|
}
|
|
42104
41884
|
extend(extendedConfig = {}) {
|
|
@@ -42106,7 +41886,7 @@ class Extension {
|
|
|
42106
41886
|
extension.parent = this;
|
|
42107
41887
|
this.child = extension;
|
|
42108
41888
|
extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
|
|
42109
|
-
if (extendedConfig.defaultOptions
|
|
41889
|
+
if (extendedConfig.defaultOptions) {
|
|
42110
41890
|
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
|
|
42111
41891
|
}
|
|
42112
41892
|
extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
|
|
@@ -42490,47 +42270,13 @@ function createNodeFromContent(content, schema, options) {
|
|
|
42490
42270
|
}
|
|
42491
42271
|
return schema.nodeFromJSON(content);
|
|
42492
42272
|
} catch (error) {
|
|
42493
|
-
if (options.errorOnInvalidContent) {
|
|
42494
|
-
throw new Error("[tiptap error]: Invalid JSON content", { cause: error });
|
|
42495
|
-
}
|
|
42496
42273
|
console.warn("[tiptap warn]: Invalid content.", "Passed value:", content, "Error:", error);
|
|
42497
42274
|
return createNodeFromContent("", schema, options);
|
|
42498
42275
|
}
|
|
42499
42276
|
}
|
|
42500
42277
|
if (isTextContent) {
|
|
42501
|
-
|
|
42502
|
-
|
|
42503
|
-
let invalidContent = "";
|
|
42504
|
-
if (options.errorOnInvalidContent) {
|
|
42505
|
-
schemaToUse = new Schema({
|
|
42506
|
-
topNode: schema.spec.topNode,
|
|
42507
|
-
marks: schema.spec.marks,
|
|
42508
|
-
// Prosemirror's schemas are executed such that: the last to execute, matches last
|
|
42509
|
-
// This means that we can add a catch-all node at the end of the schema to catch any content that we don't know how to handle
|
|
42510
|
-
nodes: schema.spec.nodes.append({
|
|
42511
|
-
__tiptap__private__unknown__catch__all__node: {
|
|
42512
|
-
content: "inline*",
|
|
42513
|
-
group: "block",
|
|
42514
|
-
parseDOM: [
|
|
42515
|
-
{
|
|
42516
|
-
tag: "*",
|
|
42517
|
-
getAttrs: (e) => {
|
|
42518
|
-
hasInvalidContent = true;
|
|
42519
|
-
invalidContent = typeof e === "string" ? e : e.outerHTML;
|
|
42520
|
-
return null;
|
|
42521
|
-
}
|
|
42522
|
-
}
|
|
42523
|
-
]
|
|
42524
|
-
}
|
|
42525
|
-
})
|
|
42526
|
-
});
|
|
42527
|
-
}
|
|
42528
|
-
const parser = DOMParser.fromSchema(schemaToUse);
|
|
42529
|
-
const response = options.slice ? parser.parseSlice(elementFromString(content), options.parseOptions).content : parser.parse(elementFromString(content), options.parseOptions);
|
|
42530
|
-
if (options.errorOnInvalidContent && hasInvalidContent) {
|
|
42531
|
-
throw new Error("[tiptap error]: Invalid HTML content", { cause: new Error(`Invalid element found: ${invalidContent}`) });
|
|
42532
|
-
}
|
|
42533
|
-
return response;
|
|
42278
|
+
const parser = DOMParser.fromSchema(schema);
|
|
42279
|
+
return options.slice ? parser.parseSlice(elementFromString(content), options.parseOptions).content : parser.parse(elementFromString(content), options.parseOptions);
|
|
42534
42280
|
}
|
|
42535
42281
|
return createNodeFromContent("", schema, options);
|
|
42536
42282
|
}
|
|
@@ -42553,10 +42299,9 @@ function selectionToInsertionEnd(tr2, startLen, bias) {
|
|
|
42553
42299
|
tr2.setSelection(Selection$1.near(tr2.doc.resolve(end2), bias));
|
|
42554
42300
|
}
|
|
42555
42301
|
const isFragment = (nodeOrFragment) => {
|
|
42556
|
-
return
|
|
42302
|
+
return nodeOrFragment.toString().startsWith("<");
|
|
42557
42303
|
};
|
|
42558
42304
|
const insertContentAt = (position, value, options) => ({ tr: tr2, dispatch, editor }) => {
|
|
42559
|
-
var _a2;
|
|
42560
42305
|
if (dispatch) {
|
|
42561
42306
|
options = {
|
|
42562
42307
|
parseOptions: {},
|
|
@@ -42565,17 +42310,14 @@ const insertContentAt = (position, value, options) => ({ tr: tr2, dispatch, edit
|
|
|
42565
42310
|
applyPasteRules: false,
|
|
42566
42311
|
...options
|
|
42567
42312
|
};
|
|
42568
|
-
|
|
42569
|
-
|
|
42570
|
-
|
|
42571
|
-
parseOptions
|
|
42572
|
-
|
|
42573
|
-
|
|
42574
|
-
|
|
42575
|
-
|
|
42576
|
-
});
|
|
42577
|
-
} catch (e) {
|
|
42578
|
-
return false;
|
|
42313
|
+
const content = createNodeFromContent(value, editor.schema, {
|
|
42314
|
+
parseOptions: {
|
|
42315
|
+
preserveWhitespace: "full",
|
|
42316
|
+
...options.parseOptions
|
|
42317
|
+
}
|
|
42318
|
+
});
|
|
42319
|
+
if (content.toString() === "<>") {
|
|
42320
|
+
return true;
|
|
42579
42321
|
}
|
|
42580
42322
|
let { from: from2, to: to2 } = typeof position === "number" ? { from: position, to: position } : { from: position.from, to: position.to };
|
|
42581
42323
|
let isOnlyTextContent = true;
|
|
@@ -42632,7 +42374,7 @@ const joinBackward = () => ({ state: state2, dispatch }) => {
|
|
|
42632
42374
|
const joinForward = () => ({ state: state2, dispatch }) => {
|
|
42633
42375
|
return joinForward$1(state2, dispatch);
|
|
42634
42376
|
};
|
|
42635
|
-
const joinItemBackward = () => ({ state: state2, dispatch
|
|
42377
|
+
const joinItemBackward = () => ({ tr: tr2, state: state2, dispatch }) => {
|
|
42636
42378
|
try {
|
|
42637
42379
|
const point2 = joinPoint(state2.doc, state2.selection.$from.pos, -1);
|
|
42638
42380
|
if (point2 === null || point2 === void 0) {
|
|
@@ -42643,7 +42385,7 @@ const joinItemBackward = () => ({ state: state2, dispatch, tr: tr2 }) => {
|
|
|
42643
42385
|
dispatch(tr2);
|
|
42644
42386
|
}
|
|
42645
42387
|
return true;
|
|
42646
|
-
} catch
|
|
42388
|
+
} catch {
|
|
42647
42389
|
return false;
|
|
42648
42390
|
}
|
|
42649
42391
|
};
|
|
@@ -42861,32 +42603,16 @@ const selectTextblockEnd = () => ({ state: state2, dispatch }) => {
|
|
|
42861
42603
|
const selectTextblockStart = () => ({ state: state2, dispatch }) => {
|
|
42862
42604
|
return selectTextblockStart$1(state2, dispatch);
|
|
42863
42605
|
};
|
|
42864
|
-
function createDocument(content, schema, parseOptions = {}
|
|
42865
|
-
return createNodeFromContent(content, schema, {
|
|
42866
|
-
slice: false,
|
|
42867
|
-
parseOptions,
|
|
42868
|
-
errorOnInvalidContent: options.errorOnInvalidContent
|
|
42869
|
-
});
|
|
42606
|
+
function createDocument(content, schema, parseOptions = {}) {
|
|
42607
|
+
return createNodeFromContent(content, schema, { slice: false, parseOptions });
|
|
42870
42608
|
}
|
|
42871
|
-
const setContent$1 = (content, emitUpdate = false, parseOptions = {}
|
|
42872
|
-
var _a2, _b;
|
|
42609
|
+
const setContent$1 = (content, emitUpdate = false, parseOptions = {}) => ({ tr: tr2, editor, dispatch }) => {
|
|
42873
42610
|
const { doc: doc2 } = tr2;
|
|
42874
|
-
|
|
42875
|
-
const document2 = createDocument(content, editor.schema, parseOptions, {
|
|
42876
|
-
errorOnInvalidContent: (_a2 = options.errorOnInvalidContent) !== null && _a2 !== void 0 ? _a2 : editor.options.enableContentCheck
|
|
42877
|
-
});
|
|
42878
|
-
if (dispatch) {
|
|
42879
|
-
tr2.replaceWith(0, doc2.content.size, document2).setMeta("preventUpdate", !emitUpdate);
|
|
42880
|
-
}
|
|
42881
|
-
return true;
|
|
42882
|
-
}
|
|
42611
|
+
const document2 = createDocument(content, editor.schema, parseOptions);
|
|
42883
42612
|
if (dispatch) {
|
|
42884
|
-
tr2.setMeta("preventUpdate", !emitUpdate);
|
|
42613
|
+
tr2.replaceWith(0, doc2.content.size, document2).setMeta("preventUpdate", !emitUpdate);
|
|
42885
42614
|
}
|
|
42886
|
-
return
|
|
42887
|
-
parseOptions,
|
|
42888
|
-
errorOnInvalidContent: (_b = options.errorOnInvalidContent) !== null && _b !== void 0 ? _b : editor.options.enableContentCheck
|
|
42889
|
-
});
|
|
42615
|
+
return true;
|
|
42890
42616
|
};
|
|
42891
42617
|
function getMarkAttributes(state2, typeOrName) {
|
|
42892
42618
|
const type3 = getMarkType(typeOrName, state2.schema);
|
|
@@ -43089,11 +42815,10 @@ function isList(name, extensions) {
|
|
|
43089
42815
|
return group.split(" ").includes("list");
|
|
43090
42816
|
}
|
|
43091
42817
|
function isNodeEmpty(node) {
|
|
43092
|
-
|
|
43093
|
-
|
|
43094
|
-
|
|
43095
|
-
|
|
43096
|
-
return node.eq(defaultContent);
|
|
42818
|
+
var _a2;
|
|
42819
|
+
const defaultContent = (_a2 = node.type.createAndFill()) === null || _a2 === void 0 ? void 0 : _a2.toJSON();
|
|
42820
|
+
const content = node.toJSON();
|
|
42821
|
+
return JSON.stringify(defaultContent) === JSON.stringify(content);
|
|
43097
42822
|
}
|
|
43098
42823
|
function isNodeSelection(value) {
|
|
43099
42824
|
return value instanceof NodeSelection;
|
|
@@ -43608,14 +43333,14 @@ var commands = /* @__PURE__ */ Object.freeze({
|
|
|
43608
43333
|
forEach,
|
|
43609
43334
|
insertContent,
|
|
43610
43335
|
insertContentAt,
|
|
43611
|
-
|
|
43336
|
+
joinUp,
|
|
43612
43337
|
joinDown,
|
|
43338
|
+
joinBackward,
|
|
43613
43339
|
joinForward,
|
|
43614
43340
|
joinItemBackward,
|
|
43615
43341
|
joinItemForward,
|
|
43616
43342
|
joinTextblockBackward,
|
|
43617
43343
|
joinTextblockForward,
|
|
43618
|
-
joinUp,
|
|
43619
43344
|
keyboardShortcut,
|
|
43620
43345
|
lift,
|
|
43621
43346
|
liftEmptyBlock,
|
|
@@ -43812,16 +43537,13 @@ const Tabindex = Extension.create({
|
|
|
43812
43537
|
new Plugin({
|
|
43813
43538
|
key: new PluginKey("tabindex"),
|
|
43814
43539
|
props: {
|
|
43815
|
-
attributes:
|
|
43540
|
+
attributes: this.editor.isEditable ? { tabindex: "0" } : {}
|
|
43816
43541
|
}
|
|
43817
43542
|
})
|
|
43818
43543
|
];
|
|
43819
43544
|
}
|
|
43820
43545
|
});
|
|
43821
43546
|
class NodePos {
|
|
43822
|
-
get name() {
|
|
43823
|
-
return this.node.type.name;
|
|
43824
|
-
}
|
|
43825
43547
|
constructor(pos, editor, isBlock = false, node = null) {
|
|
43826
43548
|
this.currentNode = null;
|
|
43827
43549
|
this.actualDepth = null;
|
|
@@ -43830,6 +43552,9 @@ class NodePos {
|
|
|
43830
43552
|
this.editor = editor;
|
|
43831
43553
|
this.currentNode = node;
|
|
43832
43554
|
}
|
|
43555
|
+
get name() {
|
|
43556
|
+
return this.node.type.name;
|
|
43557
|
+
}
|
|
43833
43558
|
get node() {
|
|
43834
43559
|
return this.currentNode || this.resolvedPos.node();
|
|
43835
43560
|
}
|
|
@@ -44093,7 +43818,6 @@ let Editor$1 = class Editor2 extends EventEmitter {
|
|
|
44093
43818
|
enableInputRules: true,
|
|
44094
43819
|
enablePasteRules: true,
|
|
44095
43820
|
enableCoreExtensions: true,
|
|
44096
|
-
enableContentCheck: false,
|
|
44097
43821
|
onBeforeCreate: () => null,
|
|
44098
43822
|
onCreate: () => null,
|
|
44099
43823
|
onUpdate: () => null,
|
|
@@ -44101,10 +43825,7 @@ let Editor$1 = class Editor2 extends EventEmitter {
|
|
|
44101
43825
|
onTransaction: () => null,
|
|
44102
43826
|
onFocus: () => null,
|
|
44103
43827
|
onBlur: () => null,
|
|
44104
|
-
onDestroy: () => null
|
|
44105
|
-
onContentError: ({ error }) => {
|
|
44106
|
-
throw error;
|
|
44107
|
-
}
|
|
43828
|
+
onDestroy: () => null
|
|
44108
43829
|
};
|
|
44109
43830
|
this.isCapturingTransaction = false;
|
|
44110
43831
|
this.capturedTransaction = null;
|
|
@@ -44114,7 +43835,6 @@ let Editor$1 = class Editor2 extends EventEmitter {
|
|
|
44114
43835
|
this.createSchema();
|
|
44115
43836
|
this.on("beforeCreate", this.options.onBeforeCreate);
|
|
44116
43837
|
this.emit("beforeCreate", { editor: this });
|
|
44117
|
-
this.on("contentError", this.options.onContentError);
|
|
44118
43838
|
this.createView();
|
|
44119
43839
|
this.injectCSS();
|
|
44120
43840
|
this.on("create", this.options.onCreate);
|
|
@@ -44268,23 +43988,7 @@ let Editor$1 = class Editor2 extends EventEmitter {
|
|
|
44268
43988
|
* Creates a ProseMirror view.
|
|
44269
43989
|
*/
|
|
44270
43990
|
createView() {
|
|
44271
|
-
|
|
44272
|
-
try {
|
|
44273
|
-
doc2 = createDocument(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: this.options.enableContentCheck });
|
|
44274
|
-
} catch (e) {
|
|
44275
|
-
if (!(e instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(e.message)) {
|
|
44276
|
-
throw e;
|
|
44277
|
-
}
|
|
44278
|
-
this.emit("contentError", {
|
|
44279
|
-
editor: this,
|
|
44280
|
-
error: e,
|
|
44281
|
-
disableCollaboration: () => {
|
|
44282
|
-
this.options.extensions = this.options.extensions.filter((extension) => extension.name !== "collaboration");
|
|
44283
|
-
this.createExtensionManager();
|
|
44284
|
-
}
|
|
44285
|
-
});
|
|
44286
|
-
doc2 = createDocument(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: false });
|
|
44287
|
-
}
|
|
43991
|
+
const doc2 = createDocument(this.options.content, this.schema, this.options.parseOptions);
|
|
44288
43992
|
const selection = resolveFocusPosition(doc2, this.options.autofocus);
|
|
44289
43993
|
this.view = new EditorView(this.options.element, {
|
|
44290
43994
|
...this.options.editorProps,
|
|
@@ -44522,8 +44226,7 @@ function nodeInputRule(config) {
|
|
|
44522
44226
|
tr2.insertText(lastChar, start2 + match2[0].length - 1);
|
|
44523
44227
|
tr2.replaceWith(matchStart, end2, newNode);
|
|
44524
44228
|
} else if (match2[0]) {
|
|
44525
|
-
|
|
44526
|
-
tr2.insert(insertionStart, config.type.create(attributes)).delete(tr2.mapping.map(start2), tr2.mapping.map(end2));
|
|
44229
|
+
tr2.insert(start2 - 1, config.type.create(attributes)).delete(tr2.mapping.map(start2), tr2.mapping.map(end2));
|
|
44527
44230
|
}
|
|
44528
44231
|
tr2.scrollIntoView();
|
|
44529
44232
|
}
|
|
@@ -44608,23 +44311,20 @@ class Mark {
|
|
|
44608
44311
|
return new Mark(config);
|
|
44609
44312
|
}
|
|
44610
44313
|
configure(options = {}) {
|
|
44611
|
-
const extension = this.extend(
|
|
44612
|
-
|
|
44613
|
-
|
|
44614
|
-
|
|
44615
|
-
|
|
44616
|
-
|
|
44617
|
-
});
|
|
44618
|
-
extension.name = this.name;
|
|
44619
|
-
extension.parent = this.parent;
|
|
44314
|
+
const extension = this.extend();
|
|
44315
|
+
extension.options = mergeDeep(this.options, options);
|
|
44316
|
+
extension.storage = callOrReturn(getExtensionField(extension, "addStorage", {
|
|
44317
|
+
name: extension.name,
|
|
44318
|
+
options: extension.options
|
|
44319
|
+
}));
|
|
44620
44320
|
return extension;
|
|
44621
44321
|
}
|
|
44622
44322
|
extend(extendedConfig = {}) {
|
|
44623
|
-
const extension = new Mark(extendedConfig);
|
|
44323
|
+
const extension = new Mark({ ...this.config, ...extendedConfig });
|
|
44624
44324
|
extension.parent = this;
|
|
44625
44325
|
this.child = extension;
|
|
44626
44326
|
extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
|
|
44627
|
-
if (extendedConfig.defaultOptions
|
|
44327
|
+
if (extendedConfig.defaultOptions) {
|
|
44628
44328
|
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
|
|
44629
44329
|
}
|
|
44630
44330
|
extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
|
|
@@ -44690,23 +44390,20 @@ let Node$2 = class Node3 {
|
|
|
44690
44390
|
return new Node3(config);
|
|
44691
44391
|
}
|
|
44692
44392
|
configure(options = {}) {
|
|
44693
|
-
const extension = this.extend(
|
|
44694
|
-
|
|
44695
|
-
|
|
44696
|
-
|
|
44697
|
-
|
|
44698
|
-
|
|
44699
|
-
});
|
|
44700
|
-
extension.name = this.name;
|
|
44701
|
-
extension.parent = this.parent;
|
|
44393
|
+
const extension = this.extend();
|
|
44394
|
+
extension.options = mergeDeep(this.options, options);
|
|
44395
|
+
extension.storage = callOrReturn(getExtensionField(extension, "addStorage", {
|
|
44396
|
+
name: extension.name,
|
|
44397
|
+
options: extension.options
|
|
44398
|
+
}));
|
|
44702
44399
|
return extension;
|
|
44703
44400
|
}
|
|
44704
44401
|
extend(extendedConfig = {}) {
|
|
44705
|
-
const extension = new Node3(extendedConfig);
|
|
44402
|
+
const extension = new Node3({ ...this.config, ...extendedConfig });
|
|
44706
44403
|
extension.parent = this;
|
|
44707
44404
|
this.child = extension;
|
|
44708
44405
|
extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
|
|
44709
|
-
if (extendedConfig.defaultOptions
|
|
44406
|
+
if (extendedConfig.defaultOptions) {
|
|
44710
44407
|
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
|
|
44711
44408
|
}
|
|
44712
44409
|
extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
|
|
@@ -45241,12 +44938,14 @@ const CodeBlock = Node$2.create({
|
|
|
45241
44938
|
if (!text || !language) {
|
|
45242
44939
|
return false;
|
|
45243
44940
|
}
|
|
45244
|
-
const { tr: tr2
|
|
45245
|
-
|
|
45246
|
-
|
|
45247
|
-
|
|
45248
|
-
tr2.
|
|
44941
|
+
const { tr: tr2 } = view.state;
|
|
44942
|
+
if (view.state.selection.from === view.state.doc.nodeSize - (1 + view.state.selection.$to.depth * 2)) {
|
|
44943
|
+
tr2.insert(view.state.selection.from - 1, this.type.create({ language }));
|
|
44944
|
+
} else {
|
|
44945
|
+
tr2.replaceSelectionWith(this.type.create({ language }));
|
|
45249
44946
|
}
|
|
44947
|
+
tr2.setSelection(TextSelection.near(tr2.doc.resolve(Math.max(0, tr2.selection.from - 2))));
|
|
44948
|
+
tr2.insertText(text.replace(/\r\n?/g, "\n"));
|
|
45250
44949
|
tr2.setMeta("paste", true);
|
|
45251
44950
|
view.dispatch(tr2);
|
|
45252
44951
|
return true;
|
|
@@ -46162,13 +45861,13 @@ function applyTransaction(history2, state2, tr2, options) {
|
|
|
46162
45861
|
return history2;
|
|
46163
45862
|
} else if (appended && appended.getMeta(historyKey)) {
|
|
46164
45863
|
if (appended.getMeta(historyKey).redo)
|
|
46165
|
-
return new HistoryState(history2.done.addTransform(tr2, void 0, options, mustPreserveItems(state2)), history2.undone, rangesFor(tr2.mapping.maps), history2.prevTime, history2.prevComposition);
|
|
45864
|
+
return new HistoryState(history2.done.addTransform(tr2, void 0, options, mustPreserveItems(state2)), history2.undone, rangesFor(tr2.mapping.maps[tr2.steps.length - 1]), history2.prevTime, history2.prevComposition);
|
|
46166
45865
|
else
|
|
46167
45866
|
return new HistoryState(history2.done, history2.undone.addTransform(tr2, void 0, options, mustPreserveItems(state2)), null, history2.prevTime, history2.prevComposition);
|
|
46168
45867
|
} else if (tr2.getMeta("addToHistory") !== false && !(appended && appended.getMeta("addToHistory") === false)) {
|
|
46169
45868
|
let composition = tr2.getMeta("composition");
|
|
46170
45869
|
let newGroup = history2.prevTime == 0 || !appended && history2.prevComposition != composition && (history2.prevTime < (tr2.time || 0) - options.newGroupDelay || !isAdjacentTo(tr2, history2.prevRanges));
|
|
46171
|
-
let prevRanges = appended ? mapRanges(history2.prevRanges, tr2.mapping) : rangesFor(tr2.mapping.maps);
|
|
45870
|
+
let prevRanges = appended ? mapRanges(history2.prevRanges, tr2.mapping) : rangesFor(tr2.mapping.maps[tr2.steps.length - 1]);
|
|
46172
45871
|
return new HistoryState(history2.done.addTransform(tr2, newGroup ? state2.selection.getBookmark() : void 0, options, mustPreserveItems(state2)), Branch.empty, prevRanges, tr2.time, composition == null ? history2.prevComposition : composition);
|
|
46173
45872
|
} else if (rebased = tr2.getMeta("rebased")) {
|
|
46174
45873
|
return new HistoryState(history2.done.rebased(tr2, rebased), history2.undone.rebased(tr2, rebased), mapRanges(history2.prevRanges, tr2.mapping), history2.prevTime, history2.prevComposition);
|
|
@@ -46189,10 +45888,9 @@ function isAdjacentTo(transform, prevRanges) {
|
|
|
46189
45888
|
});
|
|
46190
45889
|
return adjacent;
|
|
46191
45890
|
}
|
|
46192
|
-
function rangesFor(
|
|
45891
|
+
function rangesFor(map4) {
|
|
46193
45892
|
let result2 = [];
|
|
46194
|
-
|
|
46195
|
-
maps[i2].forEach((_from, _to, from2, to2) => result2.push(from2, to2));
|
|
45893
|
+
map4.forEach((_from, _to, from2, to2) => result2.push(from2, to2));
|
|
46196
45894
|
return result2;
|
|
46197
45895
|
}
|
|
46198
45896
|
function mapRanges(ranges, mapping) {
|
|
@@ -46206,16 +45904,16 @@ function mapRanges(ranges, mapping) {
|
|
|
46206
45904
|
}
|
|
46207
45905
|
return result2;
|
|
46208
45906
|
}
|
|
46209
|
-
function histTransaction(history2, state2, redo2) {
|
|
45907
|
+
function histTransaction(history2, state2, dispatch, redo2) {
|
|
46210
45908
|
let preserveItems = mustPreserveItems(state2);
|
|
46211
45909
|
let histOptions = historyKey.get(state2).spec.config;
|
|
46212
45910
|
let pop = (redo2 ? history2.undone : history2.done).popEvent(state2, preserveItems);
|
|
46213
45911
|
if (!pop)
|
|
46214
|
-
return
|
|
45912
|
+
return;
|
|
46215
45913
|
let selection = pop.selection.resolve(pop.transform.doc);
|
|
46216
45914
|
let added = (redo2 ? history2.done : history2.undone).addTransform(pop.transform, state2.selection.getBookmark(), histOptions, preserveItems);
|
|
46217
45915
|
let newHist = new HistoryState(redo2 ? added : pop.remaining, redo2 ? pop.remaining : added, null, 0, -1);
|
|
46218
|
-
|
|
45916
|
+
dispatch(pop.transform.setSelection(selection).setMeta(historyKey, { redo: redo2, historyState: newHist }).scrollIntoView());
|
|
46219
45917
|
}
|
|
46220
45918
|
let cachedPreserveItems = false, cachedPreserveItemsPlugins = null;
|
|
46221
45919
|
function mustPreserveItems(state2) {
|
|
@@ -46263,21 +45961,22 @@ function history(config = {}) {
|
|
|
46263
45961
|
}
|
|
46264
45962
|
});
|
|
46265
45963
|
}
|
|
46266
|
-
|
|
46267
|
-
|
|
46268
|
-
|
|
46269
|
-
|
|
46270
|
-
|
|
46271
|
-
|
|
46272
|
-
|
|
46273
|
-
|
|
46274
|
-
|
|
46275
|
-
|
|
46276
|
-
|
|
46277
|
-
|
|
46278
|
-
|
|
46279
|
-
|
|
46280
|
-
|
|
45964
|
+
const undo = (state2, dispatch) => {
|
|
45965
|
+
let hist = historyKey.getState(state2);
|
|
45966
|
+
if (!hist || hist.done.eventCount == 0)
|
|
45967
|
+
return false;
|
|
45968
|
+
if (dispatch)
|
|
45969
|
+
histTransaction(hist, state2, dispatch, false);
|
|
45970
|
+
return true;
|
|
45971
|
+
};
|
|
45972
|
+
const redo = (state2, dispatch) => {
|
|
45973
|
+
let hist = historyKey.getState(state2);
|
|
45974
|
+
if (!hist || hist.undone.eventCount == 0)
|
|
45975
|
+
return false;
|
|
45976
|
+
if (dispatch)
|
|
45977
|
+
histTransaction(hist, state2, dispatch, true);
|
|
45978
|
+
return true;
|
|
45979
|
+
};
|
|
46281
45980
|
const History = Extension.create({
|
|
46282
45981
|
name: "history",
|
|
46283
45982
|
addOptions() {
|
|
@@ -46329,20 +46028,10 @@ const HorizontalRule = Node$2.create({
|
|
|
46329
46028
|
addCommands() {
|
|
46330
46029
|
return {
|
|
46331
46030
|
setHorizontalRule: () => ({ chain, state: state2 }) => {
|
|
46332
|
-
const {
|
|
46333
|
-
const { $from: $originFrom, $to: $originTo } = selection;
|
|
46031
|
+
const { $to: $originTo } = state2.selection;
|
|
46334
46032
|
const currentChain = chain();
|
|
46335
|
-
if ($
|
|
46336
|
-
currentChain.insertContentAt({
|
|
46337
|
-
from: Math.max($originFrom.pos - 1, 0),
|
|
46338
|
-
to: $originTo.pos
|
|
46339
|
-
}, {
|
|
46340
|
-
type: this.name
|
|
46341
|
-
});
|
|
46342
|
-
} else if (isNodeSelection(selection)) {
|
|
46343
|
-
currentChain.insertContentAt($originTo.pos, {
|
|
46344
|
-
type: this.name
|
|
46345
|
-
});
|
|
46033
|
+
if ($originTo.parentOffset === 0) {
|
|
46034
|
+
currentChain.insertContentAt(Math.max($originTo.pos - 2, 0), { type: this.name });
|
|
46346
46035
|
} else {
|
|
46347
46036
|
currentChain.insertContent({ type: this.name });
|
|
46348
46037
|
}
|
|
@@ -46728,11 +46417,11 @@ const StarterKit = Extension.create({
|
|
|
46728
46417
|
addExtensions() {
|
|
46729
46418
|
var _a2, _b, _c, _d, _e2, _f, _g, _h, _j, _k, _l2, _m, _o, _p, _q, _r2, _s, _t2;
|
|
46730
46419
|
const extensions = [];
|
|
46731
|
-
if (this.options.bold !== false) {
|
|
46732
|
-
extensions.push(Bold.configure((_a2 = this.options) === null || _a2 === void 0 ? void 0 : _a2.bold));
|
|
46733
|
-
}
|
|
46734
46420
|
if (this.options.blockquote !== false) {
|
|
46735
|
-
extensions.push(Blockquote.configure((
|
|
46421
|
+
extensions.push(Blockquote.configure((_a2 = this.options) === null || _a2 === void 0 ? void 0 : _a2.blockquote));
|
|
46422
|
+
}
|
|
46423
|
+
if (this.options.bold !== false) {
|
|
46424
|
+
extensions.push(Bold.configure((_b = this.options) === null || _b === void 0 ? void 0 : _b.bold));
|
|
46736
46425
|
}
|
|
46737
46426
|
if (this.options.bulletList !== false) {
|
|
46738
46427
|
extensions.push(BulletList.configure((_c = this.options) === null || _c === void 0 ? void 0 : _c.bulletList));
|
|
@@ -49539,7 +49228,7 @@ class BubbleMenuView {
|
|
|
49539
49228
|
}
|
|
49540
49229
|
update(view, oldState) {
|
|
49541
49230
|
const { state: state2 } = view;
|
|
49542
|
-
const hasValidSelection = state2.selection.
|
|
49231
|
+
const hasValidSelection = state2.selection.$from.pos !== state2.selection.$to.pos;
|
|
49543
49232
|
if (this.updateDelay > 0 && hasValidSelection) {
|
|
49544
49233
|
this.handleDebouncedUpdate(view, oldState);
|
|
49545
49234
|
return;
|
|
@@ -52691,7 +52380,7 @@ const Table = Node$2.create({
|
|
|
52691
52380
|
insertTable: ({ rows = 3, cols = 3, withHeaderRow = true } = {}) => ({ tr: tr2, dispatch, editor }) => {
|
|
52692
52381
|
const node = createTable$1(editor.schema, rows, cols, withHeaderRow);
|
|
52693
52382
|
if (dispatch) {
|
|
52694
|
-
const offset2 = tr2.selection.
|
|
52383
|
+
const offset2 = tr2.selection.anchor + 1;
|
|
52695
52384
|
tr2.replaceSelectionWith(node).scrollIntoView().setSelection(TextSelection.near(tr2.doc.resolve(offset2)));
|
|
52696
52385
|
}
|
|
52697
52386
|
return true;
|