@bagelink/vue 0.0.518 → 0.0.524
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/Carousel.vue.d.ts +4 -27
- package/dist/components/Carousel.vue.d.ts.map +1 -1
- package/dist/index.cjs +197 -319
- package/dist/index.mjs +197 -319
- package/dist/style.css +140 -84
- package/dist/utils/BagelFormUtils.d.ts +2 -0
- package/dist/utils/BagelFormUtils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Card.vue +0 -1
- package/src/components/Carousel.vue +117 -134
- package/src/components/ListItem.vue +1 -1
- package/src/components/ListView.vue +1 -1
- package/src/components/TableSchema.vue +3 -3
- package/src/styles/appearance.css +66 -0
- package/src/styles/scrollbar.css +1 -1
- package/src/utils/BagelFormUtils.ts +23 -0
package/dist/index.mjs
CHANGED
|
@@ -110,21 +110,12 @@ function getPaddingObject(padding) {
|
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
112
|
function rectToClientRect$1(rect) {
|
|
113
|
-
const {
|
|
114
|
-
x: x2,
|
|
115
|
-
y: y2,
|
|
116
|
-
width,
|
|
117
|
-
height
|
|
118
|
-
} = rect;
|
|
119
113
|
return {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
bottom: y2 + height,
|
|
126
|
-
x: x2,
|
|
127
|
-
y: y2
|
|
114
|
+
...rect,
|
|
115
|
+
top: rect.y,
|
|
116
|
+
left: rect.x,
|
|
117
|
+
right: rect.x + rect.width,
|
|
118
|
+
bottom: rect.y + rect.height
|
|
128
119
|
};
|
|
129
120
|
}
|
|
130
121
|
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
@@ -295,10 +286,9 @@ async function detectOverflow$1(state2, options) {
|
|
|
295
286
|
strategy
|
|
296
287
|
}));
|
|
297
288
|
const rect = elementContext === "floating" ? {
|
|
289
|
+
...rects.floating,
|
|
298
290
|
x: x2,
|
|
299
|
-
y: y2
|
|
300
|
-
width: rects.floating.width,
|
|
301
|
-
height: rects.floating.height
|
|
291
|
+
y: y2
|
|
302
292
|
} : rects.reference;
|
|
303
293
|
const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
|
|
304
294
|
const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
|
|
@@ -745,16 +735,16 @@ const size = function(options) {
|
|
|
745
735
|
widthSide = side;
|
|
746
736
|
heightSide = alignment === "end" ? "top" : "bottom";
|
|
747
737
|
}
|
|
748
|
-
const
|
|
749
|
-
const
|
|
750
|
-
const overflowAvailableHeight = min$3(height - overflow[heightSide], maximumClippingHeight);
|
|
751
|
-
const overflowAvailableWidth = min$3(width - overflow[widthSide], maximumClippingWidth);
|
|
738
|
+
const overflowAvailableHeight = height - overflow[heightSide];
|
|
739
|
+
const overflowAvailableWidth = width - overflow[widthSide];
|
|
752
740
|
const noShift = !state2.middlewareData.shift;
|
|
753
741
|
let availableHeight = overflowAvailableHeight;
|
|
754
742
|
let availableWidth = overflowAvailableWidth;
|
|
755
743
|
if (isYAxis) {
|
|
744
|
+
const maximumClippingWidth = width - overflow.left - overflow.right;
|
|
756
745
|
availableWidth = alignment || noShift ? min$3(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
|
|
757
746
|
} else {
|
|
747
|
+
const maximumClippingHeight = height - overflow.top - overflow.bottom;
|
|
758
748
|
availableHeight = alignment || noShift ? min$3(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
|
|
759
749
|
}
|
|
760
750
|
if (noShift && !alignment) {
|
|
@@ -5128,6 +5118,7 @@ function txtField(id, label, options) {
|
|
|
5128
5118
|
required: options == null ? void 0 : options.required,
|
|
5129
5119
|
id,
|
|
5130
5120
|
label,
|
|
5121
|
+
disabled: options == null ? void 0 : options.disabled,
|
|
5131
5122
|
placeholder: options == null ? void 0 : options.placeholder,
|
|
5132
5123
|
defaultValue: options == null ? void 0 : options.defaultValue,
|
|
5133
5124
|
attrs: {
|
|
@@ -5163,6 +5154,20 @@ function checkField(id, label, options) {
|
|
|
5163
5154
|
label
|
|
5164
5155
|
};
|
|
5165
5156
|
}
|
|
5157
|
+
function dateField(id, label, options) {
|
|
5158
|
+
return {
|
|
5159
|
+
$el: "date",
|
|
5160
|
+
class: options == null ? void 0 : options.class,
|
|
5161
|
+
required: options == null ? void 0 : options.required,
|
|
5162
|
+
id,
|
|
5163
|
+
disabled: options == null ? void 0 : options.disabled,
|
|
5164
|
+
label,
|
|
5165
|
+
defaultValue: options == null ? void 0 : options.defaultValue,
|
|
5166
|
+
attrs: {
|
|
5167
|
+
disabled: options == null ? void 0 : options.disabled
|
|
5168
|
+
}
|
|
5169
|
+
};
|
|
5170
|
+
}
|
|
5166
5171
|
function numField(id, label, options) {
|
|
5167
5172
|
return {
|
|
5168
5173
|
$el: "text",
|
|
@@ -5171,6 +5176,7 @@ function numField(id, label, options) {
|
|
|
5171
5176
|
defaultValue: options == null ? void 0 : options.defaultValue,
|
|
5172
5177
|
id,
|
|
5173
5178
|
label,
|
|
5179
|
+
disabled: options == null ? void 0 : options.disabled,
|
|
5174
5180
|
placeholder: options == null ? void 0 : options.placeholder,
|
|
5175
5181
|
helptext: options == null ? void 0 : options.helptext,
|
|
5176
5182
|
attrs: {
|
|
@@ -5193,6 +5199,7 @@ function frmRow(...children2) {
|
|
|
5193
5199
|
const bagelFormUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5194
5200
|
__proto__: null,
|
|
5195
5201
|
checkField,
|
|
5202
|
+
dateField,
|
|
5196
5203
|
frmRow,
|
|
5197
5204
|
numField,
|
|
5198
5205
|
richText,
|
|
@@ -5898,7 +5905,7 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
|
5898
5905
|
});
|
|
5899
5906
|
const AccordionItem = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__scopeId", "data-v-b862dfb8"]]);
|
|
5900
5907
|
const _sfc_main$G = {};
|
|
5901
|
-
const _hoisted_1$D = { class: "list-wrap bgl_card thin grid overflow-hidden h-100
|
|
5908
|
+
const _hoisted_1$D = { class: "list-wrap bgl_card thin grid overflow-hidden h-100 pt-0 pb-05 px-0" };
|
|
5902
5909
|
const _hoisted_2$u = { class: "p-1" };
|
|
5903
5910
|
const _hoisted_3$k = { class: "list-content auto-flow-rows align-items-start overflow-y h-100" };
|
|
5904
5911
|
function _sfc_render$2(_ctx, _cache) {
|
|
@@ -5912,7 +5919,7 @@ function _sfc_render$2(_ctx, _cache) {
|
|
|
5912
5919
|
]);
|
|
5913
5920
|
}
|
|
5914
5921
|
const ListView = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["render", _sfc_render$2]]);
|
|
5915
|
-
const _hoisted_1$C = { class: "no-margin ellipsis line-height-14" };
|
|
5922
|
+
const _hoisted_1$C = { class: "no-margin ellipsis line-height-14 pb-025" };
|
|
5916
5923
|
const _hoisted_2$t = { class: "txt12 no-margin txt-gray ellipsis" };
|
|
5917
5924
|
const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
5918
5925
|
__name: "ListItem",
|
|
@@ -6143,7 +6150,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
6143
6150
|
};
|
|
6144
6151
|
}
|
|
6145
6152
|
});
|
|
6146
|
-
const TableSchema = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-
|
|
6153
|
+
const TableSchema = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-8113163b"]]);
|
|
6147
6154
|
const _sfc_main$C = {};
|
|
6148
6155
|
const _hoisted_1$z = { class: "flex space-between" };
|
|
6149
6156
|
function _sfc_render$1(_ctx, _cache) {
|
|
@@ -6515,28 +6522,37 @@ const _hoisted_2$n = { class: "Handlers" };
|
|
|
6515
6522
|
const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
6516
6523
|
__name: "Carousel",
|
|
6517
6524
|
props: {
|
|
6518
|
-
autoHeight: {
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6525
|
+
autoHeight: {
|
|
6526
|
+
type: Boolean,
|
|
6527
|
+
default: false
|
|
6528
|
+
},
|
|
6529
|
+
allowScroll: {
|
|
6530
|
+
type: Boolean,
|
|
6531
|
+
default: true
|
|
6532
|
+
},
|
|
6533
|
+
freeDrag: {
|
|
6534
|
+
type: Boolean,
|
|
6535
|
+
default: true
|
|
6536
|
+
},
|
|
6537
|
+
items: {
|
|
6538
|
+
type: Number,
|
|
6539
|
+
default: 4
|
|
6540
|
+
},
|
|
6541
|
+
index: {
|
|
6542
|
+
type: Number,
|
|
6543
|
+
default: 0
|
|
6544
|
+
}
|
|
6526
6545
|
},
|
|
6527
6546
|
emits: ["update:index"],
|
|
6528
6547
|
setup(__props, { emit: __emit }) {
|
|
6529
6548
|
const props2 = __props;
|
|
6530
6549
|
const emit2 = __emit;
|
|
6531
|
-
const bglSlider = ref(
|
|
6550
|
+
const bglSlider = ref();
|
|
6532
6551
|
let activeSlideIndex = ref(0);
|
|
6533
6552
|
let isDragging = ref(false);
|
|
6534
6553
|
let startX = ref(0);
|
|
6535
6554
|
let scrollLeft = ref(0);
|
|
6536
6555
|
let isPressed = ref(false);
|
|
6537
|
-
let yHeight = ref("auto");
|
|
6538
|
-
let autoplayInterval = ref(null);
|
|
6539
|
-
let originalSlideCount = ref(0);
|
|
6540
6556
|
function disableDrag() {
|
|
6541
6557
|
var _a2, _b;
|
|
6542
6558
|
(_a2 = bglSlider.value) == null ? void 0 : _a2.querySelectorAll("img").forEach((e) => {
|
|
@@ -6544,40 +6560,36 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
6544
6560
|
});
|
|
6545
6561
|
for (const e of ((_b = bglSlider.value) == null ? void 0 : _b.children) || []) {
|
|
6546
6562
|
e.setAttribute("draggable", "false");
|
|
6547
|
-
e.addEventListener("click", (
|
|
6563
|
+
e.addEventListener("click", (e22) => e22.preventDefault());
|
|
6548
6564
|
}
|
|
6549
6565
|
}
|
|
6566
|
+
let yHeight = ref("auto");
|
|
6550
6567
|
function evalHeight() {
|
|
6551
6568
|
if (!props2.autoHeight || !bglSlider.value) return;
|
|
6552
|
-
const
|
|
6569
|
+
const slidChildren = bglSlider.value.children[activeSlideIndex.value].children;
|
|
6570
|
+
const height = Array.from(slidChildren).map((el) => el.clientHeight).reduce((a2, b2) => a2 + b2, 0);
|
|
6553
6571
|
yHeight.value = `${height}px`;
|
|
6554
6572
|
}
|
|
6555
|
-
function goToSlide(index2
|
|
6556
|
-
if (!bglSlider.value) return;
|
|
6557
|
-
|
|
6558
|
-
if (index2 >= originalSlideCount.value) {
|
|
6559
|
-
index2 = index2 % originalSlideCount.value;
|
|
6560
|
-
behavior = "auto";
|
|
6561
|
-
} else if (index2 < 0) {
|
|
6562
|
-
index2 = originalSlideCount.value - -index2 % originalSlideCount.value;
|
|
6563
|
-
behavior = "auto";
|
|
6564
|
-
}
|
|
6565
|
-
}
|
|
6573
|
+
function goToSlide(index2) {
|
|
6574
|
+
if (!bglSlider.value || index2 < 0 || index2 > bglSlider.value.children.length - 1) return;
|
|
6575
|
+
const slider = bglSlider.value;
|
|
6566
6576
|
const isRTL = getComputedStyle(bglSlider.value).direction === "rtl";
|
|
6567
|
-
const scrollX =
|
|
6568
|
-
|
|
6577
|
+
const scrollX = slider.offsetWidth * index2 * (isRTL ? -1 : 1);
|
|
6578
|
+
slider.scrollTo({ left: scrollX, behavior: "smooth" });
|
|
6569
6579
|
activeSlideIndex.value = index2;
|
|
6570
6580
|
evalHeight();
|
|
6571
6581
|
}
|
|
6572
|
-
watch(() => props2.index,
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6582
|
+
watch(() => props2.index, goToSlide);
|
|
6583
|
+
watch(
|
|
6584
|
+
() => activeSlideIndex.value,
|
|
6585
|
+
(index2) => {
|
|
6586
|
+
emit2("update:index", index2);
|
|
6587
|
+
}
|
|
6588
|
+
);
|
|
6578
6589
|
function scrollEnd() {
|
|
6579
|
-
|
|
6580
|
-
|
|
6590
|
+
const slider = bglSlider.value;
|
|
6591
|
+
if (!slider || props2.items !== 1) return;
|
|
6592
|
+
const nextSlide = Math.round(slider.scrollLeft / slider.offsetWidth);
|
|
6581
6593
|
goToSlide(nextSlide);
|
|
6582
6594
|
}
|
|
6583
6595
|
function stopDragging(e) {
|
|
@@ -6585,8 +6597,11 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
6585
6597
|
const slider = bglSlider.value;
|
|
6586
6598
|
if (!slider) return;
|
|
6587
6599
|
const isDragForward = startX.value > e.pageX + slider.offsetLeft;
|
|
6588
|
-
|
|
6600
|
+
if (isDragForward)
|
|
6601
|
+
activeSlideIndex.value = Math.ceil(slider.scrollLeft / slider.offsetWidth);
|
|
6602
|
+
else activeSlideIndex.value = Math.floor(slider.scrollLeft / slider.offsetWidth);
|
|
6589
6603
|
if (props2.items === 1) goToSlide(activeSlideIndex.value);
|
|
6604
|
+
startX.value = 0;
|
|
6590
6605
|
document.removeEventListener("mousemove", move);
|
|
6591
6606
|
document.removeEventListener("mouseup", stopDragging);
|
|
6592
6607
|
document.removeEventListener("dragend", stopDragging);
|
|
@@ -6595,9 +6610,11 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
6595
6610
|
function move(e) {
|
|
6596
6611
|
if (!bglSlider.value) return;
|
|
6597
6612
|
const x2 = e.pageX - bglSlider.value.offsetLeft;
|
|
6598
|
-
|
|
6613
|
+
const walk = x2 - startX.value;
|
|
6614
|
+
if (walk > 20 || walk < -20) isDragging.value = true;
|
|
6599
6615
|
if (!isDragging.value) return;
|
|
6600
|
-
|
|
6616
|
+
const scroll = x2 - startX.value;
|
|
6617
|
+
bglSlider.value.scrollLeft = scrollLeft.value - scroll;
|
|
6601
6618
|
}
|
|
6602
6619
|
function startDragging(e) {
|
|
6603
6620
|
if (e.button !== 0 || !props2.freeDrag || !bglSlider.value) return;
|
|
@@ -6609,87 +6626,69 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
6609
6626
|
document.addEventListener("dragend", stopDragging);
|
|
6610
6627
|
}
|
|
6611
6628
|
function next() {
|
|
6612
|
-
if (bglSlider.value)
|
|
6613
|
-
|
|
6614
|
-
|
|
6629
|
+
if (!bglSlider.value) return;
|
|
6630
|
+
const slideCount = bglSlider.value.children.length;
|
|
6631
|
+
const isLastSlide = activeSlideIndex.value >= slideCount - 1;
|
|
6632
|
+
if (isLastSlide) goToSlide(0);
|
|
6633
|
+
else goToSlide(activeSlideIndex.value + 1);
|
|
6615
6634
|
}
|
|
6616
6635
|
function prev() {
|
|
6617
|
-
if (bglSlider.value)
|
|
6618
|
-
|
|
6619
|
-
|
|
6636
|
+
if (!bglSlider.value) return;
|
|
6637
|
+
const slideCount = bglSlider.value.children.length;
|
|
6638
|
+
if (activeSlideIndex.value === 0) goToSlide(slideCount - 1);
|
|
6639
|
+
else goToSlide(activeSlideIndex.value - 1);
|
|
6620
6640
|
}
|
|
6621
6641
|
function evalWidth() {
|
|
6622
|
-
if (bglSlider.value)
|
|
6623
|
-
|
|
6624
|
-
function startAutoplay() {
|
|
6625
|
-
if (props2.autoplay) {
|
|
6626
|
-
autoplayInterval.value = setInterval(next, props2.autoplaySpeed);
|
|
6627
|
-
}
|
|
6628
|
-
}
|
|
6629
|
-
function stopAutoplay() {
|
|
6630
|
-
if (autoplayInterval.value) {
|
|
6631
|
-
clearInterval(autoplayInterval.value);
|
|
6632
|
-
autoplayInterval.value = null;
|
|
6633
|
-
}
|
|
6634
|
-
}
|
|
6635
|
-
function cloneSlides() {
|
|
6636
|
-
if (!bglSlider.value || !props2.loop) return;
|
|
6637
|
-
const slides = Array.from(bglSlider.value.children);
|
|
6638
|
-
originalSlideCount.value = slides.length;
|
|
6639
|
-
slides.forEach((slide) => {
|
|
6640
|
-
const clone2 = slide.cloneNode(true);
|
|
6641
|
-
bglSlider.value.appendChild(clone2);
|
|
6642
|
-
});
|
|
6643
|
-
slides.forEach((slide) => {
|
|
6644
|
-
const clone2 = slide.cloneNode(true);
|
|
6645
|
-
bglSlider.value.insertBefore(clone2, bglSlider.value.firstChild);
|
|
6646
|
-
});
|
|
6642
|
+
if (!bglSlider.value) return;
|
|
6643
|
+
goToSlide(activeSlideIndex.value);
|
|
6647
6644
|
}
|
|
6648
6645
|
onMounted(() => {
|
|
6649
|
-
cloneSlides();
|
|
6650
6646
|
window.addEventListener("resize", evalWidth);
|
|
6651
6647
|
evalHeight();
|
|
6652
6648
|
disableDrag();
|
|
6653
|
-
startAutoplay();
|
|
6654
6649
|
});
|
|
6655
6650
|
onUnmounted(() => {
|
|
6656
6651
|
window.removeEventListener("resize", evalWidth);
|
|
6657
|
-
stopAutoplay();
|
|
6658
6652
|
});
|
|
6659
6653
|
return (_ctx, _cache) => {
|
|
6660
6654
|
return openBlock(), createElementBlock("div", {
|
|
6661
|
-
class: normalizeClass(["BglCarousel", { autoHeight:
|
|
6655
|
+
class: normalizeClass(["BglCarousel", { autoHeight: __props.autoHeight }]),
|
|
6662
6656
|
style: normalizeStyle({ height: unref(yHeight) })
|
|
6663
6657
|
}, [
|
|
6664
6658
|
createElementVNode("div", {
|
|
6665
6659
|
ref_key: "bglSlider",
|
|
6666
6660
|
ref: bglSlider,
|
|
6667
|
-
class: normalizeClass([
|
|
6668
|
-
|
|
6669
|
-
|
|
6661
|
+
class: normalizeClass([{
|
|
6662
|
+
dragging: unref(isDragging),
|
|
6663
|
+
clicking: unref(isPressed),
|
|
6664
|
+
[`slides-${__props.items}`]: true,
|
|
6665
|
+
allowScroll: __props.allowScroll
|
|
6666
|
+
}, "bgl-slider"]),
|
|
6670
6667
|
onScrollend: scrollEnd,
|
|
6671
|
-
onMousedown: startDragging
|
|
6672
|
-
onMouseenter: stopAutoplay,
|
|
6673
|
-
onMouseleave: startAutoplay,
|
|
6674
|
-
onFocusin: stopAutoplay,
|
|
6675
|
-
onFocusout: startAutoplay
|
|
6668
|
+
onMousedown: startDragging
|
|
6676
6669
|
}, [
|
|
6677
6670
|
unref(isDragging) ? (openBlock(), createElementBlock("div", _hoisted_1$t)) : createCommentVNode("", true),
|
|
6678
6671
|
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
6679
6672
|
], 34),
|
|
6680
6673
|
createElementVNode("div", _hoisted_2$n, [
|
|
6681
6674
|
createElementVNode("span", { onClick: prev }, [
|
|
6682
|
-
renderSlot(_ctx.$slots, "prev", {
|
|
6675
|
+
renderSlot(_ctx.$slots, "prev", {
|
|
6676
|
+
prev,
|
|
6677
|
+
index: unref(activeSlideIndex)
|
|
6678
|
+
}, void 0, true)
|
|
6683
6679
|
]),
|
|
6684
6680
|
createElementVNode("span", { onClick: next }, [
|
|
6685
|
-
renderSlot(_ctx.$slots, "next", {
|
|
6681
|
+
renderSlot(_ctx.$slots, "next", {
|
|
6682
|
+
next,
|
|
6683
|
+
index: unref(activeSlideIndex)
|
|
6684
|
+
}, void 0, true)
|
|
6686
6685
|
])
|
|
6687
6686
|
])
|
|
6688
6687
|
], 6);
|
|
6689
6688
|
};
|
|
6690
6689
|
}
|
|
6691
6690
|
});
|
|
6692
|
-
const Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__scopeId", "data-v-
|
|
6691
|
+
const Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__scopeId", "data-v-1f9c6644"]]);
|
|
6693
6692
|
const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
6694
6693
|
__name: "ModalConfirm",
|
|
6695
6694
|
props: {
|
|
@@ -30755,7 +30754,7 @@ let NodeType$1 = class NodeType2 {
|
|
|
30755
30754
|
}
|
|
30756
30755
|
/**
|
|
30757
30756
|
Returns true if the given fragment is valid content for this node
|
|
30758
|
-
type.
|
|
30757
|
+
type with the given attributes.
|
|
30759
30758
|
*/
|
|
30760
30759
|
validContent(content) {
|
|
30761
30760
|
let result2 = this.contentMatch.matchFragment(content);
|
|
@@ -30899,7 +30898,6 @@ class Schema {
|
|
|
30899
30898
|
Construct a schema from a schema [specification](https://prosemirror.net/docs/ref/#model.SchemaSpec).
|
|
30900
30899
|
*/
|
|
30901
30900
|
constructor(spec) {
|
|
30902
|
-
this.linebreakReplacement = null;
|
|
30903
30901
|
this.cached = /* @__PURE__ */ Object.create(null);
|
|
30904
30902
|
let instanceSpec = this.spec = {};
|
|
30905
30903
|
for (let prop3 in spec)
|
|
@@ -30913,13 +30911,6 @@ class Schema {
|
|
|
30913
30911
|
let type3 = this.nodes[prop3], contentExpr = type3.spec.content || "", markExpr = type3.spec.marks;
|
|
30914
30912
|
type3.contentMatch = contentExprCache[contentExpr] || (contentExprCache[contentExpr] = ContentMatch.parse(contentExpr, this.nodes));
|
|
30915
30913
|
type3.inlineContent = type3.contentMatch.inlineContent;
|
|
30916
|
-
if (type3.spec.linebreakReplacement) {
|
|
30917
|
-
if (this.linebreakReplacement)
|
|
30918
|
-
throw new RangeError("Multiple linebreak nodes defined");
|
|
30919
|
-
if (!type3.isInline || !type3.isLeaf)
|
|
30920
|
-
throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");
|
|
30921
|
-
this.linebreakReplacement = type3;
|
|
30922
|
-
}
|
|
30923
30914
|
type3.markSet = markExpr == "_" ? null : markExpr ? gatherMarks(this, markExpr.split(" ")) : markExpr == "" || !type3.inlineContent ? [] : null;
|
|
30924
30915
|
}
|
|
30925
30916
|
for (let prop3 in this.marks) {
|
|
@@ -31004,12 +30995,6 @@ function gatherMarks(schema, marks) {
|
|
|
31004
30995
|
}
|
|
31005
30996
|
return found2;
|
|
31006
30997
|
}
|
|
31007
|
-
function isTagRule(rule) {
|
|
31008
|
-
return rule.tag != null;
|
|
31009
|
-
}
|
|
31010
|
-
function isStyleRule(rule) {
|
|
31011
|
-
return rule.style != null;
|
|
31012
|
-
}
|
|
31013
30998
|
class DOMParser {
|
|
31014
30999
|
/**
|
|
31015
31000
|
Create a parser that targets the given schema, using the given
|
|
@@ -31021,9 +31006,9 @@ class DOMParser {
|
|
|
31021
31006
|
this.tags = [];
|
|
31022
31007
|
this.styles = [];
|
|
31023
31008
|
rules.forEach((rule) => {
|
|
31024
|
-
if (
|
|
31009
|
+
if (rule.tag)
|
|
31025
31010
|
this.tags.push(rule);
|
|
31026
|
-
else if (
|
|
31011
|
+
else if (rule.style)
|
|
31027
31012
|
this.styles.push(rule);
|
|
31028
31013
|
});
|
|
31029
31014
|
this.normalizeLists = !this.tags.some((r2) => {
|
|
@@ -31284,10 +31269,10 @@ class ParseContext {
|
|
|
31284
31269
|
this.addElement(dom);
|
|
31285
31270
|
}
|
|
31286
31271
|
withStyleRules(dom, f2) {
|
|
31287
|
-
let style2 = dom.style;
|
|
31288
|
-
if (!style2
|
|
31272
|
+
let style2 = dom.getAttribute("style");
|
|
31273
|
+
if (!style2)
|
|
31289
31274
|
return f2();
|
|
31290
|
-
let marks = this.readStyles(
|
|
31275
|
+
let marks = this.readStyles(parseStyles(style2));
|
|
31291
31276
|
if (!marks)
|
|
31292
31277
|
return;
|
|
31293
31278
|
let [addMarks, removeMarks] = marks, top2 = this.top;
|
|
@@ -31381,10 +31366,9 @@ class ParseContext {
|
|
|
31381
31366
|
// had a rule with `ignore` set.
|
|
31382
31367
|
readStyles(styles) {
|
|
31383
31368
|
let add2 = Mark$1.none, remove2 = Mark$1.none;
|
|
31384
|
-
for (let i2 = 0
|
|
31385
|
-
let name = styles.item(i2);
|
|
31369
|
+
for (let i2 = 0; i2 < styles.length; i2 += 2) {
|
|
31386
31370
|
for (let after = void 0; ; ) {
|
|
31387
|
-
let rule = this.parser.matchStyle(
|
|
31371
|
+
let rule = this.parser.matchStyle(styles[i2], styles[i2 + 1], this, after);
|
|
31388
31372
|
if (!rule)
|
|
31389
31373
|
break;
|
|
31390
31374
|
if (rule.ignore)
|
|
@@ -31671,6 +31655,12 @@ function normalizeList(dom) {
|
|
|
31671
31655
|
function matches(dom, selector2) {
|
|
31672
31656
|
return (dom.matches || dom.msMatchesSelector || dom.webkitMatchesSelector || dom.mozMatchesSelector).call(dom, selector2);
|
|
31673
31657
|
}
|
|
31658
|
+
function parseStyles(style2) {
|
|
31659
|
+
let re2 = /\s*([\w-]+)\s*:\s*([^;]+)/g, m2, result2 = [];
|
|
31660
|
+
while (m2 = re2.exec(style2))
|
|
31661
|
+
result2.push(m2[1], m2[2].trim());
|
|
31662
|
+
return result2;
|
|
31663
|
+
}
|
|
31674
31664
|
function copy$2(obj) {
|
|
31675
31665
|
let copy2 = {};
|
|
31676
31666
|
for (let prop3 in obj)
|
|
@@ -32538,8 +32528,7 @@ class ReplaceAroundStep extends Step$1 {
|
|
|
32538
32528
|
}
|
|
32539
32529
|
map(mapping) {
|
|
32540
32530
|
let from2 = mapping.mapResult(this.from, 1), to2 = mapping.mapResult(this.to, -1);
|
|
32541
|
-
let gapFrom =
|
|
32542
|
-
let gapTo = this.to == this.gapTo ? to2.pos : mapping.map(this.gapTo, 1);
|
|
32531
|
+
let gapFrom = mapping.map(this.gapFrom, -1), gapTo = mapping.map(this.gapTo, 1);
|
|
32543
32532
|
if (from2.deletedAcross && to2.deletedAcross || gapFrom < from2.pos || gapTo > to2.pos)
|
|
32544
32533
|
return null;
|
|
32545
32534
|
return new ReplaceAroundStep(from2.pos, to2.pos, gapFrom, gapTo, this.slice, this.insert, this.structure);
|
|
@@ -32652,7 +32641,7 @@ function removeMark(tr2, from2, to2, mark) {
|
|
|
32652
32641
|
});
|
|
32653
32642
|
matched.forEach((m2) => tr2.step(new RemoveMarkStep(m2.from, m2.to, m2.style)));
|
|
32654
32643
|
}
|
|
32655
|
-
function clearIncompatible(tr2, pos, parentType, match2 = parentType.contentMatch
|
|
32644
|
+
function clearIncompatible(tr2, pos, parentType, match2 = parentType.contentMatch) {
|
|
32656
32645
|
let node = tr2.doc.nodeAt(pos);
|
|
32657
32646
|
let replSteps = [], cur = pos + 1;
|
|
32658
32647
|
for (let i2 = 0; i2 < node.childCount; i2++) {
|
|
@@ -32665,7 +32654,7 @@ function clearIncompatible(tr2, pos, parentType, match2 = parentType.contentMatc
|
|
|
32665
32654
|
for (let j = 0; j < child.marks.length; j++)
|
|
32666
32655
|
if (!parentType.allowsMarkType(child.marks[j].type))
|
|
32667
32656
|
tr2.step(new RemoveMarkStep(cur, end2, child.marks[j]));
|
|
32668
|
-
if (
|
|
32657
|
+
if (child.isText && !parentType.spec.code) {
|
|
32669
32658
|
let m2, newline = /\r?\n|\r/g, slice4;
|
|
32670
32659
|
while (m2 = newline.exec(child.text)) {
|
|
32671
32660
|
if (!slice4)
|
|
@@ -32774,45 +32763,14 @@ function setBlockType$1(tr2, from2, to2, type3, attrs) {
|
|
|
32774
32763
|
let mapFrom = tr2.steps.length;
|
|
32775
32764
|
tr2.doc.nodesBetween(from2, to2, (node, pos) => {
|
|
32776
32765
|
if (node.isTextblock && !node.hasMarkup(type3, attrs) && canChangeType(tr2.doc, tr2.mapping.slice(mapFrom).map(pos), type3)) {
|
|
32777
|
-
|
|
32778
|
-
if (type3.schema.linebreakReplacement) {
|
|
32779
|
-
let pre = type3.whitespace == "pre", supportLinebreak = !!type3.contentMatch.matchType(type3.schema.linebreakReplacement);
|
|
32780
|
-
if (pre && !supportLinebreak)
|
|
32781
|
-
convertNewlines = false;
|
|
32782
|
-
else if (!pre && supportLinebreak)
|
|
32783
|
-
convertNewlines = true;
|
|
32784
|
-
}
|
|
32785
|
-
if (convertNewlines === false)
|
|
32786
|
-
replaceLinebreaks(tr2, node, pos, mapFrom);
|
|
32787
|
-
clearIncompatible(tr2, tr2.mapping.slice(mapFrom).map(pos, 1), type3, void 0, convertNewlines === null);
|
|
32766
|
+
tr2.clearIncompatible(tr2.mapping.slice(mapFrom).map(pos, 1), type3);
|
|
32788
32767
|
let mapping = tr2.mapping.slice(mapFrom);
|
|
32789
32768
|
let startM = mapping.map(pos, 1), endM = mapping.map(pos + node.nodeSize, 1);
|
|
32790
32769
|
tr2.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new Slice(Fragment.from(type3.create(attrs, null, node.marks)), 0, 0), 1, true));
|
|
32791
|
-
if (convertNewlines === true)
|
|
32792
|
-
replaceNewlines(tr2, node, pos, mapFrom);
|
|
32793
32770
|
return false;
|
|
32794
32771
|
}
|
|
32795
32772
|
});
|
|
32796
32773
|
}
|
|
32797
|
-
function replaceNewlines(tr2, node, pos, mapFrom) {
|
|
32798
|
-
node.forEach((child, offset2) => {
|
|
32799
|
-
if (child.isText) {
|
|
32800
|
-
let m2, newline = /\r?\n|\r/g;
|
|
32801
|
-
while (m2 = newline.exec(child.text)) {
|
|
32802
|
-
let start2 = tr2.mapping.slice(mapFrom).map(pos + 1 + offset2 + m2.index);
|
|
32803
|
-
tr2.replaceWith(start2, start2 + 1, node.type.schema.linebreakReplacement.create());
|
|
32804
|
-
}
|
|
32805
|
-
}
|
|
32806
|
-
});
|
|
32807
|
-
}
|
|
32808
|
-
function replaceLinebreaks(tr2, node, pos, mapFrom) {
|
|
32809
|
-
node.forEach((child, offset2) => {
|
|
32810
|
-
if (child.type == child.type.schema.linebreakReplacement) {
|
|
32811
|
-
let start2 = tr2.mapping.slice(mapFrom).map(pos + 1 + offset2);
|
|
32812
|
-
tr2.replaceWith(start2, start2 + 1, node.type.schema.text("\n"));
|
|
32813
|
-
}
|
|
32814
|
-
});
|
|
32815
|
-
}
|
|
32816
32774
|
function canChangeType(doc2, pos, type3) {
|
|
32817
32775
|
let $pos = doc2.resolve(pos), index2 = $pos.index();
|
|
32818
32776
|
return $pos.parent.canReplaceWith(index2, index2 + 1, type3);
|
|
@@ -34578,9 +34536,6 @@ const textRange = function(node, from2, to2) {
|
|
|
34578
34536
|
range2.setStart(node, from2 || 0);
|
|
34579
34537
|
return range2;
|
|
34580
34538
|
};
|
|
34581
|
-
const clearReusedRange = function() {
|
|
34582
|
-
reusedRange = null;
|
|
34583
|
-
};
|
|
34584
34539
|
const isEquivalentPosition = function(node, off2, targetNode, targetOff) {
|
|
34585
34540
|
return targetNode && (scanFor(node, off2, targetNode, targetOff, -1) || scanFor(node, off2, targetNode, targetOff, 1));
|
|
34586
34541
|
};
|
|
@@ -34608,40 +34563,6 @@ function scanFor(node, off2, targetNode, targetOff, dir) {
|
|
|
34608
34563
|
function nodeSize(node) {
|
|
34609
34564
|
return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length;
|
|
34610
34565
|
}
|
|
34611
|
-
function textNodeBefore$1(node, offset2) {
|
|
34612
|
-
for (; ; ) {
|
|
34613
|
-
if (node.nodeType == 3 && offset2)
|
|
34614
|
-
return node;
|
|
34615
|
-
if (node.nodeType == 1 && offset2 > 0) {
|
|
34616
|
-
if (node.contentEditable == "false")
|
|
34617
|
-
return null;
|
|
34618
|
-
node = node.childNodes[offset2 - 1];
|
|
34619
|
-
offset2 = nodeSize(node);
|
|
34620
|
-
} else if (node.parentNode && !hasBlockDesc(node)) {
|
|
34621
|
-
offset2 = domIndex(node);
|
|
34622
|
-
node = node.parentNode;
|
|
34623
|
-
} else {
|
|
34624
|
-
return null;
|
|
34625
|
-
}
|
|
34626
|
-
}
|
|
34627
|
-
}
|
|
34628
|
-
function textNodeAfter$1(node, offset2) {
|
|
34629
|
-
for (; ; ) {
|
|
34630
|
-
if (node.nodeType == 3 && offset2 < node.nodeValue.length)
|
|
34631
|
-
return node;
|
|
34632
|
-
if (node.nodeType == 1 && offset2 < node.childNodes.length) {
|
|
34633
|
-
if (node.contentEditable == "false")
|
|
34634
|
-
return null;
|
|
34635
|
-
node = node.childNodes[offset2];
|
|
34636
|
-
offset2 = 0;
|
|
34637
|
-
} else if (node.parentNode && !hasBlockDesc(node)) {
|
|
34638
|
-
offset2 = domIndex(node) + 1;
|
|
34639
|
-
node = node.parentNode;
|
|
34640
|
-
} else {
|
|
34641
|
-
return null;
|
|
34642
|
-
}
|
|
34643
|
-
}
|
|
34644
|
-
}
|
|
34645
34566
|
function isOnEdge(node, offset2, parent) {
|
|
34646
34567
|
for (let atStart = offset2 == 0, atEnd = offset2 == nodeSize(node); atStart || atEnd; ) {
|
|
34647
34568
|
if (node == parent)
|
|
@@ -34713,14 +34634,6 @@ const android = /Android \d/.test(agent);
|
|
|
34713
34634
|
const webkit = !!doc && "webkitFontSmoothing" in doc.documentElement.style;
|
|
34714
34635
|
const webkit_version = webkit ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
|
|
34715
34636
|
function windowRect(doc2) {
|
|
34716
|
-
let vp = doc2.defaultView && doc2.defaultView.visualViewport;
|
|
34717
|
-
if (vp)
|
|
34718
|
-
return {
|
|
34719
|
-
left: 0,
|
|
34720
|
-
right: vp.width,
|
|
34721
|
-
top: 0,
|
|
34722
|
-
bottom: vp.height
|
|
34723
|
-
};
|
|
34724
34637
|
return {
|
|
34725
34638
|
left: 0,
|
|
34726
34639
|
right: doc2.documentElement.clientWidth,
|
|
@@ -34922,14 +34835,14 @@ function posFromCaret(view, node, offset2, coords) {
|
|
|
34922
34835
|
let desc = view.docView.nearestDesc(cur, true);
|
|
34923
34836
|
if (!desc)
|
|
34924
34837
|
return null;
|
|
34925
|
-
if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent || !desc.contentDOM)) {
|
|
34838
|
+
if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent && !sawBlock || !desc.contentDOM)) {
|
|
34926
34839
|
let rect = desc.dom.getBoundingClientRect();
|
|
34927
|
-
if (desc.node.isBlock && desc.parent) {
|
|
34928
|
-
|
|
34840
|
+
if (desc.node.isBlock && desc.parent && !sawBlock) {
|
|
34841
|
+
sawBlock = true;
|
|
34842
|
+
if (rect.left > coords.left || rect.top > coords.top)
|
|
34929
34843
|
outsideBlock = desc.posBefore;
|
|
34930
|
-
else if (
|
|
34844
|
+
else if (rect.right < coords.left || rect.bottom < coords.top)
|
|
34931
34845
|
outsideBlock = desc.posAfter;
|
|
34932
|
-
sawBlock = true;
|
|
34933
34846
|
}
|
|
34934
34847
|
if (!desc.contentDOM && outsideBlock < 0 && !desc.node.isText) {
|
|
34935
34848
|
let before = desc.node.isBlock ? coords.top < (rect.top + rect.bottom) / 2 : coords.left < (rect.left + rect.right) / 2;
|
|
@@ -35544,9 +35457,6 @@ class ViewDesc {
|
|
|
35544
35457
|
get ignoreForCoords() {
|
|
35545
35458
|
return false;
|
|
35546
35459
|
}
|
|
35547
|
-
isText(text) {
|
|
35548
|
-
return false;
|
|
35549
|
-
}
|
|
35550
35460
|
}
|
|
35551
35461
|
class WidgetViewDesc extends ViewDesc {
|
|
35552
35462
|
constructor(parent, widget, view, pos) {
|
|
@@ -35785,7 +35695,8 @@ class NodeViewDesc extends ViewDesc {
|
|
|
35785
35695
|
let { from: from2, to: to2 } = view.state.selection;
|
|
35786
35696
|
if (!(view.state.selection instanceof TextSelection) || from2 < pos || to2 > pos + this.node.content.size)
|
|
35787
35697
|
return null;
|
|
35788
|
-
let
|
|
35698
|
+
let sel = view.domSelectionRange();
|
|
35699
|
+
let textNode = nearbyTextNode(sel.focusNode, sel.focusOffset);
|
|
35789
35700
|
if (!textNode || !this.dom.contains(textNode.parentNode))
|
|
35790
35701
|
return null;
|
|
35791
35702
|
if (this.node.inlineContent) {
|
|
@@ -35851,11 +35762,10 @@ class NodeViewDesc extends ViewDesc {
|
|
|
35851
35762
|
}
|
|
35852
35763
|
// Remove selected node marking from this node.
|
|
35853
35764
|
deselectNode() {
|
|
35854
|
-
if (this.nodeDOM.nodeType == 1)
|
|
35765
|
+
if (this.nodeDOM.nodeType == 1)
|
|
35855
35766
|
this.nodeDOM.classList.remove("ProseMirror-selectednode");
|
|
35856
|
-
|
|
35857
|
-
|
|
35858
|
-
}
|
|
35767
|
+
if (this.contentDOM || !this.node.type.spec.draggable)
|
|
35768
|
+
this.dom.removeAttribute("draggable");
|
|
35859
35769
|
}
|
|
35860
35770
|
get domAtom() {
|
|
35861
35771
|
return this.node.isAtom;
|
|
@@ -35921,9 +35831,6 @@ class TextViewDesc extends NodeViewDesc {
|
|
|
35921
35831
|
get domAtom() {
|
|
35922
35832
|
return false;
|
|
35923
35833
|
}
|
|
35924
|
-
isText(text) {
|
|
35925
|
-
return this.node.text == text;
|
|
35926
|
-
}
|
|
35927
35834
|
}
|
|
35928
35835
|
class TrailingHackViewDesc extends ViewDesc {
|
|
35929
35836
|
parseRule() {
|
|
@@ -36439,6 +36346,23 @@ function iosHacks(dom) {
|
|
|
36439
36346
|
dom.style.cssText = oldCSS;
|
|
36440
36347
|
}
|
|
36441
36348
|
}
|
|
36349
|
+
function nearbyTextNode(node, offset2) {
|
|
36350
|
+
for (; ; ) {
|
|
36351
|
+
if (node.nodeType == 3)
|
|
36352
|
+
return node;
|
|
36353
|
+
if (node.nodeType == 1 && offset2 > 0) {
|
|
36354
|
+
if (node.childNodes.length > offset2 && node.childNodes[offset2].nodeType == 3)
|
|
36355
|
+
return node.childNodes[offset2];
|
|
36356
|
+
node = node.childNodes[offset2 - 1];
|
|
36357
|
+
offset2 = nodeSize(node);
|
|
36358
|
+
} else if (node.nodeType == 1 && offset2 < node.childNodes.length) {
|
|
36359
|
+
node = node.childNodes[offset2];
|
|
36360
|
+
offset2 = 0;
|
|
36361
|
+
} else {
|
|
36362
|
+
return null;
|
|
36363
|
+
}
|
|
36364
|
+
}
|
|
36365
|
+
}
|
|
36442
36366
|
function findTextInFragment(frag, text, from2, to2) {
|
|
36443
36367
|
for (let i2 = 0, pos = 0; i2 < frag.childCount && pos <= to2; ) {
|
|
36444
36368
|
let child = frag.child(i2++), childStart = pos;
|
|
@@ -37013,7 +36937,7 @@ function serializeForClipboard(view, slice4) {
|
|
|
37013
36937
|
if (firstChild && firstChild.nodeType == 1)
|
|
37014
36938
|
firstChild.setAttribute("data-pm-slice", `${openStart} ${openEnd}${wrappers ? ` -${wrappers}` : ""} ${JSON.stringify(context)}`);
|
|
37015
36939
|
let text = view.someProp("clipboardTextSerializer", (f2) => f2(slice4, view)) || slice4.content.textBetween(0, slice4.content.size, "\n\n");
|
|
37016
|
-
return { dom: wrap2, text
|
|
36940
|
+
return { dom: wrap2, text };
|
|
37017
36941
|
}
|
|
37018
36942
|
function parseFromClipboard(view, text, html, plainText, $context) {
|
|
37019
36943
|
let inCode = $context.parent.type.spec.code;
|
|
@@ -37233,7 +37157,6 @@ class InputState {
|
|
|
37233
37157
|
this.lastTouch = 0;
|
|
37234
37158
|
this.lastAndroidDelete = 0;
|
|
37235
37159
|
this.composing = false;
|
|
37236
|
-
this.compositionNode = null;
|
|
37237
37160
|
this.composingTimeout = -1;
|
|
37238
37161
|
this.compositionNodes = [];
|
|
37239
37162
|
this.compositionEndedAt = -2e8;
|
|
@@ -37482,7 +37405,7 @@ class MouseDown {
|
|
|
37482
37405
|
}
|
|
37483
37406
|
const target = flushed ? null : event.target;
|
|
37484
37407
|
const targetDesc = target ? view.docView.nearestDesc(target, true) : null;
|
|
37485
|
-
this.target = targetDesc
|
|
37408
|
+
this.target = targetDesc ? targetDesc.dom : null;
|
|
37486
37409
|
let { selection } = view.state;
|
|
37487
37410
|
if (event.button == 0 && targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false || selection instanceof NodeSelection && selection.from <= targetPos && selection.to > targetPos)
|
|
37488
37411
|
this.mightDrag = {
|
|
@@ -37614,7 +37537,6 @@ editHandlers.compositionend = (view, event) => {
|
|
|
37614
37537
|
view.input.composing = false;
|
|
37615
37538
|
view.input.compositionEndedAt = event.timeStamp;
|
|
37616
37539
|
view.input.compositionPendingChanges = view.domObserver.pendingRecords().length ? view.input.compositionID : 0;
|
|
37617
|
-
view.input.compositionNode = null;
|
|
37618
37540
|
if (view.input.compositionPendingChanges)
|
|
37619
37541
|
Promise.resolve().then(() => view.domObserver.flush());
|
|
37620
37542
|
view.input.compositionID++;
|
|
@@ -37634,24 +37556,6 @@ function clearComposition(view) {
|
|
|
37634
37556
|
while (view.input.compositionNodes.length > 0)
|
|
37635
37557
|
view.input.compositionNodes.pop().markParentsDirty();
|
|
37636
37558
|
}
|
|
37637
|
-
function findCompositionNode(view) {
|
|
37638
|
-
let sel = view.domSelectionRange();
|
|
37639
|
-
if (!sel.focusNode)
|
|
37640
|
-
return null;
|
|
37641
|
-
let textBefore = textNodeBefore$1(sel.focusNode, sel.focusOffset);
|
|
37642
|
-
let textAfter = textNodeAfter$1(sel.focusNode, sel.focusOffset);
|
|
37643
|
-
if (textBefore && textAfter && textBefore != textAfter) {
|
|
37644
|
-
let descAfter = textAfter.pmViewDesc;
|
|
37645
|
-
if (!descAfter || !descAfter.isText(textAfter.nodeValue)) {
|
|
37646
|
-
return textAfter;
|
|
37647
|
-
} else if (view.input.compositionNode == textAfter) {
|
|
37648
|
-
let descBefore = textBefore.pmViewDesc;
|
|
37649
|
-
if (!(!descBefore || !descBefore.isText(textBefore.nodeValue)))
|
|
37650
|
-
return textAfter;
|
|
37651
|
-
}
|
|
37652
|
-
}
|
|
37653
|
-
return textBefore || textAfter;
|
|
37654
|
-
}
|
|
37655
37559
|
function timestampFromCustomEvent() {
|
|
37656
37560
|
let event = document.createEvent("Event");
|
|
37657
37561
|
event.initEvent("event", true, true);
|
|
@@ -37786,8 +37690,7 @@ handlers.dragstart = (view, _event) => {
|
|
|
37786
37690
|
if (desc && desc.node.type.spec.draggable && desc != view.docView)
|
|
37787
37691
|
node = NodeSelection.create(view.state.doc, desc.posBefore);
|
|
37788
37692
|
}
|
|
37789
|
-
let
|
|
37790
|
-
let { dom, text, slice: slice4 } = serializeForClipboard(view, draggedSlice);
|
|
37693
|
+
let slice4 = (node || view.state.selection).content(), { dom, text } = serializeForClipboard(view, slice4);
|
|
37791
37694
|
event.dataTransfer.clearData();
|
|
37792
37695
|
event.dataTransfer.setData(brokenClipboardAPI ? "Text" : "text/html", dom.innerHTML);
|
|
37793
37696
|
event.dataTransfer.effectAllowed = "copyMove";
|
|
@@ -38207,6 +38110,9 @@ class DecorationSet {
|
|
|
38207
38110
|
return this;
|
|
38208
38111
|
return local.length || children2.length ? new DecorationSet(local, children2) : empty$1;
|
|
38209
38112
|
}
|
|
38113
|
+
/**
|
|
38114
|
+
@internal
|
|
38115
|
+
*/
|
|
38210
38116
|
forChild(offset2, node) {
|
|
38211
38117
|
if (this == empty$1)
|
|
38212
38118
|
return this;
|
|
@@ -38685,21 +38591,14 @@ class DOMObserver {
|
|
|
38685
38591
|
}
|
|
38686
38592
|
}
|
|
38687
38593
|
}
|
|
38688
|
-
if (gecko && added.length) {
|
|
38594
|
+
if (gecko && added.length > 1) {
|
|
38689
38595
|
let brs = added.filter((n2) => n2.nodeName == "BR");
|
|
38690
38596
|
if (brs.length == 2) {
|
|
38691
|
-
let [
|
|
38597
|
+
let a2 = brs[0], b2 = brs[1];
|
|
38692
38598
|
if (a2.parentNode && a2.parentNode.parentNode == b2.parentNode)
|
|
38693
38599
|
b2.remove();
|
|
38694
38600
|
else
|
|
38695
38601
|
a2.remove();
|
|
38696
|
-
} else {
|
|
38697
|
-
let { focusNode } = this.currentSelection;
|
|
38698
|
-
for (let br2 of brs) {
|
|
38699
|
-
let parent = br2.parentNode;
|
|
38700
|
-
if (parent && parent.nodeName == "LI" && (!focusNode || blockParent(view, focusNode) != parent))
|
|
38701
|
-
br2.remove();
|
|
38702
|
-
}
|
|
38703
38602
|
}
|
|
38704
38603
|
}
|
|
38705
38604
|
let readSel = null;
|
|
@@ -38779,20 +38678,7 @@ function checkCSS(view) {
|
|
|
38779
38678
|
cssCheckWarned = true;
|
|
38780
38679
|
}
|
|
38781
38680
|
}
|
|
38782
|
-
function
|
|
38783
|
-
let anchorNode = range2.startContainer, anchorOffset = range2.startOffset;
|
|
38784
|
-
let focusNode = range2.endContainer, focusOffset = range2.endOffset;
|
|
38785
|
-
let currentAnchor = view.domAtPos(view.state.selection.anchor);
|
|
38786
|
-
if (isEquivalentPosition(currentAnchor.node, currentAnchor.offset, focusNode, focusOffset))
|
|
38787
|
-
[anchorNode, anchorOffset, focusNode, focusOffset] = [focusNode, focusOffset, anchorNode, anchorOffset];
|
|
38788
|
-
return { anchorNode, anchorOffset, focusNode, focusOffset };
|
|
38789
|
-
}
|
|
38790
|
-
function safariShadowSelectionRange(view, selection) {
|
|
38791
|
-
if (selection.getComposedRanges) {
|
|
38792
|
-
let range2 = selection.getComposedRanges(view.root)[0];
|
|
38793
|
-
if (range2)
|
|
38794
|
-
return rangeToSelectionRange(view, range2);
|
|
38795
|
-
}
|
|
38681
|
+
function safariShadowSelectionRange(view) {
|
|
38796
38682
|
let found2;
|
|
38797
38683
|
function read2(event) {
|
|
38798
38684
|
event.preventDefault();
|
|
@@ -38802,15 +38688,12 @@ function safariShadowSelectionRange(view, selection) {
|
|
|
38802
38688
|
view.dom.addEventListener("beforeinput", read2, true);
|
|
38803
38689
|
document.execCommand("indent");
|
|
38804
38690
|
view.dom.removeEventListener("beforeinput", read2, true);
|
|
38805
|
-
|
|
38806
|
-
|
|
38807
|
-
|
|
38808
|
-
|
|
38809
|
-
|
|
38810
|
-
|
|
38811
|
-
return p2;
|
|
38812
|
-
}
|
|
38813
|
-
return null;
|
|
38691
|
+
let anchorNode = found2.startContainer, anchorOffset = found2.startOffset;
|
|
38692
|
+
let focusNode = found2.endContainer, focusOffset = found2.endOffset;
|
|
38693
|
+
let currentAnchor = view.domAtPos(view.state.selection.anchor);
|
|
38694
|
+
if (isEquivalentPosition(currentAnchor.node, currentAnchor.offset, focusNode, focusOffset))
|
|
38695
|
+
[anchorNode, anchorOffset, focusNode, focusOffset] = [focusNode, focusOffset, anchorNode, anchorOffset];
|
|
38696
|
+
return { anchorNode, anchorOffset, focusNode, focusOffset };
|
|
38814
38697
|
}
|
|
38815
38698
|
function parseBetween(view, from_, to_) {
|
|
38816
38699
|
let { node: parent, fromOffset, toOffset, from: from2, to: to2 } = view.docView.parseRange(from_, to_);
|
|
@@ -38930,6 +38813,10 @@ function readDOMChange(view, from2, to2, typeOver, addedNodes) {
|
|
|
38930
38813
|
return;
|
|
38931
38814
|
}
|
|
38932
38815
|
}
|
|
38816
|
+
if (chrome && view.cursorWrapper && parse2.sel && parse2.sel.anchor == view.cursorWrapper.deco.from && parse2.sel.head == parse2.sel.anchor) {
|
|
38817
|
+
let size2 = change.endB - change.start;
|
|
38818
|
+
parse2.sel = { anchor: parse2.sel.anchor + size2, head: parse2.sel.anchor + size2 };
|
|
38819
|
+
}
|
|
38933
38820
|
view.input.domChangeCount++;
|
|
38934
38821
|
if (view.state.selection.from < view.state.selection.to && change.start == change.endB && view.state.selection instanceof TextSelection) {
|
|
38935
38822
|
if (change.start > view.state.selection.from && change.start <= view.state.selection.from + 2 && view.state.selection.from >= parse2.from) {
|
|
@@ -38953,7 +38840,7 @@ function readDOMChange(view, from2, to2, typeOver, addedNodes) {
|
|
|
38953
38840
|
view.input.lastIOSEnter = 0;
|
|
38954
38841
|
return;
|
|
38955
38842
|
}
|
|
38956
|
-
if (view.state.selection.anchor > change.start &&
|
|
38843
|
+
if (view.state.selection.anchor > change.start && looksLikeJoin(doc2, change.start, change.endA, $from, $to) && view.someProp("handleKeyDown", (f2) => f2(view, keyEvent(8, "Backspace")))) {
|
|
38957
38844
|
if (android && chrome)
|
|
38958
38845
|
view.domObserver.suppressSelectionUpdates();
|
|
38959
38846
|
return;
|
|
@@ -39037,18 +38924,12 @@ function isMarkChange(cur, prev) {
|
|
|
39037
38924
|
if (Fragment.from(updated).eq(cur))
|
|
39038
38925
|
return { mark, type: type3 };
|
|
39039
38926
|
}
|
|
39040
|
-
function
|
|
39041
|
-
if (
|
|
39042
|
-
|
|
39043
|
-
|
|
39044
|
-
skipClosingAndOpening($newStart, true, false) < $newEnd.pos
|
|
39045
|
-
)
|
|
38927
|
+
function looksLikeJoin(old, start2, end2, $newStart, $newEnd) {
|
|
38928
|
+
if (!$newStart.parent.isTextblock || // The content must have shrunk
|
|
38929
|
+
end2 - start2 <= $newEnd.pos - $newStart.pos || // newEnd must point directly at or after the end of the block that newStart points into
|
|
38930
|
+
skipClosingAndOpening($newStart, true, false) < $newEnd.pos)
|
|
39046
38931
|
return false;
|
|
39047
38932
|
let $start = old.resolve(start2);
|
|
39048
|
-
if (!$newStart.parent.isTextblock) {
|
|
39049
|
-
let after = $start.nodeAfter;
|
|
39050
|
-
return after != null && end2 == start2 + after.nodeSize;
|
|
39051
|
-
}
|
|
39052
38933
|
if ($start.parentOffset < $start.parent.content.size || !$start.parent.isTextblock)
|
|
39053
38934
|
return false;
|
|
39054
38935
|
let $next = old.resolve(skipClosingAndOpening($start, true, true));
|
|
@@ -39237,10 +39118,8 @@ class EditorView {
|
|
|
39237
39118
|
let forceSelUpdate = updateDoc && (ie$1 || chrome) && !this.composing && !prev.selection.empty && !state2.selection.empty && selectionContextChanged(prev.selection, state2.selection);
|
|
39238
39119
|
if (updateDoc) {
|
|
39239
39120
|
let chromeKludge = chrome ? this.trackWrites = this.domSelectionRange().focusNode : null;
|
|
39240
|
-
if (this.composing)
|
|
39241
|
-
this.input.compositionNode = findCompositionNode(this);
|
|
39242
39121
|
if (redraw || !this.docView.update(state2.doc, outerDeco, innerDeco, this)) {
|
|
39243
|
-
this.docView.updateOuterDeco(
|
|
39122
|
+
this.docView.updateOuterDeco([]);
|
|
39244
39123
|
this.docView.destroy();
|
|
39245
39124
|
this.docView = docViewDesc(state2.doc, outerDeco, innerDeco, this.dom, this);
|
|
39246
39125
|
}
|
|
@@ -39499,7 +39378,6 @@ class EditorView {
|
|
|
39499
39378
|
}
|
|
39500
39379
|
this.docView.destroy();
|
|
39501
39380
|
this.docView = null;
|
|
39502
|
-
clearReusedRange();
|
|
39503
39381
|
}
|
|
39504
39382
|
/**
|
|
39505
39383
|
This is true when the view has been
|
|
@@ -39535,8 +39413,7 @@ class EditorView {
|
|
|
39535
39413
|
@internal
|
|
39536
39414
|
*/
|
|
39537
39415
|
domSelectionRange() {
|
|
39538
|
-
|
|
39539
|
-
return safari && this.root.nodeType === 11 && deepActiveElement(this.dom.ownerDocument) == this.dom && safariShadowSelectionRange(this, sel) || sel;
|
|
39416
|
+
return safari && this.root.nodeType === 11 && deepActiveElement(this.dom.ownerDocument) == this.dom ? safariShadowSelectionRange(this) : this.domSelection();
|
|
39540
39417
|
}
|
|
39541
39418
|
/**
|
|
39542
39419
|
@internal
|
|
@@ -45499,16 +45376,16 @@ function mapRanges(ranges, mapping) {
|
|
|
45499
45376
|
}
|
|
45500
45377
|
return result2;
|
|
45501
45378
|
}
|
|
45502
|
-
function histTransaction(history2, state2, redo2) {
|
|
45379
|
+
function histTransaction(history2, state2, dispatch, redo2) {
|
|
45503
45380
|
let preserveItems = mustPreserveItems(state2);
|
|
45504
45381
|
let histOptions = historyKey.get(state2).spec.config;
|
|
45505
45382
|
let pop = (redo2 ? history2.undone : history2.done).popEvent(state2, preserveItems);
|
|
45506
45383
|
if (!pop)
|
|
45507
|
-
return
|
|
45384
|
+
return;
|
|
45508
45385
|
let selection = pop.selection.resolve(pop.transform.doc);
|
|
45509
45386
|
let added = (redo2 ? history2.done : history2.undone).addTransform(pop.transform, state2.selection.getBookmark(), histOptions, preserveItems);
|
|
45510
45387
|
let newHist = new HistoryState(redo2 ? added : pop.remaining, redo2 ? pop.remaining : added, null, 0, -1);
|
|
45511
|
-
|
|
45388
|
+
dispatch(pop.transform.setSelection(selection).setMeta(historyKey, { redo: redo2, historyState: newHist }).scrollIntoView());
|
|
45512
45389
|
}
|
|
45513
45390
|
let cachedPreserveItems = false, cachedPreserveItemsPlugins = null;
|
|
45514
45391
|
function mustPreserveItems(state2) {
|
|
@@ -45556,21 +45433,22 @@ function history(config = {}) {
|
|
|
45556
45433
|
}
|
|
45557
45434
|
});
|
|
45558
45435
|
}
|
|
45559
|
-
|
|
45560
|
-
|
|
45561
|
-
|
|
45562
|
-
|
|
45563
|
-
|
|
45564
|
-
|
|
45565
|
-
|
|
45566
|
-
|
|
45567
|
-
|
|
45568
|
-
|
|
45569
|
-
|
|
45570
|
-
|
|
45571
|
-
|
|
45572
|
-
|
|
45573
|
-
|
|
45436
|
+
const undo = (state2, dispatch) => {
|
|
45437
|
+
let hist = historyKey.getState(state2);
|
|
45438
|
+
if (!hist || hist.done.eventCount == 0)
|
|
45439
|
+
return false;
|
|
45440
|
+
if (dispatch)
|
|
45441
|
+
histTransaction(hist, state2, dispatch, false);
|
|
45442
|
+
return true;
|
|
45443
|
+
};
|
|
45444
|
+
const redo = (state2, dispatch) => {
|
|
45445
|
+
let hist = historyKey.getState(state2);
|
|
45446
|
+
if (!hist || hist.undone.eventCount == 0)
|
|
45447
|
+
return false;
|
|
45448
|
+
if (dispatch)
|
|
45449
|
+
histTransaction(hist, state2, dispatch, true);
|
|
45450
|
+
return true;
|
|
45451
|
+
};
|
|
45574
45452
|
const History = Extension.create({
|
|
45575
45453
|
name: "history",
|
|
45576
45454
|
addOptions() {
|