@codemirror/view 6.20.2 → 6.21.1

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,19 @@
1
+ ## 6.21.1 (2023-10-02)
2
+
3
+ ### Bug fixes
4
+
5
+ Fix a bug that could corrupt the DOM view for specific changes involving newlines and mark decorations.
6
+
7
+ ## 6.21.0 (2023-09-29)
8
+
9
+ ### Bug fixes
10
+
11
+ Fix a bug that could cause zero-length widgets at the start of a line to be left in the view even after they were removed.
12
+
13
+ ### New features
14
+
15
+ `RectangleMarker`'s dimension properties are now public.
16
+
1
17
  ## 6.20.2 (2023-09-25)
2
18
 
3
19
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -596,7 +596,7 @@ function replaceRange(parent, fromI, fromOff, toI, toOff, insert, breakAtStart,
596
596
  else {
597
597
  // Remove the start of the after element, if necessary, and
598
598
  // add it to `content`.
599
- if (toOff)
599
+ if (toOff || after.children.length && !after.children[0].length)
600
600
  after.merge(0, toOff, null, false, 0, openEnd);
601
601
  insert.push(after);
602
602
  }
@@ -1653,7 +1653,8 @@ class ContentBuilder {
1653
1653
  this.flushBuffer();
1654
1654
  else
1655
1655
  this.pendingBuffer = 0 /* Buf.No */;
1656
- if (!openEnd && !this.posCovered())
1656
+ if (!this.posCovered() &&
1657
+ !(openEnd && this.content.length && this.content[this.content.length - 1] instanceof BlockWidgetView))
1657
1658
  this.getLine();
1658
1659
  }
1659
1660
  buildText(length, active, openStart) {
@@ -8087,7 +8088,23 @@ class RectangleMarker {
8087
8088
  Create a marker with the given class and dimensions. If `width`
8088
8089
  is null, the DOM element will get no width style.
8089
8090
  */
8090
- constructor(className, left, top, width, height) {
8091
+ constructor(className,
8092
+ /**
8093
+ The left position of the marker (in pixels, document-relative).
8094
+ */
8095
+ left,
8096
+ /**
8097
+ The top position of the marker.
8098
+ */
8099
+ top,
8100
+ /**
8101
+ The width of the marker, or null if it shouldn't get a width assigned.
8102
+ */
8103
+ width,
8104
+ /**
8105
+ The height of the marker.
8106
+ */
8107
+ height) {
8091
8108
  this.className = className;
8092
8109
  this.left = left;
8093
8110
  this.top = top;
package/dist/index.d.cts CHANGED
@@ -1519,15 +1519,43 @@ a rectangle at a given set of coordinates.
1519
1519
  */
1520
1520
  declare class RectangleMarker implements LayerMarker {
1521
1521
  private className;
1522
- private left;
1523
- private top;
1524
- private width;
1525
- private height;
1522
+ /**
1523
+ The left position of the marker (in pixels, document-relative).
1524
+ */
1525
+ readonly left: number;
1526
+ /**
1527
+ The top position of the marker.
1528
+ */
1529
+ readonly top: number;
1530
+ /**
1531
+ The width of the marker, or null if it shouldn't get a width assigned.
1532
+ */
1533
+ readonly width: number | null;
1534
+ /**
1535
+ The height of the marker.
1536
+ */
1537
+ readonly height: number;
1526
1538
  /**
1527
1539
  Create a marker with the given class and dimensions. If `width`
1528
1540
  is null, the DOM element will get no width style.
1529
1541
  */
1530
- constructor(className: string, left: number, top: number, width: number | null, height: number);
1542
+ constructor(className: string,
1543
+ /**
1544
+ The left position of the marker (in pixels, document-relative).
1545
+ */
1546
+ left: number,
1547
+ /**
1548
+ The top position of the marker.
1549
+ */
1550
+ top: number,
1551
+ /**
1552
+ The width of the marker, or null if it shouldn't get a width assigned.
1553
+ */
1554
+ width: number | null,
1555
+ /**
1556
+ The height of the marker.
1557
+ */
1558
+ height: number);
1531
1559
  draw(): HTMLDivElement;
1532
1560
  update(elt: HTMLElement, prev: RectangleMarker): boolean;
1533
1561
  private adjust;
package/dist/index.d.ts CHANGED
@@ -1519,15 +1519,43 @@ a rectangle at a given set of coordinates.
1519
1519
  */
1520
1520
  declare class RectangleMarker implements LayerMarker {
1521
1521
  private className;
1522
- private left;
1523
- private top;
1524
- private width;
1525
- private height;
1522
+ /**
1523
+ The left position of the marker (in pixels, document-relative).
1524
+ */
1525
+ readonly left: number;
1526
+ /**
1527
+ The top position of the marker.
1528
+ */
1529
+ readonly top: number;
1530
+ /**
1531
+ The width of the marker, or null if it shouldn't get a width assigned.
1532
+ */
1533
+ readonly width: number | null;
1534
+ /**
1535
+ The height of the marker.
1536
+ */
1537
+ readonly height: number;
1526
1538
  /**
1527
1539
  Create a marker with the given class and dimensions. If `width`
1528
1540
  is null, the DOM element will get no width style.
1529
1541
  */
1530
- constructor(className: string, left: number, top: number, width: number | null, height: number);
1542
+ constructor(className: string,
1543
+ /**
1544
+ The left position of the marker (in pixels, document-relative).
1545
+ */
1546
+ left: number,
1547
+ /**
1548
+ The top position of the marker.
1549
+ */
1550
+ top: number,
1551
+ /**
1552
+ The width of the marker, or null if it shouldn't get a width assigned.
1553
+ */
1554
+ width: number | null,
1555
+ /**
1556
+ The height of the marker.
1557
+ */
1558
+ height: number);
1531
1559
  draw(): HTMLDivElement;
1532
1560
  update(elt: HTMLElement, prev: RectangleMarker): boolean;
1533
1561
  private adjust;
package/dist/index.js CHANGED
@@ -594,7 +594,7 @@ function replaceRange(parent, fromI, fromOff, toI, toOff, insert, breakAtStart,
594
594
  else {
595
595
  // Remove the start of the after element, if necessary, and
596
596
  // add it to `content`.
597
- if (toOff)
597
+ if (toOff || after.children.length && !after.children[0].length)
598
598
  after.merge(0, toOff, null, false, 0, openEnd);
599
599
  insert.push(after);
600
600
  }
@@ -1650,7 +1650,8 @@ class ContentBuilder {
1650
1650
  this.flushBuffer();
1651
1651
  else
1652
1652
  this.pendingBuffer = 0 /* Buf.No */;
1653
- if (!openEnd && !this.posCovered())
1653
+ if (!this.posCovered() &&
1654
+ !(openEnd && this.content.length && this.content[this.content.length - 1] instanceof BlockWidgetView))
1654
1655
  this.getLine();
1655
1656
  }
1656
1657
  buildText(length, active, openStart) {
@@ -8082,7 +8083,23 @@ class RectangleMarker {
8082
8083
  Create a marker with the given class and dimensions. If `width`
8083
8084
  is null, the DOM element will get no width style.
8084
8085
  */
8085
- constructor(className, left, top, width, height) {
8086
+ constructor(className,
8087
+ /**
8088
+ The left position of the marker (in pixels, document-relative).
8089
+ */
8090
+ left,
8091
+ /**
8092
+ The top position of the marker.
8093
+ */
8094
+ top,
8095
+ /**
8096
+ The width of the marker, or null if it shouldn't get a width assigned.
8097
+ */
8098
+ width,
8099
+ /**
8100
+ The height of the marker.
8101
+ */
8102
+ height) {
8086
8103
  this.className = className;
8087
8104
  this.left = left;
8088
8105
  this.top = top;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/view",
3
- "version": "6.20.2",
3
+ "version": "6.21.1",
4
4
  "description": "DOM view component for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",