@codemirror/view 6.39.4 → 6.39.6
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 +14 -0
- package/dist/index.cjs +24 -13
- package/dist/index.js +24 -13
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## 6.39.6 (2025-12-23)
|
|
2
|
+
|
|
3
|
+
### Bug fixes
|
|
4
|
+
|
|
5
|
+
Fix an issue when composing on the boundary of a decoration, where the text after the composition would get garbled.
|
|
6
|
+
|
|
7
|
+
## 6.39.5 (2025-12-22)
|
|
8
|
+
|
|
9
|
+
### Bug fixes
|
|
10
|
+
|
|
11
|
+
Fix an issue where replaced widgets alone on a line weren't reused and didn't get their `updateDOM` method called.
|
|
12
|
+
|
|
13
|
+
Fix a bug where, when selecting full lines at the end of the document and inserting a character on Chrome, an inappropriate extra newline was inserted.
|
|
14
|
+
|
|
1
15
|
## 6.39.4 (2025-12-12)
|
|
2
16
|
|
|
3
17
|
### Bug fixes
|
package/dist/index.cjs
CHANGED
|
@@ -2573,6 +2573,16 @@ class TileUpdate {
|
|
|
2573
2573
|
this.builder = new TileBuilder(this.cache, new DocTile(view, view.contentDOM), state.RangeSet.iter(blockWrappers));
|
|
2574
2574
|
this.cache.reused.set(old, 2 /* Reused.DOM */);
|
|
2575
2575
|
this.old = new TilePointer(old);
|
|
2576
|
+
this.reuseWalker = {
|
|
2577
|
+
skip: (tile, from, to) => {
|
|
2578
|
+
this.cache.add(tile);
|
|
2579
|
+
if (tile.isComposite())
|
|
2580
|
+
return false;
|
|
2581
|
+
},
|
|
2582
|
+
enter: tile => this.cache.add(tile),
|
|
2583
|
+
leave: () => { },
|
|
2584
|
+
break: () => { }
|
|
2585
|
+
};
|
|
2576
2586
|
}
|
|
2577
2587
|
run(changes, composition) {
|
|
2578
2588
|
let compositionContext = composition && this.getCompositionContext(composition.text);
|
|
@@ -2594,6 +2604,7 @@ class TileUpdate {
|
|
|
2594
2604
|
if (composition && next.fromA <= composition.range.fromA && next.toA >= composition.range.toA) {
|
|
2595
2605
|
this.emit(posB, composition.range.fromB);
|
|
2596
2606
|
this.builder.addComposition(composition, compositionContext);
|
|
2607
|
+
this.text.skip(composition.range.toB - composition.range.fromB);
|
|
2597
2608
|
this.emit(composition.range.toB, next.toB);
|
|
2598
2609
|
}
|
|
2599
2610
|
else {
|
|
@@ -2747,15 +2758,14 @@ class TileUpdate {
|
|
|
2747
2758
|
this.openMarks = openEnd;
|
|
2748
2759
|
}
|
|
2749
2760
|
forward(from, to) {
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
});
|
|
2761
|
+
if (to - from <= 10) {
|
|
2762
|
+
this.old.advance(to - from, 1, this.reuseWalker);
|
|
2763
|
+
}
|
|
2764
|
+
else {
|
|
2765
|
+
this.old.advance(5, -1, this.reuseWalker);
|
|
2766
|
+
this.old.advance(to - from - 10, -1);
|
|
2767
|
+
this.old.advance(5, 1, this.reuseWalker);
|
|
2768
|
+
}
|
|
2759
2769
|
}
|
|
2760
2770
|
getCompositionContext(text) {
|
|
2761
2771
|
let marks = [], line = null;
|
|
@@ -3827,10 +3837,11 @@ function dirAt(view, pos) {
|
|
|
3827
3837
|
|
|
3828
3838
|
const LineBreakPlaceholder = "\uffff";
|
|
3829
3839
|
class DOMReader {
|
|
3830
|
-
constructor(points,
|
|
3840
|
+
constructor(points, view) {
|
|
3831
3841
|
this.points = points;
|
|
3842
|
+
this.view = view;
|
|
3832
3843
|
this.text = "";
|
|
3833
|
-
this.lineSeparator = state
|
|
3844
|
+
this.lineSeparator = view.state.facet(state.EditorState.lineSeparator);
|
|
3834
3845
|
}
|
|
3835
3846
|
append(text) {
|
|
3836
3847
|
this.text += text;
|
|
@@ -3848,7 +3859,7 @@ class DOMReader {
|
|
|
3848
3859
|
this.readNode(cur);
|
|
3849
3860
|
let tile = Tile.get(cur), next = cur.nextSibling;
|
|
3850
3861
|
if (next == end) {
|
|
3851
|
-
if ((tile === null || tile === void 0 ? void 0 : tile.breakAfter) && !next)
|
|
3862
|
+
if ((tile === null || tile === void 0 ? void 0 : tile.breakAfter) && !next && parent != this.view.contentDOM)
|
|
3852
3863
|
this.lineBreak();
|
|
3853
3864
|
break;
|
|
3854
3865
|
}
|
|
@@ -3973,7 +3984,7 @@ class DOMChange {
|
|
|
3973
3984
|
}
|
|
3974
3985
|
else if (start > -1 && (this.bounds = domBoundsAround(view.docView.tile, start, end, 0))) {
|
|
3975
3986
|
let selPoints = iHead || iAnchor ? [] : selectionPoints(view);
|
|
3976
|
-
let reader = new DOMReader(selPoints, view
|
|
3987
|
+
let reader = new DOMReader(selPoints, view);
|
|
3977
3988
|
reader.readRange(this.bounds.startDOM, this.bounds.endDOM);
|
|
3978
3989
|
this.text = reader.text;
|
|
3979
3990
|
this.newSel = selectionFromPoints(selPoints, this.bounds.from);
|
package/dist/index.js
CHANGED
|
@@ -2569,6 +2569,16 @@ class TileUpdate {
|
|
|
2569
2569
|
this.builder = new TileBuilder(this.cache, new DocTile(view, view.contentDOM), RangeSet.iter(blockWrappers));
|
|
2570
2570
|
this.cache.reused.set(old, 2 /* Reused.DOM */);
|
|
2571
2571
|
this.old = new TilePointer(old);
|
|
2572
|
+
this.reuseWalker = {
|
|
2573
|
+
skip: (tile, from, to) => {
|
|
2574
|
+
this.cache.add(tile);
|
|
2575
|
+
if (tile.isComposite())
|
|
2576
|
+
return false;
|
|
2577
|
+
},
|
|
2578
|
+
enter: tile => this.cache.add(tile),
|
|
2579
|
+
leave: () => { },
|
|
2580
|
+
break: () => { }
|
|
2581
|
+
};
|
|
2572
2582
|
}
|
|
2573
2583
|
run(changes, composition) {
|
|
2574
2584
|
let compositionContext = composition && this.getCompositionContext(composition.text);
|
|
@@ -2590,6 +2600,7 @@ class TileUpdate {
|
|
|
2590
2600
|
if (composition && next.fromA <= composition.range.fromA && next.toA >= composition.range.toA) {
|
|
2591
2601
|
this.emit(posB, composition.range.fromB);
|
|
2592
2602
|
this.builder.addComposition(composition, compositionContext);
|
|
2603
|
+
this.text.skip(composition.range.toB - composition.range.fromB);
|
|
2593
2604
|
this.emit(composition.range.toB, next.toB);
|
|
2594
2605
|
}
|
|
2595
2606
|
else {
|
|
@@ -2743,15 +2754,14 @@ class TileUpdate {
|
|
|
2743
2754
|
this.openMarks = openEnd;
|
|
2744
2755
|
}
|
|
2745
2756
|
forward(from, to) {
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
});
|
|
2757
|
+
if (to - from <= 10) {
|
|
2758
|
+
this.old.advance(to - from, 1, this.reuseWalker);
|
|
2759
|
+
}
|
|
2760
|
+
else {
|
|
2761
|
+
this.old.advance(5, -1, this.reuseWalker);
|
|
2762
|
+
this.old.advance(to - from - 10, -1);
|
|
2763
|
+
this.old.advance(5, 1, this.reuseWalker);
|
|
2764
|
+
}
|
|
2755
2765
|
}
|
|
2756
2766
|
getCompositionContext(text) {
|
|
2757
2767
|
let marks = [], line = null;
|
|
@@ -3823,10 +3833,11 @@ function dirAt(view, pos) {
|
|
|
3823
3833
|
|
|
3824
3834
|
const LineBreakPlaceholder = "\uffff";
|
|
3825
3835
|
class DOMReader {
|
|
3826
|
-
constructor(points,
|
|
3836
|
+
constructor(points, view) {
|
|
3827
3837
|
this.points = points;
|
|
3838
|
+
this.view = view;
|
|
3828
3839
|
this.text = "";
|
|
3829
|
-
this.lineSeparator = state.facet(EditorState.lineSeparator);
|
|
3840
|
+
this.lineSeparator = view.state.facet(EditorState.lineSeparator);
|
|
3830
3841
|
}
|
|
3831
3842
|
append(text) {
|
|
3832
3843
|
this.text += text;
|
|
@@ -3844,7 +3855,7 @@ class DOMReader {
|
|
|
3844
3855
|
this.readNode(cur);
|
|
3845
3856
|
let tile = Tile.get(cur), next = cur.nextSibling;
|
|
3846
3857
|
if (next == end) {
|
|
3847
|
-
if ((tile === null || tile === void 0 ? void 0 : tile.breakAfter) && !next)
|
|
3858
|
+
if ((tile === null || tile === void 0 ? void 0 : tile.breakAfter) && !next && parent != this.view.contentDOM)
|
|
3848
3859
|
this.lineBreak();
|
|
3849
3860
|
break;
|
|
3850
3861
|
}
|
|
@@ -3969,7 +3980,7 @@ class DOMChange {
|
|
|
3969
3980
|
}
|
|
3970
3981
|
else if (start > -1 && (this.bounds = domBoundsAround(view.docView.tile, start, end, 0))) {
|
|
3971
3982
|
let selPoints = iHead || iAnchor ? [] : selectionPoints(view);
|
|
3972
|
-
let reader = new DOMReader(selPoints, view
|
|
3983
|
+
let reader = new DOMReader(selPoints, view);
|
|
3973
3984
|
reader.readRange(this.bounds.startDOM, this.bounds.endDOM);
|
|
3974
3985
|
this.text = reader.text;
|
|
3975
3986
|
this.newSel = selectionFromPoints(selPoints, this.bounds.from);
|