Text behind editable node

Hi,

When I make a node editable and provide it some text, it increases in size. When I start deleting text from textarea, text of node starts getting visible. Any fix for this?

This is mindmap sample.

I assume you are only talking about the size of the HTML textarea element used as the text editor.

That is the intended behavior. It allows people to enter more text than the TextBlock originally had.

Is there any way to keep textarea size at least equal to node size?

Northwoods Software also talks about the same issue.

It was added twice by mistake.

Is there any way to keep textarea size at least equal to node size?

You’ll need to set TextEditingTool.defaultTextEditor to be your own element. There is an example of a custom text editor at Text Editing Examples, which has two different kinds of text editing customization, although neither one customizes the behavior of a element.

Can this behavior be turned off? I have had to put in a lot of work arounds to stop textareas from growing after typing in the textarea. It seems way overkill to have to build a custom text editing tool just to keep the textarea from growing outside the original size!

I have borders around the textBlock elements and the textarea always overlaps the borders and looks horrible. Please fix this!

If you are using version 1.7, we have greatly cleaned up the text editor protocol via the HTMLInfo class. There is an implementation of the built-in editor at https://gojs.net/latest/extensions/TextEditor.js, used in a sample at HTMLInfo Text Editor.

Thanks for the quick reply!

I am using 1.7 for the new text editing features, they’re nice :)

I found a simpler work around to do a document level “input” capture and kill the event before it gets to the textarea’s own input event callback.

document.addEventListener( "input", function( ev ) { if ( ev.target.className == "class" ) { ev.preventDefault(); ev.stopPropagation(); return false; } }, true);