@codemirror/view 6.39.0-beta.5 → 6.39.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 +20 -0
- package/dist/index.cjs +19 -11
- package/dist/index.js +19 -11
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
## 6.39.1 (2025-12-09)
|
|
2
|
+
|
|
3
|
+
### Bug fixes
|
|
4
|
+
|
|
5
|
+
Restore a workaround for a Chrome selection bug that had regressed in the previous release.
|
|
6
|
+
|
|
7
|
+
## 6.39.0 (2025-12-08)
|
|
8
|
+
|
|
9
|
+
### Bug fixes
|
|
10
|
+
|
|
11
|
+
Properly handle bidirectional text in `posAtCoords`.
|
|
12
|
+
|
|
13
|
+
Avoid computing a zero character width (leading to divisions by zero) when the editor is hidden and the browser doesn't have a layout for it.
|
|
14
|
+
|
|
15
|
+
### New features
|
|
16
|
+
|
|
17
|
+
The `posAndSideAtCoords` method is an extended version of `posAtCoords` that also tells you which side of the position the coordinates are associated with.
|
|
18
|
+
|
|
19
|
+
Add support for block wrappers, decoration-like things that allow extension code to create DOM nodes around groups of lines.
|
|
20
|
+
|
|
1
21
|
## 6.38.8 (2025-11-17)
|
|
2
22
|
|
|
3
23
|
### Bug fixes
|
package/dist/index.cjs
CHANGED
|
@@ -1729,7 +1729,7 @@ class Tile {
|
|
|
1729
1729
|
isText() { return false; }
|
|
1730
1730
|
isBlock() { return false; }
|
|
1731
1731
|
get domAttrs() { return null; }
|
|
1732
|
-
sync() {
|
|
1732
|
+
sync(track) {
|
|
1733
1733
|
this.flags |= 2 /* TileFlag.Synced */;
|
|
1734
1734
|
if (this.flags & 4 /* TileFlag.AttrsDirty */) {
|
|
1735
1735
|
this.flags &= ~4 /* TileFlag.AttrsDirty */;
|
|
@@ -1801,16 +1801,19 @@ class CompositeTile extends Tile {
|
|
|
1801
1801
|
this.children.push(child);
|
|
1802
1802
|
child.parent = this;
|
|
1803
1803
|
}
|
|
1804
|
-
sync() {
|
|
1804
|
+
sync(track) {
|
|
1805
1805
|
if (this.flags & 2 /* TileFlag.Synced */)
|
|
1806
1806
|
return;
|
|
1807
|
-
super.sync();
|
|
1807
|
+
super.sync(track);
|
|
1808
1808
|
let parent = this.dom, prev = null, next;
|
|
1809
|
+
let tracking = (track === null || track === void 0 ? void 0 : track.node) == parent ? track : null;
|
|
1809
1810
|
let length = 0;
|
|
1810
1811
|
for (let child of this.children) {
|
|
1811
|
-
child.sync();
|
|
1812
|
+
child.sync(track);
|
|
1812
1813
|
length += child.length + child.breakAfter;
|
|
1813
1814
|
next = prev ? prev.nextSibling : parent.firstChild;
|
|
1815
|
+
if (tracking && next != child.dom)
|
|
1816
|
+
tracking.written = true;
|
|
1814
1817
|
if (child.dom.parentNode == parent) {
|
|
1815
1818
|
while (next && next != child.dom)
|
|
1816
1819
|
next = rm$1(next);
|
|
@@ -1821,6 +1824,8 @@ class CompositeTile extends Tile {
|
|
|
1821
1824
|
prev = child.dom;
|
|
1822
1825
|
}
|
|
1823
1826
|
next = prev ? prev.nextSibling : parent.firstChild;
|
|
1827
|
+
if (tracking && next)
|
|
1828
|
+
tracking.written = true;
|
|
1824
1829
|
while (next)
|
|
1825
1830
|
next = rm$1(next);
|
|
1826
1831
|
this.length = length;
|
|
@@ -2029,12 +2034,15 @@ class TextTile extends Tile {
|
|
|
2029
2034
|
super(dom, text.length);
|
|
2030
2035
|
this.text = text;
|
|
2031
2036
|
}
|
|
2032
|
-
sync() {
|
|
2037
|
+
sync(track) {
|
|
2033
2038
|
if (this.flags & 2 /* TileFlag.Synced */)
|
|
2034
2039
|
return;
|
|
2035
|
-
super.sync();
|
|
2036
|
-
if (this.dom.nodeValue != this.text)
|
|
2040
|
+
super.sync(track);
|
|
2041
|
+
if (this.dom.nodeValue != this.text) {
|
|
2042
|
+
if (track && track.node == this.dom)
|
|
2043
|
+
track.written = true;
|
|
2037
2044
|
this.dom.nodeValue = this.text;
|
|
2045
|
+
}
|
|
2038
2046
|
}
|
|
2039
2047
|
isText() { return true; }
|
|
2040
2048
|
toString() { return JSON.stringify(this.text); }
|
|
@@ -2939,8 +2947,8 @@ class DocView {
|
|
|
2939
2947
|
// selection from the one it displays (issue #218). This tries
|
|
2940
2948
|
// to detect that situation.
|
|
2941
2949
|
let track = browser.chrome || browser.ios ? { node: observer.selectionRange.focusNode, written: false } : undefined;
|
|
2942
|
-
this.tile.sync();
|
|
2943
|
-
if (track && (track.written || observer.selectionRange.focusNode != track.node))
|
|
2950
|
+
this.tile.sync(track);
|
|
2951
|
+
if (track && (track.written || observer.selectionRange.focusNode != track.node || !this.tile.dom.contains(track.node)))
|
|
2944
2952
|
this.forceSelection = true;
|
|
2945
2953
|
this.tile.dom.style.height = "";
|
|
2946
2954
|
});
|
|
@@ -3303,8 +3311,8 @@ class DocView {
|
|
|
3303
3311
|
this.tile.dom.appendChild(dummy);
|
|
3304
3312
|
let rect = clientRectsFor(dummy.firstChild)[0];
|
|
3305
3313
|
lineHeight = dummy.getBoundingClientRect().height;
|
|
3306
|
-
charWidth = rect ? rect.width / 27 : 7;
|
|
3307
|
-
textHeight = rect ? rect.height : lineHeight;
|
|
3314
|
+
charWidth = rect && rect.width ? rect.width / 27 : 7;
|
|
3315
|
+
textHeight = rect && rect.height ? rect.height : lineHeight;
|
|
3308
3316
|
dummy.remove();
|
|
3309
3317
|
});
|
|
3310
3318
|
return { lineHeight, charWidth, textHeight };
|
package/dist/index.js
CHANGED
|
@@ -1725,7 +1725,7 @@ class Tile {
|
|
|
1725
1725
|
isText() { return false; }
|
|
1726
1726
|
isBlock() { return false; }
|
|
1727
1727
|
get domAttrs() { return null; }
|
|
1728
|
-
sync() {
|
|
1728
|
+
sync(track) {
|
|
1729
1729
|
this.flags |= 2 /* TileFlag.Synced */;
|
|
1730
1730
|
if (this.flags & 4 /* TileFlag.AttrsDirty */) {
|
|
1731
1731
|
this.flags &= ~4 /* TileFlag.AttrsDirty */;
|
|
@@ -1797,16 +1797,19 @@ class CompositeTile extends Tile {
|
|
|
1797
1797
|
this.children.push(child);
|
|
1798
1798
|
child.parent = this;
|
|
1799
1799
|
}
|
|
1800
|
-
sync() {
|
|
1800
|
+
sync(track) {
|
|
1801
1801
|
if (this.flags & 2 /* TileFlag.Synced */)
|
|
1802
1802
|
return;
|
|
1803
|
-
super.sync();
|
|
1803
|
+
super.sync(track);
|
|
1804
1804
|
let parent = this.dom, prev = null, next;
|
|
1805
|
+
let tracking = (track === null || track === void 0 ? void 0 : track.node) == parent ? track : null;
|
|
1805
1806
|
let length = 0;
|
|
1806
1807
|
for (let child of this.children) {
|
|
1807
|
-
child.sync();
|
|
1808
|
+
child.sync(track);
|
|
1808
1809
|
length += child.length + child.breakAfter;
|
|
1809
1810
|
next = prev ? prev.nextSibling : parent.firstChild;
|
|
1811
|
+
if (tracking && next != child.dom)
|
|
1812
|
+
tracking.written = true;
|
|
1810
1813
|
if (child.dom.parentNode == parent) {
|
|
1811
1814
|
while (next && next != child.dom)
|
|
1812
1815
|
next = rm$1(next);
|
|
@@ -1817,6 +1820,8 @@ class CompositeTile extends Tile {
|
|
|
1817
1820
|
prev = child.dom;
|
|
1818
1821
|
}
|
|
1819
1822
|
next = prev ? prev.nextSibling : parent.firstChild;
|
|
1823
|
+
if (tracking && next)
|
|
1824
|
+
tracking.written = true;
|
|
1820
1825
|
while (next)
|
|
1821
1826
|
next = rm$1(next);
|
|
1822
1827
|
this.length = length;
|
|
@@ -2025,12 +2030,15 @@ class TextTile extends Tile {
|
|
|
2025
2030
|
super(dom, text.length);
|
|
2026
2031
|
this.text = text;
|
|
2027
2032
|
}
|
|
2028
|
-
sync() {
|
|
2033
|
+
sync(track) {
|
|
2029
2034
|
if (this.flags & 2 /* TileFlag.Synced */)
|
|
2030
2035
|
return;
|
|
2031
|
-
super.sync();
|
|
2032
|
-
if (this.dom.nodeValue != this.text)
|
|
2036
|
+
super.sync(track);
|
|
2037
|
+
if (this.dom.nodeValue != this.text) {
|
|
2038
|
+
if (track && track.node == this.dom)
|
|
2039
|
+
track.written = true;
|
|
2033
2040
|
this.dom.nodeValue = this.text;
|
|
2041
|
+
}
|
|
2034
2042
|
}
|
|
2035
2043
|
isText() { return true; }
|
|
2036
2044
|
toString() { return JSON.stringify(this.text); }
|
|
@@ -2935,8 +2943,8 @@ class DocView {
|
|
|
2935
2943
|
// selection from the one it displays (issue #218). This tries
|
|
2936
2944
|
// to detect that situation.
|
|
2937
2945
|
let track = browser.chrome || browser.ios ? { node: observer.selectionRange.focusNode, written: false } : undefined;
|
|
2938
|
-
this.tile.sync();
|
|
2939
|
-
if (track && (track.written || observer.selectionRange.focusNode != track.node))
|
|
2946
|
+
this.tile.sync(track);
|
|
2947
|
+
if (track && (track.written || observer.selectionRange.focusNode != track.node || !this.tile.dom.contains(track.node)))
|
|
2940
2948
|
this.forceSelection = true;
|
|
2941
2949
|
this.tile.dom.style.height = "";
|
|
2942
2950
|
});
|
|
@@ -3299,8 +3307,8 @@ class DocView {
|
|
|
3299
3307
|
this.tile.dom.appendChild(dummy);
|
|
3300
3308
|
let rect = clientRectsFor(dummy.firstChild)[0];
|
|
3301
3309
|
lineHeight = dummy.getBoundingClientRect().height;
|
|
3302
|
-
charWidth = rect ? rect.width / 27 : 7;
|
|
3303
|
-
textHeight = rect ? rect.height : lineHeight;
|
|
3310
|
+
charWidth = rect && rect.width ? rect.width / 27 : 7;
|
|
3311
|
+
textHeight = rect && rect.height ? rect.height : lineHeight;
|
|
3304
3312
|
dummy.remove();
|
|
3305
3313
|
});
|
|
3306
3314
|
return { lineHeight, charWidth, textHeight };
|