Custom edit on TextBlock hangs when text is large

I’m not sure what’s wrong, but the problem goes away when the TextBlock is visible. It’s related to ContextMenuButton Data Binding to Node property. Here’s what I suggest that you use in your node template:

      $(go.TextBlock   // Text block for the node documentation
        , {
            name: "textBlockDocumentation"
          , height: 0, width: 0
          , isMultiline: false
          , textEditor: customEditor
        }
        , new go.Binding("text", "documentation").makeTwoWay()
      ),

Perhaps even more efficient would be to have it be not visible normally, but visible just when editing. So then the TextBlock could be:

      $(go.TextBlock   // Text block for the node documentation, this is always hidden because I have a custom editor
        , {
            name: "textBlockDocumentation"
          , height: 0, width: 0
          , isMultiline: false
          , textEditor: customEditor
          , visible: false
          , textEdited: (tb, olds, news) => tb.visible = false
        }
        , new go.Binding("text", "documentation").makeTwoWay()
      ),

And you would need to change your editDoc function:

    var textBlock = nodeObj.part.findObject('textBlockDocumentation');
    if (myDiagram.commandHandler.canEditTextBlock(textBlock)) {
      textBlock.visible = true;
      textBlock.part.ensureBounds();  // needed to avoid the problem with editing not-visible TextBlocks
      myDiagram.commandHandler.editTextBlock(textBlock);
    }