Handler TextBlock is in editable mode


#1

Hi team,

Is there a way to know TextBlock is in editable mode?

TextEditor has paddings so I want to move TextEditor on padding value to top.
I’ve tried to set to TextEditor’s textarea negative top margin, I’ve tried to set for textarea wrapper position relative and for textarea position absolute with negative top. That’s not working.

Maybe there is a handler that is I can use to change margin value for TextBlock when it becomes to TextEditor. I don’t know.

Do you have an idea?

Thank you,
Alexander


#2

Any TextBlock that is edited does not actually change the TextBlock at all, until the TextEditingTool completes the edit and changes its text string.

Instead a text editor HTML element is created and positioned in front of the TextBlock. It gets focus and handles input.

Is your question just about the positioning of the editor relative to the TextBlock? You can replace the text editor with your own. Please read https://gojs.net/latest/intro/HTMLInteraction.html#TextEditors and https://gojs.net/latest/extensions/textEditor.html.

The latter demonstrates using a replacement editor that is exactly the same as the built-in editor. The definition is at https://gojs.net/latest/extensions/TextEditor.js


#3

Thank you Walter.

Yes, I just need set another top margin to TextEditor.
So when my TextBlock has

    alignment: go.Spot.TopLeft,
    margin: new go.Margin(24, 0, 0, 0)

I need to have for TextEditor margin-top 14px in this case.

I’m going to go through documentation you’ve provided to understand what can I do.

Thank you for the information and for clarifying!