|
|
@@ -1,5 +1,10 @@
|
|
|
import { EditorView } from '@codemirror/view'
|
|
|
-import { EditorSelection, EditorState, SelectionRange } from '@codemirror/state'
|
|
|
+import {
|
|
|
+ EditorSelection,
|
|
|
+ EditorState,
|
|
|
+ SelectionRange,
|
|
|
+ TransactionSpec,
|
|
|
+} from '@codemirror/state'
|
|
|
import {
|
|
|
ensureSyntaxTree,
|
|
|
foldedRanges,
|
|
|
@@ -408,7 +413,10 @@ function bubbleUpRange(
|
|
|
return range
|
|
|
}
|
|
|
|
|
|
-export function toggleRanges(command: string) {
|
|
|
+export function toggleRanges(
|
|
|
+ command: string,
|
|
|
+ annotations?: TransactionSpec['annotations']
|
|
|
+) {
|
|
|
/* There are a number of situations we need to handle in this function.
|
|
|
* In the following examples, the selection range is marked within <>
|
|
|
|
|
|
@@ -745,7 +753,7 @@ export function toggleRanges(command: string) {
|
|
|
// Shouldn't happen, but default to just wrapping the content
|
|
|
return wrapRangeInCommand(view.state, range, command)
|
|
|
}),
|
|
|
- { scrollIntoView: true }
|
|
|
+ { scrollIntoView: true, annotations }
|
|
|
)
|
|
|
return true
|
|
|
}
|