Avoid lost codemirror instances by reverting them before reloading the editor