@codemirror/view 0.19.46 → 0.19.47

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/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.19.47 (2022-03-08)
2
+
3
+ ### Bug fixes
4
+
5
+ Fix an issue where block widgets at the start of the viewport could break height computations.
6
+
1
7
  ## 0.19.46 (2022-03-03)
2
8
 
3
9
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -936,6 +936,7 @@ class WidgetBufferView extends ContentView {
936
936
  if (!this.dom) {
937
937
  let dom = document.createElement("img");
938
938
  dom.className = "cm-widgetBuffer";
939
+ dom.setAttribute("aria-hidden", "true");
939
940
  this.setDOM(dom);
940
941
  }
941
942
  }
@@ -1206,7 +1207,7 @@ class Decoration extends rangeset.RangeValue {
1206
1207
  */
1207
1208
  static widget(spec) {
1208
1209
  let side = spec.side || 0, block = !!spec.block;
1209
- side += block ? (side > 0 ? 400000000 /* BlockAfter */ : -500000000 /* BlockBefore */) : (side > 0 ? 100000000 /* InlineAfter */ : -100000000 /* InlineBefore */);
1210
+ side += block ? (side > 0 ? 300000000 /* BlockAfter */ : -400000000 /* BlockBefore */) : (side > 0 ? 100000000 /* InlineAfter */ : -100000000 /* InlineBefore */);
1210
1211
  return new PointDecoration(spec, side, side, block, spec.widget || null, false);
1211
1212
  }
1212
1213
  /**
@@ -1216,8 +1217,8 @@ class Decoration extends rangeset.RangeValue {
1216
1217
  static replace(spec) {
1217
1218
  let block = !!spec.block, startSide, endSide;
1218
1219
  if (spec.isBlockGap) {
1219
- startSide = -400000000 /* GapStart */;
1220
- endSide = 300000000 /* GapEnd */;
1220
+ startSide = -500000000 /* GapStart */;
1221
+ endSide = 400000000 /* GapEnd */;
1221
1222
  }
1222
1223
  else {
1223
1224
  let { start, end } = getInclusive(spec, block);
@@ -1434,7 +1435,7 @@ class LineView extends ContentView {
1434
1435
  let last = this.dom.lastChild;
1435
1436
  while (last && ContentView.get(last) instanceof MarkView)
1436
1437
  last = last.lastChild;
1437
- if (!last ||
1438
+ if (!last || !this.length ||
1438
1439
  last.nodeName != "BR" && ((_a = ContentView.get(last)) === null || _a === void 0 ? void 0 : _a.isEditable) == false &&
1439
1440
  (!browser.ios || !this.children.some(ch => ch instanceof TextView))) {
1440
1441
  let hack = document.createElement("BR");
package/dist/index.js CHANGED
@@ -933,6 +933,7 @@ class WidgetBufferView extends ContentView {
933
933
  if (!this.dom) {
934
934
  let dom = document.createElement("img");
935
935
  dom.className = "cm-widgetBuffer";
936
+ dom.setAttribute("aria-hidden", "true");
936
937
  this.setDOM(dom);
937
938
  }
938
939
  }
@@ -1202,7 +1203,7 @@ class Decoration extends RangeValue {
1202
1203
  */
1203
1204
  static widget(spec) {
1204
1205
  let side = spec.side || 0, block = !!spec.block;
1205
- side += block ? (side > 0 ? 400000000 /* BlockAfter */ : -500000000 /* BlockBefore */) : (side > 0 ? 100000000 /* InlineAfter */ : -100000000 /* InlineBefore */);
1206
+ side += block ? (side > 0 ? 300000000 /* BlockAfter */ : -400000000 /* BlockBefore */) : (side > 0 ? 100000000 /* InlineAfter */ : -100000000 /* InlineBefore */);
1206
1207
  return new PointDecoration(spec, side, side, block, spec.widget || null, false);
1207
1208
  }
1208
1209
  /**
@@ -1212,8 +1213,8 @@ class Decoration extends RangeValue {
1212
1213
  static replace(spec) {
1213
1214
  let block = !!spec.block, startSide, endSide;
1214
1215
  if (spec.isBlockGap) {
1215
- startSide = -400000000 /* GapStart */;
1216
- endSide = 300000000 /* GapEnd */;
1216
+ startSide = -500000000 /* GapStart */;
1217
+ endSide = 400000000 /* GapEnd */;
1217
1218
  }
1218
1219
  else {
1219
1220
  let { start, end } = getInclusive(spec, block);
@@ -1430,7 +1431,7 @@ class LineView extends ContentView {
1430
1431
  let last = this.dom.lastChild;
1431
1432
  while (last && ContentView.get(last) instanceof MarkView)
1432
1433
  last = last.lastChild;
1433
- if (!last ||
1434
+ if (!last || !this.length ||
1434
1435
  last.nodeName != "BR" && ((_a = ContentView.get(last)) === null || _a === void 0 ? void 0 : _a.isEditable) == false &&
1435
1436
  (!browser.ios || !this.children.some(ch => ch instanceof TextView))) {
1436
1437
  let hack = document.createElement("BR");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/view",
3
- "version": "0.19.46",
3
+ "version": "0.19.47",
4
4
  "description": "DOM view component for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",