There are many ways to automatically save editor changes. You can do the following:
- On editor blur use the editor#blur event.
- Once every N seconds use editor.checkDirty() and resetDirty() to verify whether changes have been made.
- When a user types, use the editor#change event, however, it's not recommended to make AJAX calls on every #change event as it may happen too often. The event must be debounced e.g., by using the eventsBuffer method.
You can also search our add-ons repository for a plugin that allows for saving and restoring content automatically.