@codemirror/view 6.20.2 → 6.21.0

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,13 @@
1
+ ## 6.21.0 (2023-09-29)
2
+
3
+ ### Bug fixes
4
+
5
+ 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.
6
+
7
+ ### New features
8
+
9
+ `RectangleMarker`'s dimension properties are now public.
10
+
1
11
  ## 6.20.2 (2023-09-25)
2
12
 
3
13
  ### 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
  }
@@ -8087,7 +8087,23 @@ class RectangleMarker {
8087
8087
  Create a marker with the given class and dimensions. If `width`
8088
8088
  is null, the DOM element will get no width style.
8089
8089
  */
8090
- constructor(className, left, top, width, height) {
8090
+ constructor(className,
8091
+ /**
8092
+ The left position of the marker (in pixels, document-relative).
8093
+ */
8094
+ left,
8095
+ /**
8096
+ The top position of the marker.
8097
+ */
8098
+ top,
8099
+ /**
8100
+ The width of the marker, or null if it shouldn't get a width assigned.
8101
+ */
8102
+ width,
8103
+ /**
8104
+ The height of the marker.
8105
+ */
8106
+ height) {
8091
8107
  this.className = className;
8092
8108
  this.left = left;
8093
8109
  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
  }
@@ -8082,7 +8082,23 @@ class RectangleMarker {
8082
8082
  Create a marker with the given class and dimensions. If `width`
8083
8083
  is null, the DOM element will get no width style.
8084
8084
  */
8085
- constructor(className, left, top, width, height) {
8085
+ constructor(className,
8086
+ /**
8087
+ The left position of the marker (in pixels, document-relative).
8088
+ */
8089
+ left,
8090
+ /**
8091
+ The top position of the marker.
8092
+ */
8093
+ top,
8094
+ /**
8095
+ The width of the marker, or null if it shouldn't get a width assigned.
8096
+ */
8097
+ width,
8098
+ /**
8099
+ The height of the marker.
8100
+ */
8101
+ height) {
8086
8102
  this.className = className;
8087
8103
  this.left = left;
8088
8104
  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.0",
4
4
  "description": "DOM view component for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",