ActionsRecorderConfig
The configuration of the ActionsRecorder plugin.
ClassicEditor
.create( editorElement, {
actionsRecorder: ... // ActionsRecorder feature options.
} )
.then( ... )
.catch( ... );
Properties
-
maxEntries : number | undefinedmodule:watchdog/actionsrecorderconfig~ActionsRecorderConfig#maxEntriesThe maximum number of action entries to keep in memory. When this limit is reached, older entries will be removed.
This behavior can be modified by providing
onMaxEntriescallback.ClassicEditor .create( editorElement, { plugins: [ ActionsRecorder, ... ], actionsRecorder: { maxEntries: 1000 } } ) .then( ... ) .catch( ... );Copy codeDefaults to
1000 -
onError : ActionsRecorderErrorCallback | undefinedmodule:watchdog/actionsrecorderconfig~ActionsRecorderConfig#onErrorCallback function called on caught error.
ClassicEditor .create( editorElement, { plugins: [ ActionsRecorder, ... ], actionsRecorder: { onError( error, entries ) { console.error( 'ActionsRecorder - Error detected:', error ); console.warn( 'Actions recorded before error:', entries ); this.flushEntries(); } } } ) .then( ... ) .catch( ... );Copy code -
onFilter : ActionsRecorderFilterCallback | undefinedmodule:watchdog/actionsrecorderconfig~ActionsRecorderConfig#onFilterFilter function that determines whether a record should be added to the list. This is called before the action executes and before the entry is stored. It allows to reduce memory usage by filtering out unnecessary records.
If this function returns
false, the record will not be stored in the entries array.ClassicEditor .create( editorElement, { plugins: [ ActionsRecorder, ... ], actionsRecorder: { onFilter( entry, prevEntries ) { // Only record command executions. return entry.action.startsWith( 'commands.' ); } } } ) .then( ... ) .catch( ... );Copy code -
onMaxEntries : ActionsRecorderMaxEntriesCallback | undefinedmodule:watchdog/actionsrecorderconfig~ActionsRecorderConfig#onMaxEntriesCallback function called when recorded entries count reaches
maxEntries.ClassicEditor .create( editorElement, { plugins: [ ActionsRecorder, ... ], actionsRecorder: { onMaxEntries() { const entries = this.getEntries(); this.flushEntries(); console.log( 'ActionsRecorder - Batch of entries:', entries ); } } } ) .then( ... ) .catch( ... );Copy codeBy default, when this callback is not provided, the list of entries is shifted so it does not include more than
maxEntries.