Make a small attempt at bringing all JS into common formatting.
Fix bug where error on creating new page deleted all contents. [Fix #58780994]