@bagelink/vue 0.0.568 → 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/form/inputs/FileUpload.vue.d.ts +2 -2
- package/dist/components/form/inputs/FileUpload.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 +655 -318
- package/dist/index.mjs +655 -318
- 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 +20 -21
- package/src/components/form/inputs/SelectInput.vue +42 -25
package/dist/index.mjs
CHANGED
|
@@ -5410,7 +5410,7 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
|
|
|
5410
5410
|
return (_ctx, _cache) => {
|
|
5411
5411
|
return openBlock(), createElementBlock("span", {
|
|
5412
5412
|
class: "bgl_icon-font",
|
|
5413
|
-
style: normalizeStyle({ fontSize: `${_ctx.size}rem`, color: _ctx.color, "font-variation-settings": `'wght' ${_ctx.weight || 400}` })
|
|
5413
|
+
style: normalizeStyle({ "fontSize": `${_ctx.size}rem`, color: _ctx.color, "font-variation-settings": `'wght' ${_ctx.weight || 400}` })
|
|
5414
5414
|
}, toDisplayString(_ctx.icon || _ctx.name), 5);
|
|
5415
5415
|
};
|
|
5416
5416
|
}
|
|
@@ -5419,8 +5419,8 @@ const _hoisted_1$J = { class: "full-nav" };
|
|
|
5419
5419
|
const _hoisted_2$A = { class: "nav-scroll" };
|
|
5420
5420
|
const _hoisted_3$n = { class: "nav-links-wrapper" };
|
|
5421
5421
|
const _hoisted_4$f = { class: "tooltip" };
|
|
5422
|
-
const _hoisted_5$
|
|
5423
|
-
const _hoisted_6$
|
|
5422
|
+
const _hoisted_5$e = { class: "bot-buttons-wrapper" };
|
|
5423
|
+
const _hoisted_6$9 = { class: "tooltip" };
|
|
5424
5424
|
const _sfc_main$N = /* @__PURE__ */ defineComponent({
|
|
5425
5425
|
__name: "NavBar",
|
|
5426
5426
|
props: {
|
|
@@ -5474,7 +5474,7 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
|
|
|
5474
5474
|
}), 128))
|
|
5475
5475
|
])
|
|
5476
5476
|
]),
|
|
5477
|
-
createElementVNode("div", _hoisted_5$
|
|
5477
|
+
createElementVNode("div", _hoisted_5$e, [
|
|
5478
5478
|
(openBlock(true), createElementBlock(Fragment$1, null, renderList(_ctx.footerLinks, (link) => {
|
|
5479
5479
|
return openBlock(), createBlock(resolveDynamicComponent(link.to ? "router-link" : "div"), {
|
|
5480
5480
|
key: link.label,
|
|
@@ -5489,7 +5489,7 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
|
|
|
5489
5489
|
createVNode(unref(_sfc_main$O), {
|
|
5490
5490
|
icon: link.icon
|
|
5491
5491
|
}, null, 8, ["icon"]),
|
|
5492
|
-
createElementVNode("div", _hoisted_6$
|
|
5492
|
+
createElementVNode("div", _hoisted_6$9, toDisplayString(link.label), 1)
|
|
5493
5493
|
]),
|
|
5494
5494
|
_: 2
|
|
5495
5495
|
}, 1032, ["to", "onClick"]);
|
|
@@ -6333,9 +6333,9 @@ const _hoisted_3$j = [
|
|
|
6333
6333
|
_hoisted_2$t
|
|
6334
6334
|
];
|
|
6335
6335
|
const _hoisted_4$d = { class: "infinite-wrapper" };
|
|
6336
|
-
const _hoisted_5$
|
|
6337
|
-
const _hoisted_6$
|
|
6338
|
-
const _hoisted_7$
|
|
6336
|
+
const _hoisted_5$d = { class: "row first-row" };
|
|
6337
|
+
const _hoisted_6$8 = { key: 0 };
|
|
6338
|
+
const _hoisted_7$3 = ["onClick"];
|
|
6339
6339
|
const _hoisted_8$1 = { class: "flex" };
|
|
6340
6340
|
const _hoisted_9$1 = ["onClick"];
|
|
6341
6341
|
const _hoisted_10$1 = { key: 0 };
|
|
@@ -6478,8 +6478,8 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
|
6478
6478
|
}), [
|
|
6479
6479
|
loading.value ? (openBlock(), createElementBlock("div", _hoisted_1$C, _hoisted_3$j)) : (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 1 }, unref(wrapperProps))), [
|
|
6480
6480
|
createElementVNode("table", _hoisted_4$d, [
|
|
6481
|
-
createElementVNode("thead", _hoisted_5$
|
|
6482
|
-
unref(isSelectable) ? (openBlock(), createElementBlock("th", _hoisted_6$
|
|
6481
|
+
createElementVNode("thead", _hoisted_5$d, [
|
|
6482
|
+
unref(isSelectable) ? (openBlock(), createElementBlock("th", _hoisted_6$8, [
|
|
6483
6483
|
createElementVNode("input", {
|
|
6484
6484
|
ref_key: "allSelector",
|
|
6485
6485
|
ref: allSelector,
|
|
@@ -6506,7 +6506,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
|
6506
6506
|
}, null, 8, ["class"])
|
|
6507
6507
|
], 2)
|
|
6508
6508
|
])
|
|
6509
|
-
], 8, _hoisted_7$
|
|
6509
|
+
], 8, _hoisted_7$3);
|
|
6510
6510
|
}), 128))
|
|
6511
6511
|
]),
|
|
6512
6512
|
createElementVNode("tbody", null, [
|
|
@@ -6600,8 +6600,8 @@ const _hoisted_2$s = {
|
|
|
6600
6600
|
};
|
|
6601
6601
|
const _hoisted_3$i = { class: "key" };
|
|
6602
6602
|
const _hoisted_4$c = { key: 1 };
|
|
6603
|
-
const _hoisted_5$
|
|
6604
|
-
const _hoisted_6$
|
|
6603
|
+
const _hoisted_5$c = { class: "key" };
|
|
6604
|
+
const _hoisted_6$7 = { class: "vlue" };
|
|
6605
6605
|
const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
6606
6606
|
__name: "DataPreview",
|
|
6607
6607
|
props: /* @__PURE__ */ mergeModels({
|
|
@@ -6651,8 +6651,8 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
6651
6651
|
key: id,
|
|
6652
6652
|
class: "data-row"
|
|
6653
6653
|
}, [
|
|
6654
|
-
createElementVNode("div", _hoisted_5$
|
|
6655
|
-
createElementVNode("div", _hoisted_6$
|
|
6654
|
+
createElementVNode("div", _hoisted_5$c, toDisplayString(label), 1),
|
|
6655
|
+
createElementVNode("div", _hoisted_6$7, toDisplayString(itemData.value[id ?? ""]), 1)
|
|
6656
6656
|
]);
|
|
6657
6657
|
}), 128))
|
|
6658
6658
|
])) : createCommentVNode("", true),
|
|
@@ -25605,10 +25605,16 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
25605
25605
|
}
|
|
25606
25606
|
});
|
|
25607
25607
|
const JSONInput = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__scopeId", "data-v-1cbaeab2"]]);
|
|
25608
|
-
const _hoisted_1$q =
|
|
25609
|
-
const _hoisted_2$k =
|
|
25610
|
-
const _hoisted_3$f =
|
|
25611
|
-
const _hoisted_4$b =
|
|
25608
|
+
const _hoisted_1$q = { class: "flex gap-05" };
|
|
25609
|
+
const _hoisted_2$k = ["disabled"];
|
|
25610
|
+
const _hoisted_3$f = { key: 1 };
|
|
25611
|
+
const _hoisted_4$b = {
|
|
25612
|
+
key: 2,
|
|
25613
|
+
class: "ms-auto ps-05 me-05"
|
|
25614
|
+
};
|
|
25615
|
+
const _hoisted_5$b = ["value"];
|
|
25616
|
+
const _hoisted_6$6 = { class: "selectinput-options" };
|
|
25617
|
+
const _hoisted_7$2 = ["onClick"];
|
|
25612
25618
|
const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
25613
25619
|
__name: "SelectInput",
|
|
25614
25620
|
props: {
|
|
@@ -25623,7 +25629,8 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
25623
25629
|
multiselect: { type: Boolean },
|
|
25624
25630
|
icon: {},
|
|
25625
25631
|
hideLabel: { type: Boolean },
|
|
25626
|
-
defaultValue: {}
|
|
25632
|
+
defaultValue: {},
|
|
25633
|
+
clearable: { type: Boolean }
|
|
25627
25634
|
},
|
|
25628
25635
|
emits: ["update:modelValue"],
|
|
25629
25636
|
setup(__props, { emit: __emit }) {
|
|
@@ -25631,6 +25638,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
25631
25638
|
const emit2 = __emit;
|
|
25632
25639
|
const searchInput = ref(null);
|
|
25633
25640
|
let selectedItems = ref([]);
|
|
25641
|
+
const selectedItemCount = computed(() => selectedItems.value.length ?? 0);
|
|
25634
25642
|
let search = ref("");
|
|
25635
25643
|
const dropdown = ref(null);
|
|
25636
25644
|
let open = ref(false);
|
|
@@ -25653,10 +25661,10 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
25653
25661
|
}
|
|
25654
25662
|
}
|
|
25655
25663
|
const selectedLabel = computed(() => {
|
|
25656
|
-
if (
|
|
25657
|
-
if (
|
|
25664
|
+
if (selectedItemCount.value === 0) return props2.placeholder || "Select";
|
|
25665
|
+
if (selectedItemCount.value > 4) {
|
|
25658
25666
|
const str = selectedItems.value.slice(0, 4).map((item) => getLabel(item)).join(", ");
|
|
25659
|
-
return `${str}... +${
|
|
25667
|
+
return `${str}... +${selectedItemCount.value - 4}`;
|
|
25660
25668
|
}
|
|
25661
25669
|
return selectedItems.value.map((item) => getLabel(item)).join(", ");
|
|
25662
25670
|
});
|
|
@@ -25689,7 +25697,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
25689
25697
|
current.push(option2);
|
|
25690
25698
|
selectedItems.value = current;
|
|
25691
25699
|
} else {
|
|
25692
|
-
selectedItems.value.splice(0,
|
|
25700
|
+
selectedItems.value.splice(0, selectedItemCount.value, option2);
|
|
25693
25701
|
}
|
|
25694
25702
|
if (!props2.multiselect) (_a2 = dropdown.value) == null ? void 0 : _a2.hide();
|
|
25695
25703
|
emitUpdate();
|
|
@@ -25717,7 +25725,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
25717
25725
|
} else {
|
|
25718
25726
|
const isSame = compareArrays([newVal].flat(), selectedItems.value);
|
|
25719
25727
|
if (!isSame) {
|
|
25720
|
-
selectedItems.value.splice(0,
|
|
25728
|
+
selectedItems.value.splice(0, selectedItemCount.value, ...[newVal].flat());
|
|
25721
25729
|
}
|
|
25722
25730
|
}
|
|
25723
25731
|
},
|
|
@@ -25751,13 +25759,13 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
25751
25759
|
ref: dropdown,
|
|
25752
25760
|
placement: "bottom-start",
|
|
25753
25761
|
class: "bagel-input selectinput",
|
|
25754
|
-
onClick: _cache[
|
|
25762
|
+
onClick: _cache[4] || (_cache[4] = withModifiers(() => {
|
|
25755
25763
|
}, ["stop"])),
|
|
25756
|
-
onHide: _cache[
|
|
25764
|
+
onHide: _cache[5] || (_cache[5] = ($event) => updateOpen(false))
|
|
25757
25765
|
}, {
|
|
25758
25766
|
popper: withCtx(() => [
|
|
25759
25767
|
createVNode(unref(_sfc_main$B), {
|
|
25760
|
-
class: "
|
|
25768
|
+
class: "p-05",
|
|
25761
25769
|
style: normalizeStyle({ width: _ctx.fullWidth ? "100%" : "auto" })
|
|
25762
25770
|
}, {
|
|
25763
25771
|
default: withCtx(() => [
|
|
@@ -25766,62 +25774,72 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
25766
25774
|
ref_key: "searchInput",
|
|
25767
25775
|
ref: searchInput,
|
|
25768
25776
|
modelValue: unref(search),
|
|
25769
|
-
"onUpdate:modelValue": _cache[
|
|
25777
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => isRef(search) ? search.value = $event : search = $event),
|
|
25770
25778
|
dense: "",
|
|
25771
25779
|
placeholder: "Search",
|
|
25772
25780
|
icon: "search"
|
|
25773
25781
|
}, null, 8, ["modelValue"])) : createCommentVNode("", true),
|
|
25774
|
-
(
|
|
25775
|
-
|
|
25776
|
-
|
|
25777
|
-
|
|
25778
|
-
|
|
25779
|
-
|
|
25780
|
-
|
|
25781
|
-
|
|
25782
|
-
|
|
25783
|
-
|
|
25784
|
-
|
|
25785
|
-
|
|
25786
|
-
|
|
25787
|
-
|
|
25788
|
-
|
|
25789
|
-
|
|
25790
|
-
|
|
25791
|
-
|
|
25782
|
+
createElementVNode("div", _hoisted_6$6, [
|
|
25783
|
+
(openBlock(true), createElementBlock(Fragment$1, null, renderList(filteredOptions.value, (option2, i2) => {
|
|
25784
|
+
return openBlock(), createElementBlock("div", {
|
|
25785
|
+
key: `${option2}${i2}`,
|
|
25786
|
+
class: normalizeClass(["selectinput-option hover gap-1", { selected: isSelected(option2) }]),
|
|
25787
|
+
onClick: ($event) => select2(option2)
|
|
25788
|
+
}, [
|
|
25789
|
+
isSelected(option2) ? (openBlock(), createBlock(unref(_sfc_main$O), {
|
|
25790
|
+
key: 0,
|
|
25791
|
+
icon: "check"
|
|
25792
|
+
})) : createCommentVNode("", true),
|
|
25793
|
+
!isSelected(option2) ? (openBlock(), createBlock(unref(_sfc_main$O), {
|
|
25794
|
+
key: 1,
|
|
25795
|
+
class: "opacity-3",
|
|
25796
|
+
icon: "fiber_manual_record"
|
|
25797
|
+
})) : createCommentVNode("", true),
|
|
25798
|
+
createElementVNode("span", null, toDisplayString(getLabel(option2)), 1)
|
|
25799
|
+
], 10, _hoisted_7$2);
|
|
25800
|
+
}), 128))
|
|
25801
|
+
]),
|
|
25792
25802
|
renderSlot(_ctx.$slots, "last", {}, void 0, true)
|
|
25793
25803
|
]),
|
|
25794
25804
|
_: 3
|
|
25795
25805
|
}, 8, ["style"])
|
|
25796
25806
|
]),
|
|
25797
25807
|
default: withCtx(() => [
|
|
25798
|
-
createElementVNode("label",
|
|
25808
|
+
createElementVNode("label", _hoisted_1$q, [
|
|
25799
25809
|
createTextVNode(toDisplayString(_ctx.label) + " ", 1),
|
|
25800
25810
|
createElementVNode("button", {
|
|
25801
25811
|
disabled: _ctx.disabled,
|
|
25802
25812
|
type: "button",
|
|
25803
|
-
class: normalizeClass(["selectinput-btn", { isEmpty:
|
|
25813
|
+
class: normalizeClass(["selectinput-btn", { isEmpty: selectedItemCount.value === 0 }]),
|
|
25804
25814
|
onKeydown: openOptions,
|
|
25805
|
-
onClick: _cache[
|
|
25815
|
+
onClick: _cache[1] || (_cache[1] = ($event) => updateOpen(true))
|
|
25806
25816
|
}, [
|
|
25807
25817
|
_ctx.icon ? (openBlock(), createBlock(unref(_sfc_main$O), {
|
|
25808
25818
|
key: 0,
|
|
25809
25819
|
icon: _ctx.icon
|
|
25810
25820
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
25811
|
-
!_ctx.hideLabel ? (openBlock(), createElementBlock("p",
|
|
25821
|
+
!_ctx.hideLabel ? (openBlock(), createElementBlock("p", _hoisted_3$f, toDisplayString(selectedLabel.value), 1)) : createCommentVNode("", true),
|
|
25822
|
+
_ctx.clearable ? (openBlock(), createElementBlock("div", _hoisted_4$b, [
|
|
25823
|
+
createVNode(unref(Btn), {
|
|
25824
|
+
thin: "",
|
|
25825
|
+
icon: "clear",
|
|
25826
|
+
class: "color-black bg-gray-light",
|
|
25827
|
+
onClick: _cache[0] || (_cache[0] = ($event) => isRef(selectedItems) ? selectedItems.value = [] : selectedItems = [])
|
|
25828
|
+
})
|
|
25829
|
+
])) : createCommentVNode("", true),
|
|
25812
25830
|
!_ctx.disabled ? (openBlock(), createBlock(unref(_sfc_main$O), mergeProps({
|
|
25813
|
-
key:
|
|
25831
|
+
key: 3,
|
|
25814
25832
|
thin: ""
|
|
25815
25833
|
}, { icon: unref(open) ? "unfold_less" : "unfold_more" }), null, 16)) : createCommentVNode("", true)
|
|
25816
|
-
], 42,
|
|
25834
|
+
], 42, _hoisted_2$k),
|
|
25817
25835
|
_ctx.required ? (openBlock(), createElementBlock("input", {
|
|
25818
25836
|
key: 0,
|
|
25819
25837
|
tabindex: "-1",
|
|
25820
25838
|
style: { "width": "0", "height": "0", "position": "absolute", "opacity": "0", "z-index": "-1" },
|
|
25821
25839
|
value: unref(selectedItems),
|
|
25822
25840
|
required: "",
|
|
25823
|
-
onInput: _cache[
|
|
25824
|
-
}, null, 40,
|
|
25841
|
+
onInput: _cache[2] || (_cache[2] = ($event) => updateOpen(true))
|
|
25842
|
+
}, null, 40, _hoisted_5$b)) : createCommentVNode("", true)
|
|
25825
25843
|
])
|
|
25826
25844
|
]),
|
|
25827
25845
|
_: 3
|
|
@@ -25829,7 +25847,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
25829
25847
|
};
|
|
25830
25848
|
}
|
|
25831
25849
|
});
|
|
25832
|
-
const SelectInput = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__scopeId", "data-v-
|
|
25850
|
+
const SelectInput = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__scopeId", "data-v-c5344871"]]);
|
|
25833
25851
|
/*!
|
|
25834
25852
|
* vue-draggable-next v2.2.0
|
|
25835
25853
|
* (c) 2023 Anish George
|
|
@@ -28816,7 +28834,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
28816
28834
|
}
|
|
28817
28835
|
});
|
|
28818
28836
|
const RadioPillsInput = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-681173be"]]);
|
|
28819
|
-
const _withScopeId$2 = (n2) => (pushScopeId("data-v-
|
|
28837
|
+
const _withScopeId$2 = (n2) => (pushScopeId("data-v-853e75be"), n2 = n2(), popScopeId(), n2);
|
|
28820
28838
|
const _hoisted_1$j = { class: "bagel-input" };
|
|
28821
28839
|
const _hoisted_2$e = {
|
|
28822
28840
|
key: 0,
|
|
@@ -28848,20 +28866,25 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
28848
28866
|
label: {},
|
|
28849
28867
|
multiple: { type: Boolean },
|
|
28850
28868
|
files: {},
|
|
28851
|
-
deleteEndpoint: {},
|
|
28852
28869
|
bindkey: {},
|
|
28853
28870
|
modelValue: {},
|
|
28854
|
-
width: {}
|
|
28871
|
+
width: {},
|
|
28872
|
+
topic: {}
|
|
28855
28873
|
},
|
|
28856
28874
|
emits: ["update:modelValue"],
|
|
28857
28875
|
setup(__props, { emit: __emit }) {
|
|
28858
28876
|
const props2 = __props;
|
|
28877
|
+
const emit2 = __emit;
|
|
28859
28878
|
const bagel = useBagel();
|
|
28860
28879
|
const bindKey2 = props2.bindkey || "id";
|
|
28861
|
-
const emit2 = __emit;
|
|
28862
28880
|
let file_bindkeys = ref(props2.modelValue || []);
|
|
28863
28881
|
const storageFiles = ref([]);
|
|
28882
|
+
async function fetchFiles() {
|
|
28883
|
+
const files = await bagel.get(`/files?topic=${props2.topic}`);
|
|
28884
|
+
storageFiles.value.push(...files);
|
|
28885
|
+
}
|
|
28864
28886
|
onMounted(() => {
|
|
28887
|
+
if (props2.topic) fetchFiles();
|
|
28865
28888
|
if (!props2.files && [file_bindkeys.value].flat().length) {
|
|
28866
28889
|
const ids = [file_bindkeys.value].flat().filter(Boolean);
|
|
28867
28890
|
if (!ids.length) return;
|
|
@@ -28913,9 +28936,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
28913
28936
|
function removeFile(file) {
|
|
28914
28937
|
const index2 = storageFiles.value.indexOf(file);
|
|
28915
28938
|
storageFiles.value.splice(index2, 1);
|
|
28916
|
-
|
|
28917
|
-
void bagel.delete(`${props2.deleteEndpoint}/${file.id}`);
|
|
28918
|
-
}
|
|
28939
|
+
void bagel.delete(`/static_files/${file.id}`);
|
|
28919
28940
|
updateModelValue();
|
|
28920
28941
|
}
|
|
28921
28942
|
async function flushQueue() {
|
|
@@ -28923,7 +28944,8 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
28923
28944
|
file.uploading = true;
|
|
28924
28945
|
if (!props2.multiple) storageFiles.value.splice(0, 1);
|
|
28925
28946
|
const serverFile = await bagel.uploadFile(file.file, {
|
|
28926
|
-
onUploadProgress: (e) => file.progress = e.progress * 100 - 1
|
|
28947
|
+
onUploadProgress: (e) => file.progress = e.progress * 100 - 1,
|
|
28948
|
+
topic: props2.topic
|
|
28927
28949
|
});
|
|
28928
28950
|
storageFiles.value.push(serverFile);
|
|
28929
28951
|
const i2 = fileQueue.value.indexOf(file);
|
|
@@ -29056,7 +29078,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
29056
29078
|
};
|
|
29057
29079
|
}
|
|
29058
29080
|
});
|
|
29059
|
-
const $el = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-
|
|
29081
|
+
const $el = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-853e75be"]]);
|
|
29060
29082
|
const _withScopeId$1 = (n2) => (pushScopeId("data-v-eceeebfb"), n2 = n2(), popScopeId(), n2);
|
|
29061
29083
|
const _hoisted_1$i = ["title"];
|
|
29062
29084
|
const _hoisted_2$d = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ createElementVNode("span", { class: "slider round" }, null, -1));
|
|
@@ -29489,7 +29511,7 @@ class Fragment {
|
|
|
29489
29511
|
/**
|
|
29490
29512
|
Find the index and inner offset corresponding to a given relative
|
|
29491
29513
|
position in this fragment. The result object will be reused
|
|
29492
|
-
(overwritten) the next time the function is called.
|
|
29514
|
+
(overwritten) the next time the function is called. @internal
|
|
29493
29515
|
*/
|
|
29494
29516
|
findIndex(pos, round2 = -1) {
|
|
29495
29517
|
if (pos == 0)
|
|
@@ -29695,7 +29717,9 @@ let Mark$1 = class Mark2 {
|
|
|
29695
29717
|
let type3 = schema.marks[json.type];
|
|
29696
29718
|
if (!type3)
|
|
29697
29719
|
throw new RangeError(`There is no mark type ${json.type} in this schema`);
|
|
29698
|
-
|
|
29720
|
+
let mark = type3.create(json.attrs);
|
|
29721
|
+
type3.checkAttrs(mark.attrs);
|
|
29722
|
+
return mark;
|
|
29699
29723
|
}
|
|
29700
29724
|
/**
|
|
29701
29725
|
Test whether two sets of marks are identical.
|
|
@@ -30192,17 +30216,28 @@ class ResolvedPos {
|
|
|
30192
30216
|
@internal
|
|
30193
30217
|
*/
|
|
30194
30218
|
static resolveCached(doc2, pos) {
|
|
30195
|
-
|
|
30196
|
-
|
|
30197
|
-
|
|
30198
|
-
|
|
30219
|
+
let cache = resolveCache.get(doc2);
|
|
30220
|
+
if (cache) {
|
|
30221
|
+
for (let i2 = 0; i2 < cache.elts.length; i2++) {
|
|
30222
|
+
let elt = cache.elts[i2];
|
|
30223
|
+
if (elt.pos == pos)
|
|
30224
|
+
return elt;
|
|
30225
|
+
}
|
|
30226
|
+
} else {
|
|
30227
|
+
resolveCache.set(doc2, cache = new ResolveCache());
|
|
30199
30228
|
}
|
|
30200
|
-
let result2 =
|
|
30201
|
-
|
|
30229
|
+
let result2 = cache.elts[cache.i] = ResolvedPos.resolve(doc2, pos);
|
|
30230
|
+
cache.i = (cache.i + 1) % resolveCacheSize;
|
|
30202
30231
|
return result2;
|
|
30203
30232
|
}
|
|
30204
30233
|
}
|
|
30205
|
-
|
|
30234
|
+
class ResolveCache {
|
|
30235
|
+
constructor() {
|
|
30236
|
+
this.elts = [];
|
|
30237
|
+
this.i = 0;
|
|
30238
|
+
}
|
|
30239
|
+
}
|
|
30240
|
+
const resolveCacheSize = 12, resolveCache = /* @__PURE__ */ new WeakMap();
|
|
30206
30241
|
class NodeRange {
|
|
30207
30242
|
/**
|
|
30208
30243
|
Construct a node range. `$from` and `$to` should point into the
|
|
@@ -30588,13 +30623,17 @@ let Node$3 = class Node2 {
|
|
|
30588
30623
|
}
|
|
30589
30624
|
/**
|
|
30590
30625
|
Check whether this node and its descendants conform to the
|
|
30591
|
-
schema, and raise
|
|
30626
|
+
schema, and raise an exception when they do not.
|
|
30592
30627
|
*/
|
|
30593
30628
|
check() {
|
|
30594
30629
|
this.type.checkContent(this.content);
|
|
30630
|
+
this.type.checkAttrs(this.attrs);
|
|
30595
30631
|
let copy2 = Mark$1.none;
|
|
30596
|
-
for (let i2 = 0; i2 < this.marks.length; i2++)
|
|
30597
|
-
|
|
30632
|
+
for (let i2 = 0; i2 < this.marks.length; i2++) {
|
|
30633
|
+
let mark = this.marks[i2];
|
|
30634
|
+
mark.type.checkAttrs(mark.attrs);
|
|
30635
|
+
copy2 = mark.addToSet(copy2);
|
|
30636
|
+
}
|
|
30598
30637
|
if (!Mark$1.sameSet(copy2, this.marks))
|
|
30599
30638
|
throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((m2) => m2.type.name)}`);
|
|
30600
30639
|
this.content.forEach((node) => node.check());
|
|
@@ -30620,7 +30659,7 @@ let Node$3 = class Node2 {
|
|
|
30620
30659
|
static fromJSON(schema, json) {
|
|
30621
30660
|
if (!json)
|
|
30622
30661
|
throw new RangeError("Invalid input for Node.fromJSON");
|
|
30623
|
-
let marks =
|
|
30662
|
+
let marks = void 0;
|
|
30624
30663
|
if (json.marks) {
|
|
30625
30664
|
if (!Array.isArray(json.marks))
|
|
30626
30665
|
throw new RangeError("Invalid mark data for Node.fromJSON");
|
|
@@ -30632,7 +30671,9 @@ let Node$3 = class Node2 {
|
|
|
30632
30671
|
return schema.text(json.text, marks);
|
|
30633
30672
|
}
|
|
30634
30673
|
let content = Fragment.fromJSON(schema, json.content);
|
|
30635
|
-
|
|
30674
|
+
let node = schema.nodeType(json.type).create(json.attrs, content, marks);
|
|
30675
|
+
node.type.checkAttrs(node.attrs);
|
|
30676
|
+
return node;
|
|
30636
30677
|
}
|
|
30637
30678
|
};
|
|
30638
30679
|
Node$3.prototype.text = void 0;
|
|
@@ -31114,6 +31155,16 @@ function computeAttrs(attrs, value) {
|
|
|
31114
31155
|
}
|
|
31115
31156
|
return built;
|
|
31116
31157
|
}
|
|
31158
|
+
function checkAttrs(attrs, values3, type3, name) {
|
|
31159
|
+
for (let name2 in values3)
|
|
31160
|
+
if (!(name2 in attrs))
|
|
31161
|
+
throw new RangeError(`Unsupported attribute ${name2} for ${type3} of type ${name2}`);
|
|
31162
|
+
for (let name2 in attrs) {
|
|
31163
|
+
let attr = attrs[name2];
|
|
31164
|
+
if (attr.validate)
|
|
31165
|
+
attr.validate(values3[name2]);
|
|
31166
|
+
}
|
|
31167
|
+
}
|
|
31117
31168
|
function initAttrs(attrs) {
|
|
31118
31169
|
let result2 = /* @__PURE__ */ Object.create(null);
|
|
31119
31170
|
if (attrs)
|
|
@@ -31243,7 +31294,7 @@ let NodeType$1 = class NodeType2 {
|
|
|
31243
31294
|
}
|
|
31244
31295
|
/**
|
|
31245
31296
|
Returns true if the given fragment is valid content for this node
|
|
31246
|
-
type
|
|
31297
|
+
type.
|
|
31247
31298
|
*/
|
|
31248
31299
|
validContent(content) {
|
|
31249
31300
|
let result2 = this.contentMatch.matchFragment(content);
|
|
@@ -31264,6 +31315,12 @@ let NodeType$1 = class NodeType2 {
|
|
|
31264
31315
|
throw new RangeError(`Invalid content for node ${this.name}: ${content.toString().slice(0, 50)}`);
|
|
31265
31316
|
}
|
|
31266
31317
|
/**
|
|
31318
|
+
@internal
|
|
31319
|
+
*/
|
|
31320
|
+
checkAttrs(attrs) {
|
|
31321
|
+
checkAttrs(this.attrs, attrs, "node", this.name);
|
|
31322
|
+
}
|
|
31323
|
+
/**
|
|
31267
31324
|
Check whether the given mark type is allowed in this node.
|
|
31268
31325
|
*/
|
|
31269
31326
|
allowsMarkType(markType) {
|
|
@@ -31313,10 +31370,19 @@ let NodeType$1 = class NodeType2 {
|
|
|
31313
31370
|
return result2;
|
|
31314
31371
|
}
|
|
31315
31372
|
};
|
|
31373
|
+
function validateType(type3) {
|
|
31374
|
+
let types = type3.split("|");
|
|
31375
|
+
return (value) => {
|
|
31376
|
+
let name = value === null ? "null" : typeof value;
|
|
31377
|
+
if (types.indexOf(name) < 0)
|
|
31378
|
+
throw new RangeError(`Expected value of type ${types}, got ${name}`);
|
|
31379
|
+
};
|
|
31380
|
+
}
|
|
31316
31381
|
class Attribute {
|
|
31317
31382
|
constructor(options) {
|
|
31318
31383
|
this.hasDefault = Object.prototype.hasOwnProperty.call(options, "default");
|
|
31319
31384
|
this.default = options.default;
|
|
31385
|
+
this.validate = typeof options.validate == "string" ? validateType(options.validate) : options.validate;
|
|
31320
31386
|
}
|
|
31321
31387
|
get isRequired() {
|
|
31322
31388
|
return !this.hasDefault;
|
|
@@ -31375,6 +31441,12 @@ class MarkType {
|
|
|
31375
31441
|
return set2[i2];
|
|
31376
31442
|
}
|
|
31377
31443
|
/**
|
|
31444
|
+
@internal
|
|
31445
|
+
*/
|
|
31446
|
+
checkAttrs(attrs) {
|
|
31447
|
+
checkAttrs(this.attrs, attrs, "mark", this.name);
|
|
31448
|
+
}
|
|
31449
|
+
/**
|
|
31378
31450
|
Queries whether a given mark type is
|
|
31379
31451
|
[excluded](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) by this one.
|
|
31380
31452
|
*/
|
|
@@ -31387,6 +31459,7 @@ class Schema {
|
|
|
31387
31459
|
Construct a schema from a schema [specification](https://prosemirror.net/docs/ref/#model.SchemaSpec).
|
|
31388
31460
|
*/
|
|
31389
31461
|
constructor(spec) {
|
|
31462
|
+
this.linebreakReplacement = null;
|
|
31390
31463
|
this.cached = /* @__PURE__ */ Object.create(null);
|
|
31391
31464
|
let instanceSpec = this.spec = {};
|
|
31392
31465
|
for (let prop3 in spec)
|
|
@@ -31400,6 +31473,13 @@ class Schema {
|
|
|
31400
31473
|
let type3 = this.nodes[prop3], contentExpr = type3.spec.content || "", markExpr = type3.spec.marks;
|
|
31401
31474
|
type3.contentMatch = contentExprCache[contentExpr] || (contentExprCache[contentExpr] = ContentMatch.parse(contentExpr, this.nodes));
|
|
31402
31475
|
type3.inlineContent = type3.contentMatch.inlineContent;
|
|
31476
|
+
if (type3.spec.linebreakReplacement) {
|
|
31477
|
+
if (this.linebreakReplacement)
|
|
31478
|
+
throw new RangeError("Multiple linebreak nodes defined");
|
|
31479
|
+
if (!type3.isInline || !type3.isLeaf)
|
|
31480
|
+
throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");
|
|
31481
|
+
this.linebreakReplacement = type3;
|
|
31482
|
+
}
|
|
31403
31483
|
type3.markSet = markExpr == "_" ? null : markExpr ? gatherMarks(this, markExpr.split(" ")) : markExpr == "" || !type3.inlineContent ? [] : null;
|
|
31404
31484
|
}
|
|
31405
31485
|
for (let prop3 in this.marks) {
|
|
@@ -31484,6 +31564,12 @@ function gatherMarks(schema, marks) {
|
|
|
31484
31564
|
}
|
|
31485
31565
|
return found2;
|
|
31486
31566
|
}
|
|
31567
|
+
function isTagRule(rule) {
|
|
31568
|
+
return rule.tag != null;
|
|
31569
|
+
}
|
|
31570
|
+
function isStyleRule(rule) {
|
|
31571
|
+
return rule.style != null;
|
|
31572
|
+
}
|
|
31487
31573
|
class DOMParser {
|
|
31488
31574
|
/**
|
|
31489
31575
|
Create a parser that targets the given schema, using the given
|
|
@@ -31494,11 +31580,16 @@ class DOMParser {
|
|
|
31494
31580
|
this.rules = rules;
|
|
31495
31581
|
this.tags = [];
|
|
31496
31582
|
this.styles = [];
|
|
31583
|
+
let matchedStyles = this.matchedStyles = [];
|
|
31497
31584
|
rules.forEach((rule) => {
|
|
31498
|
-
if (rule
|
|
31585
|
+
if (isTagRule(rule)) {
|
|
31499
31586
|
this.tags.push(rule);
|
|
31500
|
-
else if (rule
|
|
31587
|
+
} else if (isStyleRule(rule)) {
|
|
31588
|
+
let prop3 = /[^=]*/.exec(rule.style)[0];
|
|
31589
|
+
if (matchedStyles.indexOf(prop3) < 0)
|
|
31590
|
+
matchedStyles.push(prop3);
|
|
31501
31591
|
this.styles.push(rule);
|
|
31592
|
+
}
|
|
31502
31593
|
});
|
|
31503
31594
|
this.normalizeLists = !this.tags.some((r2) => {
|
|
31504
31595
|
if (!/^(ul|ol)\b/.test(r2.tag) || !r2.node)
|
|
@@ -31758,10 +31849,10 @@ class ParseContext {
|
|
|
31758
31849
|
this.addElement(dom);
|
|
31759
31850
|
}
|
|
31760
31851
|
withStyleRules(dom, f2) {
|
|
31761
|
-
let style2 = dom.
|
|
31762
|
-
if (!style2)
|
|
31852
|
+
let style2 = dom.style;
|
|
31853
|
+
if (!style2 || !style2.length)
|
|
31763
31854
|
return f2();
|
|
31764
|
-
let marks = this.readStyles(
|
|
31855
|
+
let marks = this.readStyles(dom.style);
|
|
31765
31856
|
if (!marks)
|
|
31766
31857
|
return;
|
|
31767
31858
|
let [addMarks, removeMarks] = marks, top2 = this.top;
|
|
@@ -31855,27 +31946,30 @@ class ParseContext {
|
|
|
31855
31946
|
// had a rule with `ignore` set.
|
|
31856
31947
|
readStyles(styles) {
|
|
31857
31948
|
let add2 = Mark$1.none, remove2 = Mark$1.none;
|
|
31858
|
-
|
|
31859
|
-
for (let
|
|
31860
|
-
let
|
|
31861
|
-
if (
|
|
31862
|
-
|
|
31863
|
-
|
|
31864
|
-
|
|
31865
|
-
|
|
31866
|
-
|
|
31867
|
-
|
|
31868
|
-
|
|
31869
|
-
|
|
31870
|
-
|
|
31871
|
-
|
|
31872
|
-
|
|
31873
|
-
|
|
31874
|
-
|
|
31875
|
-
|
|
31876
|
-
|
|
31949
|
+
if (styles.length)
|
|
31950
|
+
for (let i2 = 0; i2 < this.parser.matchedStyles.length; i2++) {
|
|
31951
|
+
let name = this.parser.matchedStyles[i2], value = styles.getPropertyValue(name);
|
|
31952
|
+
if (value)
|
|
31953
|
+
for (let after = void 0; ; ) {
|
|
31954
|
+
let rule = this.parser.matchStyle(name, value, this, after);
|
|
31955
|
+
if (!rule)
|
|
31956
|
+
break;
|
|
31957
|
+
if (rule.ignore)
|
|
31958
|
+
return null;
|
|
31959
|
+
if (rule.clearMark) {
|
|
31960
|
+
this.top.pendingMarks.concat(this.top.activeMarks).forEach((m2) => {
|
|
31961
|
+
if (rule.clearMark(m2))
|
|
31962
|
+
remove2 = m2.addToSet(remove2);
|
|
31963
|
+
});
|
|
31964
|
+
} else {
|
|
31965
|
+
add2 = this.parser.schema.marks[rule.mark].create(rule.attrs).addToSet(add2);
|
|
31966
|
+
}
|
|
31967
|
+
if (rule.consuming === false)
|
|
31968
|
+
after = rule;
|
|
31969
|
+
else
|
|
31970
|
+
break;
|
|
31971
|
+
}
|
|
31877
31972
|
}
|
|
31878
|
-
}
|
|
31879
31973
|
return [add2, remove2];
|
|
31880
31974
|
}
|
|
31881
31975
|
// Look up a handler for the given node. If none are found, return
|
|
@@ -32144,12 +32238,6 @@ function normalizeList(dom) {
|
|
|
32144
32238
|
function matches(dom, selector2) {
|
|
32145
32239
|
return (dom.matches || dom.msMatchesSelector || dom.webkitMatchesSelector || dom.mozMatchesSelector).call(dom, selector2);
|
|
32146
32240
|
}
|
|
32147
|
-
function parseStyles(style2) {
|
|
32148
|
-
let re2 = /\s*([\w-]+)\s*:\s*([^;]+)/g, m2, result2 = [];
|
|
32149
|
-
while (m2 = re2.exec(style2))
|
|
32150
|
-
result2.push(m2[1], m2[2].trim());
|
|
32151
|
-
return result2;
|
|
32152
|
-
}
|
|
32153
32241
|
function copy$2(obj) {
|
|
32154
32242
|
let copy2 = {};
|
|
32155
32243
|
for (let prop3 in obj)
|
|
@@ -32240,7 +32328,7 @@ class DOMSerializer {
|
|
|
32240
32328
|
@internal
|
|
32241
32329
|
*/
|
|
32242
32330
|
serializeNodeInner(node, options) {
|
|
32243
|
-
let { dom, contentDOM } =
|
|
32331
|
+
let { dom, contentDOM } = renderSpec(doc$1(options), this.nodes[node.type.name](node), null, node.attrs);
|
|
32244
32332
|
if (contentDOM) {
|
|
32245
32333
|
if (node.isLeaf)
|
|
32246
32334
|
throw new RangeError("Content hole not allowed in a leaf node spec");
|
|
@@ -32271,7 +32359,7 @@ class DOMSerializer {
|
|
|
32271
32359
|
*/
|
|
32272
32360
|
serializeMark(mark, inline, options = {}) {
|
|
32273
32361
|
let toDOM = this.marks[mark.type.name];
|
|
32274
|
-
return toDOM &&
|
|
32362
|
+
return toDOM && renderSpec(doc$1(options), toDOM(mark, inline), null, mark.attrs);
|
|
32275
32363
|
}
|
|
32276
32364
|
/**
|
|
32277
32365
|
Render an [output spec](https://prosemirror.net/docs/ref/#model.DOMOutputSpec) to a DOM node. If
|
|
@@ -32279,48 +32367,7 @@ class DOMSerializer {
|
|
|
32279
32367
|
node with the hole.
|
|
32280
32368
|
*/
|
|
32281
32369
|
static renderSpec(doc2, structure, xmlNS = null) {
|
|
32282
|
-
|
|
32283
|
-
return { dom: doc2.createTextNode(structure) };
|
|
32284
|
-
if (structure.nodeType != null)
|
|
32285
|
-
return { dom: structure };
|
|
32286
|
-
if (structure.dom && structure.dom.nodeType != null)
|
|
32287
|
-
return structure;
|
|
32288
|
-
let tagName = structure[0], space = tagName.indexOf(" ");
|
|
32289
|
-
if (space > 0) {
|
|
32290
|
-
xmlNS = tagName.slice(0, space);
|
|
32291
|
-
tagName = tagName.slice(space + 1);
|
|
32292
|
-
}
|
|
32293
|
-
let contentDOM;
|
|
32294
|
-
let dom = xmlNS ? doc2.createElementNS(xmlNS, tagName) : doc2.createElement(tagName);
|
|
32295
|
-
let attrs = structure[1], start2 = 1;
|
|
32296
|
-
if (attrs && typeof attrs == "object" && attrs.nodeType == null && !Array.isArray(attrs)) {
|
|
32297
|
-
start2 = 2;
|
|
32298
|
-
for (let name in attrs)
|
|
32299
|
-
if (attrs[name] != null) {
|
|
32300
|
-
let space2 = name.indexOf(" ");
|
|
32301
|
-
if (space2 > 0)
|
|
32302
|
-
dom.setAttributeNS(name.slice(0, space2), name.slice(space2 + 1), attrs[name]);
|
|
32303
|
-
else
|
|
32304
|
-
dom.setAttribute(name, attrs[name]);
|
|
32305
|
-
}
|
|
32306
|
-
}
|
|
32307
|
-
for (let i2 = start2; i2 < structure.length; i2++) {
|
|
32308
|
-
let child = structure[i2];
|
|
32309
|
-
if (child === 0) {
|
|
32310
|
-
if (i2 < structure.length - 1 || i2 > start2)
|
|
32311
|
-
throw new RangeError("Content hole must be the only child of its parent node");
|
|
32312
|
-
return { dom, contentDOM: dom };
|
|
32313
|
-
} else {
|
|
32314
|
-
let { dom: inner, contentDOM: innerContent } = DOMSerializer.renderSpec(doc2, child, xmlNS);
|
|
32315
|
-
dom.appendChild(inner);
|
|
32316
|
-
if (innerContent) {
|
|
32317
|
-
if (contentDOM)
|
|
32318
|
-
throw new RangeError("Multiple content holes");
|
|
32319
|
-
contentDOM = innerContent;
|
|
32320
|
-
}
|
|
32321
|
-
}
|
|
32322
|
-
}
|
|
32323
|
-
return { dom, contentDOM };
|
|
32370
|
+
return renderSpec(doc2, structure, xmlNS);
|
|
32324
32371
|
}
|
|
32325
32372
|
/**
|
|
32326
32373
|
Build a serializer using the [`toDOM`](https://prosemirror.net/docs/ref/#model.NodeSpec.toDOM)
|
|
@@ -32358,6 +32405,84 @@ function gatherToDOM(obj) {
|
|
|
32358
32405
|
function doc$1(options) {
|
|
32359
32406
|
return options.document || window.document;
|
|
32360
32407
|
}
|
|
32408
|
+
const suspiciousAttributeCache = /* @__PURE__ */ new WeakMap();
|
|
32409
|
+
function suspiciousAttributes(attrs) {
|
|
32410
|
+
let value = suspiciousAttributeCache.get(attrs);
|
|
32411
|
+
if (value === void 0)
|
|
32412
|
+
suspiciousAttributeCache.set(attrs, value = suspiciousAttributesInner(attrs));
|
|
32413
|
+
return value;
|
|
32414
|
+
}
|
|
32415
|
+
function suspiciousAttributesInner(attrs) {
|
|
32416
|
+
let result2 = null;
|
|
32417
|
+
function scan(value) {
|
|
32418
|
+
if (value && typeof value == "object") {
|
|
32419
|
+
if (Array.isArray(value)) {
|
|
32420
|
+
if (typeof value[0] == "string") {
|
|
32421
|
+
if (!result2)
|
|
32422
|
+
result2 = [];
|
|
32423
|
+
result2.push(value);
|
|
32424
|
+
} else {
|
|
32425
|
+
for (let i2 = 0; i2 < value.length; i2++)
|
|
32426
|
+
scan(value[i2]);
|
|
32427
|
+
}
|
|
32428
|
+
} else {
|
|
32429
|
+
for (let prop3 in value)
|
|
32430
|
+
scan(value[prop3]);
|
|
32431
|
+
}
|
|
32432
|
+
}
|
|
32433
|
+
}
|
|
32434
|
+
scan(attrs);
|
|
32435
|
+
return result2;
|
|
32436
|
+
}
|
|
32437
|
+
function renderSpec(doc2, structure, xmlNS, blockArraysIn) {
|
|
32438
|
+
if (typeof structure == "string")
|
|
32439
|
+
return { dom: doc2.createTextNode(structure) };
|
|
32440
|
+
if (structure.nodeType != null)
|
|
32441
|
+
return { dom: structure };
|
|
32442
|
+
if (structure.dom && structure.dom.nodeType != null)
|
|
32443
|
+
return structure;
|
|
32444
|
+
let tagName = structure[0], suspicious;
|
|
32445
|
+
if (typeof tagName != "string")
|
|
32446
|
+
throw new RangeError("Invalid array passed to renderSpec");
|
|
32447
|
+
if (blockArraysIn && (suspicious = suspiciousAttributes(blockArraysIn)) && suspicious.indexOf(structure) > -1)
|
|
32448
|
+
throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");
|
|
32449
|
+
let space = tagName.indexOf(" ");
|
|
32450
|
+
if (space > 0) {
|
|
32451
|
+
xmlNS = tagName.slice(0, space);
|
|
32452
|
+
tagName = tagName.slice(space + 1);
|
|
32453
|
+
}
|
|
32454
|
+
let contentDOM;
|
|
32455
|
+
let dom = xmlNS ? doc2.createElementNS(xmlNS, tagName) : doc2.createElement(tagName);
|
|
32456
|
+
let attrs = structure[1], start2 = 1;
|
|
32457
|
+
if (attrs && typeof attrs == "object" && attrs.nodeType == null && !Array.isArray(attrs)) {
|
|
32458
|
+
start2 = 2;
|
|
32459
|
+
for (let name in attrs)
|
|
32460
|
+
if (attrs[name] != null) {
|
|
32461
|
+
let space2 = name.indexOf(" ");
|
|
32462
|
+
if (space2 > 0)
|
|
32463
|
+
dom.setAttributeNS(name.slice(0, space2), name.slice(space2 + 1), attrs[name]);
|
|
32464
|
+
else
|
|
32465
|
+
dom.setAttribute(name, attrs[name]);
|
|
32466
|
+
}
|
|
32467
|
+
}
|
|
32468
|
+
for (let i2 = start2; i2 < structure.length; i2++) {
|
|
32469
|
+
let child = structure[i2];
|
|
32470
|
+
if (child === 0) {
|
|
32471
|
+
if (i2 < structure.length - 1 || i2 > start2)
|
|
32472
|
+
throw new RangeError("Content hole must be the only child of its parent node");
|
|
32473
|
+
return { dom, contentDOM: dom };
|
|
32474
|
+
} else {
|
|
32475
|
+
let { dom: inner, contentDOM: innerContent } = renderSpec(doc2, child, xmlNS, blockArraysIn);
|
|
32476
|
+
dom.appendChild(inner);
|
|
32477
|
+
if (innerContent) {
|
|
32478
|
+
if (contentDOM)
|
|
32479
|
+
throw new RangeError("Multiple content holes");
|
|
32480
|
+
contentDOM = innerContent;
|
|
32481
|
+
}
|
|
32482
|
+
}
|
|
32483
|
+
}
|
|
32484
|
+
return { dom, contentDOM };
|
|
32485
|
+
}
|
|
32361
32486
|
const lower16 = 65535;
|
|
32362
32487
|
const factor16 = Math.pow(2, 16);
|
|
32363
32488
|
function makeRecover(index2, offset2) {
|
|
@@ -33017,7 +33142,8 @@ class ReplaceAroundStep extends Step$1 {
|
|
|
33017
33142
|
}
|
|
33018
33143
|
map(mapping) {
|
|
33019
33144
|
let from2 = mapping.mapResult(this.from, 1), to2 = mapping.mapResult(this.to, -1);
|
|
33020
|
-
let gapFrom =
|
|
33145
|
+
let gapFrom = this.from == this.gapFrom ? from2.pos : mapping.map(this.gapFrom, -1);
|
|
33146
|
+
let gapTo = this.to == this.gapTo ? to2.pos : mapping.map(this.gapTo, 1);
|
|
33021
33147
|
if (from2.deletedAcross && to2.deletedAcross || gapFrom < from2.pos || gapTo > to2.pos)
|
|
33022
33148
|
return null;
|
|
33023
33149
|
return new ReplaceAroundStep(from2.pos, to2.pos, gapFrom, gapTo, this.slice, this.insert, this.structure);
|
|
@@ -33130,7 +33256,7 @@ function removeMark(tr2, from2, to2, mark) {
|
|
|
33130
33256
|
});
|
|
33131
33257
|
matched.forEach((m2) => tr2.step(new RemoveMarkStep(m2.from, m2.to, m2.style)));
|
|
33132
33258
|
}
|
|
33133
|
-
function clearIncompatible(tr2, pos, parentType, match2 = parentType.contentMatch) {
|
|
33259
|
+
function clearIncompatible(tr2, pos, parentType, match2 = parentType.contentMatch, clearNewlines = true) {
|
|
33134
33260
|
let node = tr2.doc.nodeAt(pos);
|
|
33135
33261
|
let replSteps = [], cur = pos + 1;
|
|
33136
33262
|
for (let i2 = 0; i2 < node.childCount; i2++) {
|
|
@@ -33143,7 +33269,7 @@ function clearIncompatible(tr2, pos, parentType, match2 = parentType.contentMatc
|
|
|
33143
33269
|
for (let j2 = 0; j2 < child.marks.length; j2++)
|
|
33144
33270
|
if (!parentType.allowsMarkType(child.marks[j2].type))
|
|
33145
33271
|
tr2.step(new RemoveMarkStep(cur, end2, child.marks[j2]));
|
|
33146
|
-
if (child.isText &&
|
|
33272
|
+
if (clearNewlines && child.isText && parentType.whitespace != "pre") {
|
|
33147
33273
|
let m2, newline = /\r?\n|\r/g, slice4;
|
|
33148
33274
|
while (m2 = newline.exec(child.text)) {
|
|
33149
33275
|
if (!slice4)
|
|
@@ -33252,14 +33378,45 @@ function setBlockType$1(tr2, from2, to2, type3, attrs) {
|
|
|
33252
33378
|
let mapFrom = tr2.steps.length;
|
|
33253
33379
|
tr2.doc.nodesBetween(from2, to2, (node, pos) => {
|
|
33254
33380
|
if (node.isTextblock && !node.hasMarkup(type3, attrs) && canChangeType(tr2.doc, tr2.mapping.slice(mapFrom).map(pos), type3)) {
|
|
33255
|
-
|
|
33381
|
+
let convertNewlines = null;
|
|
33382
|
+
if (type3.schema.linebreakReplacement) {
|
|
33383
|
+
let pre = type3.whitespace == "pre", supportLinebreak = !!type3.contentMatch.matchType(type3.schema.linebreakReplacement);
|
|
33384
|
+
if (pre && !supportLinebreak)
|
|
33385
|
+
convertNewlines = false;
|
|
33386
|
+
else if (!pre && supportLinebreak)
|
|
33387
|
+
convertNewlines = true;
|
|
33388
|
+
}
|
|
33389
|
+
if (convertNewlines === false)
|
|
33390
|
+
replaceLinebreaks(tr2, node, pos, mapFrom);
|
|
33391
|
+
clearIncompatible(tr2, tr2.mapping.slice(mapFrom).map(pos, 1), type3, void 0, convertNewlines === null);
|
|
33256
33392
|
let mapping = tr2.mapping.slice(mapFrom);
|
|
33257
33393
|
let startM = mapping.map(pos, 1), endM = mapping.map(pos + node.nodeSize, 1);
|
|
33258
33394
|
tr2.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new Slice(Fragment.from(type3.create(attrs, null, node.marks)), 0, 0), 1, true));
|
|
33395
|
+
if (convertNewlines === true)
|
|
33396
|
+
replaceNewlines(tr2, node, pos, mapFrom);
|
|
33259
33397
|
return false;
|
|
33260
33398
|
}
|
|
33261
33399
|
});
|
|
33262
33400
|
}
|
|
33401
|
+
function replaceNewlines(tr2, node, pos, mapFrom) {
|
|
33402
|
+
node.forEach((child, offset2) => {
|
|
33403
|
+
if (child.isText) {
|
|
33404
|
+
let m2, newline = /\r?\n|\r/g;
|
|
33405
|
+
while (m2 = newline.exec(child.text)) {
|
|
33406
|
+
let start2 = tr2.mapping.slice(mapFrom).map(pos + 1 + offset2 + m2.index);
|
|
33407
|
+
tr2.replaceWith(start2, start2 + 1, node.type.schema.linebreakReplacement.create());
|
|
33408
|
+
}
|
|
33409
|
+
}
|
|
33410
|
+
});
|
|
33411
|
+
}
|
|
33412
|
+
function replaceLinebreaks(tr2, node, pos, mapFrom) {
|
|
33413
|
+
node.forEach((child, offset2) => {
|
|
33414
|
+
if (child.type == child.type.schema.linebreakReplacement) {
|
|
33415
|
+
let start2 = tr2.mapping.slice(mapFrom).map(pos + 1 + offset2);
|
|
33416
|
+
tr2.replaceWith(start2, start2 + 1, node.type.schema.text("\n"));
|
|
33417
|
+
}
|
|
33418
|
+
});
|
|
33419
|
+
}
|
|
33263
33420
|
function canChangeType(doc2, pos, type3) {
|
|
33264
33421
|
let $pos = doc2.resolve(pos), index2 = $pos.index();
|
|
33265
33422
|
return $pos.parent.canReplaceWith(index2, index2 + 1, type3);
|
|
@@ -35025,6 +35182,9 @@ const textRange = function(node, from2, to2) {
|
|
|
35025
35182
|
range2.setStart(node, from2 || 0);
|
|
35026
35183
|
return range2;
|
|
35027
35184
|
};
|
|
35185
|
+
const clearReusedRange = function() {
|
|
35186
|
+
reusedRange = null;
|
|
35187
|
+
};
|
|
35028
35188
|
const isEquivalentPosition = function(node, off2, targetNode, targetOff) {
|
|
35029
35189
|
return targetNode && (scanFor(node, off2, targetNode, targetOff, -1) || scanFor(node, off2, targetNode, targetOff, 1));
|
|
35030
35190
|
};
|
|
@@ -35052,6 +35212,40 @@ function scanFor(node, off2, targetNode, targetOff, dir) {
|
|
|
35052
35212
|
function nodeSize(node) {
|
|
35053
35213
|
return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length;
|
|
35054
35214
|
}
|
|
35215
|
+
function textNodeBefore$1(node, offset2) {
|
|
35216
|
+
for (; ; ) {
|
|
35217
|
+
if (node.nodeType == 3 && offset2)
|
|
35218
|
+
return node;
|
|
35219
|
+
if (node.nodeType == 1 && offset2 > 0) {
|
|
35220
|
+
if (node.contentEditable == "false")
|
|
35221
|
+
return null;
|
|
35222
|
+
node = node.childNodes[offset2 - 1];
|
|
35223
|
+
offset2 = nodeSize(node);
|
|
35224
|
+
} else if (node.parentNode && !hasBlockDesc(node)) {
|
|
35225
|
+
offset2 = domIndex(node);
|
|
35226
|
+
node = node.parentNode;
|
|
35227
|
+
} else {
|
|
35228
|
+
return null;
|
|
35229
|
+
}
|
|
35230
|
+
}
|
|
35231
|
+
}
|
|
35232
|
+
function textNodeAfter$1(node, offset2) {
|
|
35233
|
+
for (; ; ) {
|
|
35234
|
+
if (node.nodeType == 3 && offset2 < node.nodeValue.length)
|
|
35235
|
+
return node;
|
|
35236
|
+
if (node.nodeType == 1 && offset2 < node.childNodes.length) {
|
|
35237
|
+
if (node.contentEditable == "false")
|
|
35238
|
+
return null;
|
|
35239
|
+
node = node.childNodes[offset2];
|
|
35240
|
+
offset2 = 0;
|
|
35241
|
+
} else if (node.parentNode && !hasBlockDesc(node)) {
|
|
35242
|
+
offset2 = domIndex(node) + 1;
|
|
35243
|
+
node = node.parentNode;
|
|
35244
|
+
} else {
|
|
35245
|
+
return null;
|
|
35246
|
+
}
|
|
35247
|
+
}
|
|
35248
|
+
}
|
|
35055
35249
|
function isOnEdge(node, offset2, parent) {
|
|
35056
35250
|
for (let atStart = offset2 == 0, atEnd = offset2 == nodeSize(node); atStart || atEnd; ) {
|
|
35057
35251
|
if (node == parent)
|
|
@@ -35123,6 +35317,14 @@ const android = /Android \d/.test(agent);
|
|
|
35123
35317
|
const webkit = !!doc && "webkitFontSmoothing" in doc.documentElement.style;
|
|
35124
35318
|
const webkit_version = webkit ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
|
|
35125
35319
|
function windowRect(doc2) {
|
|
35320
|
+
let vp = doc2.defaultView && doc2.defaultView.visualViewport;
|
|
35321
|
+
if (vp)
|
|
35322
|
+
return {
|
|
35323
|
+
left: 0,
|
|
35324
|
+
right: vp.width,
|
|
35325
|
+
top: 0,
|
|
35326
|
+
bottom: vp.height
|
|
35327
|
+
};
|
|
35126
35328
|
return {
|
|
35127
35329
|
left: 0,
|
|
35128
35330
|
right: doc2.documentElement.clientWidth,
|
|
@@ -35324,14 +35526,14 @@ function posFromCaret(view, node, offset2, coords) {
|
|
|
35324
35526
|
let desc = view.docView.nearestDesc(cur, true);
|
|
35325
35527
|
if (!desc)
|
|
35326
35528
|
return null;
|
|
35327
|
-
if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent
|
|
35529
|
+
if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent || !desc.contentDOM)) {
|
|
35328
35530
|
let rect = desc.dom.getBoundingClientRect();
|
|
35329
|
-
if (desc.node.isBlock && desc.parent
|
|
35330
|
-
sawBlock
|
|
35331
|
-
if (rect.left > coords.left || rect.top > coords.top)
|
|
35531
|
+
if (desc.node.isBlock && desc.parent) {
|
|
35532
|
+
if (!sawBlock && rect.left > coords.left || rect.top > coords.top)
|
|
35332
35533
|
outsideBlock = desc.posBefore;
|
|
35333
|
-
else if (rect.right < coords.left || rect.bottom < coords.top)
|
|
35534
|
+
else if (!sawBlock && rect.right < coords.left || rect.bottom < coords.top)
|
|
35334
35535
|
outsideBlock = desc.posAfter;
|
|
35536
|
+
sawBlock = true;
|
|
35335
35537
|
}
|
|
35336
35538
|
if (!desc.contentDOM && outsideBlock < 0 && !desc.node.isText) {
|
|
35337
35539
|
let before = desc.node.isBlock ? coords.top < (rect.top + rect.bottom) / 2 : coords.left < (rect.left + rect.right) / 2;
|
|
@@ -35946,6 +36148,9 @@ class ViewDesc {
|
|
|
35946
36148
|
get ignoreForCoords() {
|
|
35947
36149
|
return false;
|
|
35948
36150
|
}
|
|
36151
|
+
isText(text) {
|
|
36152
|
+
return false;
|
|
36153
|
+
}
|
|
35949
36154
|
}
|
|
35950
36155
|
class WidgetViewDesc extends ViewDesc {
|
|
35951
36156
|
constructor(parent, widget, view, pos) {
|
|
@@ -36184,8 +36389,7 @@ class NodeViewDesc extends ViewDesc {
|
|
|
36184
36389
|
let { from: from2, to: to2 } = view.state.selection;
|
|
36185
36390
|
if (!(view.state.selection instanceof TextSelection) || from2 < pos || to2 > pos + this.node.content.size)
|
|
36186
36391
|
return null;
|
|
36187
|
-
let
|
|
36188
|
-
let textNode = nearbyTextNode(sel.focusNode, sel.focusOffset);
|
|
36392
|
+
let textNode = view.input.compositionNode;
|
|
36189
36393
|
if (!textNode || !this.dom.contains(textNode.parentNode))
|
|
36190
36394
|
return null;
|
|
36191
36395
|
if (this.node.inlineContent) {
|
|
@@ -36251,10 +36455,11 @@ class NodeViewDesc extends ViewDesc {
|
|
|
36251
36455
|
}
|
|
36252
36456
|
// Remove selected node marking from this node.
|
|
36253
36457
|
deselectNode() {
|
|
36254
|
-
if (this.nodeDOM.nodeType == 1)
|
|
36458
|
+
if (this.nodeDOM.nodeType == 1) {
|
|
36255
36459
|
this.nodeDOM.classList.remove("ProseMirror-selectednode");
|
|
36256
|
-
|
|
36257
|
-
|
|
36460
|
+
if (this.contentDOM || !this.node.type.spec.draggable)
|
|
36461
|
+
this.dom.removeAttribute("draggable");
|
|
36462
|
+
}
|
|
36258
36463
|
}
|
|
36259
36464
|
get domAtom() {
|
|
36260
36465
|
return this.node.isAtom;
|
|
@@ -36320,6 +36525,9 @@ class TextViewDesc extends NodeViewDesc {
|
|
|
36320
36525
|
get domAtom() {
|
|
36321
36526
|
return false;
|
|
36322
36527
|
}
|
|
36528
|
+
isText(text) {
|
|
36529
|
+
return this.node.text == text;
|
|
36530
|
+
}
|
|
36323
36531
|
}
|
|
36324
36532
|
class TrailingHackViewDesc extends ViewDesc {
|
|
36325
36533
|
parseRule() {
|
|
@@ -36835,23 +37043,6 @@ function iosHacks(dom) {
|
|
|
36835
37043
|
dom.style.cssText = oldCSS;
|
|
36836
37044
|
}
|
|
36837
37045
|
}
|
|
36838
|
-
function nearbyTextNode(node, offset2) {
|
|
36839
|
-
for (; ; ) {
|
|
36840
|
-
if (node.nodeType == 3)
|
|
36841
|
-
return node;
|
|
36842
|
-
if (node.nodeType == 1 && offset2 > 0) {
|
|
36843
|
-
if (node.childNodes.length > offset2 && node.childNodes[offset2].nodeType == 3)
|
|
36844
|
-
return node.childNodes[offset2];
|
|
36845
|
-
node = node.childNodes[offset2 - 1];
|
|
36846
|
-
offset2 = nodeSize(node);
|
|
36847
|
-
} else if (node.nodeType == 1 && offset2 < node.childNodes.length) {
|
|
36848
|
-
node = node.childNodes[offset2];
|
|
36849
|
-
offset2 = 0;
|
|
36850
|
-
} else {
|
|
36851
|
-
return null;
|
|
36852
|
-
}
|
|
36853
|
-
}
|
|
36854
|
-
}
|
|
36855
37046
|
function findTextInFragment(frag, text, from2, to2) {
|
|
36856
37047
|
for (let i2 = 0, pos = 0; i2 < frag.childCount && pos <= to2; ) {
|
|
36857
37048
|
let child = frag.child(i2++), childStart = pos;
|
|
@@ -37426,7 +37617,7 @@ function serializeForClipboard(view, slice4) {
|
|
|
37426
37617
|
if (firstChild && firstChild.nodeType == 1)
|
|
37427
37618
|
firstChild.setAttribute("data-pm-slice", `${openStart} ${openEnd}${wrappers ? ` -${wrappers}` : ""} ${JSON.stringify(context)}`);
|
|
37428
37619
|
let text = view.someProp("clipboardTextSerializer", (f2) => f2(slice4, view)) || slice4.content.textBetween(0, slice4.content.size, "\n\n");
|
|
37429
|
-
return { dom: wrap2, text };
|
|
37620
|
+
return { dom: wrap2, text, slice: slice4 };
|
|
37430
37621
|
}
|
|
37431
37622
|
function parseFromClipboard(view, text, html, plainText, $context) {
|
|
37432
37623
|
let inCode = $context.parent.type.spec.code;
|
|
@@ -37646,6 +37837,7 @@ class InputState {
|
|
|
37646
37837
|
this.lastTouch = 0;
|
|
37647
37838
|
this.lastAndroidDelete = 0;
|
|
37648
37839
|
this.composing = false;
|
|
37840
|
+
this.compositionNode = null;
|
|
37649
37841
|
this.composingTimeout = -1;
|
|
37650
37842
|
this.compositionNodes = [];
|
|
37651
37843
|
this.compositionEndedAt = -2e8;
|
|
@@ -37895,7 +38087,7 @@ class MouseDown {
|
|
|
37895
38087
|
}
|
|
37896
38088
|
const target = flushed ? null : event.target;
|
|
37897
38089
|
const targetDesc = target ? view.docView.nearestDesc(target, true) : null;
|
|
37898
|
-
this.target = targetDesc ? targetDesc.dom : null;
|
|
38090
|
+
this.target = targetDesc && targetDesc.dom.nodeType == 1 ? targetDesc.dom : null;
|
|
37899
38091
|
let { selection } = view.state;
|
|
37900
38092
|
if (event.button == 0 && targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false || selection instanceof NodeSelection && selection.from <= targetPos && selection.to > targetPos)
|
|
37901
38093
|
this.mightDrag = {
|
|
@@ -38027,6 +38219,7 @@ editHandlers.compositionend = (view, event) => {
|
|
|
38027
38219
|
view.input.composing = false;
|
|
38028
38220
|
view.input.compositionEndedAt = event.timeStamp;
|
|
38029
38221
|
view.input.compositionPendingChanges = view.domObserver.pendingRecords().length ? view.input.compositionID : 0;
|
|
38222
|
+
view.input.compositionNode = null;
|
|
38030
38223
|
if (view.input.compositionPendingChanges)
|
|
38031
38224
|
Promise.resolve().then(() => view.domObserver.flush());
|
|
38032
38225
|
view.input.compositionID++;
|
|
@@ -38046,6 +38239,26 @@ function clearComposition(view) {
|
|
|
38046
38239
|
while (view.input.compositionNodes.length > 0)
|
|
38047
38240
|
view.input.compositionNodes.pop().markParentsDirty();
|
|
38048
38241
|
}
|
|
38242
|
+
function findCompositionNode(view) {
|
|
38243
|
+
let sel = view.domSelectionRange();
|
|
38244
|
+
if (!sel.focusNode)
|
|
38245
|
+
return null;
|
|
38246
|
+
let textBefore = textNodeBefore$1(sel.focusNode, sel.focusOffset);
|
|
38247
|
+
let textAfter = textNodeAfter$1(sel.focusNode, sel.focusOffset);
|
|
38248
|
+
if (textBefore && textAfter && textBefore != textAfter) {
|
|
38249
|
+
let descAfter = textAfter.pmViewDesc, lastChanged = view.domObserver.lastChangedTextNode;
|
|
38250
|
+
if (textBefore == lastChanged || textAfter == lastChanged)
|
|
38251
|
+
return lastChanged;
|
|
38252
|
+
if (!descAfter || !descAfter.isText(textAfter.nodeValue)) {
|
|
38253
|
+
return textAfter;
|
|
38254
|
+
} else if (view.input.compositionNode == textAfter) {
|
|
38255
|
+
let descBefore = textBefore.pmViewDesc;
|
|
38256
|
+
if (!(!descBefore || !descBefore.isText(textBefore.nodeValue)))
|
|
38257
|
+
return textAfter;
|
|
38258
|
+
}
|
|
38259
|
+
}
|
|
38260
|
+
return textBefore || textAfter;
|
|
38261
|
+
}
|
|
38049
38262
|
function timestampFromCustomEvent() {
|
|
38050
38263
|
let event = document.createEvent("Event");
|
|
38051
38264
|
event.initEvent("event", true, true);
|
|
@@ -38180,7 +38393,8 @@ handlers.dragstart = (view, _event) => {
|
|
|
38180
38393
|
if (desc && desc.node.type.spec.draggable && desc != view.docView)
|
|
38181
38394
|
node = NodeSelection.create(view.state.doc, desc.posBefore);
|
|
38182
38395
|
}
|
|
38183
|
-
let
|
|
38396
|
+
let draggedSlice = (node || view.state.selection).content();
|
|
38397
|
+
let { dom, text, slice: slice4 } = serializeForClipboard(view, draggedSlice);
|
|
38184
38398
|
event.dataTransfer.clearData();
|
|
38185
38399
|
event.dataTransfer.setData(brokenClipboardAPI ? "Text" : "text/html", dom.innerHTML);
|
|
38186
38400
|
event.dataTransfer.effectAllowed = "copyMove";
|
|
@@ -38600,9 +38814,6 @@ class DecorationSet {
|
|
|
38600
38814
|
return this;
|
|
38601
38815
|
return local.length || children2.length ? new DecorationSet(local, children2) : empty$1;
|
|
38602
38816
|
}
|
|
38603
|
-
/**
|
|
38604
|
-
@internal
|
|
38605
|
-
*/
|
|
38606
38817
|
forChild(offset2, node) {
|
|
38607
38818
|
if (this == empty$1)
|
|
38608
38819
|
return this;
|
|
@@ -38956,6 +39167,7 @@ class DOMObserver {
|
|
|
38956
39167
|
this.currentSelection = new SelectionState();
|
|
38957
39168
|
this.onCharData = null;
|
|
38958
39169
|
this.suppressingSelectionUpdates = false;
|
|
39170
|
+
this.lastChangedTextNode = null;
|
|
38959
39171
|
this.observer = window.MutationObserver && new window.MutationObserver((mutations) => {
|
|
38960
39172
|
for (let i2 = 0; i2 < mutations.length; i2++)
|
|
38961
39173
|
this.queue.push(mutations[i2]);
|
|
@@ -39081,14 +39293,21 @@ class DOMObserver {
|
|
|
39081
39293
|
}
|
|
39082
39294
|
}
|
|
39083
39295
|
}
|
|
39084
|
-
if (gecko && added.length
|
|
39296
|
+
if (gecko && added.length) {
|
|
39085
39297
|
let brs = added.filter((n2) => n2.nodeName == "BR");
|
|
39086
39298
|
if (brs.length == 2) {
|
|
39087
|
-
let a2
|
|
39299
|
+
let [a2, b2] = brs;
|
|
39088
39300
|
if (a2.parentNode && a2.parentNode.parentNode == b2.parentNode)
|
|
39089
39301
|
b2.remove();
|
|
39090
39302
|
else
|
|
39091
39303
|
a2.remove();
|
|
39304
|
+
} else {
|
|
39305
|
+
let { focusNode } = this.currentSelection;
|
|
39306
|
+
for (let br2 of brs) {
|
|
39307
|
+
let parent = br2.parentNode;
|
|
39308
|
+
if (parent && parent.nodeName == "LI" && (!focusNode || blockParent(view, focusNode) != parent))
|
|
39309
|
+
br2.remove();
|
|
39310
|
+
}
|
|
39092
39311
|
}
|
|
39093
39312
|
}
|
|
39094
39313
|
let readSel = null;
|
|
@@ -39120,8 +39339,12 @@ class DOMObserver {
|
|
|
39120
39339
|
if (!desc || desc.ignoreMutation(mut))
|
|
39121
39340
|
return null;
|
|
39122
39341
|
if (mut.type == "childList") {
|
|
39123
|
-
for (let i2 = 0; i2 < mut.addedNodes.length; i2++)
|
|
39124
|
-
|
|
39342
|
+
for (let i2 = 0; i2 < mut.addedNodes.length; i2++) {
|
|
39343
|
+
let node = mut.addedNodes[i2];
|
|
39344
|
+
added.push(node);
|
|
39345
|
+
if (node.nodeType == 3)
|
|
39346
|
+
this.lastChangedTextNode = node;
|
|
39347
|
+
}
|
|
39125
39348
|
if (desc.contentDOM && desc.contentDOM != desc.dom && !desc.contentDOM.contains(mut.target))
|
|
39126
39349
|
return { from: desc.posBefore, to: desc.posAfter };
|
|
39127
39350
|
let prev = mut.previousSibling, next = mut.nextSibling;
|
|
@@ -39142,6 +39365,7 @@ class DOMObserver {
|
|
|
39142
39365
|
} else if (mut.type == "attributes") {
|
|
39143
39366
|
return { from: desc.posAtStart - desc.border, to: desc.posAtEnd + desc.border };
|
|
39144
39367
|
} else {
|
|
39368
|
+
this.lastChangedTextNode = mut.target;
|
|
39145
39369
|
return {
|
|
39146
39370
|
from: desc.posAtStart,
|
|
39147
39371
|
to: desc.posAtEnd,
|
|
@@ -39168,7 +39392,20 @@ function checkCSS(view) {
|
|
|
39168
39392
|
cssCheckWarned = true;
|
|
39169
39393
|
}
|
|
39170
39394
|
}
|
|
39171
|
-
function
|
|
39395
|
+
function rangeToSelectionRange(view, range2) {
|
|
39396
|
+
let anchorNode = range2.startContainer, anchorOffset = range2.startOffset;
|
|
39397
|
+
let focusNode = range2.endContainer, focusOffset = range2.endOffset;
|
|
39398
|
+
let currentAnchor = view.domAtPos(view.state.selection.anchor);
|
|
39399
|
+
if (isEquivalentPosition(currentAnchor.node, currentAnchor.offset, focusNode, focusOffset))
|
|
39400
|
+
[anchorNode, anchorOffset, focusNode, focusOffset] = [focusNode, focusOffset, anchorNode, anchorOffset];
|
|
39401
|
+
return { anchorNode, anchorOffset, focusNode, focusOffset };
|
|
39402
|
+
}
|
|
39403
|
+
function safariShadowSelectionRange(view, selection) {
|
|
39404
|
+
if (selection.getComposedRanges) {
|
|
39405
|
+
let range2 = selection.getComposedRanges(view.root)[0];
|
|
39406
|
+
if (range2)
|
|
39407
|
+
return rangeToSelectionRange(view, range2);
|
|
39408
|
+
}
|
|
39172
39409
|
let found2;
|
|
39173
39410
|
function read2(event) {
|
|
39174
39411
|
event.preventDefault();
|
|
@@ -39178,12 +39415,15 @@ function safariShadowSelectionRange(view) {
|
|
|
39178
39415
|
view.dom.addEventListener("beforeinput", read2, true);
|
|
39179
39416
|
document.execCommand("indent");
|
|
39180
39417
|
view.dom.removeEventListener("beforeinput", read2, true);
|
|
39181
|
-
|
|
39182
|
-
|
|
39183
|
-
|
|
39184
|
-
|
|
39185
|
-
|
|
39186
|
-
|
|
39418
|
+
return found2 ? rangeToSelectionRange(view, found2) : null;
|
|
39419
|
+
}
|
|
39420
|
+
function blockParent(view, node) {
|
|
39421
|
+
for (let p2 = node.parentNode; p2 && p2 != view.dom; p2 = p2.parentNode) {
|
|
39422
|
+
let desc = view.docView.nearestDesc(p2, true);
|
|
39423
|
+
if (desc && desc.node.isBlock)
|
|
39424
|
+
return p2;
|
|
39425
|
+
}
|
|
39426
|
+
return null;
|
|
39187
39427
|
}
|
|
39188
39428
|
function parseBetween(view, from_, to_) {
|
|
39189
39429
|
let { node: parent, fromOffset, toOffset, from: from2, to: to2 } = view.docView.parseRange(from_, to_);
|
|
@@ -39303,10 +39543,6 @@ function readDOMChange(view, from2, to2, typeOver, addedNodes) {
|
|
|
39303
39543
|
return;
|
|
39304
39544
|
}
|
|
39305
39545
|
}
|
|
39306
|
-
if (chrome && view.cursorWrapper && parse2.sel && parse2.sel.anchor == view.cursorWrapper.deco.from && parse2.sel.head == parse2.sel.anchor) {
|
|
39307
|
-
let size2 = change.endB - change.start;
|
|
39308
|
-
parse2.sel = { anchor: parse2.sel.anchor + size2, head: parse2.sel.anchor + size2 };
|
|
39309
|
-
}
|
|
39310
39546
|
view.input.domChangeCount++;
|
|
39311
39547
|
if (view.state.selection.from < view.state.selection.to && change.start == change.endB && view.state.selection instanceof TextSelection) {
|
|
39312
39548
|
if (change.start > view.state.selection.from && change.start <= view.state.selection.from + 2 && view.state.selection.from >= parse2.from) {
|
|
@@ -39330,7 +39566,7 @@ function readDOMChange(view, from2, to2, typeOver, addedNodes) {
|
|
|
39330
39566
|
view.input.lastIOSEnter = 0;
|
|
39331
39567
|
return;
|
|
39332
39568
|
}
|
|
39333
|
-
if (view.state.selection.anchor > change.start &&
|
|
39569
|
+
if (view.state.selection.anchor > change.start && looksLikeBackspace(doc2, change.start, change.endA, $from, $to) && view.someProp("handleKeyDown", (f2) => f2(view, keyEvent(8, "Backspace")))) {
|
|
39334
39570
|
if (android && chrome)
|
|
39335
39571
|
view.domObserver.suppressSelectionUpdates();
|
|
39336
39572
|
return;
|
|
@@ -39414,12 +39650,18 @@ function isMarkChange(cur, prev) {
|
|
|
39414
39650
|
if (Fragment.from(updated).eq(cur))
|
|
39415
39651
|
return { mark, type: type3 };
|
|
39416
39652
|
}
|
|
39417
|
-
function
|
|
39418
|
-
if (
|
|
39419
|
-
|
|
39420
|
-
|
|
39653
|
+
function looksLikeBackspace(old, start2, end2, $newStart, $newEnd) {
|
|
39654
|
+
if (
|
|
39655
|
+
// The content must have shrunk
|
|
39656
|
+
end2 - start2 <= $newEnd.pos - $newStart.pos || // newEnd must point directly at or after the end of the block that newStart points into
|
|
39657
|
+
skipClosingAndOpening($newStart, true, false) < $newEnd.pos
|
|
39658
|
+
)
|
|
39421
39659
|
return false;
|
|
39422
39660
|
let $start = old.resolve(start2);
|
|
39661
|
+
if (!$newStart.parent.isTextblock) {
|
|
39662
|
+
let after = $start.nodeAfter;
|
|
39663
|
+
return after != null && end2 == start2 + after.nodeSize;
|
|
39664
|
+
}
|
|
39423
39665
|
if ($start.parentOffset < $start.parent.content.size || !$start.parent.isTextblock)
|
|
39424
39666
|
return false;
|
|
39425
39667
|
let $next = old.resolve(skipClosingAndOpening($start, true, true));
|
|
@@ -39608,8 +39850,10 @@ class EditorView {
|
|
|
39608
39850
|
let forceSelUpdate = updateDoc && (ie$1 || chrome) && !this.composing && !prev.selection.empty && !state2.selection.empty && selectionContextChanged(prev.selection, state2.selection);
|
|
39609
39851
|
if (updateDoc) {
|
|
39610
39852
|
let chromeKludge = chrome ? this.trackWrites = this.domSelectionRange().focusNode : null;
|
|
39853
|
+
if (this.composing)
|
|
39854
|
+
this.input.compositionNode = findCompositionNode(this);
|
|
39611
39855
|
if (redraw || !this.docView.update(state2.doc, outerDeco, innerDeco, this)) {
|
|
39612
|
-
this.docView.updateOuterDeco(
|
|
39856
|
+
this.docView.updateOuterDeco(outerDeco);
|
|
39613
39857
|
this.docView.destroy();
|
|
39614
39858
|
this.docView = docViewDesc(state2.doc, outerDeco, innerDeco, this.dom, this);
|
|
39615
39859
|
}
|
|
@@ -39868,6 +40112,7 @@ class EditorView {
|
|
|
39868
40112
|
}
|
|
39869
40113
|
this.docView.destroy();
|
|
39870
40114
|
this.docView = null;
|
|
40115
|
+
clearReusedRange();
|
|
39871
40116
|
}
|
|
39872
40117
|
/**
|
|
39873
40118
|
This is true when the view has been
|
|
@@ -39903,7 +40148,8 @@ class EditorView {
|
|
|
39903
40148
|
@internal
|
|
39904
40149
|
*/
|
|
39905
40150
|
domSelectionRange() {
|
|
39906
|
-
|
|
40151
|
+
let sel = this.domSelection();
|
|
40152
|
+
return safari && this.root.nodeType === 11 && deepActiveElement(this.dom.ownerDocument) == this.dom && safariShadowSelectionRange(this, sel) || sel;
|
|
39907
40153
|
}
|
|
39908
40154
|
/**
|
|
39909
40155
|
@internal
|
|
@@ -40894,7 +41140,8 @@ function getAttributesFromExtensions(extensions) {
|
|
|
40894
41140
|
const context = {
|
|
40895
41141
|
name: extension.name,
|
|
40896
41142
|
options: extension.options,
|
|
40897
|
-
storage: extension.storage
|
|
41143
|
+
storage: extension.storage,
|
|
41144
|
+
extensions: nodeAndMarkExtensions
|
|
40898
41145
|
};
|
|
40899
41146
|
const addGlobalAttributes = getExtensionField(extension, "addGlobalAttributes", context);
|
|
40900
41147
|
if (!addGlobalAttributes) {
|
|
@@ -41020,7 +41267,7 @@ function fromString(value) {
|
|
|
41020
41267
|
return value;
|
|
41021
41268
|
}
|
|
41022
41269
|
function injectExtensionAttributesToParseRule(parseRule, extensionAttributes) {
|
|
41023
|
-
if (parseRule
|
|
41270
|
+
if ("style" in parseRule) {
|
|
41024
41271
|
return parseRule;
|
|
41025
41272
|
}
|
|
41026
41273
|
return {
|
|
@@ -41085,6 +41332,7 @@ function getSchemaByResolvedExtensions(extensions, editor) {
|
|
|
41085
41332
|
selectable: callOrReturn(getExtensionField(extension, "selectable", context)),
|
|
41086
41333
|
draggable: callOrReturn(getExtensionField(extension, "draggable", context)),
|
|
41087
41334
|
code: callOrReturn(getExtensionField(extension, "code", context)),
|
|
41335
|
+
whitespace: callOrReturn(getExtensionField(extension, "whitespace", context)),
|
|
41088
41336
|
defining: callOrReturn(getExtensionField(extension, "defining", context)),
|
|
41089
41337
|
isolating: callOrReturn(getExtensionField(extension, "isolating", context)),
|
|
41090
41338
|
attrs: Object.fromEntries(extensionAttributes.map((extensionAttribute) => {
|
|
@@ -41640,7 +41888,7 @@ class ExtensionManager {
|
|
|
41640
41888
|
const plugins2 = [];
|
|
41641
41889
|
const addKeyboardShortcuts = getExtensionField(extension, "addKeyboardShortcuts", context);
|
|
41642
41890
|
let defaultBindings = {};
|
|
41643
|
-
if (extension.type === "mark" && extension
|
|
41891
|
+
if (extension.type === "mark" && getExtensionField(extension, "exitable", context)) {
|
|
41644
41892
|
defaultBindings.ArrowRight = () => Mark.handleExit({ editor, mark: extension });
|
|
41645
41893
|
}
|
|
41646
41894
|
if (addKeyboardShortcuts) {
|
|
@@ -41788,14 +42036,10 @@ function mergeDeep(target, source) {
|
|
|
41788
42036
|
const output = { ...target };
|
|
41789
42037
|
if (isPlainObject(target) && isPlainObject(source)) {
|
|
41790
42038
|
Object.keys(source).forEach((key) => {
|
|
41791
|
-
if (isPlainObject(source[key])) {
|
|
41792
|
-
|
|
41793
|
-
Object.assign(output, { [key]: source[key] });
|
|
41794
|
-
} else {
|
|
41795
|
-
output[key] = mergeDeep(target[key], source[key]);
|
|
41796
|
-
}
|
|
42039
|
+
if (isPlainObject(source[key]) && isPlainObject(target[key])) {
|
|
42040
|
+
output[key] = mergeDeep(target[key], source[key]);
|
|
41797
42041
|
} else {
|
|
41798
|
-
|
|
42042
|
+
output[key] = source[key];
|
|
41799
42043
|
}
|
|
41800
42044
|
});
|
|
41801
42045
|
}
|
|
@@ -41834,13 +42078,15 @@ class Extension {
|
|
|
41834
42078
|
return new Extension(config);
|
|
41835
42079
|
}
|
|
41836
42080
|
configure(options = {}) {
|
|
41837
|
-
const extension = this.extend(
|
|
42081
|
+
const extension = this.extend({
|
|
42082
|
+
...this.config,
|
|
42083
|
+
addOptions() {
|
|
42084
|
+
var _a2;
|
|
42085
|
+
return mergeDeep(((_a2 = this.parent) === null || _a2 === void 0 ? void 0 : _a2.call(this)) || {}, options);
|
|
42086
|
+
}
|
|
42087
|
+
});
|
|
42088
|
+
extension.name = this.name;
|
|
41838
42089
|
extension.parent = this.parent;
|
|
41839
|
-
extension.options = mergeDeep(this.options, options);
|
|
41840
|
-
extension.storage = callOrReturn(getExtensionField(extension, "addStorage", {
|
|
41841
|
-
name: extension.name,
|
|
41842
|
-
options: extension.options
|
|
41843
|
-
}));
|
|
41844
42090
|
return extension;
|
|
41845
42091
|
}
|
|
41846
42092
|
extend(extendedConfig = {}) {
|
|
@@ -41848,7 +42094,7 @@ class Extension {
|
|
|
41848
42094
|
extension.parent = this;
|
|
41849
42095
|
this.child = extension;
|
|
41850
42096
|
extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
|
|
41851
|
-
if (extendedConfig.defaultOptions) {
|
|
42097
|
+
if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
|
|
41852
42098
|
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
|
|
41853
42099
|
}
|
|
41854
42100
|
extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
|
|
@@ -42232,13 +42478,47 @@ function createNodeFromContent(content, schema, options) {
|
|
|
42232
42478
|
}
|
|
42233
42479
|
return schema.nodeFromJSON(content);
|
|
42234
42480
|
} catch (error) {
|
|
42481
|
+
if (options.errorOnInvalidContent) {
|
|
42482
|
+
throw new Error("[tiptap error]: Invalid JSON content", { cause: error });
|
|
42483
|
+
}
|
|
42235
42484
|
console.warn("[tiptap warn]: Invalid content.", "Passed value:", content, "Error:", error);
|
|
42236
42485
|
return createNodeFromContent("", schema, options);
|
|
42237
42486
|
}
|
|
42238
42487
|
}
|
|
42239
42488
|
if (isTextContent) {
|
|
42240
|
-
|
|
42241
|
-
|
|
42489
|
+
let schemaToUse = schema;
|
|
42490
|
+
let hasInvalidContent = false;
|
|
42491
|
+
let invalidContent = "";
|
|
42492
|
+
if (options.errorOnInvalidContent) {
|
|
42493
|
+
schemaToUse = new Schema({
|
|
42494
|
+
topNode: schema.spec.topNode,
|
|
42495
|
+
marks: schema.spec.marks,
|
|
42496
|
+
// Prosemirror's schemas are executed such that: the last to execute, matches last
|
|
42497
|
+
// 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
|
|
42498
|
+
nodes: schema.spec.nodes.append({
|
|
42499
|
+
__tiptap__private__unknown__catch__all__node: {
|
|
42500
|
+
content: "inline*",
|
|
42501
|
+
group: "block",
|
|
42502
|
+
parseDOM: [
|
|
42503
|
+
{
|
|
42504
|
+
tag: "*",
|
|
42505
|
+
getAttrs: (e) => {
|
|
42506
|
+
hasInvalidContent = true;
|
|
42507
|
+
invalidContent = typeof e === "string" ? e : e.outerHTML;
|
|
42508
|
+
return null;
|
|
42509
|
+
}
|
|
42510
|
+
}
|
|
42511
|
+
]
|
|
42512
|
+
}
|
|
42513
|
+
})
|
|
42514
|
+
});
|
|
42515
|
+
}
|
|
42516
|
+
const parser = DOMParser.fromSchema(schemaToUse);
|
|
42517
|
+
const response = options.slice ? parser.parseSlice(elementFromString(content), options.parseOptions).content : parser.parse(elementFromString(content), options.parseOptions);
|
|
42518
|
+
if (options.errorOnInvalidContent && hasInvalidContent) {
|
|
42519
|
+
throw new Error("[tiptap error]: Invalid HTML content", { cause: new Error(`Invalid element found: ${invalidContent}`) });
|
|
42520
|
+
}
|
|
42521
|
+
return response;
|
|
42242
42522
|
}
|
|
42243
42523
|
return createNodeFromContent("", schema, options);
|
|
42244
42524
|
}
|
|
@@ -42261,9 +42541,10 @@ function selectionToInsertionEnd(tr2, startLen, bias) {
|
|
|
42261
42541
|
tr2.setSelection(Selection$1.near(tr2.doc.resolve(end2), bias));
|
|
42262
42542
|
}
|
|
42263
42543
|
const isFragment = (nodeOrFragment) => {
|
|
42264
|
-
return
|
|
42544
|
+
return !("type" in nodeOrFragment);
|
|
42265
42545
|
};
|
|
42266
42546
|
const insertContentAt = (position, value, options) => ({ tr: tr2, dispatch, editor }) => {
|
|
42547
|
+
var _a2;
|
|
42267
42548
|
if (dispatch) {
|
|
42268
42549
|
options = {
|
|
42269
42550
|
parseOptions: {},
|
|
@@ -42272,14 +42553,17 @@ const insertContentAt = (position, value, options) => ({ tr: tr2, dispatch, edit
|
|
|
42272
42553
|
applyPasteRules: false,
|
|
42273
42554
|
...options
|
|
42274
42555
|
};
|
|
42275
|
-
|
|
42276
|
-
|
|
42277
|
-
|
|
42278
|
-
|
|
42279
|
-
|
|
42280
|
-
|
|
42281
|
-
|
|
42282
|
-
|
|
42556
|
+
let content;
|
|
42557
|
+
try {
|
|
42558
|
+
content = createNodeFromContent(value, editor.schema, {
|
|
42559
|
+
parseOptions: {
|
|
42560
|
+
preserveWhitespace: "full",
|
|
42561
|
+
...options.parseOptions
|
|
42562
|
+
},
|
|
42563
|
+
errorOnInvalidContent: (_a2 = options.errorOnInvalidContent) !== null && _a2 !== void 0 ? _a2 : editor.options.enableContentCheck
|
|
42564
|
+
});
|
|
42565
|
+
} catch (e) {
|
|
42566
|
+
return false;
|
|
42283
42567
|
}
|
|
42284
42568
|
let { from: from2, to: to2 } = typeof position === "number" ? { from: position, to: position } : { from: position.from, to: position.to };
|
|
42285
42569
|
let isOnlyTextContent = true;
|
|
@@ -42336,7 +42620,7 @@ const joinBackward = () => ({ state: state2, dispatch }) => {
|
|
|
42336
42620
|
const joinForward = () => ({ state: state2, dispatch }) => {
|
|
42337
42621
|
return joinForward$1(state2, dispatch);
|
|
42338
42622
|
};
|
|
42339
|
-
const joinItemBackward = () => ({
|
|
42623
|
+
const joinItemBackward = () => ({ state: state2, dispatch, tr: tr2 }) => {
|
|
42340
42624
|
try {
|
|
42341
42625
|
const point2 = joinPoint(state2.doc, state2.selection.$from.pos, -1);
|
|
42342
42626
|
if (point2 === null || point2 === void 0) {
|
|
@@ -42347,7 +42631,7 @@ const joinItemBackward = () => ({ tr: tr2, state: state2, dispatch }) => {
|
|
|
42347
42631
|
dispatch(tr2);
|
|
42348
42632
|
}
|
|
42349
42633
|
return true;
|
|
42350
|
-
} catch {
|
|
42634
|
+
} catch (e) {
|
|
42351
42635
|
return false;
|
|
42352
42636
|
}
|
|
42353
42637
|
};
|
|
@@ -42565,16 +42849,32 @@ const selectTextblockEnd = () => ({ state: state2, dispatch }) => {
|
|
|
42565
42849
|
const selectTextblockStart = () => ({ state: state2, dispatch }) => {
|
|
42566
42850
|
return selectTextblockStart$1(state2, dispatch);
|
|
42567
42851
|
};
|
|
42568
|
-
function createDocument(content, schema, parseOptions = {}) {
|
|
42569
|
-
return createNodeFromContent(content, schema, {
|
|
42852
|
+
function createDocument(content, schema, parseOptions = {}, options = {}) {
|
|
42853
|
+
return createNodeFromContent(content, schema, {
|
|
42854
|
+
slice: false,
|
|
42855
|
+
parseOptions,
|
|
42856
|
+
errorOnInvalidContent: options.errorOnInvalidContent
|
|
42857
|
+
});
|
|
42570
42858
|
}
|
|
42571
|
-
const setContent$1 = (content, emitUpdate = false, parseOptions = {}) => ({ tr: tr2,
|
|
42859
|
+
const setContent$1 = (content, emitUpdate = false, parseOptions = {}, options = {}) => ({ editor, tr: tr2, dispatch, commands: commands2 }) => {
|
|
42860
|
+
var _a2, _b;
|
|
42572
42861
|
const { doc: doc2 } = tr2;
|
|
42573
|
-
|
|
42862
|
+
if (parseOptions.preserveWhitespace !== "full") {
|
|
42863
|
+
const document2 = createDocument(content, editor.schema, parseOptions, {
|
|
42864
|
+
errorOnInvalidContent: (_a2 = options.errorOnInvalidContent) !== null && _a2 !== void 0 ? _a2 : editor.options.enableContentCheck
|
|
42865
|
+
});
|
|
42866
|
+
if (dispatch) {
|
|
42867
|
+
tr2.replaceWith(0, doc2.content.size, document2).setMeta("preventUpdate", !emitUpdate);
|
|
42868
|
+
}
|
|
42869
|
+
return true;
|
|
42870
|
+
}
|
|
42574
42871
|
if (dispatch) {
|
|
42575
|
-
tr2.
|
|
42872
|
+
tr2.setMeta("preventUpdate", !emitUpdate);
|
|
42576
42873
|
}
|
|
42577
|
-
return
|
|
42874
|
+
return commands2.insertContentAt({ from: 0, to: doc2.content.size }, content, {
|
|
42875
|
+
parseOptions,
|
|
42876
|
+
errorOnInvalidContent: (_b = options.errorOnInvalidContent) !== null && _b !== void 0 ? _b : editor.options.enableContentCheck
|
|
42877
|
+
});
|
|
42578
42878
|
};
|
|
42579
42879
|
function getMarkAttributes(state2, typeOrName) {
|
|
42580
42880
|
const type3 = getMarkType(typeOrName, state2.schema);
|
|
@@ -42777,10 +43077,11 @@ function isList(name, extensions) {
|
|
|
42777
43077
|
return group.split(" ").includes("list");
|
|
42778
43078
|
}
|
|
42779
43079
|
function isNodeEmpty(node) {
|
|
42780
|
-
|
|
42781
|
-
|
|
42782
|
-
|
|
42783
|
-
|
|
43080
|
+
const defaultContent = node.type.createAndFill();
|
|
43081
|
+
if (!defaultContent) {
|
|
43082
|
+
return false;
|
|
43083
|
+
}
|
|
43084
|
+
return node.eq(defaultContent);
|
|
42784
43085
|
}
|
|
42785
43086
|
function isNodeSelection(value) {
|
|
42786
43087
|
return value instanceof NodeSelection;
|
|
@@ -43295,14 +43596,14 @@ var commands = /* @__PURE__ */ Object.freeze({
|
|
|
43295
43596
|
forEach,
|
|
43296
43597
|
insertContent,
|
|
43297
43598
|
insertContentAt,
|
|
43298
|
-
joinUp,
|
|
43299
|
-
joinDown,
|
|
43300
43599
|
joinBackward,
|
|
43600
|
+
joinDown,
|
|
43301
43601
|
joinForward,
|
|
43302
43602
|
joinItemBackward,
|
|
43303
43603
|
joinItemForward,
|
|
43304
43604
|
joinTextblockBackward,
|
|
43305
43605
|
joinTextblockForward,
|
|
43606
|
+
joinUp,
|
|
43306
43607
|
keyboardShortcut,
|
|
43307
43608
|
lift,
|
|
43308
43609
|
liftEmptyBlock,
|
|
@@ -43499,13 +43800,16 @@ const Tabindex = Extension.create({
|
|
|
43499
43800
|
new Plugin({
|
|
43500
43801
|
key: new PluginKey("tabindex"),
|
|
43501
43802
|
props: {
|
|
43502
|
-
attributes: this.editor.isEditable ? { tabindex: "0" } : {}
|
|
43803
|
+
attributes: () => this.editor.isEditable ? { tabindex: "0" } : {}
|
|
43503
43804
|
}
|
|
43504
43805
|
})
|
|
43505
43806
|
];
|
|
43506
43807
|
}
|
|
43507
43808
|
});
|
|
43508
43809
|
class NodePos {
|
|
43810
|
+
get name() {
|
|
43811
|
+
return this.node.type.name;
|
|
43812
|
+
}
|
|
43509
43813
|
constructor(pos, editor, isBlock = false, node = null) {
|
|
43510
43814
|
this.currentNode = null;
|
|
43511
43815
|
this.actualDepth = null;
|
|
@@ -43514,9 +43818,6 @@ class NodePos {
|
|
|
43514
43818
|
this.editor = editor;
|
|
43515
43819
|
this.currentNode = node;
|
|
43516
43820
|
}
|
|
43517
|
-
get name() {
|
|
43518
|
-
return this.node.type.name;
|
|
43519
|
-
}
|
|
43520
43821
|
get node() {
|
|
43521
43822
|
return this.currentNode || this.resolvedPos.node();
|
|
43522
43823
|
}
|
|
@@ -43780,6 +44081,7 @@ let Editor$1 = class Editor2 extends EventEmitter {
|
|
|
43780
44081
|
enableInputRules: true,
|
|
43781
44082
|
enablePasteRules: true,
|
|
43782
44083
|
enableCoreExtensions: true,
|
|
44084
|
+
enableContentCheck: false,
|
|
43783
44085
|
onBeforeCreate: () => null,
|
|
43784
44086
|
onCreate: () => null,
|
|
43785
44087
|
onUpdate: () => null,
|
|
@@ -43787,7 +44089,10 @@ let Editor$1 = class Editor2 extends EventEmitter {
|
|
|
43787
44089
|
onTransaction: () => null,
|
|
43788
44090
|
onFocus: () => null,
|
|
43789
44091
|
onBlur: () => null,
|
|
43790
|
-
onDestroy: () => null
|
|
44092
|
+
onDestroy: () => null,
|
|
44093
|
+
onContentError: ({ error }) => {
|
|
44094
|
+
throw error;
|
|
44095
|
+
}
|
|
43791
44096
|
};
|
|
43792
44097
|
this.isCapturingTransaction = false;
|
|
43793
44098
|
this.capturedTransaction = null;
|
|
@@ -43797,6 +44102,7 @@ let Editor$1 = class Editor2 extends EventEmitter {
|
|
|
43797
44102
|
this.createSchema();
|
|
43798
44103
|
this.on("beforeCreate", this.options.onBeforeCreate);
|
|
43799
44104
|
this.emit("beforeCreate", { editor: this });
|
|
44105
|
+
this.on("contentError", this.options.onContentError);
|
|
43800
44106
|
this.createView();
|
|
43801
44107
|
this.injectCSS();
|
|
43802
44108
|
this.on("create", this.options.onCreate);
|
|
@@ -43950,7 +44256,23 @@ let Editor$1 = class Editor2 extends EventEmitter {
|
|
|
43950
44256
|
* Creates a ProseMirror view.
|
|
43951
44257
|
*/
|
|
43952
44258
|
createView() {
|
|
43953
|
-
|
|
44259
|
+
let doc2;
|
|
44260
|
+
try {
|
|
44261
|
+
doc2 = createDocument(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: this.options.enableContentCheck });
|
|
44262
|
+
} catch (e) {
|
|
44263
|
+
if (!(e instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(e.message)) {
|
|
44264
|
+
throw e;
|
|
44265
|
+
}
|
|
44266
|
+
this.emit("contentError", {
|
|
44267
|
+
editor: this,
|
|
44268
|
+
error: e,
|
|
44269
|
+
disableCollaboration: () => {
|
|
44270
|
+
this.options.extensions = this.options.extensions.filter((extension) => extension.name !== "collaboration");
|
|
44271
|
+
this.createExtensionManager();
|
|
44272
|
+
}
|
|
44273
|
+
});
|
|
44274
|
+
doc2 = createDocument(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: false });
|
|
44275
|
+
}
|
|
43954
44276
|
const selection = resolveFocusPosition(doc2, this.options.autofocus);
|
|
43955
44277
|
this.view = new EditorView(this.options.element, {
|
|
43956
44278
|
...this.options.editorProps,
|
|
@@ -44188,7 +44510,8 @@ function nodeInputRule(config) {
|
|
|
44188
44510
|
tr2.insertText(lastChar, start2 + match2[0].length - 1);
|
|
44189
44511
|
tr2.replaceWith(matchStart, end2, newNode);
|
|
44190
44512
|
} else if (match2[0]) {
|
|
44191
|
-
|
|
44513
|
+
const insertionStart = config.type.isInline ? start2 : start2 - 1;
|
|
44514
|
+
tr2.insert(insertionStart, config.type.create(attributes)).delete(tr2.mapping.map(start2), tr2.mapping.map(end2));
|
|
44192
44515
|
}
|
|
44193
44516
|
tr2.scrollIntoView();
|
|
44194
44517
|
}
|
|
@@ -44273,20 +44596,23 @@ class Mark {
|
|
|
44273
44596
|
return new Mark(config);
|
|
44274
44597
|
}
|
|
44275
44598
|
configure(options = {}) {
|
|
44276
|
-
const extension = this.extend(
|
|
44277
|
-
|
|
44278
|
-
|
|
44279
|
-
|
|
44280
|
-
|
|
44281
|
-
|
|
44599
|
+
const extension = this.extend({
|
|
44600
|
+
...this.config,
|
|
44601
|
+
addOptions() {
|
|
44602
|
+
var _a2;
|
|
44603
|
+
return mergeDeep(((_a2 = this.parent) === null || _a2 === void 0 ? void 0 : _a2.call(this)) || {}, options);
|
|
44604
|
+
}
|
|
44605
|
+
});
|
|
44606
|
+
extension.name = this.name;
|
|
44607
|
+
extension.parent = this.parent;
|
|
44282
44608
|
return extension;
|
|
44283
44609
|
}
|
|
44284
44610
|
extend(extendedConfig = {}) {
|
|
44285
|
-
const extension = new Mark(
|
|
44611
|
+
const extension = new Mark(extendedConfig);
|
|
44286
44612
|
extension.parent = this;
|
|
44287
44613
|
this.child = extension;
|
|
44288
44614
|
extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
|
|
44289
|
-
if (extendedConfig.defaultOptions) {
|
|
44615
|
+
if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
|
|
44290
44616
|
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
|
|
44291
44617
|
}
|
|
44292
44618
|
extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
|
|
@@ -44352,20 +44678,23 @@ let Node$2 = class Node3 {
|
|
|
44352
44678
|
return new Node3(config);
|
|
44353
44679
|
}
|
|
44354
44680
|
configure(options = {}) {
|
|
44355
|
-
const extension = this.extend(
|
|
44356
|
-
|
|
44357
|
-
|
|
44358
|
-
|
|
44359
|
-
|
|
44360
|
-
|
|
44681
|
+
const extension = this.extend({
|
|
44682
|
+
...this.config,
|
|
44683
|
+
addOptions() {
|
|
44684
|
+
var _a2;
|
|
44685
|
+
return mergeDeep(((_a2 = this.parent) === null || _a2 === void 0 ? void 0 : _a2.call(this)) || {}, options);
|
|
44686
|
+
}
|
|
44687
|
+
});
|
|
44688
|
+
extension.name = this.name;
|
|
44689
|
+
extension.parent = this.parent;
|
|
44361
44690
|
return extension;
|
|
44362
44691
|
}
|
|
44363
44692
|
extend(extendedConfig = {}) {
|
|
44364
|
-
const extension = new Node3(
|
|
44693
|
+
const extension = new Node3(extendedConfig);
|
|
44365
44694
|
extension.parent = this;
|
|
44366
44695
|
this.child = extension;
|
|
44367
44696
|
extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
|
|
44368
|
-
if (extendedConfig.defaultOptions) {
|
|
44697
|
+
if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
|
|
44369
44698
|
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
|
|
44370
44699
|
}
|
|
44371
44700
|
extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
|
|
@@ -44900,14 +45229,12 @@ const CodeBlock = Node$2.create({
|
|
|
44900
45229
|
if (!text || !language) {
|
|
44901
45230
|
return false;
|
|
44902
45231
|
}
|
|
44903
|
-
const { tr: tr2 } = view.state;
|
|
44904
|
-
|
|
44905
|
-
|
|
44906
|
-
|
|
44907
|
-
tr2.
|
|
45232
|
+
const { tr: tr2, schema } = view.state;
|
|
45233
|
+
const textNode = schema.text(text.replace(/\r\n?/g, "\n"));
|
|
45234
|
+
tr2.replaceSelectionWith(this.type.create({ language }, textNode));
|
|
45235
|
+
if (tr2.selection.$from.parent.type !== this.type) {
|
|
45236
|
+
tr2.setSelection(TextSelection.near(tr2.doc.resolve(Math.max(0, tr2.selection.from - 2))));
|
|
44908
45237
|
}
|
|
44909
|
-
tr2.setSelection(TextSelection.near(tr2.doc.resolve(Math.max(0, tr2.selection.from - 2))));
|
|
44910
|
-
tr2.insertText(text.replace(/\r\n?/g, "\n"));
|
|
44911
45238
|
tr2.setMeta("paste", true);
|
|
44912
45239
|
view.dispatch(tr2);
|
|
44913
45240
|
return true;
|
|
@@ -45823,13 +46150,13 @@ function applyTransaction(history2, state2, tr2, options) {
|
|
|
45823
46150
|
return history2;
|
|
45824
46151
|
} else if (appended && appended.getMeta(historyKey)) {
|
|
45825
46152
|
if (appended.getMeta(historyKey).redo)
|
|
45826
|
-
return new HistoryState(history2.done.addTransform(tr2, void 0, options, mustPreserveItems(state2)), history2.undone, rangesFor(tr2.mapping.maps
|
|
46153
|
+
return new HistoryState(history2.done.addTransform(tr2, void 0, options, mustPreserveItems(state2)), history2.undone, rangesFor(tr2.mapping.maps), history2.prevTime, history2.prevComposition);
|
|
45827
46154
|
else
|
|
45828
46155
|
return new HistoryState(history2.done, history2.undone.addTransform(tr2, void 0, options, mustPreserveItems(state2)), null, history2.prevTime, history2.prevComposition);
|
|
45829
46156
|
} else if (tr2.getMeta("addToHistory") !== false && !(appended && appended.getMeta("addToHistory") === false)) {
|
|
45830
46157
|
let composition = tr2.getMeta("composition");
|
|
45831
46158
|
let newGroup = history2.prevTime == 0 || !appended && history2.prevComposition != composition && (history2.prevTime < (tr2.time || 0) - options.newGroupDelay || !isAdjacentTo(tr2, history2.prevRanges));
|
|
45832
|
-
let prevRanges = appended ? mapRanges(history2.prevRanges, tr2.mapping) : rangesFor(tr2.mapping.maps
|
|
46159
|
+
let prevRanges = appended ? mapRanges(history2.prevRanges, tr2.mapping) : rangesFor(tr2.mapping.maps);
|
|
45833
46160
|
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);
|
|
45834
46161
|
} else if (rebased = tr2.getMeta("rebased")) {
|
|
45835
46162
|
return new HistoryState(history2.done.rebased(tr2, rebased), history2.undone.rebased(tr2, rebased), mapRanges(history2.prevRanges, tr2.mapping), history2.prevTime, history2.prevComposition);
|
|
@@ -45850,9 +46177,10 @@ function isAdjacentTo(transform, prevRanges) {
|
|
|
45850
46177
|
});
|
|
45851
46178
|
return adjacent;
|
|
45852
46179
|
}
|
|
45853
|
-
function rangesFor(
|
|
46180
|
+
function rangesFor(maps) {
|
|
45854
46181
|
let result2 = [];
|
|
45855
|
-
|
|
46182
|
+
for (let i2 = maps.length - 1; i2 >= 0 && result2.length == 0; i2--)
|
|
46183
|
+
maps[i2].forEach((_from, _to, from2, to2) => result2.push(from2, to2));
|
|
45856
46184
|
return result2;
|
|
45857
46185
|
}
|
|
45858
46186
|
function mapRanges(ranges, mapping) {
|
|
@@ -45866,16 +46194,16 @@ function mapRanges(ranges, mapping) {
|
|
|
45866
46194
|
}
|
|
45867
46195
|
return result2;
|
|
45868
46196
|
}
|
|
45869
|
-
function histTransaction(history2, state2,
|
|
46197
|
+
function histTransaction(history2, state2, redo2) {
|
|
45870
46198
|
let preserveItems = mustPreserveItems(state2);
|
|
45871
46199
|
let histOptions = historyKey.get(state2).spec.config;
|
|
45872
46200
|
let pop = (redo2 ? history2.undone : history2.done).popEvent(state2, preserveItems);
|
|
45873
46201
|
if (!pop)
|
|
45874
|
-
return;
|
|
46202
|
+
return null;
|
|
45875
46203
|
let selection = pop.selection.resolve(pop.transform.doc);
|
|
45876
46204
|
let added = (redo2 ? history2.done : history2.undone).addTransform(pop.transform, state2.selection.getBookmark(), histOptions, preserveItems);
|
|
45877
46205
|
let newHist = new HistoryState(redo2 ? added : pop.remaining, redo2 ? pop.remaining : added, null, 0, -1);
|
|
45878
|
-
|
|
46206
|
+
return pop.transform.setSelection(selection).setMeta(historyKey, { redo: redo2, historyState: newHist });
|
|
45879
46207
|
}
|
|
45880
46208
|
let cachedPreserveItems = false, cachedPreserveItemsPlugins = null;
|
|
45881
46209
|
function mustPreserveItems(state2) {
|
|
@@ -45923,22 +46251,21 @@ function history(config = {}) {
|
|
|
45923
46251
|
}
|
|
45924
46252
|
});
|
|
45925
46253
|
}
|
|
45926
|
-
|
|
45927
|
-
|
|
45928
|
-
|
|
45929
|
-
|
|
45930
|
-
|
|
45931
|
-
|
|
45932
|
-
|
|
45933
|
-
|
|
45934
|
-
|
|
45935
|
-
|
|
45936
|
-
|
|
45937
|
-
|
|
45938
|
-
|
|
45939
|
-
|
|
45940
|
-
|
|
45941
|
-
};
|
|
46254
|
+
function buildCommand(redo2, scroll) {
|
|
46255
|
+
return (state2, dispatch) => {
|
|
46256
|
+
let hist = historyKey.getState(state2);
|
|
46257
|
+
if (!hist || (redo2 ? hist.undone : hist.done).eventCount == 0)
|
|
46258
|
+
return false;
|
|
46259
|
+
if (dispatch) {
|
|
46260
|
+
let tr2 = histTransaction(hist, state2, redo2);
|
|
46261
|
+
if (tr2)
|
|
46262
|
+
dispatch(scroll ? tr2.scrollIntoView() : tr2);
|
|
46263
|
+
}
|
|
46264
|
+
return true;
|
|
46265
|
+
};
|
|
46266
|
+
}
|
|
46267
|
+
const undo = buildCommand(false, true);
|
|
46268
|
+
const redo = buildCommand(true, true);
|
|
45942
46269
|
const History = Extension.create({
|
|
45943
46270
|
name: "history",
|
|
45944
46271
|
addOptions() {
|
|
@@ -45990,10 +46317,20 @@ const HorizontalRule = Node$2.create({
|
|
|
45990
46317
|
addCommands() {
|
|
45991
46318
|
return {
|
|
45992
46319
|
setHorizontalRule: () => ({ chain, state: state2 }) => {
|
|
45993
|
-
const {
|
|
46320
|
+
const { selection } = state2;
|
|
46321
|
+
const { $from: $originFrom, $to: $originTo } = selection;
|
|
45994
46322
|
const currentChain = chain();
|
|
45995
|
-
if ($
|
|
45996
|
-
currentChain.insertContentAt(
|
|
46323
|
+
if ($originFrom.parentOffset === 0) {
|
|
46324
|
+
currentChain.insertContentAt({
|
|
46325
|
+
from: Math.max($originFrom.pos - 1, 0),
|
|
46326
|
+
to: $originTo.pos
|
|
46327
|
+
}, {
|
|
46328
|
+
type: this.name
|
|
46329
|
+
});
|
|
46330
|
+
} else if (isNodeSelection(selection)) {
|
|
46331
|
+
currentChain.insertContentAt($originTo.pos, {
|
|
46332
|
+
type: this.name
|
|
46333
|
+
});
|
|
45997
46334
|
} else {
|
|
45998
46335
|
currentChain.insertContent({ type: this.name });
|
|
45999
46336
|
}
|
|
@@ -46379,11 +46716,11 @@ const StarterKit = Extension.create({
|
|
|
46379
46716
|
addExtensions() {
|
|
46380
46717
|
var _a2, _b, _c, _d, _e2, _f, _g, _h, _j, _k, _l2, _m, _o, _p, _q, _r2, _s, _t2;
|
|
46381
46718
|
const extensions = [];
|
|
46382
|
-
if (this.options.blockquote !== false) {
|
|
46383
|
-
extensions.push(Blockquote.configure((_a2 = this.options) === null || _a2 === void 0 ? void 0 : _a2.blockquote));
|
|
46384
|
-
}
|
|
46385
46719
|
if (this.options.bold !== false) {
|
|
46386
|
-
extensions.push(Bold.configure((
|
|
46720
|
+
extensions.push(Bold.configure((_a2 = this.options) === null || _a2 === void 0 ? void 0 : _a2.bold));
|
|
46721
|
+
}
|
|
46722
|
+
if (this.options.blockquote !== false) {
|
|
46723
|
+
extensions.push(Blockquote.configure((_b = this.options) === null || _b === void 0 ? void 0 : _b.blockquote));
|
|
46387
46724
|
}
|
|
46388
46725
|
if (this.options.bulletList !== false) {
|
|
46389
46726
|
extensions.push(BulletList.configure((_c = this.options) === null || _c === void 0 ? void 0 : _c.bulletList));
|
|
@@ -49190,7 +49527,7 @@ class BubbleMenuView {
|
|
|
49190
49527
|
}
|
|
49191
49528
|
update(view, oldState) {
|
|
49192
49529
|
const { state: state2 } = view;
|
|
49193
|
-
const hasValidSelection = state2.selection
|
|
49530
|
+
const hasValidSelection = state2.selection.from !== state2.selection.to;
|
|
49194
49531
|
if (this.updateDelay > 0 && hasValidSelection) {
|
|
49195
49532
|
this.handleDebouncedUpdate(view, oldState);
|
|
49196
49533
|
return;
|
|
@@ -52342,7 +52679,7 @@ const Table = Node$2.create({
|
|
|
52342
52679
|
insertTable: ({ rows = 3, cols = 3, withHeaderRow = true } = {}) => ({ tr: tr2, dispatch, editor }) => {
|
|
52343
52680
|
const node = createTable$1(editor.schema, rows, cols, withHeaderRow);
|
|
52344
52681
|
if (dispatch) {
|
|
52345
|
-
const offset2 = tr2.selection.
|
|
52682
|
+
const offset2 = tr2.selection.from + 1;
|
|
52346
52683
|
tr2.replaceSelectionWith(node).scrollIntoView().setSelection(TextSelection.near(tr2.doc.resolve(offset2)));
|
|
52347
52684
|
}
|
|
52348
52685
|
return true;
|