ActionsRecorder
A plugin that records user actions and editor state changes for debugging purposes. It tracks commands execution, model operations, UI interactions, and document events. It just collects data locally, and does not send it anywhere, integrator is responsible for gathering data from this plugin for further processing.
Important! ActionsRecorder is an experimental feature, and may become deprecated.
By default, plugin stores latest 1000 action entries. Integrator can register an onError callback to collect those entries
in case of exception. Integrator should augment this data with application specific data such as page-id or session-id,
depending on the application. Augmented data should be processed by the integrator, for example integrator should send it
to some data collecting endpoint for later analysis.
Example:
	ClassicEditor
		.create( editorElement, {
			plugins: [ ActionsRecorder, ... ],
			actionsRecorder: {
				maxEntries: 1000, // This is the default value and could be adjusted.
				onError( error, entries ) {
					console.error( 'ActionsRecorder - Error detected:', error );
					console.warn( 'Actions recorded before error:', entries );
					this.flushEntries();
					// Integrator should send and store the entries. The error is already in the last entry in serializable form.
				}
			}
		} )
		.then( ... )
		.catch( ... );
Alternatively integrator could continuously collect actions in batches and send them to theirs endpoint for later analysis:
	ClassicEditor
		.create( editorElement, {
			plugins: [ ActionsRecorder, ... ],
			actionsRecorder: {
				maxEntries: 50, // This is the batch size.
				onMaxEntries() {
					const entries = this.getEntries();
					this.flushEntries();
					console.log( 'ActionsRecorder - Batch of entries:', entries );
					// Integrator should send and store the entries.
				},
				onError( error, entries ) {
					console.error( 'ActionsRecorder - Error detected:', error );
					console.warn( 'Actions recorded before error:', entries );
					this.flushEntries();
					// Integrator should send and store the entries. The error is already in the last entry in serializable form.
				}
			}
		} )
		.then( ... )
		.catch( ... );
See plugin configuration for more details.
Properties
- 
                              module:watchdog/actionsrecorder~ActionsRecorder#editorThe editor instance. 
- 
                              _entries : Array<ActionsRecorderEntry>privatemodule:watchdog/actionsrecorder~ActionsRecorder#_entriesArray storing all recorded action entries with their context and state snapshots. 
- 
                              _errorCallback : ActionsRecorderErrorCallback | undefinedprivatemodule:watchdog/actionsrecorder~ActionsRecorder#_errorCallbackError callback. 
- 
                              _errors : Set<Error>privatemodule:watchdog/actionsrecorder~ActionsRecorder#_errorsSet of already reported errors used to notify only once for each error (not on every try-catch nested block). 
- 
                              _filterCallback : ActionsRecorderFilterCallback | undefinedprivatemodule:watchdog/actionsrecorder~ActionsRecorder#_filterCallbackFilter function to determine which entries should be stored. 
- 
                              _frameStack : Array<ActionsRecorderEntry>privatemodule:watchdog/actionsrecorder~ActionsRecorder#_frameStackStack tracking nested action frames to maintain call hierarchy. 
- 
                              _maxEntries : numberprivatemodule:watchdog/actionsrecorder~ActionsRecorder#_maxEntriesMaximum number of action entries to keep in memory. 
- 
                              module:watchdog/actionsrecorder~ActionsRecorder#_maxEntriesCallbackCallback triggered every time count of recorded entries reaches maxEntries. 
Static properties
- 
                              isOfficialPlugin : truereadonlystaticmodule:watchdog/actionsrecorder~ActionsRecorder.isOfficialPlugin
- 
                              pluginName : 'ActionsRecorder'readonlystaticmodule:watchdog/actionsrecorder~ActionsRecorder.pluginName
Methods
- 
                              constructor( editor )module:watchdog/actionsrecorder~ActionsRecorder#constructor
- 
                              flushEntries() → voidmodule:watchdog/actionsrecorder~ActionsRecorder#flushEntries
- 
                              getEntries() → Array<ActionsRecorderEntry>module:watchdog/actionsrecorder~ActionsRecorder#getEntries
- 
                              module:watchdog/actionsrecorder~ActionsRecorder#_buildStateSnapshotBuilds a snapshot of the current editor state including document version, read-only status, focus state, and model selection. Returns- ActionsRecorderEntryEditorSnapshot
- An object containing the current editor state snapshot. 
 
- 
                              _callErrorCallback( [ error ] ) → voidprivatemodule:watchdog/actionsrecorder~ActionsRecorder#_callErrorCallback
- 
                              _enterFrame( action, [ params ] ) → ActionsRecorderEntryprivatemodule:watchdog/actionsrecorder~ActionsRecorder#_enterFrameCreates a new action frame and adds it to the recording stack. Parameters- action : string
- The name/type of the action being recorded. 
- [ params ] : Array<unknown>
- Optional parameters associated with the event. 
 Returns- ActionsRecorderEntry
- The created call frame object. 
 
- 
                              _leaveFrame( callFrame, [ result ], [ error ] ) → voidprivatemodule:watchdog/actionsrecorder~ActionsRecorder#_leaveFrameCloses an action frame and records its final state and results. Parameters- callFrame : ActionsRecorderEntry
- The call frame to close. 
- [ result ] : any
- Optional result value from the action. 
- [ error ] : any
- Optional error that occurred during the action. 
 Returns- void
 
- 
                              _maxEntriesDefaultHandler() → voidprivatemodule:watchdog/actionsrecorder~ActionsRecorder#_maxEntriesDefaultHandler
- 
                              _tapCommand( commandName, command ) → voidprivatemodule:watchdog/actionsrecorder~ActionsRecorder#_tapCommandSets up recording for a specific command execution. Parameters- commandName : string
- The name of the command to record. 
- command : Command
- The command instance to tap into. 
 Returns- void
 
- 
                              _tapCommands() → voidprivatemodule:watchdog/actionsrecorder~ActionsRecorder#_tapCommandsSets up recording for all editor commands, both existing and future ones. Taps into the command execution to track when commands are run. Returns- void
 
- 
                              _tapComponentFactory() → voidprivatemodule:watchdog/actionsrecorder~ActionsRecorder#_tapComponentFactorySets up recording for UI component factory creation and component interactions. Tracks when components are created and their execute events. Returns- void
 
- 
                              _tapFireMethod( emitter, eventNames, context ) → voidprivatemodule:watchdog/actionsrecorder~ActionsRecorder#_tapFireMethodSets up recording for specific events fired by an emitter object. Parameters- emitter : any
- The object that fires events to be recorded. 
- eventNames : Array<string>
- Array of event names to record. 
- context : Record<string, any>
- Additional context to include with recorded events. - Defaults to - {}
 Returns- void
 
- 
                              _tapModelMethods() → voidprivatemodule:watchdog/actionsrecorder~ActionsRecorder#_tapModelMethodsSets up recording for key model methods like insertContent, insertObject, and deleteContent. These methods represent high-level model manipulation operations. Returns- void
 
- 
                              _tapModelSelection() → voidprivatemodule:watchdog/actionsrecorder~ActionsRecorder#_tapModelSelectionSets up recording for model selection changes. Tracks when the selection range, attributes, or markers change. Returns- void
 
- 
                              _tapOperationApply() → voidprivatemodule:watchdog/actionsrecorder~ActionsRecorder#_tapOperationApplySets up recording for model operation applications. Tracks when operations are applied to the model document. Returns- void
 
- 
                              _tapViewDocumentEvents() → voidprivatemodule:watchdog/actionsrecorder~ActionsRecorder#_tapViewDocumentEventsSets up recording for view document events like clicks, keyboard input, selection changes, and other user interactions. Returns- void