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