TransactionSpecBuilder

Builder scope for constructing a TransactionSpec via DSL.

Example:

val spec = transactionSpec {
insert(0, "Hello")
selection(5)
scrollIntoView()
}

Functions

Link copied to clipboard
fun <T> annotate(annotation: Annotation<T>)

Add an annotation.

Link copied to clipboard
fun delete(from: DocPos, to: DocPos)

Delete text from from to to.

Link copied to clipboard
fun <T> effect(effect: StateEffect<T>)

Add a state effect.

Link copied to clipboard
fun filter(enabled: Boolean)

Set whether transaction filters should be applied.

Link copied to clipboard
fun insert(pos: DocPos, text: Text)

Insert a Text at the given position.

fun insert(pos: DocPos, text: String)

Insert text at the given position.

Link copied to clipboard
fun replace(from: DocPos, to: DocPos, text: Text)
fun replace(from: DocPos, to: DocPos, text: String)

Replace text from from to to with text.

Link copied to clipboard

Mark that the selection should be scrolled into view.

Link copied to clipboard
fun selection(cursor: DocPos)

Set the cursor position.

fun selection(selection: EditorSelection)

Set the selection from an EditorSelection.

fun selection(anchor: DocPos, head: DocPos)

Set a selection range.

Link copied to clipboard

Mark positions as relative to the document after preceding specs.

Link copied to clipboard
fun userEvent(event: String)

Set the user event type.