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