@bagelink/vue 0.0.570 → 0.0.575
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/Drop.vue.d.ts +34 -0
- package/dist/components/Drop.vue.d.ts.map +1 -0
- package/dist/components/FileUploader.vue.d.ts +60 -0
- package/dist/components/FileUploader.vue.d.ts.map +1 -0
- package/dist/components/form/ItemRef.vue.d.ts +1 -0
- package/dist/components/form/ItemRef.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/FileUpload.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/SelectField.vue.d.ts +1 -4
- package/dist/components/form/inputs/SelectField.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/SelectInput.vue.d.ts +2 -0
- package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
- package/dist/index.cjs +645 -312
- package/dist/index.mjs +645 -312
- package/dist/style.css +22 -22
- package/package.json +10 -10
- package/src/components/MaterialIcon.vue +2 -3
- package/src/components/form/inputs/FileUpload.vue +12 -14
- package/src/components/form/inputs/SelectInput.vue +42 -25
- package/dist/components/Popover.vue.d.ts +0 -10
- package/dist/components/Popover.vue.d.ts.map +0 -1
- package/dist/types/materialIcon.d.ts +0 -2
- package/dist/types/materialIcon.d.ts.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -5412,7 +5412,7 @@ const _sfc_main$O = /* @__PURE__ */ vue.defineComponent({
|
|
|
5412
5412
|
return (_ctx, _cache) => {
|
|
5413
5413
|
return vue.openBlock(), vue.createElementBlock("span", {
|
|
5414
5414
|
class: "bgl_icon-font",
|
|
5415
|
-
style: vue.normalizeStyle({ fontSize: `${_ctx.size}rem`, color: _ctx.color, "font-variation-settings": `'wght' ${_ctx.weight || 400}` })
|
|
5415
|
+
style: vue.normalizeStyle({ "fontSize": `${_ctx.size}rem`, color: _ctx.color, "font-variation-settings": `'wght' ${_ctx.weight || 400}` })
|
|
5416
5416
|
}, vue.toDisplayString(_ctx.icon || _ctx.name), 5);
|
|
5417
5417
|
};
|
|
5418
5418
|
}
|
|
@@ -5421,8 +5421,8 @@ const _hoisted_1$J = { class: "full-nav" };
|
|
|
5421
5421
|
const _hoisted_2$A = { class: "nav-scroll" };
|
|
5422
5422
|
const _hoisted_3$n = { class: "nav-links-wrapper" };
|
|
5423
5423
|
const _hoisted_4$f = { class: "tooltip" };
|
|
5424
|
-
const _hoisted_5$
|
|
5425
|
-
const _hoisted_6$
|
|
5424
|
+
const _hoisted_5$e = { class: "bot-buttons-wrapper" };
|
|
5425
|
+
const _hoisted_6$9 = { class: "tooltip" };
|
|
5426
5426
|
const _sfc_main$N = /* @__PURE__ */ vue.defineComponent({
|
|
5427
5427
|
__name: "NavBar",
|
|
5428
5428
|
props: {
|
|
@@ -5476,7 +5476,7 @@ const _sfc_main$N = /* @__PURE__ */ vue.defineComponent({
|
|
|
5476
5476
|
}), 128))
|
|
5477
5477
|
])
|
|
5478
5478
|
]),
|
|
5479
|
-
vue.createElementVNode("div", _hoisted_5$
|
|
5479
|
+
vue.createElementVNode("div", _hoisted_5$e, [
|
|
5480
5480
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.footerLinks, (link) => {
|
|
5481
5481
|
return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(link.to ? "router-link" : "div"), {
|
|
5482
5482
|
key: link.label,
|
|
@@ -5491,7 +5491,7 @@ const _sfc_main$N = /* @__PURE__ */ vue.defineComponent({
|
|
|
5491
5491
|
vue.createVNode(vue.unref(_sfc_main$O), {
|
|
5492
5492
|
icon: link.icon
|
|
5493
5493
|
}, null, 8, ["icon"]),
|
|
5494
|
-
vue.createElementVNode("div", _hoisted_6$
|
|
5494
|
+
vue.createElementVNode("div", _hoisted_6$9, vue.toDisplayString(link.label), 1)
|
|
5495
5495
|
]),
|
|
5496
5496
|
_: 2
|
|
5497
5497
|
}, 1032, ["to", "onClick"]);
|
|
@@ -6335,9 +6335,9 @@ const _hoisted_3$j = [
|
|
|
6335
6335
|
_hoisted_2$t
|
|
6336
6336
|
];
|
|
6337
6337
|
const _hoisted_4$d = { class: "infinite-wrapper" };
|
|
6338
|
-
const _hoisted_5$
|
|
6339
|
-
const _hoisted_6$
|
|
6340
|
-
const _hoisted_7$
|
|
6338
|
+
const _hoisted_5$d = { class: "row first-row" };
|
|
6339
|
+
const _hoisted_6$8 = { key: 0 };
|
|
6340
|
+
const _hoisted_7$3 = ["onClick"];
|
|
6341
6341
|
const _hoisted_8$1 = { class: "flex" };
|
|
6342
6342
|
const _hoisted_9$1 = ["onClick"];
|
|
6343
6343
|
const _hoisted_10$1 = { key: 0 };
|
|
@@ -6480,8 +6480,8 @@ const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({
|
|
|
6480
6480
|
}), [
|
|
6481
6481
|
loading.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$C, _hoisted_3$j)) : (vue.openBlock(), vue.createElementBlock("div", vue.normalizeProps(vue.mergeProps({ key: 1 }, vue.unref(wrapperProps))), [
|
|
6482
6482
|
vue.createElementVNode("table", _hoisted_4$d, [
|
|
6483
|
-
vue.createElementVNode("thead", _hoisted_5$
|
|
6484
|
-
vue.unref(isSelectable) ? (vue.openBlock(), vue.createElementBlock("th", _hoisted_6$
|
|
6483
|
+
vue.createElementVNode("thead", _hoisted_5$d, [
|
|
6484
|
+
vue.unref(isSelectable) ? (vue.openBlock(), vue.createElementBlock("th", _hoisted_6$8, [
|
|
6485
6485
|
vue.createElementVNode("input", {
|
|
6486
6486
|
ref_key: "allSelector",
|
|
6487
6487
|
ref: allSelector,
|
|
@@ -6508,7 +6508,7 @@ const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({
|
|
|
6508
6508
|
}, null, 8, ["class"])
|
|
6509
6509
|
], 2)
|
|
6510
6510
|
])
|
|
6511
|
-
], 8, _hoisted_7$
|
|
6511
|
+
], 8, _hoisted_7$3);
|
|
6512
6512
|
}), 128))
|
|
6513
6513
|
]),
|
|
6514
6514
|
vue.createElementVNode("tbody", null, [
|
|
@@ -6602,8 +6602,8 @@ const _hoisted_2$s = {
|
|
|
6602
6602
|
};
|
|
6603
6603
|
const _hoisted_3$i = { class: "key" };
|
|
6604
6604
|
const _hoisted_4$c = { key: 1 };
|
|
6605
|
-
const _hoisted_5$
|
|
6606
|
-
const _hoisted_6$
|
|
6605
|
+
const _hoisted_5$c = { class: "key" };
|
|
6606
|
+
const _hoisted_6$7 = { class: "vlue" };
|
|
6607
6607
|
const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
|
|
6608
6608
|
__name: "DataPreview",
|
|
6609
6609
|
props: /* @__PURE__ */ vue.mergeModels({
|
|
@@ -6653,8 +6653,8 @@ const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
|
|
|
6653
6653
|
key: id,
|
|
6654
6654
|
class: "data-row"
|
|
6655
6655
|
}, [
|
|
6656
|
-
vue.createElementVNode("div", _hoisted_5$
|
|
6657
|
-
vue.createElementVNode("div", _hoisted_6$
|
|
6656
|
+
vue.createElementVNode("div", _hoisted_5$c, vue.toDisplayString(label), 1),
|
|
6657
|
+
vue.createElementVNode("div", _hoisted_6$7, vue.toDisplayString(itemData.value[id ?? ""]), 1)
|
|
6658
6658
|
]);
|
|
6659
6659
|
}), 128))
|
|
6660
6660
|
])) : vue.createCommentVNode("", true),
|
|
@@ -25607,10 +25607,16 @@ const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
|
|
|
25607
25607
|
}
|
|
25608
25608
|
});
|
|
25609
25609
|
const JSONInput = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__scopeId", "data-v-1cbaeab2"]]);
|
|
25610
|
-
const _hoisted_1$q =
|
|
25611
|
-
const _hoisted_2$k =
|
|
25612
|
-
const _hoisted_3$f =
|
|
25613
|
-
const _hoisted_4$b =
|
|
25610
|
+
const _hoisted_1$q = { class: "flex gap-05" };
|
|
25611
|
+
const _hoisted_2$k = ["disabled"];
|
|
25612
|
+
const _hoisted_3$f = { key: 1 };
|
|
25613
|
+
const _hoisted_4$b = {
|
|
25614
|
+
key: 2,
|
|
25615
|
+
class: "ms-auto ps-05 me-05"
|
|
25616
|
+
};
|
|
25617
|
+
const _hoisted_5$b = ["value"];
|
|
25618
|
+
const _hoisted_6$6 = { class: "selectinput-options" };
|
|
25619
|
+
const _hoisted_7$2 = ["onClick"];
|
|
25614
25620
|
const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
|
|
25615
25621
|
__name: "SelectInput",
|
|
25616
25622
|
props: {
|
|
@@ -25625,7 +25631,8 @@ const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
|
|
|
25625
25631
|
multiselect: { type: Boolean },
|
|
25626
25632
|
icon: {},
|
|
25627
25633
|
hideLabel: { type: Boolean },
|
|
25628
|
-
defaultValue: {}
|
|
25634
|
+
defaultValue: {},
|
|
25635
|
+
clearable: { type: Boolean }
|
|
25629
25636
|
},
|
|
25630
25637
|
emits: ["update:modelValue"],
|
|
25631
25638
|
setup(__props, { emit: __emit }) {
|
|
@@ -25633,6 +25640,7 @@ const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
|
|
|
25633
25640
|
const emit2 = __emit;
|
|
25634
25641
|
const searchInput = vue.ref(null);
|
|
25635
25642
|
let selectedItems = vue.ref([]);
|
|
25643
|
+
const selectedItemCount = vue.computed(() => selectedItems.value.length ?? 0);
|
|
25636
25644
|
let search = vue.ref("");
|
|
25637
25645
|
const dropdown = vue.ref(null);
|
|
25638
25646
|
let open = vue.ref(false);
|
|
@@ -25655,10 +25663,10 @@ const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
|
|
|
25655
25663
|
}
|
|
25656
25664
|
}
|
|
25657
25665
|
const selectedLabel = vue.computed(() => {
|
|
25658
|
-
if (
|
|
25659
|
-
if (
|
|
25666
|
+
if (selectedItemCount.value === 0) return props2.placeholder || "Select";
|
|
25667
|
+
if (selectedItemCount.value > 4) {
|
|
25660
25668
|
const str = selectedItems.value.slice(0, 4).map((item) => getLabel(item)).join(", ");
|
|
25661
|
-
return `${str}... +${
|
|
25669
|
+
return `${str}... +${selectedItemCount.value - 4}`;
|
|
25662
25670
|
}
|
|
25663
25671
|
return selectedItems.value.map((item) => getLabel(item)).join(", ");
|
|
25664
25672
|
});
|
|
@@ -25691,7 +25699,7 @@ const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
|
|
|
25691
25699
|
current.push(option2);
|
|
25692
25700
|
selectedItems.value = current;
|
|
25693
25701
|
} else {
|
|
25694
|
-
selectedItems.value.splice(0,
|
|
25702
|
+
selectedItems.value.splice(0, selectedItemCount.value, option2);
|
|
25695
25703
|
}
|
|
25696
25704
|
if (!props2.multiselect) (_a2 = dropdown.value) == null ? void 0 : _a2.hide();
|
|
25697
25705
|
emitUpdate();
|
|
@@ -25719,7 +25727,7 @@ const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
|
|
|
25719
25727
|
} else {
|
|
25720
25728
|
const isSame = compareArrays([newVal].flat(), selectedItems.value);
|
|
25721
25729
|
if (!isSame) {
|
|
25722
|
-
selectedItems.value.splice(0,
|
|
25730
|
+
selectedItems.value.splice(0, selectedItemCount.value, ...[newVal].flat());
|
|
25723
25731
|
}
|
|
25724
25732
|
}
|
|
25725
25733
|
},
|
|
@@ -25753,13 +25761,13 @@ const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
|
|
|
25753
25761
|
ref: dropdown,
|
|
25754
25762
|
placement: "bottom-start",
|
|
25755
25763
|
class: "bagel-input selectinput",
|
|
25756
|
-
onClick: _cache[
|
|
25764
|
+
onClick: _cache[4] || (_cache[4] = vue.withModifiers(() => {
|
|
25757
25765
|
}, ["stop"])),
|
|
25758
|
-
onHide: _cache[
|
|
25766
|
+
onHide: _cache[5] || (_cache[5] = ($event) => updateOpen(false))
|
|
25759
25767
|
}, {
|
|
25760
25768
|
popper: vue.withCtx(() => [
|
|
25761
25769
|
vue.createVNode(vue.unref(_sfc_main$B), {
|
|
25762
|
-
class: "
|
|
25770
|
+
class: "p-05",
|
|
25763
25771
|
style: vue.normalizeStyle({ width: _ctx.fullWidth ? "100%" : "auto" })
|
|
25764
25772
|
}, {
|
|
25765
25773
|
default: vue.withCtx(() => [
|
|
@@ -25768,62 +25776,72 @@ const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
|
|
|
25768
25776
|
ref_key: "searchInput",
|
|
25769
25777
|
ref: searchInput,
|
|
25770
25778
|
modelValue: vue.unref(search),
|
|
25771
|
-
"onUpdate:modelValue": _cache[
|
|
25779
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => vue.isRef(search) ? search.value = $event : search = $event),
|
|
25772
25780
|
dense: "",
|
|
25773
25781
|
placeholder: "Search",
|
|
25774
25782
|
icon: "search"
|
|
25775
25783
|
}, null, 8, ["modelValue"])) : vue.createCommentVNode("", true),
|
|
25776
|
-
|
|
25777
|
-
|
|
25778
|
-
|
|
25779
|
-
|
|
25780
|
-
|
|
25781
|
-
|
|
25782
|
-
|
|
25783
|
-
|
|
25784
|
-
|
|
25785
|
-
|
|
25786
|
-
|
|
25787
|
-
|
|
25788
|
-
|
|
25789
|
-
|
|
25790
|
-
|
|
25791
|
-
|
|
25792
|
-
|
|
25793
|
-
|
|
25784
|
+
vue.createElementVNode("div", _hoisted_6$6, [
|
|
25785
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(filteredOptions.value, (option2, i2) => {
|
|
25786
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
25787
|
+
key: `${option2}${i2}`,
|
|
25788
|
+
class: vue.normalizeClass(["selectinput-option hover gap-1", { selected: isSelected(option2) }]),
|
|
25789
|
+
onClick: ($event) => select2(option2)
|
|
25790
|
+
}, [
|
|
25791
|
+
isSelected(option2) ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$O), {
|
|
25792
|
+
key: 0,
|
|
25793
|
+
icon: "check"
|
|
25794
|
+
})) : vue.createCommentVNode("", true),
|
|
25795
|
+
!isSelected(option2) ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$O), {
|
|
25796
|
+
key: 1,
|
|
25797
|
+
class: "opacity-3",
|
|
25798
|
+
icon: "fiber_manual_record"
|
|
25799
|
+
})) : vue.createCommentVNode("", true),
|
|
25800
|
+
vue.createElementVNode("span", null, vue.toDisplayString(getLabel(option2)), 1)
|
|
25801
|
+
], 10, _hoisted_7$2);
|
|
25802
|
+
}), 128))
|
|
25803
|
+
]),
|
|
25794
25804
|
vue.renderSlot(_ctx.$slots, "last", {}, void 0, true)
|
|
25795
25805
|
]),
|
|
25796
25806
|
_: 3
|
|
25797
25807
|
}, 8, ["style"])
|
|
25798
25808
|
]),
|
|
25799
25809
|
default: vue.withCtx(() => [
|
|
25800
|
-
vue.createElementVNode("label",
|
|
25810
|
+
vue.createElementVNode("label", _hoisted_1$q, [
|
|
25801
25811
|
vue.createTextVNode(vue.toDisplayString(_ctx.label) + " ", 1),
|
|
25802
25812
|
vue.createElementVNode("button", {
|
|
25803
25813
|
disabled: _ctx.disabled,
|
|
25804
25814
|
type: "button",
|
|
25805
|
-
class: vue.normalizeClass(["selectinput-btn", { isEmpty:
|
|
25815
|
+
class: vue.normalizeClass(["selectinput-btn", { isEmpty: selectedItemCount.value === 0 }]),
|
|
25806
25816
|
onKeydown: openOptions,
|
|
25807
|
-
onClick: _cache[
|
|
25817
|
+
onClick: _cache[1] || (_cache[1] = ($event) => updateOpen(true))
|
|
25808
25818
|
}, [
|
|
25809
25819
|
_ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$O), {
|
|
25810
25820
|
key: 0,
|
|
25811
25821
|
icon: _ctx.icon
|
|
25812
25822
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
25813
|
-
!_ctx.hideLabel ? (vue.openBlock(), vue.createElementBlock("p",
|
|
25823
|
+
!_ctx.hideLabel ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_3$f, vue.toDisplayString(selectedLabel.value), 1)) : vue.createCommentVNode("", true),
|
|
25824
|
+
_ctx.clearable ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$b, [
|
|
25825
|
+
vue.createVNode(vue.unref(Btn), {
|
|
25826
|
+
thin: "",
|
|
25827
|
+
icon: "clear",
|
|
25828
|
+
class: "color-black bg-gray-light",
|
|
25829
|
+
onClick: _cache[0] || (_cache[0] = ($event) => vue.isRef(selectedItems) ? selectedItems.value = [] : selectedItems = [])
|
|
25830
|
+
})
|
|
25831
|
+
])) : vue.createCommentVNode("", true),
|
|
25814
25832
|
!_ctx.disabled ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$O), vue.mergeProps({
|
|
25815
|
-
key:
|
|
25833
|
+
key: 3,
|
|
25816
25834
|
thin: ""
|
|
25817
25835
|
}, { icon: vue.unref(open) ? "unfold_less" : "unfold_more" }), null, 16)) : vue.createCommentVNode("", true)
|
|
25818
|
-
], 42,
|
|
25836
|
+
], 42, _hoisted_2$k),
|
|
25819
25837
|
_ctx.required ? (vue.openBlock(), vue.createElementBlock("input", {
|
|
25820
25838
|
key: 0,
|
|
25821
25839
|
tabindex: "-1",
|
|
25822
25840
|
style: { "width": "0", "height": "0", "position": "absolute", "opacity": "0", "z-index": "-1" },
|
|
25823
25841
|
value: vue.unref(selectedItems),
|
|
25824
25842
|
required: "",
|
|
25825
|
-
onInput: _cache[
|
|
25826
|
-
}, null, 40,
|
|
25843
|
+
onInput: _cache[2] || (_cache[2] = ($event) => updateOpen(true))
|
|
25844
|
+
}, null, 40, _hoisted_5$b)) : vue.createCommentVNode("", true)
|
|
25827
25845
|
])
|
|
25828
25846
|
]),
|
|
25829
25847
|
_: 3
|
|
@@ -25831,7 +25849,7 @@ const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
|
|
|
25831
25849
|
};
|
|
25832
25850
|
}
|
|
25833
25851
|
});
|
|
25834
|
-
const SelectInput = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__scopeId", "data-v-
|
|
25852
|
+
const SelectInput = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__scopeId", "data-v-c5344871"]]);
|
|
25835
25853
|
/*!
|
|
25836
25854
|
* vue-draggable-next v2.2.0
|
|
25837
25855
|
* (c) 2023 Anish George
|
|
@@ -28818,7 +28836,7 @@ const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
|
|
|
28818
28836
|
}
|
|
28819
28837
|
});
|
|
28820
28838
|
const RadioPillsInput = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-681173be"]]);
|
|
28821
|
-
const _withScopeId$2 = (n2) => (vue.pushScopeId("data-v-
|
|
28839
|
+
const _withScopeId$2 = (n2) => (vue.pushScopeId("data-v-853e75be"), n2 = n2(), vue.popScopeId(), n2);
|
|
28822
28840
|
const _hoisted_1$j = { class: "bagel-input" };
|
|
28823
28841
|
const _hoisted_2$e = {
|
|
28824
28842
|
key: 0,
|
|
@@ -28858,9 +28876,9 @@ const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
|
|
|
28858
28876
|
emits: ["update:modelValue"],
|
|
28859
28877
|
setup(__props, { emit: __emit }) {
|
|
28860
28878
|
const props2 = __props;
|
|
28879
|
+
const emit2 = __emit;
|
|
28861
28880
|
const bagel = useBagel();
|
|
28862
28881
|
const bindKey2 = props2.bindkey || "id";
|
|
28863
|
-
const emit2 = __emit;
|
|
28864
28882
|
let file_bindkeys = vue.ref(props2.modelValue || []);
|
|
28865
28883
|
const storageFiles = vue.ref([]);
|
|
28866
28884
|
async function fetchFiles() {
|
|
@@ -29062,7 +29080,7 @@ const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
|
|
|
29062
29080
|
};
|
|
29063
29081
|
}
|
|
29064
29082
|
});
|
|
29065
|
-
const $el = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-
|
|
29083
|
+
const $el = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-853e75be"]]);
|
|
29066
29084
|
const _withScopeId$1 = (n2) => (vue.pushScopeId("data-v-eceeebfb"), n2 = n2(), vue.popScopeId(), n2);
|
|
29067
29085
|
const _hoisted_1$i = ["title"];
|
|
29068
29086
|
const _hoisted_2$d = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ vue.createElementVNode("span", { class: "slider round" }, null, -1));
|
|
@@ -29495,7 +29513,7 @@ class Fragment {
|
|
|
29495
29513
|
/**
|
|
29496
29514
|
Find the index and inner offset corresponding to a given relative
|
|
29497
29515
|
position in this fragment. The result object will be reused
|
|
29498
|
-
(overwritten) the next time the function is called.
|
|
29516
|
+
(overwritten) the next time the function is called. @internal
|
|
29499
29517
|
*/
|
|
29500
29518
|
findIndex(pos, round2 = -1) {
|
|
29501
29519
|
if (pos == 0)
|
|
@@ -29701,7 +29719,9 @@ let Mark$1 = class Mark2 {
|
|
|
29701
29719
|
let type3 = schema.marks[json.type];
|
|
29702
29720
|
if (!type3)
|
|
29703
29721
|
throw new RangeError(`There is no mark type ${json.type} in this schema`);
|
|
29704
|
-
|
|
29722
|
+
let mark = type3.create(json.attrs);
|
|
29723
|
+
type3.checkAttrs(mark.attrs);
|
|
29724
|
+
return mark;
|
|
29705
29725
|
}
|
|
29706
29726
|
/**
|
|
29707
29727
|
Test whether two sets of marks are identical.
|
|
@@ -30198,17 +30218,28 @@ class ResolvedPos {
|
|
|
30198
30218
|
@internal
|
|
30199
30219
|
*/
|
|
30200
30220
|
static resolveCached(doc2, pos) {
|
|
30201
|
-
|
|
30202
|
-
|
|
30203
|
-
|
|
30204
|
-
|
|
30221
|
+
let cache = resolveCache.get(doc2);
|
|
30222
|
+
if (cache) {
|
|
30223
|
+
for (let i2 = 0; i2 < cache.elts.length; i2++) {
|
|
30224
|
+
let elt = cache.elts[i2];
|
|
30225
|
+
if (elt.pos == pos)
|
|
30226
|
+
return elt;
|
|
30227
|
+
}
|
|
30228
|
+
} else {
|
|
30229
|
+
resolveCache.set(doc2, cache = new ResolveCache());
|
|
30205
30230
|
}
|
|
30206
|
-
let result2 =
|
|
30207
|
-
|
|
30231
|
+
let result2 = cache.elts[cache.i] = ResolvedPos.resolve(doc2, pos);
|
|
30232
|
+
cache.i = (cache.i + 1) % resolveCacheSize;
|
|
30208
30233
|
return result2;
|
|
30209
30234
|
}
|
|
30210
30235
|
}
|
|
30211
|
-
|
|
30236
|
+
class ResolveCache {
|
|
30237
|
+
constructor() {
|
|
30238
|
+
this.elts = [];
|
|
30239
|
+
this.i = 0;
|
|
30240
|
+
}
|
|
30241
|
+
}
|
|
30242
|
+
const resolveCacheSize = 12, resolveCache = /* @__PURE__ */ new WeakMap();
|
|
30212
30243
|
class NodeRange {
|
|
30213
30244
|
/**
|
|
30214
30245
|
Construct a node range. `$from` and `$to` should point into the
|
|
@@ -30594,13 +30625,17 @@ let Node$3 = class Node2 {
|
|
|
30594
30625
|
}
|
|
30595
30626
|
/**
|
|
30596
30627
|
Check whether this node and its descendants conform to the
|
|
30597
|
-
schema, and raise
|
|
30628
|
+
schema, and raise an exception when they do not.
|
|
30598
30629
|
*/
|
|
30599
30630
|
check() {
|
|
30600
30631
|
this.type.checkContent(this.content);
|
|
30632
|
+
this.type.checkAttrs(this.attrs);
|
|
30601
30633
|
let copy2 = Mark$1.none;
|
|
30602
|
-
for (let i2 = 0; i2 < this.marks.length; i2++)
|
|
30603
|
-
|
|
30634
|
+
for (let i2 = 0; i2 < this.marks.length; i2++) {
|
|
30635
|
+
let mark = this.marks[i2];
|
|
30636
|
+
mark.type.checkAttrs(mark.attrs);
|
|
30637
|
+
copy2 = mark.addToSet(copy2);
|
|
30638
|
+
}
|
|
30604
30639
|
if (!Mark$1.sameSet(copy2, this.marks))
|
|
30605
30640
|
throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((m2) => m2.type.name)}`);
|
|
30606
30641
|
this.content.forEach((node) => node.check());
|
|
@@ -30626,7 +30661,7 @@ let Node$3 = class Node2 {
|
|
|
30626
30661
|
static fromJSON(schema, json) {
|
|
30627
30662
|
if (!json)
|
|
30628
30663
|
throw new RangeError("Invalid input for Node.fromJSON");
|
|
30629
|
-
let marks =
|
|
30664
|
+
let marks = void 0;
|
|
30630
30665
|
if (json.marks) {
|
|
30631
30666
|
if (!Array.isArray(json.marks))
|
|
30632
30667
|
throw new RangeError("Invalid mark data for Node.fromJSON");
|
|
@@ -30638,7 +30673,9 @@ let Node$3 = class Node2 {
|
|
|
30638
30673
|
return schema.text(json.text, marks);
|
|
30639
30674
|
}
|
|
30640
30675
|
let content = Fragment.fromJSON(schema, json.content);
|
|
30641
|
-
|
|
30676
|
+
let node = schema.nodeType(json.type).create(json.attrs, content, marks);
|
|
30677
|
+
node.type.checkAttrs(node.attrs);
|
|
30678
|
+
return node;
|
|
30642
30679
|
}
|
|
30643
30680
|
};
|
|
30644
30681
|
Node$3.prototype.text = void 0;
|
|
@@ -31120,6 +31157,16 @@ function computeAttrs(attrs, value) {
|
|
|
31120
31157
|
}
|
|
31121
31158
|
return built;
|
|
31122
31159
|
}
|
|
31160
|
+
function checkAttrs(attrs, values3, type3, name) {
|
|
31161
|
+
for (let name2 in values3)
|
|
31162
|
+
if (!(name2 in attrs))
|
|
31163
|
+
throw new RangeError(`Unsupported attribute ${name2} for ${type3} of type ${name2}`);
|
|
31164
|
+
for (let name2 in attrs) {
|
|
31165
|
+
let attr = attrs[name2];
|
|
31166
|
+
if (attr.validate)
|
|
31167
|
+
attr.validate(values3[name2]);
|
|
31168
|
+
}
|
|
31169
|
+
}
|
|
31123
31170
|
function initAttrs(attrs) {
|
|
31124
31171
|
let result2 = /* @__PURE__ */ Object.create(null);
|
|
31125
31172
|
if (attrs)
|
|
@@ -31249,7 +31296,7 @@ let NodeType$1 = class NodeType2 {
|
|
|
31249
31296
|
}
|
|
31250
31297
|
/**
|
|
31251
31298
|
Returns true if the given fragment is valid content for this node
|
|
31252
|
-
type
|
|
31299
|
+
type.
|
|
31253
31300
|
*/
|
|
31254
31301
|
validContent(content) {
|
|
31255
31302
|
let result2 = this.contentMatch.matchFragment(content);
|
|
@@ -31270,6 +31317,12 @@ let NodeType$1 = class NodeType2 {
|
|
|
31270
31317
|
throw new RangeError(`Invalid content for node ${this.name}: ${content.toString().slice(0, 50)}`);
|
|
31271
31318
|
}
|
|
31272
31319
|
/**
|
|
31320
|
+
@internal
|
|
31321
|
+
*/
|
|
31322
|
+
checkAttrs(attrs) {
|
|
31323
|
+
checkAttrs(this.attrs, attrs, "node", this.name);
|
|
31324
|
+
}
|
|
31325
|
+
/**
|
|
31273
31326
|
Check whether the given mark type is allowed in this node.
|
|
31274
31327
|
*/
|
|
31275
31328
|
allowsMarkType(markType) {
|
|
@@ -31319,10 +31372,19 @@ let NodeType$1 = class NodeType2 {
|
|
|
31319
31372
|
return result2;
|
|
31320
31373
|
}
|
|
31321
31374
|
};
|
|
31375
|
+
function validateType(type3) {
|
|
31376
|
+
let types = type3.split("|");
|
|
31377
|
+
return (value) => {
|
|
31378
|
+
let name = value === null ? "null" : typeof value;
|
|
31379
|
+
if (types.indexOf(name) < 0)
|
|
31380
|
+
throw new RangeError(`Expected value of type ${types}, got ${name}`);
|
|
31381
|
+
};
|
|
31382
|
+
}
|
|
31322
31383
|
class Attribute {
|
|
31323
31384
|
constructor(options) {
|
|
31324
31385
|
this.hasDefault = Object.prototype.hasOwnProperty.call(options, "default");
|
|
31325
31386
|
this.default = options.default;
|
|
31387
|
+
this.validate = typeof options.validate == "string" ? validateType(options.validate) : options.validate;
|
|
31326
31388
|
}
|
|
31327
31389
|
get isRequired() {
|
|
31328
31390
|
return !this.hasDefault;
|
|
@@ -31381,6 +31443,12 @@ class MarkType {
|
|
|
31381
31443
|
return set2[i2];
|
|
31382
31444
|
}
|
|
31383
31445
|
/**
|
|
31446
|
+
@internal
|
|
31447
|
+
*/
|
|
31448
|
+
checkAttrs(attrs) {
|
|
31449
|
+
checkAttrs(this.attrs, attrs, "mark", this.name);
|
|
31450
|
+
}
|
|
31451
|
+
/**
|
|
31384
31452
|
Queries whether a given mark type is
|
|
31385
31453
|
[excluded](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) by this one.
|
|
31386
31454
|
*/
|
|
@@ -31393,6 +31461,7 @@ class Schema {
|
|
|
31393
31461
|
Construct a schema from a schema [specification](https://prosemirror.net/docs/ref/#model.SchemaSpec).
|
|
31394
31462
|
*/
|
|
31395
31463
|
constructor(spec) {
|
|
31464
|
+
this.linebreakReplacement = null;
|
|
31396
31465
|
this.cached = /* @__PURE__ */ Object.create(null);
|
|
31397
31466
|
let instanceSpec = this.spec = {};
|
|
31398
31467
|
for (let prop3 in spec)
|
|
@@ -31406,6 +31475,13 @@ class Schema {
|
|
|
31406
31475
|
let type3 = this.nodes[prop3], contentExpr = type3.spec.content || "", markExpr = type3.spec.marks;
|
|
31407
31476
|
type3.contentMatch = contentExprCache[contentExpr] || (contentExprCache[contentExpr] = ContentMatch.parse(contentExpr, this.nodes));
|
|
31408
31477
|
type3.inlineContent = type3.contentMatch.inlineContent;
|
|
31478
|
+
if (type3.spec.linebreakReplacement) {
|
|
31479
|
+
if (this.linebreakReplacement)
|
|
31480
|
+
throw new RangeError("Multiple linebreak nodes defined");
|
|
31481
|
+
if (!type3.isInline || !type3.isLeaf)
|
|
31482
|
+
throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");
|
|
31483
|
+
this.linebreakReplacement = type3;
|
|
31484
|
+
}
|
|
31409
31485
|
type3.markSet = markExpr == "_" ? null : markExpr ? gatherMarks(this, markExpr.split(" ")) : markExpr == "" || !type3.inlineContent ? [] : null;
|
|
31410
31486
|
}
|
|
31411
31487
|
for (let prop3 in this.marks) {
|
|
@@ -31490,6 +31566,12 @@ function gatherMarks(schema, marks) {
|
|
|
31490
31566
|
}
|
|
31491
31567
|
return found2;
|
|
31492
31568
|
}
|
|
31569
|
+
function isTagRule(rule) {
|
|
31570
|
+
return rule.tag != null;
|
|
31571
|
+
}
|
|
31572
|
+
function isStyleRule(rule) {
|
|
31573
|
+
return rule.style != null;
|
|
31574
|
+
}
|
|
31493
31575
|
class DOMParser {
|
|
31494
31576
|
/**
|
|
31495
31577
|
Create a parser that targets the given schema, using the given
|
|
@@ -31500,11 +31582,16 @@ class DOMParser {
|
|
|
31500
31582
|
this.rules = rules;
|
|
31501
31583
|
this.tags = [];
|
|
31502
31584
|
this.styles = [];
|
|
31585
|
+
let matchedStyles = this.matchedStyles = [];
|
|
31503
31586
|
rules.forEach((rule) => {
|
|
31504
|
-
if (rule
|
|
31587
|
+
if (isTagRule(rule)) {
|
|
31505
31588
|
this.tags.push(rule);
|
|
31506
|
-
else if (rule
|
|
31589
|
+
} else if (isStyleRule(rule)) {
|
|
31590
|
+
let prop3 = /[^=]*/.exec(rule.style)[0];
|
|
31591
|
+
if (matchedStyles.indexOf(prop3) < 0)
|
|
31592
|
+
matchedStyles.push(prop3);
|
|
31507
31593
|
this.styles.push(rule);
|
|
31594
|
+
}
|
|
31508
31595
|
});
|
|
31509
31596
|
this.normalizeLists = !this.tags.some((r2) => {
|
|
31510
31597
|
if (!/^(ul|ol)\b/.test(r2.tag) || !r2.node)
|
|
@@ -31764,10 +31851,10 @@ class ParseContext {
|
|
|
31764
31851
|
this.addElement(dom);
|
|
31765
31852
|
}
|
|
31766
31853
|
withStyleRules(dom, f2) {
|
|
31767
|
-
let style2 = dom.
|
|
31768
|
-
if (!style2)
|
|
31854
|
+
let style2 = dom.style;
|
|
31855
|
+
if (!style2 || !style2.length)
|
|
31769
31856
|
return f2();
|
|
31770
|
-
let marks = this.readStyles(
|
|
31857
|
+
let marks = this.readStyles(dom.style);
|
|
31771
31858
|
if (!marks)
|
|
31772
31859
|
return;
|
|
31773
31860
|
let [addMarks, removeMarks] = marks, top2 = this.top;
|
|
@@ -31861,27 +31948,30 @@ class ParseContext {
|
|
|
31861
31948
|
// had a rule with `ignore` set.
|
|
31862
31949
|
readStyles(styles) {
|
|
31863
31950
|
let add2 = Mark$1.none, remove2 = Mark$1.none;
|
|
31864
|
-
|
|
31865
|
-
for (let
|
|
31866
|
-
let
|
|
31867
|
-
if (
|
|
31868
|
-
|
|
31869
|
-
|
|
31870
|
-
|
|
31871
|
-
|
|
31872
|
-
|
|
31873
|
-
|
|
31874
|
-
|
|
31875
|
-
|
|
31876
|
-
|
|
31877
|
-
|
|
31878
|
-
|
|
31879
|
-
|
|
31880
|
-
|
|
31881
|
-
|
|
31882
|
-
|
|
31951
|
+
if (styles.length)
|
|
31952
|
+
for (let i2 = 0; i2 < this.parser.matchedStyles.length; i2++) {
|
|
31953
|
+
let name = this.parser.matchedStyles[i2], value = styles.getPropertyValue(name);
|
|
31954
|
+
if (value)
|
|
31955
|
+
for (let after = void 0; ; ) {
|
|
31956
|
+
let rule = this.parser.matchStyle(name, value, this, after);
|
|
31957
|
+
if (!rule)
|
|
31958
|
+
break;
|
|
31959
|
+
if (rule.ignore)
|
|
31960
|
+
return null;
|
|
31961
|
+
if (rule.clearMark) {
|
|
31962
|
+
this.top.pendingMarks.concat(this.top.activeMarks).forEach((m2) => {
|
|
31963
|
+
if (rule.clearMark(m2))
|
|
31964
|
+
remove2 = m2.addToSet(remove2);
|
|
31965
|
+
});
|
|
31966
|
+
} else {
|
|
31967
|
+
add2 = this.parser.schema.marks[rule.mark].create(rule.attrs).addToSet(add2);
|
|
31968
|
+
}
|
|
31969
|
+
if (rule.consuming === false)
|
|
31970
|
+
after = rule;
|
|
31971
|
+
else
|
|
31972
|
+
break;
|
|
31973
|
+
}
|
|
31883
31974
|
}
|
|
31884
|
-
}
|
|
31885
31975
|
return [add2, remove2];
|
|
31886
31976
|
}
|
|
31887
31977
|
// Look up a handler for the given node. If none are found, return
|
|
@@ -32150,12 +32240,6 @@ function normalizeList(dom) {
|
|
|
32150
32240
|
function matches(dom, selector2) {
|
|
32151
32241
|
return (dom.matches || dom.msMatchesSelector || dom.webkitMatchesSelector || dom.mozMatchesSelector).call(dom, selector2);
|
|
32152
32242
|
}
|
|
32153
|
-
function parseStyles(style2) {
|
|
32154
|
-
let re2 = /\s*([\w-]+)\s*:\s*([^;]+)/g, m2, result2 = [];
|
|
32155
|
-
while (m2 = re2.exec(style2))
|
|
32156
|
-
result2.push(m2[1], m2[2].trim());
|
|
32157
|
-
return result2;
|
|
32158
|
-
}
|
|
32159
32243
|
function copy$2(obj) {
|
|
32160
32244
|
let copy2 = {};
|
|
32161
32245
|
for (let prop3 in obj)
|
|
@@ -32246,7 +32330,7 @@ class DOMSerializer {
|
|
|
32246
32330
|
@internal
|
|
32247
32331
|
*/
|
|
32248
32332
|
serializeNodeInner(node, options) {
|
|
32249
|
-
let { dom, contentDOM } =
|
|
32333
|
+
let { dom, contentDOM } = renderSpec(doc$1(options), this.nodes[node.type.name](node), null, node.attrs);
|
|
32250
32334
|
if (contentDOM) {
|
|
32251
32335
|
if (node.isLeaf)
|
|
32252
32336
|
throw new RangeError("Content hole not allowed in a leaf node spec");
|
|
@@ -32277,7 +32361,7 @@ class DOMSerializer {
|
|
|
32277
32361
|
*/
|
|
32278
32362
|
serializeMark(mark, inline, options = {}) {
|
|
32279
32363
|
let toDOM = this.marks[mark.type.name];
|
|
32280
|
-
return toDOM &&
|
|
32364
|
+
return toDOM && renderSpec(doc$1(options), toDOM(mark, inline), null, mark.attrs);
|
|
32281
32365
|
}
|
|
32282
32366
|
/**
|
|
32283
32367
|
Render an [output spec](https://prosemirror.net/docs/ref/#model.DOMOutputSpec) to a DOM node. If
|
|
@@ -32285,48 +32369,7 @@ class DOMSerializer {
|
|
|
32285
32369
|
node with the hole.
|
|
32286
32370
|
*/
|
|
32287
32371
|
static renderSpec(doc2, structure, xmlNS = null) {
|
|
32288
|
-
|
|
32289
|
-
return { dom: doc2.createTextNode(structure) };
|
|
32290
|
-
if (structure.nodeType != null)
|
|
32291
|
-
return { dom: structure };
|
|
32292
|
-
if (structure.dom && structure.dom.nodeType != null)
|
|
32293
|
-
return structure;
|
|
32294
|
-
let tagName = structure[0], space = tagName.indexOf(" ");
|
|
32295
|
-
if (space > 0) {
|
|
32296
|
-
xmlNS = tagName.slice(0, space);
|
|
32297
|
-
tagName = tagName.slice(space + 1);
|
|
32298
|
-
}
|
|
32299
|
-
let contentDOM;
|
|
32300
|
-
let dom = xmlNS ? doc2.createElementNS(xmlNS, tagName) : doc2.createElement(tagName);
|
|
32301
|
-
let attrs = structure[1], start2 = 1;
|
|
32302
|
-
if (attrs && typeof attrs == "object" && attrs.nodeType == null && !Array.isArray(attrs)) {
|
|
32303
|
-
start2 = 2;
|
|
32304
|
-
for (let name in attrs)
|
|
32305
|
-
if (attrs[name] != null) {
|
|
32306
|
-
let space2 = name.indexOf(" ");
|
|
32307
|
-
if (space2 > 0)
|
|
32308
|
-
dom.setAttributeNS(name.slice(0, space2), name.slice(space2 + 1), attrs[name]);
|
|
32309
|
-
else
|
|
32310
|
-
dom.setAttribute(name, attrs[name]);
|
|
32311
|
-
}
|
|
32312
|
-
}
|
|
32313
|
-
for (let i2 = start2; i2 < structure.length; i2++) {
|
|
32314
|
-
let child = structure[i2];
|
|
32315
|
-
if (child === 0) {
|
|
32316
|
-
if (i2 < structure.length - 1 || i2 > start2)
|
|
32317
|
-
throw new RangeError("Content hole must be the only child of its parent node");
|
|
32318
|
-
return { dom, contentDOM: dom };
|
|
32319
|
-
} else {
|
|
32320
|
-
let { dom: inner, contentDOM: innerContent } = DOMSerializer.renderSpec(doc2, child, xmlNS);
|
|
32321
|
-
dom.appendChild(inner);
|
|
32322
|
-
if (innerContent) {
|
|
32323
|
-
if (contentDOM)
|
|
32324
|
-
throw new RangeError("Multiple content holes");
|
|
32325
|
-
contentDOM = innerContent;
|
|
32326
|
-
}
|
|
32327
|
-
}
|
|
32328
|
-
}
|
|
32329
|
-
return { dom, contentDOM };
|
|
32372
|
+
return renderSpec(doc2, structure, xmlNS);
|
|
32330
32373
|
}
|
|
32331
32374
|
/**
|
|
32332
32375
|
Build a serializer using the [`toDOM`](https://prosemirror.net/docs/ref/#model.NodeSpec.toDOM)
|
|
@@ -32364,6 +32407,84 @@ function gatherToDOM(obj) {
|
|
|
32364
32407
|
function doc$1(options) {
|
|
32365
32408
|
return options.document || window.document;
|
|
32366
32409
|
}
|
|
32410
|
+
const suspiciousAttributeCache = /* @__PURE__ */ new WeakMap();
|
|
32411
|
+
function suspiciousAttributes(attrs) {
|
|
32412
|
+
let value = suspiciousAttributeCache.get(attrs);
|
|
32413
|
+
if (value === void 0)
|
|
32414
|
+
suspiciousAttributeCache.set(attrs, value = suspiciousAttributesInner(attrs));
|
|
32415
|
+
return value;
|
|
32416
|
+
}
|
|
32417
|
+
function suspiciousAttributesInner(attrs) {
|
|
32418
|
+
let result2 = null;
|
|
32419
|
+
function scan(value) {
|
|
32420
|
+
if (value && typeof value == "object") {
|
|
32421
|
+
if (Array.isArray(value)) {
|
|
32422
|
+
if (typeof value[0] == "string") {
|
|
32423
|
+
if (!result2)
|
|
32424
|
+
result2 = [];
|
|
32425
|
+
result2.push(value);
|
|
32426
|
+
} else {
|
|
32427
|
+
for (let i2 = 0; i2 < value.length; i2++)
|
|
32428
|
+
scan(value[i2]);
|
|
32429
|
+
}
|
|
32430
|
+
} else {
|
|
32431
|
+
for (let prop3 in value)
|
|
32432
|
+
scan(value[prop3]);
|
|
32433
|
+
}
|
|
32434
|
+
}
|
|
32435
|
+
}
|
|
32436
|
+
scan(attrs);
|
|
32437
|
+
return result2;
|
|
32438
|
+
}
|
|
32439
|
+
function renderSpec(doc2, structure, xmlNS, blockArraysIn) {
|
|
32440
|
+
if (typeof structure == "string")
|
|
32441
|
+
return { dom: doc2.createTextNode(structure) };
|
|
32442
|
+
if (structure.nodeType != null)
|
|
32443
|
+
return { dom: structure };
|
|
32444
|
+
if (structure.dom && structure.dom.nodeType != null)
|
|
32445
|
+
return structure;
|
|
32446
|
+
let tagName = structure[0], suspicious;
|
|
32447
|
+
if (typeof tagName != "string")
|
|
32448
|
+
throw new RangeError("Invalid array passed to renderSpec");
|
|
32449
|
+
if (blockArraysIn && (suspicious = suspiciousAttributes(blockArraysIn)) && suspicious.indexOf(structure) > -1)
|
|
32450
|
+
throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");
|
|
32451
|
+
let space = tagName.indexOf(" ");
|
|
32452
|
+
if (space > 0) {
|
|
32453
|
+
xmlNS = tagName.slice(0, space);
|
|
32454
|
+
tagName = tagName.slice(space + 1);
|
|
32455
|
+
}
|
|
32456
|
+
let contentDOM;
|
|
32457
|
+
let dom = xmlNS ? doc2.createElementNS(xmlNS, tagName) : doc2.createElement(tagName);
|
|
32458
|
+
let attrs = structure[1], start2 = 1;
|
|
32459
|
+
if (attrs && typeof attrs == "object" && attrs.nodeType == null && !Array.isArray(attrs)) {
|
|
32460
|
+
start2 = 2;
|
|
32461
|
+
for (let name in attrs)
|
|
32462
|
+
if (attrs[name] != null) {
|
|
32463
|
+
let space2 = name.indexOf(" ");
|
|
32464
|
+
if (space2 > 0)
|
|
32465
|
+
dom.setAttributeNS(name.slice(0, space2), name.slice(space2 + 1), attrs[name]);
|
|
32466
|
+
else
|
|
32467
|
+
dom.setAttribute(name, attrs[name]);
|
|
32468
|
+
}
|
|
32469
|
+
}
|
|
32470
|
+
for (let i2 = start2; i2 < structure.length; i2++) {
|
|
32471
|
+
let child = structure[i2];
|
|
32472
|
+
if (child === 0) {
|
|
32473
|
+
if (i2 < structure.length - 1 || i2 > start2)
|
|
32474
|
+
throw new RangeError("Content hole must be the only child of its parent node");
|
|
32475
|
+
return { dom, contentDOM: dom };
|
|
32476
|
+
} else {
|
|
32477
|
+
let { dom: inner, contentDOM: innerContent } = renderSpec(doc2, child, xmlNS, blockArraysIn);
|
|
32478
|
+
dom.appendChild(inner);
|
|
32479
|
+
if (innerContent) {
|
|
32480
|
+
if (contentDOM)
|
|
32481
|
+
throw new RangeError("Multiple content holes");
|
|
32482
|
+
contentDOM = innerContent;
|
|
32483
|
+
}
|
|
32484
|
+
}
|
|
32485
|
+
}
|
|
32486
|
+
return { dom, contentDOM };
|
|
32487
|
+
}
|
|
32367
32488
|
const lower16 = 65535;
|
|
32368
32489
|
const factor16 = Math.pow(2, 16);
|
|
32369
32490
|
function makeRecover(index2, offset2) {
|
|
@@ -33023,7 +33144,8 @@ class ReplaceAroundStep extends Step$1 {
|
|
|
33023
33144
|
}
|
|
33024
33145
|
map(mapping) {
|
|
33025
33146
|
let from2 = mapping.mapResult(this.from, 1), to2 = mapping.mapResult(this.to, -1);
|
|
33026
|
-
let gapFrom =
|
|
33147
|
+
let gapFrom = this.from == this.gapFrom ? from2.pos : mapping.map(this.gapFrom, -1);
|
|
33148
|
+
let gapTo = this.to == this.gapTo ? to2.pos : mapping.map(this.gapTo, 1);
|
|
33027
33149
|
if (from2.deletedAcross && to2.deletedAcross || gapFrom < from2.pos || gapTo > to2.pos)
|
|
33028
33150
|
return null;
|
|
33029
33151
|
return new ReplaceAroundStep(from2.pos, to2.pos, gapFrom, gapTo, this.slice, this.insert, this.structure);
|
|
@@ -33136,7 +33258,7 @@ function removeMark(tr2, from2, to2, mark) {
|
|
|
33136
33258
|
});
|
|
33137
33259
|
matched.forEach((m2) => tr2.step(new RemoveMarkStep(m2.from, m2.to, m2.style)));
|
|
33138
33260
|
}
|
|
33139
|
-
function clearIncompatible(tr2, pos, parentType, match2 = parentType.contentMatch) {
|
|
33261
|
+
function clearIncompatible(tr2, pos, parentType, match2 = parentType.contentMatch, clearNewlines = true) {
|
|
33140
33262
|
let node = tr2.doc.nodeAt(pos);
|
|
33141
33263
|
let replSteps = [], cur = pos + 1;
|
|
33142
33264
|
for (let i2 = 0; i2 < node.childCount; i2++) {
|
|
@@ -33149,7 +33271,7 @@ function clearIncompatible(tr2, pos, parentType, match2 = parentType.contentMatc
|
|
|
33149
33271
|
for (let j2 = 0; j2 < child.marks.length; j2++)
|
|
33150
33272
|
if (!parentType.allowsMarkType(child.marks[j2].type))
|
|
33151
33273
|
tr2.step(new RemoveMarkStep(cur, end2, child.marks[j2]));
|
|
33152
|
-
if (child.isText &&
|
|
33274
|
+
if (clearNewlines && child.isText && parentType.whitespace != "pre") {
|
|
33153
33275
|
let m2, newline = /\r?\n|\r/g, slice4;
|
|
33154
33276
|
while (m2 = newline.exec(child.text)) {
|
|
33155
33277
|
if (!slice4)
|
|
@@ -33258,14 +33380,45 @@ function setBlockType$1(tr2, from2, to2, type3, attrs) {
|
|
|
33258
33380
|
let mapFrom = tr2.steps.length;
|
|
33259
33381
|
tr2.doc.nodesBetween(from2, to2, (node, pos) => {
|
|
33260
33382
|
if (node.isTextblock && !node.hasMarkup(type3, attrs) && canChangeType(tr2.doc, tr2.mapping.slice(mapFrom).map(pos), type3)) {
|
|
33261
|
-
|
|
33383
|
+
let convertNewlines = null;
|
|
33384
|
+
if (type3.schema.linebreakReplacement) {
|
|
33385
|
+
let pre = type3.whitespace == "pre", supportLinebreak = !!type3.contentMatch.matchType(type3.schema.linebreakReplacement);
|
|
33386
|
+
if (pre && !supportLinebreak)
|
|
33387
|
+
convertNewlines = false;
|
|
33388
|
+
else if (!pre && supportLinebreak)
|
|
33389
|
+
convertNewlines = true;
|
|
33390
|
+
}
|
|
33391
|
+
if (convertNewlines === false)
|
|
33392
|
+
replaceLinebreaks(tr2, node, pos, mapFrom);
|
|
33393
|
+
clearIncompatible(tr2, tr2.mapping.slice(mapFrom).map(pos, 1), type3, void 0, convertNewlines === null);
|
|
33262
33394
|
let mapping = tr2.mapping.slice(mapFrom);
|
|
33263
33395
|
let startM = mapping.map(pos, 1), endM = mapping.map(pos + node.nodeSize, 1);
|
|
33264
33396
|
tr2.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new Slice(Fragment.from(type3.create(attrs, null, node.marks)), 0, 0), 1, true));
|
|
33397
|
+
if (convertNewlines === true)
|
|
33398
|
+
replaceNewlines(tr2, node, pos, mapFrom);
|
|
33265
33399
|
return false;
|
|
33266
33400
|
}
|
|
33267
33401
|
});
|
|
33268
33402
|
}
|
|
33403
|
+
function replaceNewlines(tr2, node, pos, mapFrom) {
|
|
33404
|
+
node.forEach((child, offset2) => {
|
|
33405
|
+
if (child.isText) {
|
|
33406
|
+
let m2, newline = /\r?\n|\r/g;
|
|
33407
|
+
while (m2 = newline.exec(child.text)) {
|
|
33408
|
+
let start2 = tr2.mapping.slice(mapFrom).map(pos + 1 + offset2 + m2.index);
|
|
33409
|
+
tr2.replaceWith(start2, start2 + 1, node.type.schema.linebreakReplacement.create());
|
|
33410
|
+
}
|
|
33411
|
+
}
|
|
33412
|
+
});
|
|
33413
|
+
}
|
|
33414
|
+
function replaceLinebreaks(tr2, node, pos, mapFrom) {
|
|
33415
|
+
node.forEach((child, offset2) => {
|
|
33416
|
+
if (child.type == child.type.schema.linebreakReplacement) {
|
|
33417
|
+
let start2 = tr2.mapping.slice(mapFrom).map(pos + 1 + offset2);
|
|
33418
|
+
tr2.replaceWith(start2, start2 + 1, node.type.schema.text("\n"));
|
|
33419
|
+
}
|
|
33420
|
+
});
|
|
33421
|
+
}
|
|
33269
33422
|
function canChangeType(doc2, pos, type3) {
|
|
33270
33423
|
let $pos = doc2.resolve(pos), index2 = $pos.index();
|
|
33271
33424
|
return $pos.parent.canReplaceWith(index2, index2 + 1, type3);
|
|
@@ -35031,6 +35184,9 @@ const textRange = function(node, from2, to2) {
|
|
|
35031
35184
|
range2.setStart(node, from2 || 0);
|
|
35032
35185
|
return range2;
|
|
35033
35186
|
};
|
|
35187
|
+
const clearReusedRange = function() {
|
|
35188
|
+
reusedRange = null;
|
|
35189
|
+
};
|
|
35034
35190
|
const isEquivalentPosition = function(node, off2, targetNode, targetOff) {
|
|
35035
35191
|
return targetNode && (scanFor(node, off2, targetNode, targetOff, -1) || scanFor(node, off2, targetNode, targetOff, 1));
|
|
35036
35192
|
};
|
|
@@ -35058,6 +35214,40 @@ function scanFor(node, off2, targetNode, targetOff, dir) {
|
|
|
35058
35214
|
function nodeSize(node) {
|
|
35059
35215
|
return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length;
|
|
35060
35216
|
}
|
|
35217
|
+
function textNodeBefore$1(node, offset2) {
|
|
35218
|
+
for (; ; ) {
|
|
35219
|
+
if (node.nodeType == 3 && offset2)
|
|
35220
|
+
return node;
|
|
35221
|
+
if (node.nodeType == 1 && offset2 > 0) {
|
|
35222
|
+
if (node.contentEditable == "false")
|
|
35223
|
+
return null;
|
|
35224
|
+
node = node.childNodes[offset2 - 1];
|
|
35225
|
+
offset2 = nodeSize(node);
|
|
35226
|
+
} else if (node.parentNode && !hasBlockDesc(node)) {
|
|
35227
|
+
offset2 = domIndex(node);
|
|
35228
|
+
node = node.parentNode;
|
|
35229
|
+
} else {
|
|
35230
|
+
return null;
|
|
35231
|
+
}
|
|
35232
|
+
}
|
|
35233
|
+
}
|
|
35234
|
+
function textNodeAfter$1(node, offset2) {
|
|
35235
|
+
for (; ; ) {
|
|
35236
|
+
if (node.nodeType == 3 && offset2 < node.nodeValue.length)
|
|
35237
|
+
return node;
|
|
35238
|
+
if (node.nodeType == 1 && offset2 < node.childNodes.length) {
|
|
35239
|
+
if (node.contentEditable == "false")
|
|
35240
|
+
return null;
|
|
35241
|
+
node = node.childNodes[offset2];
|
|
35242
|
+
offset2 = 0;
|
|
35243
|
+
} else if (node.parentNode && !hasBlockDesc(node)) {
|
|
35244
|
+
offset2 = domIndex(node) + 1;
|
|
35245
|
+
node = node.parentNode;
|
|
35246
|
+
} else {
|
|
35247
|
+
return null;
|
|
35248
|
+
}
|
|
35249
|
+
}
|
|
35250
|
+
}
|
|
35061
35251
|
function isOnEdge(node, offset2, parent) {
|
|
35062
35252
|
for (let atStart = offset2 == 0, atEnd = offset2 == nodeSize(node); atStart || atEnd; ) {
|
|
35063
35253
|
if (node == parent)
|
|
@@ -35129,6 +35319,14 @@ const android = /Android \d/.test(agent);
|
|
|
35129
35319
|
const webkit = !!doc && "webkitFontSmoothing" in doc.documentElement.style;
|
|
35130
35320
|
const webkit_version = webkit ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
|
|
35131
35321
|
function windowRect(doc2) {
|
|
35322
|
+
let vp = doc2.defaultView && doc2.defaultView.visualViewport;
|
|
35323
|
+
if (vp)
|
|
35324
|
+
return {
|
|
35325
|
+
left: 0,
|
|
35326
|
+
right: vp.width,
|
|
35327
|
+
top: 0,
|
|
35328
|
+
bottom: vp.height
|
|
35329
|
+
};
|
|
35132
35330
|
return {
|
|
35133
35331
|
left: 0,
|
|
35134
35332
|
right: doc2.documentElement.clientWidth,
|
|
@@ -35330,14 +35528,14 @@ function posFromCaret(view, node, offset2, coords) {
|
|
|
35330
35528
|
let desc = view.docView.nearestDesc(cur, true);
|
|
35331
35529
|
if (!desc)
|
|
35332
35530
|
return null;
|
|
35333
|
-
if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent
|
|
35531
|
+
if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent || !desc.contentDOM)) {
|
|
35334
35532
|
let rect = desc.dom.getBoundingClientRect();
|
|
35335
|
-
if (desc.node.isBlock && desc.parent
|
|
35336
|
-
sawBlock
|
|
35337
|
-
if (rect.left > coords.left || rect.top > coords.top)
|
|
35533
|
+
if (desc.node.isBlock && desc.parent) {
|
|
35534
|
+
if (!sawBlock && rect.left > coords.left || rect.top > coords.top)
|
|
35338
35535
|
outsideBlock = desc.posBefore;
|
|
35339
|
-
else if (rect.right < coords.left || rect.bottom < coords.top)
|
|
35536
|
+
else if (!sawBlock && rect.right < coords.left || rect.bottom < coords.top)
|
|
35340
35537
|
outsideBlock = desc.posAfter;
|
|
35538
|
+
sawBlock = true;
|
|
35341
35539
|
}
|
|
35342
35540
|
if (!desc.contentDOM && outsideBlock < 0 && !desc.node.isText) {
|
|
35343
35541
|
let before = desc.node.isBlock ? coords.top < (rect.top + rect.bottom) / 2 : coords.left < (rect.left + rect.right) / 2;
|
|
@@ -35952,6 +36150,9 @@ class ViewDesc {
|
|
|
35952
36150
|
get ignoreForCoords() {
|
|
35953
36151
|
return false;
|
|
35954
36152
|
}
|
|
36153
|
+
isText(text) {
|
|
36154
|
+
return false;
|
|
36155
|
+
}
|
|
35955
36156
|
}
|
|
35956
36157
|
class WidgetViewDesc extends ViewDesc {
|
|
35957
36158
|
constructor(parent, widget, view, pos) {
|
|
@@ -36190,8 +36391,7 @@ class NodeViewDesc extends ViewDesc {
|
|
|
36190
36391
|
let { from: from2, to: to2 } = view.state.selection;
|
|
36191
36392
|
if (!(view.state.selection instanceof TextSelection) || from2 < pos || to2 > pos + this.node.content.size)
|
|
36192
36393
|
return null;
|
|
36193
|
-
let
|
|
36194
|
-
let textNode = nearbyTextNode(sel.focusNode, sel.focusOffset);
|
|
36394
|
+
let textNode = view.input.compositionNode;
|
|
36195
36395
|
if (!textNode || !this.dom.contains(textNode.parentNode))
|
|
36196
36396
|
return null;
|
|
36197
36397
|
if (this.node.inlineContent) {
|
|
@@ -36257,10 +36457,11 @@ class NodeViewDesc extends ViewDesc {
|
|
|
36257
36457
|
}
|
|
36258
36458
|
// Remove selected node marking from this node.
|
|
36259
36459
|
deselectNode() {
|
|
36260
|
-
if (this.nodeDOM.nodeType == 1)
|
|
36460
|
+
if (this.nodeDOM.nodeType == 1) {
|
|
36261
36461
|
this.nodeDOM.classList.remove("ProseMirror-selectednode");
|
|
36262
|
-
|
|
36263
|
-
|
|
36462
|
+
if (this.contentDOM || !this.node.type.spec.draggable)
|
|
36463
|
+
this.dom.removeAttribute("draggable");
|
|
36464
|
+
}
|
|
36264
36465
|
}
|
|
36265
36466
|
get domAtom() {
|
|
36266
36467
|
return this.node.isAtom;
|
|
@@ -36326,6 +36527,9 @@ class TextViewDesc extends NodeViewDesc {
|
|
|
36326
36527
|
get domAtom() {
|
|
36327
36528
|
return false;
|
|
36328
36529
|
}
|
|
36530
|
+
isText(text) {
|
|
36531
|
+
return this.node.text == text;
|
|
36532
|
+
}
|
|
36329
36533
|
}
|
|
36330
36534
|
class TrailingHackViewDesc extends ViewDesc {
|
|
36331
36535
|
parseRule() {
|
|
@@ -36841,23 +37045,6 @@ function iosHacks(dom) {
|
|
|
36841
37045
|
dom.style.cssText = oldCSS;
|
|
36842
37046
|
}
|
|
36843
37047
|
}
|
|
36844
|
-
function nearbyTextNode(node, offset2) {
|
|
36845
|
-
for (; ; ) {
|
|
36846
|
-
if (node.nodeType == 3)
|
|
36847
|
-
return node;
|
|
36848
|
-
if (node.nodeType == 1 && offset2 > 0) {
|
|
36849
|
-
if (node.childNodes.length > offset2 && node.childNodes[offset2].nodeType == 3)
|
|
36850
|
-
return node.childNodes[offset2];
|
|
36851
|
-
node = node.childNodes[offset2 - 1];
|
|
36852
|
-
offset2 = nodeSize(node);
|
|
36853
|
-
} else if (node.nodeType == 1 && offset2 < node.childNodes.length) {
|
|
36854
|
-
node = node.childNodes[offset2];
|
|
36855
|
-
offset2 = 0;
|
|
36856
|
-
} else {
|
|
36857
|
-
return null;
|
|
36858
|
-
}
|
|
36859
|
-
}
|
|
36860
|
-
}
|
|
36861
37048
|
function findTextInFragment(frag, text, from2, to2) {
|
|
36862
37049
|
for (let i2 = 0, pos = 0; i2 < frag.childCount && pos <= to2; ) {
|
|
36863
37050
|
let child = frag.child(i2++), childStart = pos;
|
|
@@ -37432,7 +37619,7 @@ function serializeForClipboard(view, slice4) {
|
|
|
37432
37619
|
if (firstChild && firstChild.nodeType == 1)
|
|
37433
37620
|
firstChild.setAttribute("data-pm-slice", `${openStart} ${openEnd}${wrappers ? ` -${wrappers}` : ""} ${JSON.stringify(context)}`);
|
|
37434
37621
|
let text = view.someProp("clipboardTextSerializer", (f2) => f2(slice4, view)) || slice4.content.textBetween(0, slice4.content.size, "\n\n");
|
|
37435
|
-
return { dom: wrap2, text };
|
|
37622
|
+
return { dom: wrap2, text, slice: slice4 };
|
|
37436
37623
|
}
|
|
37437
37624
|
function parseFromClipboard(view, text, html, plainText, $context) {
|
|
37438
37625
|
let inCode = $context.parent.type.spec.code;
|
|
@@ -37652,6 +37839,7 @@ class InputState {
|
|
|
37652
37839
|
this.lastTouch = 0;
|
|
37653
37840
|
this.lastAndroidDelete = 0;
|
|
37654
37841
|
this.composing = false;
|
|
37842
|
+
this.compositionNode = null;
|
|
37655
37843
|
this.composingTimeout = -1;
|
|
37656
37844
|
this.compositionNodes = [];
|
|
37657
37845
|
this.compositionEndedAt = -2e8;
|
|
@@ -37901,7 +38089,7 @@ class MouseDown {
|
|
|
37901
38089
|
}
|
|
37902
38090
|
const target = flushed ? null : event.target;
|
|
37903
38091
|
const targetDesc = target ? view.docView.nearestDesc(target, true) : null;
|
|
37904
|
-
this.target = targetDesc ? targetDesc.dom : null;
|
|
38092
|
+
this.target = targetDesc && targetDesc.dom.nodeType == 1 ? targetDesc.dom : null;
|
|
37905
38093
|
let { selection } = view.state;
|
|
37906
38094
|
if (event.button == 0 && targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false || selection instanceof NodeSelection && selection.from <= targetPos && selection.to > targetPos)
|
|
37907
38095
|
this.mightDrag = {
|
|
@@ -38033,6 +38221,7 @@ editHandlers.compositionend = (view, event) => {
|
|
|
38033
38221
|
view.input.composing = false;
|
|
38034
38222
|
view.input.compositionEndedAt = event.timeStamp;
|
|
38035
38223
|
view.input.compositionPendingChanges = view.domObserver.pendingRecords().length ? view.input.compositionID : 0;
|
|
38224
|
+
view.input.compositionNode = null;
|
|
38036
38225
|
if (view.input.compositionPendingChanges)
|
|
38037
38226
|
Promise.resolve().then(() => view.domObserver.flush());
|
|
38038
38227
|
view.input.compositionID++;
|
|
@@ -38052,6 +38241,26 @@ function clearComposition(view) {
|
|
|
38052
38241
|
while (view.input.compositionNodes.length > 0)
|
|
38053
38242
|
view.input.compositionNodes.pop().markParentsDirty();
|
|
38054
38243
|
}
|
|
38244
|
+
function findCompositionNode(view) {
|
|
38245
|
+
let sel = view.domSelectionRange();
|
|
38246
|
+
if (!sel.focusNode)
|
|
38247
|
+
return null;
|
|
38248
|
+
let textBefore = textNodeBefore$1(sel.focusNode, sel.focusOffset);
|
|
38249
|
+
let textAfter = textNodeAfter$1(sel.focusNode, sel.focusOffset);
|
|
38250
|
+
if (textBefore && textAfter && textBefore != textAfter) {
|
|
38251
|
+
let descAfter = textAfter.pmViewDesc, lastChanged = view.domObserver.lastChangedTextNode;
|
|
38252
|
+
if (textBefore == lastChanged || textAfter == lastChanged)
|
|
38253
|
+
return lastChanged;
|
|
38254
|
+
if (!descAfter || !descAfter.isText(textAfter.nodeValue)) {
|
|
38255
|
+
return textAfter;
|
|
38256
|
+
} else if (view.input.compositionNode == textAfter) {
|
|
38257
|
+
let descBefore = textBefore.pmViewDesc;
|
|
38258
|
+
if (!(!descBefore || !descBefore.isText(textBefore.nodeValue)))
|
|
38259
|
+
return textAfter;
|
|
38260
|
+
}
|
|
38261
|
+
}
|
|
38262
|
+
return textBefore || textAfter;
|
|
38263
|
+
}
|
|
38055
38264
|
function timestampFromCustomEvent() {
|
|
38056
38265
|
let event = document.createEvent("Event");
|
|
38057
38266
|
event.initEvent("event", true, true);
|
|
@@ -38186,7 +38395,8 @@ handlers.dragstart = (view, _event) => {
|
|
|
38186
38395
|
if (desc && desc.node.type.spec.draggable && desc != view.docView)
|
|
38187
38396
|
node = NodeSelection.create(view.state.doc, desc.posBefore);
|
|
38188
38397
|
}
|
|
38189
|
-
let
|
|
38398
|
+
let draggedSlice = (node || view.state.selection).content();
|
|
38399
|
+
let { dom, text, slice: slice4 } = serializeForClipboard(view, draggedSlice);
|
|
38190
38400
|
event.dataTransfer.clearData();
|
|
38191
38401
|
event.dataTransfer.setData(brokenClipboardAPI ? "Text" : "text/html", dom.innerHTML);
|
|
38192
38402
|
event.dataTransfer.effectAllowed = "copyMove";
|
|
@@ -38606,9 +38816,6 @@ class DecorationSet {
|
|
|
38606
38816
|
return this;
|
|
38607
38817
|
return local.length || children2.length ? new DecorationSet(local, children2) : empty$1;
|
|
38608
38818
|
}
|
|
38609
|
-
/**
|
|
38610
|
-
@internal
|
|
38611
|
-
*/
|
|
38612
38819
|
forChild(offset2, node) {
|
|
38613
38820
|
if (this == empty$1)
|
|
38614
38821
|
return this;
|
|
@@ -38962,6 +39169,7 @@ class DOMObserver {
|
|
|
38962
39169
|
this.currentSelection = new SelectionState();
|
|
38963
39170
|
this.onCharData = null;
|
|
38964
39171
|
this.suppressingSelectionUpdates = false;
|
|
39172
|
+
this.lastChangedTextNode = null;
|
|
38965
39173
|
this.observer = window.MutationObserver && new window.MutationObserver((mutations) => {
|
|
38966
39174
|
for (let i2 = 0; i2 < mutations.length; i2++)
|
|
38967
39175
|
this.queue.push(mutations[i2]);
|
|
@@ -39087,14 +39295,21 @@ class DOMObserver {
|
|
|
39087
39295
|
}
|
|
39088
39296
|
}
|
|
39089
39297
|
}
|
|
39090
|
-
if (gecko && added.length
|
|
39298
|
+
if (gecko && added.length) {
|
|
39091
39299
|
let brs = added.filter((n2) => n2.nodeName == "BR");
|
|
39092
39300
|
if (brs.length == 2) {
|
|
39093
|
-
let a2
|
|
39301
|
+
let [a2, b2] = brs;
|
|
39094
39302
|
if (a2.parentNode && a2.parentNode.parentNode == b2.parentNode)
|
|
39095
39303
|
b2.remove();
|
|
39096
39304
|
else
|
|
39097
39305
|
a2.remove();
|
|
39306
|
+
} else {
|
|
39307
|
+
let { focusNode } = this.currentSelection;
|
|
39308
|
+
for (let br2 of brs) {
|
|
39309
|
+
let parent = br2.parentNode;
|
|
39310
|
+
if (parent && parent.nodeName == "LI" && (!focusNode || blockParent(view, focusNode) != parent))
|
|
39311
|
+
br2.remove();
|
|
39312
|
+
}
|
|
39098
39313
|
}
|
|
39099
39314
|
}
|
|
39100
39315
|
let readSel = null;
|
|
@@ -39126,8 +39341,12 @@ class DOMObserver {
|
|
|
39126
39341
|
if (!desc || desc.ignoreMutation(mut))
|
|
39127
39342
|
return null;
|
|
39128
39343
|
if (mut.type == "childList") {
|
|
39129
|
-
for (let i2 = 0; i2 < mut.addedNodes.length; i2++)
|
|
39130
|
-
|
|
39344
|
+
for (let i2 = 0; i2 < mut.addedNodes.length; i2++) {
|
|
39345
|
+
let node = mut.addedNodes[i2];
|
|
39346
|
+
added.push(node);
|
|
39347
|
+
if (node.nodeType == 3)
|
|
39348
|
+
this.lastChangedTextNode = node;
|
|
39349
|
+
}
|
|
39131
39350
|
if (desc.contentDOM && desc.contentDOM != desc.dom && !desc.contentDOM.contains(mut.target))
|
|
39132
39351
|
return { from: desc.posBefore, to: desc.posAfter };
|
|
39133
39352
|
let prev = mut.previousSibling, next = mut.nextSibling;
|
|
@@ -39148,6 +39367,7 @@ class DOMObserver {
|
|
|
39148
39367
|
} else if (mut.type == "attributes") {
|
|
39149
39368
|
return { from: desc.posAtStart - desc.border, to: desc.posAtEnd + desc.border };
|
|
39150
39369
|
} else {
|
|
39370
|
+
this.lastChangedTextNode = mut.target;
|
|
39151
39371
|
return {
|
|
39152
39372
|
from: desc.posAtStart,
|
|
39153
39373
|
to: desc.posAtEnd,
|
|
@@ -39174,7 +39394,20 @@ function checkCSS(view) {
|
|
|
39174
39394
|
cssCheckWarned = true;
|
|
39175
39395
|
}
|
|
39176
39396
|
}
|
|
39177
|
-
function
|
|
39397
|
+
function rangeToSelectionRange(view, range2) {
|
|
39398
|
+
let anchorNode = range2.startContainer, anchorOffset = range2.startOffset;
|
|
39399
|
+
let focusNode = range2.endContainer, focusOffset = range2.endOffset;
|
|
39400
|
+
let currentAnchor = view.domAtPos(view.state.selection.anchor);
|
|
39401
|
+
if (isEquivalentPosition(currentAnchor.node, currentAnchor.offset, focusNode, focusOffset))
|
|
39402
|
+
[anchorNode, anchorOffset, focusNode, focusOffset] = [focusNode, focusOffset, anchorNode, anchorOffset];
|
|
39403
|
+
return { anchorNode, anchorOffset, focusNode, focusOffset };
|
|
39404
|
+
}
|
|
39405
|
+
function safariShadowSelectionRange(view, selection) {
|
|
39406
|
+
if (selection.getComposedRanges) {
|
|
39407
|
+
let range2 = selection.getComposedRanges(view.root)[0];
|
|
39408
|
+
if (range2)
|
|
39409
|
+
return rangeToSelectionRange(view, range2);
|
|
39410
|
+
}
|
|
39178
39411
|
let found2;
|
|
39179
39412
|
function read2(event) {
|
|
39180
39413
|
event.preventDefault();
|
|
@@ -39184,12 +39417,15 @@ function safariShadowSelectionRange(view) {
|
|
|
39184
39417
|
view.dom.addEventListener("beforeinput", read2, true);
|
|
39185
39418
|
document.execCommand("indent");
|
|
39186
39419
|
view.dom.removeEventListener("beforeinput", read2, true);
|
|
39187
|
-
|
|
39188
|
-
|
|
39189
|
-
|
|
39190
|
-
|
|
39191
|
-
|
|
39192
|
-
|
|
39420
|
+
return found2 ? rangeToSelectionRange(view, found2) : null;
|
|
39421
|
+
}
|
|
39422
|
+
function blockParent(view, node) {
|
|
39423
|
+
for (let p2 = node.parentNode; p2 && p2 != view.dom; p2 = p2.parentNode) {
|
|
39424
|
+
let desc = view.docView.nearestDesc(p2, true);
|
|
39425
|
+
if (desc && desc.node.isBlock)
|
|
39426
|
+
return p2;
|
|
39427
|
+
}
|
|
39428
|
+
return null;
|
|
39193
39429
|
}
|
|
39194
39430
|
function parseBetween(view, from_, to_) {
|
|
39195
39431
|
let { node: parent, fromOffset, toOffset, from: from2, to: to2 } = view.docView.parseRange(from_, to_);
|
|
@@ -39309,10 +39545,6 @@ function readDOMChange(view, from2, to2, typeOver, addedNodes) {
|
|
|
39309
39545
|
return;
|
|
39310
39546
|
}
|
|
39311
39547
|
}
|
|
39312
|
-
if (chrome && view.cursorWrapper && parse2.sel && parse2.sel.anchor == view.cursorWrapper.deco.from && parse2.sel.head == parse2.sel.anchor) {
|
|
39313
|
-
let size2 = change.endB - change.start;
|
|
39314
|
-
parse2.sel = { anchor: parse2.sel.anchor + size2, head: parse2.sel.anchor + size2 };
|
|
39315
|
-
}
|
|
39316
39548
|
view.input.domChangeCount++;
|
|
39317
39549
|
if (view.state.selection.from < view.state.selection.to && change.start == change.endB && view.state.selection instanceof TextSelection) {
|
|
39318
39550
|
if (change.start > view.state.selection.from && change.start <= view.state.selection.from + 2 && view.state.selection.from >= parse2.from) {
|
|
@@ -39336,7 +39568,7 @@ function readDOMChange(view, from2, to2, typeOver, addedNodes) {
|
|
|
39336
39568
|
view.input.lastIOSEnter = 0;
|
|
39337
39569
|
return;
|
|
39338
39570
|
}
|
|
39339
|
-
if (view.state.selection.anchor > change.start &&
|
|
39571
|
+
if (view.state.selection.anchor > change.start && looksLikeBackspace(doc2, change.start, change.endA, $from, $to) && view.someProp("handleKeyDown", (f2) => f2(view, keyEvent(8, "Backspace")))) {
|
|
39340
39572
|
if (android && chrome)
|
|
39341
39573
|
view.domObserver.suppressSelectionUpdates();
|
|
39342
39574
|
return;
|
|
@@ -39420,12 +39652,18 @@ function isMarkChange(cur, prev) {
|
|
|
39420
39652
|
if (Fragment.from(updated).eq(cur))
|
|
39421
39653
|
return { mark, type: type3 };
|
|
39422
39654
|
}
|
|
39423
|
-
function
|
|
39424
|
-
if (
|
|
39425
|
-
|
|
39426
|
-
|
|
39655
|
+
function looksLikeBackspace(old, start2, end2, $newStart, $newEnd) {
|
|
39656
|
+
if (
|
|
39657
|
+
// The content must have shrunk
|
|
39658
|
+
end2 - start2 <= $newEnd.pos - $newStart.pos || // newEnd must point directly at or after the end of the block that newStart points into
|
|
39659
|
+
skipClosingAndOpening($newStart, true, false) < $newEnd.pos
|
|
39660
|
+
)
|
|
39427
39661
|
return false;
|
|
39428
39662
|
let $start = old.resolve(start2);
|
|
39663
|
+
if (!$newStart.parent.isTextblock) {
|
|
39664
|
+
let after = $start.nodeAfter;
|
|
39665
|
+
return after != null && end2 == start2 + after.nodeSize;
|
|
39666
|
+
}
|
|
39429
39667
|
if ($start.parentOffset < $start.parent.content.size || !$start.parent.isTextblock)
|
|
39430
39668
|
return false;
|
|
39431
39669
|
let $next = old.resolve(skipClosingAndOpening($start, true, true));
|
|
@@ -39614,8 +39852,10 @@ class EditorView {
|
|
|
39614
39852
|
let forceSelUpdate = updateDoc && (ie$1 || chrome) && !this.composing && !prev.selection.empty && !state2.selection.empty && selectionContextChanged(prev.selection, state2.selection);
|
|
39615
39853
|
if (updateDoc) {
|
|
39616
39854
|
let chromeKludge = chrome ? this.trackWrites = this.domSelectionRange().focusNode : null;
|
|
39855
|
+
if (this.composing)
|
|
39856
|
+
this.input.compositionNode = findCompositionNode(this);
|
|
39617
39857
|
if (redraw || !this.docView.update(state2.doc, outerDeco, innerDeco, this)) {
|
|
39618
|
-
this.docView.updateOuterDeco(
|
|
39858
|
+
this.docView.updateOuterDeco(outerDeco);
|
|
39619
39859
|
this.docView.destroy();
|
|
39620
39860
|
this.docView = docViewDesc(state2.doc, outerDeco, innerDeco, this.dom, this);
|
|
39621
39861
|
}
|
|
@@ -39874,6 +40114,7 @@ class EditorView {
|
|
|
39874
40114
|
}
|
|
39875
40115
|
this.docView.destroy();
|
|
39876
40116
|
this.docView = null;
|
|
40117
|
+
clearReusedRange();
|
|
39877
40118
|
}
|
|
39878
40119
|
/**
|
|
39879
40120
|
This is true when the view has been
|
|
@@ -39909,7 +40150,8 @@ class EditorView {
|
|
|
39909
40150
|
@internal
|
|
39910
40151
|
*/
|
|
39911
40152
|
domSelectionRange() {
|
|
39912
|
-
|
|
40153
|
+
let sel = this.domSelection();
|
|
40154
|
+
return safari && this.root.nodeType === 11 && deepActiveElement(this.dom.ownerDocument) == this.dom && safariShadowSelectionRange(this, sel) || sel;
|
|
39913
40155
|
}
|
|
39914
40156
|
/**
|
|
39915
40157
|
@internal
|
|
@@ -40900,7 +41142,8 @@ function getAttributesFromExtensions(extensions) {
|
|
|
40900
41142
|
const context = {
|
|
40901
41143
|
name: extension.name,
|
|
40902
41144
|
options: extension.options,
|
|
40903
|
-
storage: extension.storage
|
|
41145
|
+
storage: extension.storage,
|
|
41146
|
+
extensions: nodeAndMarkExtensions
|
|
40904
41147
|
};
|
|
40905
41148
|
const addGlobalAttributes = getExtensionField(extension, "addGlobalAttributes", context);
|
|
40906
41149
|
if (!addGlobalAttributes) {
|
|
@@ -41026,7 +41269,7 @@ function fromString(value) {
|
|
|
41026
41269
|
return value;
|
|
41027
41270
|
}
|
|
41028
41271
|
function injectExtensionAttributesToParseRule(parseRule, extensionAttributes) {
|
|
41029
|
-
if (parseRule
|
|
41272
|
+
if ("style" in parseRule) {
|
|
41030
41273
|
return parseRule;
|
|
41031
41274
|
}
|
|
41032
41275
|
return {
|
|
@@ -41091,6 +41334,7 @@ function getSchemaByResolvedExtensions(extensions, editor) {
|
|
|
41091
41334
|
selectable: callOrReturn(getExtensionField(extension, "selectable", context)),
|
|
41092
41335
|
draggable: callOrReturn(getExtensionField(extension, "draggable", context)),
|
|
41093
41336
|
code: callOrReturn(getExtensionField(extension, "code", context)),
|
|
41337
|
+
whitespace: callOrReturn(getExtensionField(extension, "whitespace", context)),
|
|
41094
41338
|
defining: callOrReturn(getExtensionField(extension, "defining", context)),
|
|
41095
41339
|
isolating: callOrReturn(getExtensionField(extension, "isolating", context)),
|
|
41096
41340
|
attrs: Object.fromEntries(extensionAttributes.map((extensionAttribute) => {
|
|
@@ -41646,7 +41890,7 @@ class ExtensionManager {
|
|
|
41646
41890
|
const plugins2 = [];
|
|
41647
41891
|
const addKeyboardShortcuts = getExtensionField(extension, "addKeyboardShortcuts", context);
|
|
41648
41892
|
let defaultBindings = {};
|
|
41649
|
-
if (extension.type === "mark" && extension
|
|
41893
|
+
if (extension.type === "mark" && getExtensionField(extension, "exitable", context)) {
|
|
41650
41894
|
defaultBindings.ArrowRight = () => Mark.handleExit({ editor, mark: extension });
|
|
41651
41895
|
}
|
|
41652
41896
|
if (addKeyboardShortcuts) {
|
|
@@ -41794,14 +42038,10 @@ function mergeDeep(target, source) {
|
|
|
41794
42038
|
const output = { ...target };
|
|
41795
42039
|
if (isPlainObject(target) && isPlainObject(source)) {
|
|
41796
42040
|
Object.keys(source).forEach((key) => {
|
|
41797
|
-
if (isPlainObject(source[key])) {
|
|
41798
|
-
|
|
41799
|
-
Object.assign(output, { [key]: source[key] });
|
|
41800
|
-
} else {
|
|
41801
|
-
output[key] = mergeDeep(target[key], source[key]);
|
|
41802
|
-
}
|
|
42041
|
+
if (isPlainObject(source[key]) && isPlainObject(target[key])) {
|
|
42042
|
+
output[key] = mergeDeep(target[key], source[key]);
|
|
41803
42043
|
} else {
|
|
41804
|
-
|
|
42044
|
+
output[key] = source[key];
|
|
41805
42045
|
}
|
|
41806
42046
|
});
|
|
41807
42047
|
}
|
|
@@ -41840,13 +42080,15 @@ class Extension {
|
|
|
41840
42080
|
return new Extension(config);
|
|
41841
42081
|
}
|
|
41842
42082
|
configure(options = {}) {
|
|
41843
|
-
const extension = this.extend(
|
|
42083
|
+
const extension = this.extend({
|
|
42084
|
+
...this.config,
|
|
42085
|
+
addOptions() {
|
|
42086
|
+
var _a2;
|
|
42087
|
+
return mergeDeep(((_a2 = this.parent) === null || _a2 === void 0 ? void 0 : _a2.call(this)) || {}, options);
|
|
42088
|
+
}
|
|
42089
|
+
});
|
|
42090
|
+
extension.name = this.name;
|
|
41844
42091
|
extension.parent = this.parent;
|
|
41845
|
-
extension.options = mergeDeep(this.options, options);
|
|
41846
|
-
extension.storage = callOrReturn(getExtensionField(extension, "addStorage", {
|
|
41847
|
-
name: extension.name,
|
|
41848
|
-
options: extension.options
|
|
41849
|
-
}));
|
|
41850
42092
|
return extension;
|
|
41851
42093
|
}
|
|
41852
42094
|
extend(extendedConfig = {}) {
|
|
@@ -41854,7 +42096,7 @@ class Extension {
|
|
|
41854
42096
|
extension.parent = this;
|
|
41855
42097
|
this.child = extension;
|
|
41856
42098
|
extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
|
|
41857
|
-
if (extendedConfig.defaultOptions) {
|
|
42099
|
+
if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
|
|
41858
42100
|
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
|
|
41859
42101
|
}
|
|
41860
42102
|
extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
|
|
@@ -42238,13 +42480,47 @@ function createNodeFromContent(content, schema, options) {
|
|
|
42238
42480
|
}
|
|
42239
42481
|
return schema.nodeFromJSON(content);
|
|
42240
42482
|
} catch (error) {
|
|
42483
|
+
if (options.errorOnInvalidContent) {
|
|
42484
|
+
throw new Error("[tiptap error]: Invalid JSON content", { cause: error });
|
|
42485
|
+
}
|
|
42241
42486
|
console.warn("[tiptap warn]: Invalid content.", "Passed value:", content, "Error:", error);
|
|
42242
42487
|
return createNodeFromContent("", schema, options);
|
|
42243
42488
|
}
|
|
42244
42489
|
}
|
|
42245
42490
|
if (isTextContent) {
|
|
42246
|
-
|
|
42247
|
-
|
|
42491
|
+
let schemaToUse = schema;
|
|
42492
|
+
let hasInvalidContent = false;
|
|
42493
|
+
let invalidContent = "";
|
|
42494
|
+
if (options.errorOnInvalidContent) {
|
|
42495
|
+
schemaToUse = new Schema({
|
|
42496
|
+
topNode: schema.spec.topNode,
|
|
42497
|
+
marks: schema.spec.marks,
|
|
42498
|
+
// Prosemirror's schemas are executed such that: the last to execute, matches last
|
|
42499
|
+
// 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
|
|
42500
|
+
nodes: schema.spec.nodes.append({
|
|
42501
|
+
__tiptap__private__unknown__catch__all__node: {
|
|
42502
|
+
content: "inline*",
|
|
42503
|
+
group: "block",
|
|
42504
|
+
parseDOM: [
|
|
42505
|
+
{
|
|
42506
|
+
tag: "*",
|
|
42507
|
+
getAttrs: (e) => {
|
|
42508
|
+
hasInvalidContent = true;
|
|
42509
|
+
invalidContent = typeof e === "string" ? e : e.outerHTML;
|
|
42510
|
+
return null;
|
|
42511
|
+
}
|
|
42512
|
+
}
|
|
42513
|
+
]
|
|
42514
|
+
}
|
|
42515
|
+
})
|
|
42516
|
+
});
|
|
42517
|
+
}
|
|
42518
|
+
const parser = DOMParser.fromSchema(schemaToUse);
|
|
42519
|
+
const response = options.slice ? parser.parseSlice(elementFromString(content), options.parseOptions).content : parser.parse(elementFromString(content), options.parseOptions);
|
|
42520
|
+
if (options.errorOnInvalidContent && hasInvalidContent) {
|
|
42521
|
+
throw new Error("[tiptap error]: Invalid HTML content", { cause: new Error(`Invalid element found: ${invalidContent}`) });
|
|
42522
|
+
}
|
|
42523
|
+
return response;
|
|
42248
42524
|
}
|
|
42249
42525
|
return createNodeFromContent("", schema, options);
|
|
42250
42526
|
}
|
|
@@ -42267,9 +42543,10 @@ function selectionToInsertionEnd(tr2, startLen, bias) {
|
|
|
42267
42543
|
tr2.setSelection(Selection$1.near(tr2.doc.resolve(end2), bias));
|
|
42268
42544
|
}
|
|
42269
42545
|
const isFragment = (nodeOrFragment) => {
|
|
42270
|
-
return
|
|
42546
|
+
return !("type" in nodeOrFragment);
|
|
42271
42547
|
};
|
|
42272
42548
|
const insertContentAt = (position, value, options) => ({ tr: tr2, dispatch, editor }) => {
|
|
42549
|
+
var _a2;
|
|
42273
42550
|
if (dispatch) {
|
|
42274
42551
|
options = {
|
|
42275
42552
|
parseOptions: {},
|
|
@@ -42278,14 +42555,17 @@ const insertContentAt = (position, value, options) => ({ tr: tr2, dispatch, edit
|
|
|
42278
42555
|
applyPasteRules: false,
|
|
42279
42556
|
...options
|
|
42280
42557
|
};
|
|
42281
|
-
|
|
42282
|
-
|
|
42283
|
-
|
|
42284
|
-
|
|
42285
|
-
|
|
42286
|
-
|
|
42287
|
-
|
|
42288
|
-
|
|
42558
|
+
let content;
|
|
42559
|
+
try {
|
|
42560
|
+
content = createNodeFromContent(value, editor.schema, {
|
|
42561
|
+
parseOptions: {
|
|
42562
|
+
preserveWhitespace: "full",
|
|
42563
|
+
...options.parseOptions
|
|
42564
|
+
},
|
|
42565
|
+
errorOnInvalidContent: (_a2 = options.errorOnInvalidContent) !== null && _a2 !== void 0 ? _a2 : editor.options.enableContentCheck
|
|
42566
|
+
});
|
|
42567
|
+
} catch (e) {
|
|
42568
|
+
return false;
|
|
42289
42569
|
}
|
|
42290
42570
|
let { from: from2, to: to2 } = typeof position === "number" ? { from: position, to: position } : { from: position.from, to: position.to };
|
|
42291
42571
|
let isOnlyTextContent = true;
|
|
@@ -42342,7 +42622,7 @@ const joinBackward = () => ({ state: state2, dispatch }) => {
|
|
|
42342
42622
|
const joinForward = () => ({ state: state2, dispatch }) => {
|
|
42343
42623
|
return joinForward$1(state2, dispatch);
|
|
42344
42624
|
};
|
|
42345
|
-
const joinItemBackward = () => ({
|
|
42625
|
+
const joinItemBackward = () => ({ state: state2, dispatch, tr: tr2 }) => {
|
|
42346
42626
|
try {
|
|
42347
42627
|
const point2 = joinPoint(state2.doc, state2.selection.$from.pos, -1);
|
|
42348
42628
|
if (point2 === null || point2 === void 0) {
|
|
@@ -42353,7 +42633,7 @@ const joinItemBackward = () => ({ tr: tr2, state: state2, dispatch }) => {
|
|
|
42353
42633
|
dispatch(tr2);
|
|
42354
42634
|
}
|
|
42355
42635
|
return true;
|
|
42356
|
-
} catch {
|
|
42636
|
+
} catch (e) {
|
|
42357
42637
|
return false;
|
|
42358
42638
|
}
|
|
42359
42639
|
};
|
|
@@ -42571,16 +42851,32 @@ const selectTextblockEnd = () => ({ state: state2, dispatch }) => {
|
|
|
42571
42851
|
const selectTextblockStart = () => ({ state: state2, dispatch }) => {
|
|
42572
42852
|
return selectTextblockStart$1(state2, dispatch);
|
|
42573
42853
|
};
|
|
42574
|
-
function createDocument(content, schema, parseOptions = {}) {
|
|
42575
|
-
return createNodeFromContent(content, schema, {
|
|
42854
|
+
function createDocument(content, schema, parseOptions = {}, options = {}) {
|
|
42855
|
+
return createNodeFromContent(content, schema, {
|
|
42856
|
+
slice: false,
|
|
42857
|
+
parseOptions,
|
|
42858
|
+
errorOnInvalidContent: options.errorOnInvalidContent
|
|
42859
|
+
});
|
|
42576
42860
|
}
|
|
42577
|
-
const setContent$1 = (content, emitUpdate = false, parseOptions = {}) => ({ tr: tr2,
|
|
42861
|
+
const setContent$1 = (content, emitUpdate = false, parseOptions = {}, options = {}) => ({ editor, tr: tr2, dispatch, commands: commands2 }) => {
|
|
42862
|
+
var _a2, _b;
|
|
42578
42863
|
const { doc: doc2 } = tr2;
|
|
42579
|
-
|
|
42864
|
+
if (parseOptions.preserveWhitespace !== "full") {
|
|
42865
|
+
const document2 = createDocument(content, editor.schema, parseOptions, {
|
|
42866
|
+
errorOnInvalidContent: (_a2 = options.errorOnInvalidContent) !== null && _a2 !== void 0 ? _a2 : editor.options.enableContentCheck
|
|
42867
|
+
});
|
|
42868
|
+
if (dispatch) {
|
|
42869
|
+
tr2.replaceWith(0, doc2.content.size, document2).setMeta("preventUpdate", !emitUpdate);
|
|
42870
|
+
}
|
|
42871
|
+
return true;
|
|
42872
|
+
}
|
|
42580
42873
|
if (dispatch) {
|
|
42581
|
-
tr2.
|
|
42874
|
+
tr2.setMeta("preventUpdate", !emitUpdate);
|
|
42582
42875
|
}
|
|
42583
|
-
return
|
|
42876
|
+
return commands2.insertContentAt({ from: 0, to: doc2.content.size }, content, {
|
|
42877
|
+
parseOptions,
|
|
42878
|
+
errorOnInvalidContent: (_b = options.errorOnInvalidContent) !== null && _b !== void 0 ? _b : editor.options.enableContentCheck
|
|
42879
|
+
});
|
|
42584
42880
|
};
|
|
42585
42881
|
function getMarkAttributes(state2, typeOrName) {
|
|
42586
42882
|
const type3 = getMarkType(typeOrName, state2.schema);
|
|
@@ -42783,10 +43079,11 @@ function isList(name, extensions) {
|
|
|
42783
43079
|
return group.split(" ").includes("list");
|
|
42784
43080
|
}
|
|
42785
43081
|
function isNodeEmpty(node) {
|
|
42786
|
-
|
|
42787
|
-
|
|
42788
|
-
|
|
42789
|
-
|
|
43082
|
+
const defaultContent = node.type.createAndFill();
|
|
43083
|
+
if (!defaultContent) {
|
|
43084
|
+
return false;
|
|
43085
|
+
}
|
|
43086
|
+
return node.eq(defaultContent);
|
|
42790
43087
|
}
|
|
42791
43088
|
function isNodeSelection(value) {
|
|
42792
43089
|
return value instanceof NodeSelection;
|
|
@@ -43301,14 +43598,14 @@ var commands = /* @__PURE__ */ Object.freeze({
|
|
|
43301
43598
|
forEach,
|
|
43302
43599
|
insertContent,
|
|
43303
43600
|
insertContentAt,
|
|
43304
|
-
joinUp,
|
|
43305
|
-
joinDown,
|
|
43306
43601
|
joinBackward,
|
|
43602
|
+
joinDown,
|
|
43307
43603
|
joinForward,
|
|
43308
43604
|
joinItemBackward,
|
|
43309
43605
|
joinItemForward,
|
|
43310
43606
|
joinTextblockBackward,
|
|
43311
43607
|
joinTextblockForward,
|
|
43608
|
+
joinUp,
|
|
43312
43609
|
keyboardShortcut,
|
|
43313
43610
|
lift,
|
|
43314
43611
|
liftEmptyBlock,
|
|
@@ -43505,13 +43802,16 @@ const Tabindex = Extension.create({
|
|
|
43505
43802
|
new Plugin({
|
|
43506
43803
|
key: new PluginKey("tabindex"),
|
|
43507
43804
|
props: {
|
|
43508
|
-
attributes: this.editor.isEditable ? { tabindex: "0" } : {}
|
|
43805
|
+
attributes: () => this.editor.isEditable ? { tabindex: "0" } : {}
|
|
43509
43806
|
}
|
|
43510
43807
|
})
|
|
43511
43808
|
];
|
|
43512
43809
|
}
|
|
43513
43810
|
});
|
|
43514
43811
|
class NodePos {
|
|
43812
|
+
get name() {
|
|
43813
|
+
return this.node.type.name;
|
|
43814
|
+
}
|
|
43515
43815
|
constructor(pos, editor, isBlock = false, node = null) {
|
|
43516
43816
|
this.currentNode = null;
|
|
43517
43817
|
this.actualDepth = null;
|
|
@@ -43520,9 +43820,6 @@ class NodePos {
|
|
|
43520
43820
|
this.editor = editor;
|
|
43521
43821
|
this.currentNode = node;
|
|
43522
43822
|
}
|
|
43523
|
-
get name() {
|
|
43524
|
-
return this.node.type.name;
|
|
43525
|
-
}
|
|
43526
43823
|
get node() {
|
|
43527
43824
|
return this.currentNode || this.resolvedPos.node();
|
|
43528
43825
|
}
|
|
@@ -43786,6 +44083,7 @@ let Editor$1 = class Editor2 extends EventEmitter {
|
|
|
43786
44083
|
enableInputRules: true,
|
|
43787
44084
|
enablePasteRules: true,
|
|
43788
44085
|
enableCoreExtensions: true,
|
|
44086
|
+
enableContentCheck: false,
|
|
43789
44087
|
onBeforeCreate: () => null,
|
|
43790
44088
|
onCreate: () => null,
|
|
43791
44089
|
onUpdate: () => null,
|
|
@@ -43793,7 +44091,10 @@ let Editor$1 = class Editor2 extends EventEmitter {
|
|
|
43793
44091
|
onTransaction: () => null,
|
|
43794
44092
|
onFocus: () => null,
|
|
43795
44093
|
onBlur: () => null,
|
|
43796
|
-
onDestroy: () => null
|
|
44094
|
+
onDestroy: () => null,
|
|
44095
|
+
onContentError: ({ error }) => {
|
|
44096
|
+
throw error;
|
|
44097
|
+
}
|
|
43797
44098
|
};
|
|
43798
44099
|
this.isCapturingTransaction = false;
|
|
43799
44100
|
this.capturedTransaction = null;
|
|
@@ -43803,6 +44104,7 @@ let Editor$1 = class Editor2 extends EventEmitter {
|
|
|
43803
44104
|
this.createSchema();
|
|
43804
44105
|
this.on("beforeCreate", this.options.onBeforeCreate);
|
|
43805
44106
|
this.emit("beforeCreate", { editor: this });
|
|
44107
|
+
this.on("contentError", this.options.onContentError);
|
|
43806
44108
|
this.createView();
|
|
43807
44109
|
this.injectCSS();
|
|
43808
44110
|
this.on("create", this.options.onCreate);
|
|
@@ -43956,7 +44258,23 @@ let Editor$1 = class Editor2 extends EventEmitter {
|
|
|
43956
44258
|
* Creates a ProseMirror view.
|
|
43957
44259
|
*/
|
|
43958
44260
|
createView() {
|
|
43959
|
-
|
|
44261
|
+
let doc2;
|
|
44262
|
+
try {
|
|
44263
|
+
doc2 = createDocument(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: this.options.enableContentCheck });
|
|
44264
|
+
} catch (e) {
|
|
44265
|
+
if (!(e instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(e.message)) {
|
|
44266
|
+
throw e;
|
|
44267
|
+
}
|
|
44268
|
+
this.emit("contentError", {
|
|
44269
|
+
editor: this,
|
|
44270
|
+
error: e,
|
|
44271
|
+
disableCollaboration: () => {
|
|
44272
|
+
this.options.extensions = this.options.extensions.filter((extension) => extension.name !== "collaboration");
|
|
44273
|
+
this.createExtensionManager();
|
|
44274
|
+
}
|
|
44275
|
+
});
|
|
44276
|
+
doc2 = createDocument(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: false });
|
|
44277
|
+
}
|
|
43960
44278
|
const selection = resolveFocusPosition(doc2, this.options.autofocus);
|
|
43961
44279
|
this.view = new EditorView(this.options.element, {
|
|
43962
44280
|
...this.options.editorProps,
|
|
@@ -44194,7 +44512,8 @@ function nodeInputRule(config) {
|
|
|
44194
44512
|
tr2.insertText(lastChar, start2 + match2[0].length - 1);
|
|
44195
44513
|
tr2.replaceWith(matchStart, end2, newNode);
|
|
44196
44514
|
} else if (match2[0]) {
|
|
44197
|
-
|
|
44515
|
+
const insertionStart = config.type.isInline ? start2 : start2 - 1;
|
|
44516
|
+
tr2.insert(insertionStart, config.type.create(attributes)).delete(tr2.mapping.map(start2), tr2.mapping.map(end2));
|
|
44198
44517
|
}
|
|
44199
44518
|
tr2.scrollIntoView();
|
|
44200
44519
|
}
|
|
@@ -44279,20 +44598,23 @@ class Mark {
|
|
|
44279
44598
|
return new Mark(config);
|
|
44280
44599
|
}
|
|
44281
44600
|
configure(options = {}) {
|
|
44282
|
-
const extension = this.extend(
|
|
44283
|
-
|
|
44284
|
-
|
|
44285
|
-
|
|
44286
|
-
|
|
44287
|
-
|
|
44601
|
+
const extension = this.extend({
|
|
44602
|
+
...this.config,
|
|
44603
|
+
addOptions() {
|
|
44604
|
+
var _a2;
|
|
44605
|
+
return mergeDeep(((_a2 = this.parent) === null || _a2 === void 0 ? void 0 : _a2.call(this)) || {}, options);
|
|
44606
|
+
}
|
|
44607
|
+
});
|
|
44608
|
+
extension.name = this.name;
|
|
44609
|
+
extension.parent = this.parent;
|
|
44288
44610
|
return extension;
|
|
44289
44611
|
}
|
|
44290
44612
|
extend(extendedConfig = {}) {
|
|
44291
|
-
const extension = new Mark(
|
|
44613
|
+
const extension = new Mark(extendedConfig);
|
|
44292
44614
|
extension.parent = this;
|
|
44293
44615
|
this.child = extension;
|
|
44294
44616
|
extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
|
|
44295
|
-
if (extendedConfig.defaultOptions) {
|
|
44617
|
+
if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
|
|
44296
44618
|
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
|
|
44297
44619
|
}
|
|
44298
44620
|
extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
|
|
@@ -44358,20 +44680,23 @@ let Node$2 = class Node3 {
|
|
|
44358
44680
|
return new Node3(config);
|
|
44359
44681
|
}
|
|
44360
44682
|
configure(options = {}) {
|
|
44361
|
-
const extension = this.extend(
|
|
44362
|
-
|
|
44363
|
-
|
|
44364
|
-
|
|
44365
|
-
|
|
44366
|
-
|
|
44683
|
+
const extension = this.extend({
|
|
44684
|
+
...this.config,
|
|
44685
|
+
addOptions() {
|
|
44686
|
+
var _a2;
|
|
44687
|
+
return mergeDeep(((_a2 = this.parent) === null || _a2 === void 0 ? void 0 : _a2.call(this)) || {}, options);
|
|
44688
|
+
}
|
|
44689
|
+
});
|
|
44690
|
+
extension.name = this.name;
|
|
44691
|
+
extension.parent = this.parent;
|
|
44367
44692
|
return extension;
|
|
44368
44693
|
}
|
|
44369
44694
|
extend(extendedConfig = {}) {
|
|
44370
|
-
const extension = new Node3(
|
|
44695
|
+
const extension = new Node3(extendedConfig);
|
|
44371
44696
|
extension.parent = this;
|
|
44372
44697
|
this.child = extension;
|
|
44373
44698
|
extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
|
|
44374
|
-
if (extendedConfig.defaultOptions) {
|
|
44699
|
+
if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
|
|
44375
44700
|
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
|
|
44376
44701
|
}
|
|
44377
44702
|
extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
|
|
@@ -44906,14 +45231,12 @@ const CodeBlock = Node$2.create({
|
|
|
44906
45231
|
if (!text || !language) {
|
|
44907
45232
|
return false;
|
|
44908
45233
|
}
|
|
44909
|
-
const { tr: tr2 } = view.state;
|
|
44910
|
-
|
|
44911
|
-
|
|
44912
|
-
|
|
44913
|
-
tr2.
|
|
45234
|
+
const { tr: tr2, schema } = view.state;
|
|
45235
|
+
const textNode = schema.text(text.replace(/\r\n?/g, "\n"));
|
|
45236
|
+
tr2.replaceSelectionWith(this.type.create({ language }, textNode));
|
|
45237
|
+
if (tr2.selection.$from.parent.type !== this.type) {
|
|
45238
|
+
tr2.setSelection(TextSelection.near(tr2.doc.resolve(Math.max(0, tr2.selection.from - 2))));
|
|
44914
45239
|
}
|
|
44915
|
-
tr2.setSelection(TextSelection.near(tr2.doc.resolve(Math.max(0, tr2.selection.from - 2))));
|
|
44916
|
-
tr2.insertText(text.replace(/\r\n?/g, "\n"));
|
|
44917
45240
|
tr2.setMeta("paste", true);
|
|
44918
45241
|
view.dispatch(tr2);
|
|
44919
45242
|
return true;
|
|
@@ -45829,13 +46152,13 @@ function applyTransaction(history2, state2, tr2, options) {
|
|
|
45829
46152
|
return history2;
|
|
45830
46153
|
} else if (appended && appended.getMeta(historyKey)) {
|
|
45831
46154
|
if (appended.getMeta(historyKey).redo)
|
|
45832
|
-
return new HistoryState(history2.done.addTransform(tr2, void 0, options, mustPreserveItems(state2)), history2.undone, rangesFor(tr2.mapping.maps
|
|
46155
|
+
return new HistoryState(history2.done.addTransform(tr2, void 0, options, mustPreserveItems(state2)), history2.undone, rangesFor(tr2.mapping.maps), history2.prevTime, history2.prevComposition);
|
|
45833
46156
|
else
|
|
45834
46157
|
return new HistoryState(history2.done, history2.undone.addTransform(tr2, void 0, options, mustPreserveItems(state2)), null, history2.prevTime, history2.prevComposition);
|
|
45835
46158
|
} else if (tr2.getMeta("addToHistory") !== false && !(appended && appended.getMeta("addToHistory") === false)) {
|
|
45836
46159
|
let composition = tr2.getMeta("composition");
|
|
45837
46160
|
let newGroup = history2.prevTime == 0 || !appended && history2.prevComposition != composition && (history2.prevTime < (tr2.time || 0) - options.newGroupDelay || !isAdjacentTo(tr2, history2.prevRanges));
|
|
45838
|
-
let prevRanges = appended ? mapRanges(history2.prevRanges, tr2.mapping) : rangesFor(tr2.mapping.maps
|
|
46161
|
+
let prevRanges = appended ? mapRanges(history2.prevRanges, tr2.mapping) : rangesFor(tr2.mapping.maps);
|
|
45839
46162
|
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);
|
|
45840
46163
|
} else if (rebased = tr2.getMeta("rebased")) {
|
|
45841
46164
|
return new HistoryState(history2.done.rebased(tr2, rebased), history2.undone.rebased(tr2, rebased), mapRanges(history2.prevRanges, tr2.mapping), history2.prevTime, history2.prevComposition);
|
|
@@ -45856,9 +46179,10 @@ function isAdjacentTo(transform, prevRanges) {
|
|
|
45856
46179
|
});
|
|
45857
46180
|
return adjacent;
|
|
45858
46181
|
}
|
|
45859
|
-
function rangesFor(
|
|
46182
|
+
function rangesFor(maps) {
|
|
45860
46183
|
let result2 = [];
|
|
45861
|
-
|
|
46184
|
+
for (let i2 = maps.length - 1; i2 >= 0 && result2.length == 0; i2--)
|
|
46185
|
+
maps[i2].forEach((_from, _to, from2, to2) => result2.push(from2, to2));
|
|
45862
46186
|
return result2;
|
|
45863
46187
|
}
|
|
45864
46188
|
function mapRanges(ranges, mapping) {
|
|
@@ -45872,16 +46196,16 @@ function mapRanges(ranges, mapping) {
|
|
|
45872
46196
|
}
|
|
45873
46197
|
return result2;
|
|
45874
46198
|
}
|
|
45875
|
-
function histTransaction(history2, state2,
|
|
46199
|
+
function histTransaction(history2, state2, redo2) {
|
|
45876
46200
|
let preserveItems = mustPreserveItems(state2);
|
|
45877
46201
|
let histOptions = historyKey.get(state2).spec.config;
|
|
45878
46202
|
let pop = (redo2 ? history2.undone : history2.done).popEvent(state2, preserveItems);
|
|
45879
46203
|
if (!pop)
|
|
45880
|
-
return;
|
|
46204
|
+
return null;
|
|
45881
46205
|
let selection = pop.selection.resolve(pop.transform.doc);
|
|
45882
46206
|
let added = (redo2 ? history2.done : history2.undone).addTransform(pop.transform, state2.selection.getBookmark(), histOptions, preserveItems);
|
|
45883
46207
|
let newHist = new HistoryState(redo2 ? added : pop.remaining, redo2 ? pop.remaining : added, null, 0, -1);
|
|
45884
|
-
|
|
46208
|
+
return pop.transform.setSelection(selection).setMeta(historyKey, { redo: redo2, historyState: newHist });
|
|
45885
46209
|
}
|
|
45886
46210
|
let cachedPreserveItems = false, cachedPreserveItemsPlugins = null;
|
|
45887
46211
|
function mustPreserveItems(state2) {
|
|
@@ -45929,22 +46253,21 @@ function history(config = {}) {
|
|
|
45929
46253
|
}
|
|
45930
46254
|
});
|
|
45931
46255
|
}
|
|
45932
|
-
|
|
45933
|
-
|
|
45934
|
-
|
|
45935
|
-
|
|
45936
|
-
|
|
45937
|
-
|
|
45938
|
-
|
|
45939
|
-
|
|
45940
|
-
|
|
45941
|
-
|
|
45942
|
-
|
|
45943
|
-
|
|
45944
|
-
|
|
45945
|
-
|
|
45946
|
-
|
|
45947
|
-
};
|
|
46256
|
+
function buildCommand(redo2, scroll) {
|
|
46257
|
+
return (state2, dispatch) => {
|
|
46258
|
+
let hist = historyKey.getState(state2);
|
|
46259
|
+
if (!hist || (redo2 ? hist.undone : hist.done).eventCount == 0)
|
|
46260
|
+
return false;
|
|
46261
|
+
if (dispatch) {
|
|
46262
|
+
let tr2 = histTransaction(hist, state2, redo2);
|
|
46263
|
+
if (tr2)
|
|
46264
|
+
dispatch(scroll ? tr2.scrollIntoView() : tr2);
|
|
46265
|
+
}
|
|
46266
|
+
return true;
|
|
46267
|
+
};
|
|
46268
|
+
}
|
|
46269
|
+
const undo = buildCommand(false, true);
|
|
46270
|
+
const redo = buildCommand(true, true);
|
|
45948
46271
|
const History = Extension.create({
|
|
45949
46272
|
name: "history",
|
|
45950
46273
|
addOptions() {
|
|
@@ -45996,10 +46319,20 @@ const HorizontalRule = Node$2.create({
|
|
|
45996
46319
|
addCommands() {
|
|
45997
46320
|
return {
|
|
45998
46321
|
setHorizontalRule: () => ({ chain, state: state2 }) => {
|
|
45999
|
-
const {
|
|
46322
|
+
const { selection } = state2;
|
|
46323
|
+
const { $from: $originFrom, $to: $originTo } = selection;
|
|
46000
46324
|
const currentChain = chain();
|
|
46001
|
-
if ($
|
|
46002
|
-
currentChain.insertContentAt(
|
|
46325
|
+
if ($originFrom.parentOffset === 0) {
|
|
46326
|
+
currentChain.insertContentAt({
|
|
46327
|
+
from: Math.max($originFrom.pos - 1, 0),
|
|
46328
|
+
to: $originTo.pos
|
|
46329
|
+
}, {
|
|
46330
|
+
type: this.name
|
|
46331
|
+
});
|
|
46332
|
+
} else if (isNodeSelection(selection)) {
|
|
46333
|
+
currentChain.insertContentAt($originTo.pos, {
|
|
46334
|
+
type: this.name
|
|
46335
|
+
});
|
|
46003
46336
|
} else {
|
|
46004
46337
|
currentChain.insertContent({ type: this.name });
|
|
46005
46338
|
}
|
|
@@ -46385,11 +46718,11 @@ const StarterKit = Extension.create({
|
|
|
46385
46718
|
addExtensions() {
|
|
46386
46719
|
var _a2, _b, _c, _d, _e2, _f, _g, _h, _j, _k, _l2, _m, _o, _p, _q, _r2, _s, _t2;
|
|
46387
46720
|
const extensions = [];
|
|
46388
|
-
if (this.options.blockquote !== false) {
|
|
46389
|
-
extensions.push(Blockquote.configure((_a2 = this.options) === null || _a2 === void 0 ? void 0 : _a2.blockquote));
|
|
46390
|
-
}
|
|
46391
46721
|
if (this.options.bold !== false) {
|
|
46392
|
-
extensions.push(Bold.configure((
|
|
46722
|
+
extensions.push(Bold.configure((_a2 = this.options) === null || _a2 === void 0 ? void 0 : _a2.bold));
|
|
46723
|
+
}
|
|
46724
|
+
if (this.options.blockquote !== false) {
|
|
46725
|
+
extensions.push(Blockquote.configure((_b = this.options) === null || _b === void 0 ? void 0 : _b.blockquote));
|
|
46393
46726
|
}
|
|
46394
46727
|
if (this.options.bulletList !== false) {
|
|
46395
46728
|
extensions.push(BulletList.configure((_c = this.options) === null || _c === void 0 ? void 0 : _c.bulletList));
|
|
@@ -49196,7 +49529,7 @@ class BubbleMenuView {
|
|
|
49196
49529
|
}
|
|
49197
49530
|
update(view, oldState) {
|
|
49198
49531
|
const { state: state2 } = view;
|
|
49199
|
-
const hasValidSelection = state2.selection
|
|
49532
|
+
const hasValidSelection = state2.selection.from !== state2.selection.to;
|
|
49200
49533
|
if (this.updateDelay > 0 && hasValidSelection) {
|
|
49201
49534
|
this.handleDebouncedUpdate(view, oldState);
|
|
49202
49535
|
return;
|
|
@@ -52348,7 +52681,7 @@ const Table = Node$2.create({
|
|
|
52348
52681
|
insertTable: ({ rows = 3, cols = 3, withHeaderRow = true } = {}) => ({ tr: tr2, dispatch, editor }) => {
|
|
52349
52682
|
const node = createTable$1(editor.schema, rows, cols, withHeaderRow);
|
|
52350
52683
|
if (dispatch) {
|
|
52351
|
-
const offset2 = tr2.selection.
|
|
52684
|
+
const offset2 = tr2.selection.from + 1;
|
|
52352
52685
|
tr2.replaceSelectionWith(node).scrollIntoView().setSelection(TextSelection.near(tr2.doc.resolve(offset2)));
|
|
52353
52686
|
}
|
|
52354
52687
|
return true;
|