Code example. After submision inputForm, value in editor and compiledEditor dissapear:
var btnValue = document.querySelector("#inButton");
btnValue.addEventListener("click", function () {
$('#inputHidden').val(editor.getValue());
localStorage.setItem('storage', editor.getValue());
compiledEditor.setValue(localStorage.getItem('storage'));
document.getElementById('inputForm').submit()
});