Aloha Editor

Aloha Editor Guides

These guides help you to make your content editable and to develop Aloha Editor.

The Undo Plugin

The Undo plugin replaces native browser undo/redo functionality.

1 Usage

The Undo Plugin allows you to undo changes to an editable by pressing Ctrl+Z (or Cmd+Z on Mac). You may also reapply changes made undone by pressing Ctrl+Shift+Z or Cmd+Shift+Z on Mac. The Undo Plugin has no UI and no components.

2 Configuration

This plugin does not provide any configuration settings itself.

However, the Undo plugin relies on the aloha-smart-content-changed event for creating undo snapshots. All undo and redo actions will jump from one undo snapshot to another.

The aloha-smart-content-changed fires after content changes. The event doesn’t fire immediately, but only if the content didn’t change again for a certain amount of time. By default the timeout is 5 seconds (the idle setting). If the user types a character that is in the list configured by the delimiters settings, the timeout is drastically shortened to half a second (the delay setting).

The timeouts and delimiters can be configured as follows (timeouts are in milliseconds):


Aloha.settings.smartContentChange = {
    delimiters: [ ':', ';', '.', '!', '?', ',', unescape( '%u0009' ), unescape( '%u0020' ), 'Enter' ],
    idle: 5000,
    delay: 500
};

3 References