refactored plugin to reformat automatically on editor deactivate rather than as a user-initiated action