Or you could implement it without using TextEditingTool at all, just by responding to the F1 key and looking at the selected node (if there is one), displaying your dialog, choosing what text to start editing, and if successful modifying the text of the node.
I’m not sure it makes sense to have multiple text editors active at the same time, since only one input element may have focus at any one time. But you could certainly have both visible at the same time. That might be confusing for the user, though.
Yes, you could change which text editor that you use at the time a command occurs. But it is more commonplace to have different text editors defined on different TextBlocks, by setting TextBlock.textEditor. The sample Text Editing Examples does that for the fourth TextBlock of the Node.
Implement your F1 key command by overriding CommandHandler.doKeyDown, as shown at GoJS Commands -- Northwoods Software, and calling CommandHandler.editTextBlock with the specific TextBlock to edit.
How can I add a event listener when text editor lose focus (until the text editing tool abandon its ‘textBlock’)?
I’m trying to solve this issue with a way which I change the text editor type for each edit starting.
So, I had to revert editor type of text block to default for each edit finishing.
How can I do this when text editor lost focus?
At the time that TextEditingTool.doAccept is called, there is definitely still a value for TextEditingTool.textBlock. That property is only set to null in the TextEditingTool.doDeactivate method, which is called only when the tool is stopping.