The popup is caused by a bound onbeforeunload
event that is being added via the autosave plugin. To completely disable it;
var editor = window.Joomla.editors.instances['{editor}'];
editor.instance.plugins.autosave = {};
Replace {editor}
with the id of the editor.
Addendum (2022-09-15):
This code now throws an error during the onbeforeunload
event. I've found a fix already:
var editor = window.Joomla.editors.instances['{editor}'];
editor.instance.plugins.autosave = {storeDraft:function(){editor.instance.setDirty(false)}};