core/api/soft/CodeMirror/state/src
root 3268e6a008 Заказы 2023-07-12 18:02:20 +03:00
..
README.md Заказы 2023-07-12 18:02:20 +03:00
change.ts Заказы 2023-07-12 18:02:20 +03:00
config.ts Заказы 2023-07-12 18:02:20 +03:00
extension.ts Заказы 2023-07-12 18:02:20 +03:00
facet.ts Заказы 2023-07-12 18:02:20 +03:00
index.ts Заказы 2023-07-12 18:02:20 +03:00
selection.ts Заказы 2023-07-12 18:02:20 +03:00
state.ts Заказы 2023-07-12 18:02:20 +03:00
transaction.ts Заказы 2023-07-12 18:02:20 +03:00

README.md

In its most basic form, the editor state is made up of a current document and a selection. Because there are a lot of extra pieces that an editor might need to keep in its state (such as an undo history or syntax tree), it is possible for extensions to add additional fields to the state object.

@EditorStateConfig

@EditorState

@SelectionRange

@EditorSelection

@Text

Changes and Transactions

CodeMirror treats changes to the document as objects, which are usually part of a transaction.

This is how you'd make a change to a document (replacing “world” with “editor”) and create a new state with the updated document:

let state = EditorState.create({doc: "hello world"})
let transaction = state.t().replace(6, 11, "editor")
console.log(transaction.doc.toString()) // "hello editor"
let newState = transaction.apply()

@ChangeDesc

@Change

@ChangeSet

@Transaction

@Annotation

@StateEffect

@StateEffectSpec

@StateEffectType

@MapMode

@Mapping

@ChangedRange

Extending Editor State

The following are some types and mechanisms used when writing extensions for the editor state.

@StateCommand

@Extension

@StateFieldSpec

@StateField

@FacetConfig

@Facet

@Precedence

@ExtensionGroup

@Syntax

@IndentContext

@languageData

Utilities

@fillConfig

@combineConfig