NEWCKEditor 5 Long-term Support is here! Find out more
Sign up (with export icon)

ActionsRecorderConfig

Api-interface icon interface

The configuration of the ActionsRecorder plugin.

	ClassicEditor
		.create( editorElement, {
			actionsRecorder: ... // ActionsRecorder feature options.
		} )
		.then( ... )
		.catch( ... );
Copy code

See all editor configuration options.

Properties

  • Chevron-right icon

    maxEntries : number | undefined

    The 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 onMaxEntries callback.

    	ClassicEditor
    		.create( editorElement, {
    			plugins: [ ActionsRecorder, ... ],
    			actionsRecorder: {
    				maxEntries: 1000
    			}
    		} )
    		.then( ... )
    		.catch( ... );
    
    Copy code

    Defaults to 1000

  • Chevron-right icon

    Callback 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
  • Chevron-right icon

    Filter 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
  • Chevron-right icon

    Callback 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 code

    By default, when this callback is not provided, the list of entries is shifted so it does not include more than maxEntries.