EditorState class

The state of the editor.

The state includes:

  • The document to render
  • The state of the selection

EditorState also includes the services of the editor:

  • Selection service
  • Scroll service
  • Keyboard service
  • Input service
  • Toolbar service

In consideration of collaborative editing, all the mutations should be applied through Transaction.

Mutating the document with document's API is not recommended.

Available Extensions

Constructors

EditorState({required Document document, Duration minHistoryItemDuration = const Duration(milliseconds: 200)})
EditorState.blank({bool withInitialText = true})
EditorState.empty()

Properties

autoCompleteTextProvider AppFlowyAutoCompleteTextProvider?
getter/setter pair
autoScroller ↔ AutoScroller?
store the auto scroller instance in here temporarily.
getter/setter pair
cursorSelection Selection?
no setter
disableRules bool
getter/setter pair
disableSealTimer bool
getter/setter pair
document Document
final
editable bool
Whether the editor is editable.
getter/setter pair
editorStyle EditorStyle
The style of the editor.
getter/setter pair
enableAutoComplete bool
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
logConfiguration LogConfiguration
Configures log output parameters, such as log level and log output callbacks, with this variable.
no setter
minHistoryItemDuration Duration
final
onDispose ValueNotifier<int>
final
remoteSelections PropertyValueNotifier<List<RemoteSelection>>
Remote selection is the selection from other users.
final
renderBox RenderBox?
no setter
renderer BlockComponentRendererService
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollableState ScrollableState?
getter/setter pair
scrollService AppFlowyScrollService?
no setter
selection Selection?
The selection of the editor.
getter/setter pair
selectionExtraInfo Map?
getter/setter pair
selectionMenuItems List<SelectionMenuItem>
Stores the selection menu items.
getter/setter pair
selectionNotifier PropertyValueNotifier<Selection?>
The selection notifier of the editor.
final
selectionService AppFlowySelectionService
no setter
selectionType SelectionType?
getter/setter pair
selectionUpdateReason SelectionUpdateReason
no setter
service EditorService
final
showFooter bool
getter/setter pair
showHeader bool
getter/setter pair
toggledStyle UnmodifiableMapView<String, dynamic>
Store the toggled format style, like bold, italic, etc. All the values must be the key from AppFlowyRichTextKeys.supportToggled.
no setter
toggledStyleNotifier ValueNotifier<Attributes>
latefinal
toolbarItems List<ToolbarItem>
Stores the toolbar items.
getter/setter pair
transaction Transaction
no setter
transactionStream Stream<(TransactionTime, Transaction)>
listen to this stream to get notified when the transaction applies.
no setter
undoManager → UndoManager
final

Methods

apply(Transaction transaction, {bool isRemote = false, ApplyOptions options = const ApplyOptions(recordUndo: true), bool withUpdateSelection = true}) Future<void>
Apply the transaction to the state.
cancelSubscription() → void
dispose() → void
getNodeAtPath(Path path) Node?
getNodesInSelection(Selection selection) List<Node>
get nodes in selection
getSelectedNodes({Selection? selection, bool withCopy = true}) List<Node>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reload() → void
Force rebuild the editor.
selectionRects() List<Rect>
The current selection areas's rect in editor.
toString() String
A string representation of this object.
inherited
updateAutoScroller(ScrollableState scrollableState) → void
updateCursorSelection(Selection? cursorSelection, [CursorUpdateReason reason = CursorUpdateReason.others]) Future<void>
updateSelectionWithReason(Selection? selection, {SelectionUpdateReason reason = SelectionUpdateReason.transaction, Map? extraInfo}) Future<void>
updateToggledStyle(String key, dynamic value) → void

Operators

operator ==(Object other) bool
The equality operator.
inherited