TextEditingTool class

The TextEditingTool is used to let the user interactively edit text in place. This sets the TextBlock#text property; you may want to save the changed text to the model by using a TwoWay Binding on the "text" property of editable TextBlocks.

Typically this is used by setting the TextBlock#editable property to true on a particular TextBlock in a part. When the part is selected and the user clicks on the TextBlock or invokes the CommandHandler#editTextBlock command, this tool is started and it uses an HTMLTextArea to perform in-place text editing. (For more details see the description for TextEditingTool#doActivate.)

The TextBlock is accessible as the TextEditingTool#textBlock property. The text editor is accessible as the TextEditingTool#currentTextEditor property. From the text editor control one can access the TextBlock being edited via the 'textEditingTool' property to get to this tool, from which one can use the TextEditingTool#textBlock property.

You can disable mouse clicking from starting this text editing tool by setting Tool#isEnabled to false. You can disable the F2 key from starting this text editing tool by making sure Part#canEdit returns false, by either setting Diagram#allowTextEdit to false or by setting Part#textEditable to false.

If you want to programmatically start the user editing a particular TextBlock, call CommandHandler#editTextBlock. That command method is also invoked by the F2 key on the keyboard.

For a general discussion of text editing validation, see: Introduction to Text Validation. For customizing the TextEditingTool, read about HTMLInfo and see Introduction to Text Editors.

Implemented types
Available extensions
Annotations
  • @JS()
  • @staticInterop

Constructors

TextEditingTool()
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

doubleClick EnumValue
A possible value for TextEditingTool#starting, A double click on a TextBlock with TextBlock#editable property set to true will start in-place editing.
getter/setter pair
enter EnumValue
A possible value for TextEditingTool#acceptText, the user has typed ENTER.
getter/setter pair
lostFocus EnumValue
A possible value for TextEditingTool#acceptText, the text editing control has lost focus.
getter/setter pair
mouseDown EnumValue
A possible value for TextEditingTool#acceptText, the user has clicked somewhere else in the diagram.
getter/setter pair
singleClick EnumValue
A possible value for TextEditingTool#starting, A single click on a TextBlock with TextBlock#editable property set to true will start in-place editing.
getter/setter pair
singleClickSelected EnumValue
A possible value for TextEditingTool#starting, A single click on a TextBlock with TextBlock#editable property set to true will start in-place editing, but only if the Part that the TextBlock is in is already selected.
getter/setter pair
stateActive EnumValue
A possible value for #state, TextEditingTool#doActivate sets the value of #state to this.
getter/setter pair
stateEditing EnumValue
A possible value for #state, The default text editor receiving focus sets the value of #state to this.
getter/setter pair
stateInvalid EnumValue
A possible value for #state, If validation fails, TextEditingTool.acceptText sets the value of #state to this.
getter/setter pair
stateNone EnumValue
A possible value for #state, this is the starting value before the tool is activated.
getter/setter pair
stateValidated EnumValue
A possible value for #state, Once accepted and the tool begins the "TextEditing" transaction, the value of #state is set to this.
getter/setter pair
stateValidating EnumValue
A possible value for #state, TextEditingTool.acceptText sets the value of #state to this.
getter/setter pair
tab EnumValue
A possible value for TextEditingTool#acceptText, the user has typed TAB.
getter/setter pair