fix unintended beforeunload on post or preview