TextEditingTool$Typings extension

on

Properties

currentTextEditor HTMLInfo?
Gets or sets the HTMLInfo that is editing the text.
getter/setter pair
defaultTextEditor HTMLInfo
Gets or sets the default HTMLInfo that edits the text.
getter/setter pair
selectsTextOnActivate bool
Gets or sets whether to select (highlight) the editable text when the TextEditingTool is activated. The default is true.
getter/setter pair
starting EnumValue
Gets or sets how user gestures can start in-place editing of text.
getter/setter pair
state EnumValue
Gets or sets the state of the TextEditingTool. The only accepted values are listed as constant properties of TextEditingTool, including:
getter/setter pair
textBlock TextBlock?
Gets or sets the TextBlock that is being edited. This property is initially null and is set in TextEditingTool#doActivate as the TextBlock at the mouse click point. However, if you set this property beforehand, TextEditingTool#doActivate will not set it, and this tool will edit the given TextBlock.
getter/setter pair
textValidation bool Function(TextBlock, String, String)?
Gets or sets the predicate that determines whether or not a string of text is valid. If this is non-null, this predicate is called in addition to any TextBlock#textValidation predicate. See #isValidText for more details. The default predicate is null, which is equivalent to simply returning true.
getter/setter pair

Methods

acceptText(EnumValue reason) → void
Finish editing by trying to accept the new text.
canStart() bool
This may run when there is a mouse-click on a TextBlock for which the TextBlock#editable property is true in a Part that Part#isSelected.
doActivate() → void
Start editing the text for a #textBlock.
doCancel() → void
Abort any text editing operation.
doDeactivate() → void
Release the mouse.
doError(String oldstring, String newstring) → void
Call the #textBlock's TextBlock#errorFunction, if there is one, and then show the text editor again. This is called only when the #isValidText method returned false. The value of #state will be StateInvalid. This method may be overridden. You may wish to override this method in order to not continue showing the editor. @expose @param oldstring @param newstring @since 2.1
doMouseDown() → void
This calls #acceptText with the reason TextEditingTool.MouseDown, if this tool Tool#isActive.
doMouseUp() → void
A click (mouse up) calls TextEditingTool#doActivate if this tool is not already active and if TextEditingTool#canStart returns true.
doStart() → void
This calls TextEditingTool#doActivate if there is a #textBlock set. #doActivate attempts to set #textBlock if it is null.
doSuccess(String oldstring, String newstring) → void
Call the #textBlock's TextBlock#textEdited event handler, if there is one. This is called just after the TextBlock#text has been set to the new string value. When this method returns, this tool raises the "TextEdited" DiagramEvent and commits the transaction. This method may be overridden. @expose @param oldstring @param newstring @since 2.1
isValidText(TextBlock textblock, String oldstr, String newstr) bool
This predicate checks any TextBlock#textValidation predicate and this tool's #textValidation predicate to make sure the TextBlock#text property may be set to the new string.
measureTemporaryTextBlock(String text) TextBlock
This method returns a temporary TextBlock used for measuring text during editing. The TextBlock.text is set to the parameter's value, and the TextBlock is measured with the last available width of the #textBlock.