ActionsRecorderConfig
The configuration of the ActionsRecorder plugin.
ClassicEditor
.create( {
actionsRecorder: ... // ActionsRecorder feature options.
} )
.then( ... )
.catch( ... );Copy codeProperties
maxEntries?: numbermodule: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.
Copy codeClassicEditor .create( { plugins: [ ActionsRecorder, ... ], actionsRecorder: { maxEntries: 1000 } } ) .then( ... ) .catch( ... );Defaults to
1000module:watchdog/actionsrecorderconfig~ActionsRecorderConfig#onErrorCallback function called on caught error.
Copy codeClassicEditor .create( { plugins: [ ActionsRecorder, ... ], actionsRecorder: { onError( error, entries ) { console.error( 'ActionsRecorder - Error detected:', error ); console.warn( 'Actions recorded before error:', entries ); this.flushEntries(); } } } ) .then( ... ) .catch( ... );module: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.
Copy codeClassicEditor .create( { plugins: [ ActionsRecorder, ... ], actionsRecorder: { onFilter( entry, prevEntries ) { // Only record command executions. return entry.action.startsWith( 'commands.' ); } } } ) .then( ... ) .catch( ... );module:watchdog/actionsrecorderconfig~ActionsRecorderConfig#onMaxEntriesCallback function called when recorded entries count reaches
maxEntries.
Copy codeClassicEditor .create( { plugins: [ ActionsRecorder, ... ], actionsRecorder: { onMaxEntries() { const entries = this.getEntries(); this.flushEntries(); console.log( 'ActionsRecorder - Batch of entries:', entries ); } } } ) .then( ... ) .catch( ... );By default, when this callback is not provided, the list of entries is shifted so it does not include more than
maxEntries.