History and undo/redo require your backend to support versioned state storage.
If your backend is append-only, you can still implement
publish() and
revertAllChanges() independently.getLastChanged()
Enables the history panel and diff view. blökkli calls this periodically to detect whether the content has changed since the editor was last loaded — for example, if another user made edits in a parallel session.
Return a timestamp string, an integer version counter, or any other value that changes when the content changes. blökkli compares the returned value against the previously stored value using strict equality.
Signature
setHistoryIndex({ index })
Enables undo and redo. blökkli maintains a local history index and calls this method when the user triggers an undo (Ctrl/Cmd+Z) or redo (Ctrl/Cmd+Shift+Z) action. Your backend should restore the content to the state at the given index.
Signature
The history index to restore.
0 is the oldest recorded state; higher values
are more recent. blökkli tracks the valid range and only calls this method
with indices within bounds.revertAllChanges()
Enables the Revert button. Called when the user confirms they want to discard all unpublished changes and return to the last published state. Your backend should delete or discard all draft/pending revisions.
Signature
publish()
Enables the Publish button in the editor toolbar. Called when the user clicks Publish and confirms the action. Your backend should persist the current draft state as the active published version.
Signature
takeOwnership()
Enables the Ownership feature. Some content management systems lock an entity to the user who opened it for editing. When another user attempts to edit the same entity, blökkli shows an “in use” warning. Implementing takeOwnership() lets the second user forcibly take over the editing session.
Signature
If your backend does not implement entity locking, you do not need this
method. blökkli only shows the ownership UI when
takeOwnership() is present
in the adapter.changeLanguage({ langcode })
Enables the Translations feature. Called when the user switches the active editing language in the language selector. Navigate to the correct URL or update the query string so the editor reloads with the selected language’s content.
Signature
The BCP 47 language code of the target language (e.g.,
'de', 'fr',
'nl'). Matches the codes you provide in the language prop on
<BlokkliProvider>.
