@codemirror/state 6.3.0 → 6.3.2
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 +7 -2
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +7 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## 6.3.2 (2023-11-27)
|
|
2
|
+
|
|
3
|
+
### Bug fixes
|
|
4
|
+
|
|
5
|
+
Make sure transactions cannot add multiple selections when `allowMultipleSelections` is false.
|
|
6
|
+
|
|
7
|
+
Fix a bug that caused `Text.iterLines` to not return empty lines at the end of the iterated ranges.
|
|
8
|
+
|
|
9
|
+
## 6.3.1 (2023-10-18)
|
|
10
|
+
|
|
11
|
+
### Bug fixes
|
|
12
|
+
|
|
13
|
+
Give the tag property on `FacetReader` the type of the output type parameter to force TypeScript to infer the proper type when converting from `Facet` to `FacetReader`.
|
|
14
|
+
|
|
1
15
|
## 6.3.0 (2023-10-12)
|
|
2
16
|
|
|
3
17
|
### New features
|
package/dist/index.cjs
CHANGED
|
@@ -485,7 +485,11 @@ class LineCursor {
|
|
|
485
485
|
}
|
|
486
486
|
next(skip = 0) {
|
|
487
487
|
let { done, lineBreak, value } = this.inner.next(skip);
|
|
488
|
-
if (done) {
|
|
488
|
+
if (done && this.afterBreak) {
|
|
489
|
+
this.value = "";
|
|
490
|
+
this.afterBreak = false;
|
|
491
|
+
}
|
|
492
|
+
else if (done) {
|
|
489
493
|
this.done = true;
|
|
490
494
|
this.value = "";
|
|
491
495
|
}
|
|
@@ -2643,7 +2647,8 @@ class EditorState {
|
|
|
2643
2647
|
else {
|
|
2644
2648
|
startValues = tr.startState.values.slice();
|
|
2645
2649
|
}
|
|
2646
|
-
|
|
2650
|
+
let selection = tr.startState.facet(allowMultipleSelections) ? tr.newSelection : tr.newSelection.asSingle();
|
|
2651
|
+
new EditorState(conf, tr.newDoc, selection, startValues, (state, slot) => slot.update(state, tr), tr);
|
|
2647
2652
|
}
|
|
2648
2653
|
/**
|
|
2649
2654
|
Create a [transaction spec](https://codemirror.net/6/docs/ref/#state.TransactionSpec) that
|
package/dist/index.d.cts
CHANGED
|
@@ -571,11 +571,10 @@ declare class Facet<Input, Output = readonly Input[]> implements FacetReader<Out
|
|
|
571
571
|
*/
|
|
572
572
|
from<T extends Input>(field: StateField<T>): Extension;
|
|
573
573
|
from<T>(field: StateField<T>, get: (value: T) => Input): Extension;
|
|
574
|
-
tag:
|
|
574
|
+
tag: Output;
|
|
575
575
|
}
|
|
576
|
-
declare const FacetTag: unique symbol;
|
|
577
576
|
/**
|
|
578
|
-
A facet reader can be used to fetch the value of a facet,
|
|
577
|
+
A facet reader can be used to fetch the value of a facet, through
|
|
579
578
|
[`EditorState.facet`](https://codemirror.net/6/docs/ref/#state.EditorState.facet) or as a dependency
|
|
580
579
|
in [`Facet.compute`](https://codemirror.net/6/docs/ref/#state.Facet.compute), but not to define new
|
|
581
580
|
values for the facet.
|
|
@@ -583,9 +582,10 @@ values for the facet.
|
|
|
583
582
|
type FacetReader<Output> = {
|
|
584
583
|
/**
|
|
585
584
|
Dummy tag that makes sure TypeScript doesn't consider all object
|
|
586
|
-
types as conforming to this type.
|
|
585
|
+
types as conforming to this type. Not actually present on the
|
|
586
|
+
object.
|
|
587
587
|
*/
|
|
588
|
-
tag:
|
|
588
|
+
tag: Output;
|
|
589
589
|
};
|
|
590
590
|
type Slot<T> = FacetReader<T> | StateField<T> | "doc" | "selection";
|
|
591
591
|
type StateFieldSpec<Value> = {
|
package/dist/index.d.ts
CHANGED
|
@@ -571,11 +571,10 @@ declare class Facet<Input, Output = readonly Input[]> implements FacetReader<Out
|
|
|
571
571
|
*/
|
|
572
572
|
from<T extends Input>(field: StateField<T>): Extension;
|
|
573
573
|
from<T>(field: StateField<T>, get: (value: T) => Input): Extension;
|
|
574
|
-
tag:
|
|
574
|
+
tag: Output;
|
|
575
575
|
}
|
|
576
|
-
declare const FacetTag: unique symbol;
|
|
577
576
|
/**
|
|
578
|
-
A facet reader can be used to fetch the value of a facet,
|
|
577
|
+
A facet reader can be used to fetch the value of a facet, through
|
|
579
578
|
[`EditorState.facet`](https://codemirror.net/6/docs/ref/#state.EditorState.facet) or as a dependency
|
|
580
579
|
in [`Facet.compute`](https://codemirror.net/6/docs/ref/#state.Facet.compute), but not to define new
|
|
581
580
|
values for the facet.
|
|
@@ -583,9 +582,10 @@ values for the facet.
|
|
|
583
582
|
type FacetReader<Output> = {
|
|
584
583
|
/**
|
|
585
584
|
Dummy tag that makes sure TypeScript doesn't consider all object
|
|
586
|
-
types as conforming to this type.
|
|
585
|
+
types as conforming to this type. Not actually present on the
|
|
586
|
+
object.
|
|
587
587
|
*/
|
|
588
|
-
tag:
|
|
588
|
+
tag: Output;
|
|
589
589
|
};
|
|
590
590
|
type Slot<T> = FacetReader<T> | StateField<T> | "doc" | "selection";
|
|
591
591
|
type StateFieldSpec<Value> = {
|
package/dist/index.js
CHANGED
|
@@ -483,7 +483,11 @@ class LineCursor {
|
|
|
483
483
|
}
|
|
484
484
|
next(skip = 0) {
|
|
485
485
|
let { done, lineBreak, value } = this.inner.next(skip);
|
|
486
|
-
if (done) {
|
|
486
|
+
if (done && this.afterBreak) {
|
|
487
|
+
this.value = "";
|
|
488
|
+
this.afterBreak = false;
|
|
489
|
+
}
|
|
490
|
+
else if (done) {
|
|
487
491
|
this.done = true;
|
|
488
492
|
this.value = "";
|
|
489
493
|
}
|
|
@@ -2639,7 +2643,8 @@ class EditorState {
|
|
|
2639
2643
|
else {
|
|
2640
2644
|
startValues = tr.startState.values.slice();
|
|
2641
2645
|
}
|
|
2642
|
-
|
|
2646
|
+
let selection = tr.startState.facet(allowMultipleSelections) ? tr.newSelection : tr.newSelection.asSingle();
|
|
2647
|
+
new EditorState(conf, tr.newDoc, selection, startValues, (state, slot) => slot.update(state, tr), tr);
|
|
2643
2648
|
}
|
|
2644
2649
|
/**
|
|
2645
2650
|
Create a [transaction spec](https://codemirror.net/6/docs/ref/#state.TransactionSpec) that
|