Input box is out of range in edit mode

Input box is out of range in edit mode.
Input box is out of range in edit mode.
Input box is out of range in edit mode.

Yes, if they type a lot and you do not limit what they can enter, the text editor can get big. What is your question? Have you read https://gojs.net/latest/intro/HTMLInteraction.html#TextEditors ?

In terms of user experience, shouldn’t the maximum width of the input box default to the width of the rectangular box?

You can customize the text editor so that the <textarea> is limited in width. Or any other policies you want.

But I should say that what you suggest is reasonable unless the text starts off very narrow – such as when it is initially an empty string.

Can the height of the textarea be adaptive? At the same time, the height of the rectangular box will also adapt to the height of the textare.

Yes.
https://gojs.net/latest/extensions/TextEditor.html
https://gojs.net/latest/extensions/TextEditor.js

Can it adapt while inputting?

As I said, yes. Just adapt the code to create your own custom editor.