Editor class
Editor for a document editing experience.
An Editor is the entry point for all mutations within a document editing experience. Such changes might impact a Document, DocumentComposer, and any other relevant objects or data structures associated with a document editing experience.
The following artifacts are involved with making changes to pieces of a document editing experience:
- EditRequest - a desired change.
- EditCommand - mutates Editables to achieve a change.
- EditEvent - describes a change that was made.
- EditReaction - (optionally) requests more changes after some original change.
- EditListener - is notified of all changes made by an Editor.
- Implemented types
- Available extensions
Constructors
-
Editor({required Map<
String, Editable> editables, List<EditRequestHandler> ? requestHandlers, HistoryGroupingPolicy historyGroupingPolicy = neverMergePolicy, List<EditReaction> ? reactionPipeline, List<EditListener> ? listeners, bool isHistoryEnabled = false}) - Constructs an Editor with:
Properties
- composer → MutableDocumentComposer
-
Available on Editor, provided by the StandardEditables extension
Finds and returns the MutableDocumentComposer within the Editor.no setter - context ↔ EditContext
-
Service Locator that provides all resources that are relevant for document editing.
latefinal
- document → MutableDocument
-
Available on Editor, provided by the StandardEditables extension
Finds and returns the MutableDocument within the Editor.no setter -
future
→ List<
CommandTransaction> -
A list of editor transactions that were undone since the last time a change was
made.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
history
→ List<
CommandTransaction> -
A list of editor transactions that were run previously, leading to the current
state of the document, and other editables.
no setter
- historyGroupingPolicy → HistoryGroupingPolicy
-
Policies that determine when a new transaction of changes should be combined with the
previous transaction, impacting what is undone by undo.
final
- isHistoryEnabled → bool
-
Whether history tracking (and undo/redo) are enabled.
final
- maybeComposer → MutableDocumentComposer?
-
Available on Editor, provided by the StandardEditables extension
Finds and returns the MutableDocumentComposer within the Editor, ornullif no MutableDocumentComposer is in the Editor.no setter - maybeDocument → MutableDocument?
-
Available on Editor, provided by the StandardEditables extension
Finds and returns the MutableDocument within the Editor, ornullif no MutableDocument is in the Editor.no setter -
reactionPipeline
→ List<
EditReaction> -
A pipeline of objects that receive change-lists from command execution
and get the first opportunity to spawn additional commands before the
change list is dispatched to regular listeners.
final
-
requestHandlers
→ List<
EditRequestHandler> -
Chain of Responsibility that maps a given EditRequest to an EditCommand.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addListener(
EditListener listener, {int? index}) → void -
Adds a
listener, which is notified of each series of EditEvents after a batch of EditCommands complete. -
dispose(
) → void -
endTransaction(
) → void - Ends a transaction that was started with a call to startTransaction.
-
execute(
List< EditRequest> requests) → void -
Executes the given
requests.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
redo(
) → void -
removeListener(
EditListener listener) → void -
Removes a
listenerfrom the set of change listeners. -
startTransaction(
) → void - Starts a transaction that runs across multiple calls to execute, until endTransaction is called.
-
toString(
) → String -
A string representation of this object.
inherited
-
undo(
) → void
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
createNodeId(
) → String - Generates a new ID for a DocumentNode.
Constants
- composerKey → const String
- Service locator key to obtain a DocumentComposer from find, if a DocumentComposer is available in the EditContext.
- documentKey → const String
- Service locator key to obtain a Document from find, if a Document is available in the EditContext.
- layoutKey → const String
- Service locator key to obtain a DocumentLayoutEditable from find, if a DocumentLayoutEditable is available in the EditContext.