Getting node key on custom 'TextEditor.show()'

Hello, Walter.

I implemented a custom text editor.
And I’d like to get the key of a node trying to edit on ‘show()’ method.

The gojs passed 3 parameters ‘textBlock’, ‘diagram’ and ‘tool’ like below.

TextEditor.show = function(textBlock, diagram, tool) {
    ...

I suppose that I can get the key through the ancestors of specified textBlock.
But I don’t know how I can get the key of editing node.
I cannot find proper api or method exact.

I’m trying to edit the textblock without selection.
I’m editing a textblock under a node not selected.
So, I couldn’t use diagram.selection.

Should I use global variable for this?

Thank you, always.

textBlock.part.data.key
… or whatever the name of your key property is on your node data.

1 Like