Iím not sure, but try this, from help:
Returns the text in the editbox of the specified window.
If N = 1, returns the text in the second editbox in a channel window, if it's open.
So before whatever erases the editbox do this:
var %editing = $editbox(window,N)
and when you return to the window:
editbox -f %editing