@ckeditor/ckeditor5-watchdog 48.2.0 → 48.3.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actionsrecorder.d.ts +246 -246
- package/dist/actionsrecorderconfig.d.ts +187 -187
- package/dist/augmentation.d.ts +18 -18
- package/dist/contextwatchdog.d.ts +315 -315
- package/dist/editorwatchdog.d.ts +214 -214
- package/dist/index-content.css +1 -0
- package/dist/index-editor.css +1 -0
- package/dist/index.css +0 -2
- package/dist/index.d.ts +12 -12
- package/dist/index.js +1633 -1849
- package/dist/index.js.map +1 -1
- package/dist/utils/areconnectedthroughproperties.d.ts +7 -7
- package/dist/utils/getsubnodes.d.ts +7 -7
- package/dist/utils/normalizerootsconfig.d.ts +15 -15
- package/dist/watchdog.d.ts +205 -205
- package/package.json +4 -4
- package/dist/index.css.map +0 -1
|
@@ -1,204 +1,204 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import type { ActionsRecorder } from
|
|
6
|
+
* @module watchdog/actionsrecorderconfig
|
|
7
|
+
*/
|
|
8
|
+
import type { ActionsRecorder } from "./actionsrecorder.js";
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
10
|
+
* The configuration of the ActionsRecorder plugin.
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* ClassicEditor
|
|
14
|
+
* .create( {
|
|
15
|
+
* actionsRecorder: ... // ActionsRecorder feature options.
|
|
16
|
+
* } )
|
|
17
|
+
* .then( ... )
|
|
18
|
+
* .catch( ... );
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* See {@link module:core/editor/editorconfig~EditorConfig all editor configuration options}.
|
|
22
|
+
*/
|
|
23
23
|
export interface ActionsRecorderConfig {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
24
|
+
/**
|
|
25
|
+
* The maximum number of action entries to keep in memory.
|
|
26
|
+
* When this limit is reached, older entries will be removed.
|
|
27
|
+
*
|
|
28
|
+
* This behavior can be modified by providing {@link #onMaxEntries `onMaxEntries`} callback.
|
|
29
|
+
*
|
|
30
|
+
* ```ts
|
|
31
|
+
* ClassicEditor
|
|
32
|
+
* .create( {
|
|
33
|
+
* plugins: [ ActionsRecorder, ... ],
|
|
34
|
+
* actionsRecorder: {
|
|
35
|
+
* maxEntries: 1000
|
|
36
|
+
* }
|
|
37
|
+
* } )
|
|
38
|
+
* .then( ... )
|
|
39
|
+
* .catch( ... );
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @default 1000
|
|
43
|
+
*/
|
|
44
|
+
maxEntries?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Filter function that determines whether a record should be added to the list.
|
|
47
|
+
* This is called before the action executes and before the entry is stored.
|
|
48
|
+
* It allows to reduce memory usage by filtering out unnecessary records.
|
|
49
|
+
*
|
|
50
|
+
* If this function returns `false`, the record will not be stored in the entries array.
|
|
51
|
+
*
|
|
52
|
+
* ```ts
|
|
53
|
+
* ClassicEditor
|
|
54
|
+
* .create( {
|
|
55
|
+
* plugins: [ ActionsRecorder, ... ],
|
|
56
|
+
* actionsRecorder: {
|
|
57
|
+
* onFilter( entry, prevEntries ) {
|
|
58
|
+
* // Only record command executions.
|
|
59
|
+
* return entry.action.startsWith( 'commands.' );
|
|
60
|
+
* }
|
|
61
|
+
* }
|
|
62
|
+
* } )
|
|
63
|
+
* .then( ... )
|
|
64
|
+
* .catch( ... );
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
onFilter?: ActionsRecorderFilterCallback;
|
|
68
|
+
/**
|
|
69
|
+
* Callback function called on caught error.
|
|
70
|
+
*
|
|
71
|
+
* ```ts
|
|
72
|
+
* ClassicEditor
|
|
73
|
+
* .create( {
|
|
74
|
+
* plugins: [ ActionsRecorder, ... ],
|
|
75
|
+
* actionsRecorder: {
|
|
76
|
+
* onError( error, entries ) {
|
|
77
|
+
* console.error( 'ActionsRecorder - Error detected:', error );
|
|
78
|
+
* console.warn( 'Actions recorded before error:', entries );
|
|
79
|
+
*
|
|
80
|
+
* this.flushEntries();
|
|
81
|
+
* }
|
|
82
|
+
* }
|
|
83
|
+
* } )
|
|
84
|
+
* .then( ... )
|
|
85
|
+
* .catch( ... );
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
onError?: ActionsRecorderErrorCallback;
|
|
89
|
+
/**
|
|
90
|
+
* Callback function called when recorded entries count reaches {@link #maxEntries `maxEntries`}.
|
|
91
|
+
*
|
|
92
|
+
* ```ts
|
|
93
|
+
* ClassicEditor
|
|
94
|
+
* .create( {
|
|
95
|
+
* plugins: [ ActionsRecorder, ... ],
|
|
96
|
+
* actionsRecorder: {
|
|
97
|
+
* onMaxEntries() {
|
|
98
|
+
* const entries = this.getEntries();
|
|
99
|
+
*
|
|
100
|
+
* this.flushEntries();
|
|
101
|
+
*
|
|
102
|
+
* console.log( 'ActionsRecorder - Batch of entries:', entries );
|
|
103
|
+
* }
|
|
104
|
+
* }
|
|
105
|
+
* } )
|
|
106
|
+
* .then( ... )
|
|
107
|
+
* .catch( ... );
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* By default, when this callback is not provided, the list of entries is shifted so it does not include more than
|
|
111
|
+
* {@link #maxEntries `maxEntries`}.
|
|
112
|
+
*/
|
|
113
|
+
onMaxEntries?: ActionsRecorderMaxEntriesCallback;
|
|
114
114
|
}
|
|
115
115
|
/**
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
116
|
+
* Callback function type for the {@link ~ActionsRecorderConfig#onFilter `onFilter`} option.
|
|
117
|
+
* Called before the action executes to determine if it should be recorded.
|
|
118
|
+
*
|
|
119
|
+
* @param entry The action entry to be filtered.
|
|
120
|
+
* @param prevEntries The array of previous action entries.
|
|
121
|
+
*/
|
|
122
122
|
export type ActionsRecorderFilterCallback = (this: ActionsRecorder, entry: ActionsRecorderEntry, prevEntries: Array<ActionsRecorderEntry>) => boolean;
|
|
123
123
|
/**
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
124
|
+
* Callback function type for the {@link ~ActionsRecorderConfig#onError `onError`} option.
|
|
125
|
+
*
|
|
126
|
+
* @param error The error that occurred.
|
|
127
|
+
* @param entries The log of actions before the error was encountered.
|
|
128
|
+
*/
|
|
129
129
|
export type ActionsRecorderErrorCallback = (this: ActionsRecorder, error: any, entries: Array<ActionsRecorderEntry>) => void;
|
|
130
130
|
/**
|
|
131
|
-
|
|
132
|
-
|
|
131
|
+
* Callback function type for the {@link ~ActionsRecorderConfig#onMaxEntries `onMaxEntries`} option.
|
|
132
|
+
*/
|
|
133
133
|
export type ActionsRecorderMaxEntriesCallback = (this: ActionsRecorder) => void;
|
|
134
134
|
/**
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
* Represents the state snapshot of the editor at a specific point in time.
|
|
136
|
+
*/
|
|
137
137
|
export interface ActionsRecorderEntryEditorSnapshot {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
138
|
+
/**
|
|
139
|
+
* The document version. See {@link module:engine/model/document~ModelDocument#version}.
|
|
140
|
+
*/
|
|
141
|
+
documentVersion: number;
|
|
142
|
+
/**
|
|
143
|
+
* Whether the editor is in the read-only mode. See {@link module:core/editor/editor~Editor#isReadOnly}.
|
|
144
|
+
*/
|
|
145
|
+
editorReadOnly: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* True if document is focused. See {@link module:engine/view/document~ViewDocument#isFocused}.
|
|
148
|
+
*/
|
|
149
|
+
editorFocused: boolean;
|
|
150
|
+
/**
|
|
151
|
+
* The current model selection. See {@link module:engine/model/document~ModelDocument#selection}.
|
|
152
|
+
*/
|
|
153
|
+
modelSelection: any;
|
|
154
154
|
}
|
|
155
155
|
/**
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
* Represents a recorded action entry with context and state information.
|
|
157
|
+
*/
|
|
158
158
|
export interface ActionsRecorderEntry {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
159
|
+
/**
|
|
160
|
+
* Entry timestamp in ISO date time format.
|
|
161
|
+
*/
|
|
162
|
+
timeStamp: string;
|
|
163
|
+
/**
|
|
164
|
+
* For nested actions this is a reference to parent action (nesting of try-catch blocks).
|
|
165
|
+
*
|
|
166
|
+
* For example when user clicks a button in a toolbar it could generate such nested tree:
|
|
167
|
+
* * `component.bold:execute`
|
|
168
|
+
* * `commands.bold:execute`
|
|
169
|
+
* * `model.applyOperation`
|
|
170
|
+
*/
|
|
171
|
+
parentEntry?: ActionsRecorderEntry;
|
|
172
|
+
/**
|
|
173
|
+
* The name of the action.
|
|
174
|
+
*
|
|
175
|
+
* For example:
|
|
176
|
+
* * `component.bold:execute` Main action for toolbar button `bold` was executed.
|
|
177
|
+
* * `commands.bold:execute` The `bold` command was executed.
|
|
178
|
+
* * `model.applyOperation` The low-level operation was applied to the model.
|
|
179
|
+
* * `observers:paste` The `paste` DOM event was dispatched in the editing root.
|
|
180
|
+
* * `model.insertContent` The `model#insertContent()` was called.
|
|
181
|
+
* * `model-selection:change:range` The model selection range was changed.
|
|
182
|
+
*/
|
|
183
|
+
action: string;
|
|
184
|
+
/**
|
|
185
|
+
* The editor state before the action was executed.
|
|
186
|
+
*/
|
|
187
|
+
before: ActionsRecorderEntryEditorSnapshot;
|
|
188
|
+
/**
|
|
189
|
+
* The editor state after the action was executed.
|
|
190
|
+
*/
|
|
191
|
+
after?: ActionsRecorderEntryEditorSnapshot;
|
|
192
|
+
/**
|
|
193
|
+
* Params provided for the executed action. They depend on the actual action.
|
|
194
|
+
*/
|
|
195
|
+
params?: Array<any>;
|
|
196
|
+
/**
|
|
197
|
+
* The result returned by the executed action. It depends on the actual action.
|
|
198
|
+
*/
|
|
199
|
+
result?: any;
|
|
200
|
+
/**
|
|
201
|
+
* The error if the action throws one.
|
|
202
|
+
*/
|
|
203
|
+
error?: any;
|
|
204
204
|
}
|
package/dist/augmentation.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import type { EditorData } from
|
|
6
|
-
import type { ActionsRecorderConfig } from
|
|
7
|
-
declare module
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
import type { EditorData } from "./editorwatchdog.js";
|
|
6
|
+
import type { ActionsRecorderConfig } from "./actionsrecorderconfig.js";
|
|
7
|
+
declare module "@ckeditor/ckeditor5-core" {
|
|
8
|
+
interface EditorConfig {
|
|
9
|
+
/**
|
|
10
|
+
* The temporary property that is used for passing data to the plugin which restores the editor state.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
_watchdogInitialData?: EditorData;
|
|
15
|
+
/**
|
|
16
|
+
* The configuration for the actions recorder plugin.
|
|
17
|
+
*/
|
|
18
|
+
actionsRecorder?: ActionsRecorderConfig;
|
|
19
|
+
}
|
|
20
20
|
}
|