@codemirror/state
Advanced tools
Comparing version 0.18.7 to 0.19.0
@@ -0,1 +1,15 @@ | ||
## 0.19.0 (2021-08-11) | ||
### Breaking changes | ||
User event strings now work differently—the events emitted by the core packages follow a different system, and hierarchical event tags can be created by separating the words with dots. | ||
### New features | ||
`languageDataAt` now takes an optional `side` argument to specificy which side of the position you're interested in. | ||
It is now possible to add a user event annotation with a direct `userEvent` property on a transaction spec. | ||
Transactions now have an `isUserEvent` method that can be used to check if it is (a subtype of) some user event type. | ||
## 0.18.7 (2021-05-04) | ||
@@ -2,0 +16,0 @@ |
@@ -686,2 +686,6 @@ import { Text } from '@codemirror/text'; | ||
/** | ||
Shorthand for `annotations: `[`Transaction.userEvent`](https://codemirror.net/6/docs/ref/#state.Transaction^userEvent)[`.of(...)`. | ||
*/ | ||
userEvent?: string; | ||
/** | ||
When set to `true`, the transaction is marked as needing to | ||
@@ -777,2 +781,10 @@ scroll the current selection into view. | ||
/** | ||
Returns true if the transaction has a [user | ||
event](https://codemirror.net/6/docs/ref/#state.Transaction^userEvent) annotation that is equal to | ||
or more specific than `event`. For example, if the transaction | ||
has `"select.pointer"` as user event, `"select"` and | ||
`"select.pointer"` will match it. | ||
*/ | ||
isUserEvent(event: string): boolean | "" | undefined; | ||
/** | ||
Annotation used to store transaction timestamps. | ||
@@ -783,11 +795,25 @@ */ | ||
Annotation used to associate a transaction with a user interface | ||
event. The view will set this to... | ||
event. Holds a string identifying the event, using a | ||
dot-separated format to support attaching more specific | ||
information. The events used by the core libraries are: | ||
- `"input"` when the user types text | ||
- `"delete"` when the user deletes the selection or text near the selection | ||
- `"keyboardselection"` when moving the selection via the keyboard | ||
- `"pointerselection"` when moving the selection through the pointing device | ||
- `"paste"` when pasting content | ||
- `"cut"` when cutting | ||
- `"drop"` when content is inserted via drag-and-drop | ||
- `"input"` when content is entered | ||
- `"input.type"` for typed input | ||
- `"input.type.compose"` for composition | ||
- `"input.paste"` for pasted input | ||
- `"input.drop"` when adding content with drag-and-drop | ||
- `"input.complete"` when autocompleting | ||
- `"delete"` when the user deletes content | ||
- `"delete.selection"` when deleting the selection | ||
- `"delete.forward"` when deleting forward from the selection | ||
- `"delete.backward"` when deleting backward from the selection | ||
- `"delete.cut"` when cutting to the clipboard | ||
- `"move"` when content is moved | ||
- `"move.drop"` when content is moved within the editor through drag-and-drop | ||
- `"select"` when explicitly changing the selection | ||
- `"select.pointer"` when selecting with a mouse or other pointing device | ||
- `"undo"` and `"redo"` for history actions | ||
Use [`isUserEvent`](https://codemirror.net/6/docs/ref/#state.Transaction.isUserEvent) to check | ||
whether the annotation matches a given event. | ||
*/ | ||
@@ -1026,5 +1052,5 @@ static userEvent: AnnotationType<string>; | ||
*/ | ||
static languageData: Facet<(state: EditorState, pos: number) => readonly { | ||
static languageData: Facet<(state: EditorState, pos: number, side: 0 | 1 | -1) => readonly { | ||
[name: string]: any; | ||
}[], readonly ((state: EditorState, pos: number) => readonly { | ||
}[], readonly ((state: EditorState, pos: number, side: 0 | 1 | -1) => readonly { | ||
[name: string]: any; | ||
@@ -1036,3 +1062,3 @@ }[])[]>; | ||
*/ | ||
languageDataAt<T>(name: string, pos: number): readonly T[]; | ||
languageDataAt<T>(name: string, pos: number, side?: -1 | 0 | 1): readonly T[]; | ||
/** | ||
@@ -1039,0 +1065,0 @@ Return a function that can categorize strings (expected to |
{ | ||
"name": "@codemirror/state", | ||
"version": "0.18.7", | ||
"version": "0.19.0", | ||
"description": "Editor state data structures for the CodeMirror code editor", | ||
@@ -29,3 +29,3 @@ "scripts": { | ||
"dependencies": { | ||
"@codemirror/text": "^0.18.0" | ||
"@codemirror/text": "^0.19.0" | ||
}, | ||
@@ -32,0 +32,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
214434
5538
+ Added@codemirror/text@0.19.6(transitive)
- Removed@codemirror/text@0.18.1(transitive)
Updated@codemirror/text@^0.19.0