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.
My English was wrong.
I didn’t mean ‘at the same time’ that multiple text editors activated at once.
The users should choice which type of editor he would use each time.
Thank you for your answer.
I’ll study that reference and try it.
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?
But I found that the tool already doesn’t have ‘textBlock’ at that point.
May I should add event listener for ‘click’ event for canvas?
I think it’s a little risky that I take textblock object through diagram.selection in this listener function.
What would be most nice try to me for this issue.
Please show me the road.
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.