Closing TextBlock editing programmatically

Once I have edited a TextBlock, I want to be able to accept the new text and close the editor programmatically, rather than by clicking somewhere else in the diagram. A bit like the converse of Diagram.commandHandler.editTextBlock(). I have tried Diagram.commandHandler.stopComamnd(): it closes the editor, but loses the new text. How can I achieve this?

Try calling TextEditingTool.acceptText.

Hi,
Which [quote=“walter, post:2, topic:6696”]
TextEditingTool.acceptText.
[/quote]
Should be called in this case?

I’m trying to call diagram.toolManager.textEditingTool.currentTextEditor.acceptText(go.TextEditingTool.Enter);
But it does nothing. Same with defaultTextEditor.

That should be an error because acceptText is defined on TextEditingTool, not on the HTML DOM Element interface.

Yes, you right it was diagram.toolManager.textEditingTool.currentTextEditor.textEditingTool

The problem in my case was that I was giving acceptText a wrong argument. When argument is LostFocus it accepts text as expected.