@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
package/dist/editorwatchdog.d.ts
CHANGED
|
@@ -1,225 +1,225 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { Watchdog, type WatchdogConfig } from
|
|
6
|
-
import type { CKEditorError } from
|
|
7
|
-
import type { Editor, EditorConfig, Context } from
|
|
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 { Watchdog, type WatchdogConfig } from "./watchdog.js";
|
|
6
|
+
import type { CKEditorError } from "@ckeditor/ckeditor5-utils";
|
|
7
|
+
import type { Editor, EditorConfig, Context } from "@ckeditor/ckeditor5-core";
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
* A watchdog for CKEditor 5 editors.
|
|
10
|
+
*
|
|
11
|
+
* See the {@glink features/watchdog Watchdog feature guide} to learn the rationale behind it and
|
|
12
|
+
* how to use it.
|
|
13
|
+
*/
|
|
14
14
|
export declare class EditorWatchdog<TEditor extends Editor = Editor> extends Watchdog {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
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
|
-
|
|
15
|
+
/**
|
|
16
|
+
* The current editor instance.
|
|
17
|
+
*/
|
|
18
|
+
private _editor;
|
|
19
|
+
/**
|
|
20
|
+
* A promise associated with the life cycle of the editor (creation or destruction processes).
|
|
21
|
+
*
|
|
22
|
+
* It is used to prevent the initialization of the editor if the previous instance has not been destroyed yet,
|
|
23
|
+
* and conversely, to prevent the destruction of the editor if it has not been initialized.
|
|
24
|
+
*/
|
|
25
|
+
private _lifecyclePromise;
|
|
26
|
+
/**
|
|
27
|
+
* Throttled save method. The `save()` method is called the specified `saveInterval` after `throttledSave()` is called,
|
|
28
|
+
* unless a new action happens in the meantime.
|
|
29
|
+
*/
|
|
30
|
+
private _throttledSave;
|
|
31
|
+
/**
|
|
32
|
+
* The latest saved editor data represented as a root name -> root data object.
|
|
33
|
+
*/
|
|
34
|
+
private _data?;
|
|
35
|
+
/**
|
|
36
|
+
* The last document version.
|
|
37
|
+
*/
|
|
38
|
+
private _lastDocumentVersion?;
|
|
39
|
+
/**
|
|
40
|
+
* The editor source element or data.
|
|
41
|
+
*/
|
|
42
|
+
private _elementOrData?;
|
|
43
|
+
/**
|
|
44
|
+
* Stores the original DOM element for single-root editors.
|
|
45
|
+
*/
|
|
46
|
+
private _editorAttachTo;
|
|
47
|
+
/**
|
|
48
|
+
* Specifies whether the editor is a single-root editor (e.g. ClassicEditor) or a multi-root editor (e.g. MultiRootEditor).
|
|
49
|
+
*/
|
|
50
|
+
private _isSingleRootEditor;
|
|
51
|
+
/**
|
|
52
|
+
* Specifies whether the editor was created using config-based creator mode (without a source element or data as the first argument).
|
|
53
|
+
*
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
_isUsingConfigBasedCreator: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* The latest record of the editor editable elements. Used to restart the editor.
|
|
59
|
+
*/
|
|
60
|
+
private _editables;
|
|
61
|
+
/**
|
|
62
|
+
* The editor configuration.
|
|
63
|
+
*/
|
|
64
|
+
private _config?;
|
|
65
|
+
/**
|
|
66
|
+
* The creation method.
|
|
67
|
+
*
|
|
68
|
+
* @see #setCreator
|
|
69
|
+
*/
|
|
70
|
+
protected _creator: EditorWatchdogCreatorFunction<TEditor>;
|
|
71
|
+
/**
|
|
72
|
+
* The destruction method.
|
|
73
|
+
*
|
|
74
|
+
* @see #setDestructor
|
|
75
|
+
*/
|
|
76
|
+
protected _destructor: (editor: Editor) => Promise<unknown>;
|
|
77
|
+
private _excludedProps?;
|
|
78
|
+
/**
|
|
79
|
+
* @param Editor The editor class.
|
|
80
|
+
* @param watchdogConfig The watchdog plugin configuration.
|
|
81
|
+
*/
|
|
82
|
+
constructor(Editor: {
|
|
83
|
+
create(...args: any): Promise<TEditor>;
|
|
84
|
+
} | null, watchdogConfig?: WatchdogConfig);
|
|
85
|
+
/**
|
|
86
|
+
* The current editor instance.
|
|
87
|
+
*/
|
|
88
|
+
get editor(): TEditor | null;
|
|
89
|
+
/**
|
|
90
|
+
* @internal
|
|
91
|
+
*/
|
|
92
|
+
get _item(): TEditor | null;
|
|
93
|
+
/**
|
|
94
|
+
* Sets the function that is responsible for the editor creation.
|
|
95
|
+
* It expects a function that should return a promise.
|
|
96
|
+
*
|
|
97
|
+
* For config-based editor creation:
|
|
98
|
+
*
|
|
99
|
+
* ```ts
|
|
100
|
+
* watchdog.setCreator( config => ClassicEditor.create( config ) );
|
|
101
|
+
* ```
|
|
102
|
+
*
|
|
103
|
+
* For legacy editor creation (with element or data as the first argument):
|
|
104
|
+
*
|
|
105
|
+
* ```ts
|
|
106
|
+
* watchdog.setCreator( ( element, config ) => ClassicEditor.create( element, config ) );
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
setCreator(creator: EditorWatchdogCreatorFunction<TEditor>): void;
|
|
110
|
+
/**
|
|
111
|
+
* Sets the function that is responsible for the editor destruction.
|
|
112
|
+
* Overrides the default destruction function, which destroys only the editor instance.
|
|
113
|
+
* It expects a function that should return a promise or `undefined`.
|
|
114
|
+
*
|
|
115
|
+
* ```ts
|
|
116
|
+
* watchdog.setDestructor( editor => {
|
|
117
|
+
* // Do something before the editor is destroyed.
|
|
118
|
+
*
|
|
119
|
+
* return editor
|
|
120
|
+
* .destroy()
|
|
121
|
+
* .then( () => {
|
|
122
|
+
* // Do something after the editor is destroyed.
|
|
123
|
+
* } );
|
|
124
|
+
* } );
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
setDestructor(destructor: (editor: Editor) => Promise<unknown>): void;
|
|
128
|
+
/**
|
|
129
|
+
* Restarts the editor instance. This method is called whenever an editor error occurs. It fires the `restart` event and changes
|
|
130
|
+
* the state to `initializing`.
|
|
131
|
+
*
|
|
132
|
+
* @fires restart
|
|
133
|
+
*/
|
|
134
|
+
protected override _restart(): Promise<unknown>;
|
|
135
|
+
/**
|
|
136
|
+
* Creates the editor instance and keeps it running, using the defined creator and destructor.
|
|
137
|
+
*
|
|
138
|
+
* @param config The editor configuration.
|
|
139
|
+
* @param context A context for the editor.
|
|
140
|
+
*/
|
|
141
|
+
create(config: EditorConfig, context?: Context): Promise<unknown>;
|
|
142
|
+
/**
|
|
143
|
+
* Creates the editor instance and keeps it running, using the defined creator and destructor.
|
|
144
|
+
*
|
|
145
|
+
* **Note**: This method signature is deprecated and will be removed in the future release.
|
|
146
|
+
*
|
|
147
|
+
* @deprecated
|
|
148
|
+
* @param elementOrData The editor source element or the editor data.
|
|
149
|
+
* @param config The editor configuration.
|
|
150
|
+
* @param context A context for the editor.
|
|
151
|
+
*/
|
|
152
|
+
create(elementOrData: HTMLElement | string | Record<string, string> | Record<string, HTMLElement>, config: EditorConfig, context?: Context): Promise<unknown>;
|
|
153
|
+
/**
|
|
154
|
+
* Destroys the watchdog and the current editor instance. It fires the callback
|
|
155
|
+
* registered in {@link #setDestructor `setDestructor()`} and uses it to destroy the editor instance.
|
|
156
|
+
* It also sets the state to `destroyed`.
|
|
157
|
+
*/
|
|
158
|
+
override destroy(): Promise<unknown>;
|
|
159
|
+
private _destroy;
|
|
160
|
+
/**
|
|
161
|
+
* Saves the editor data, so it can be restored after the crash even if the data cannot be fetched at
|
|
162
|
+
* the moment of the crash.
|
|
163
|
+
*/
|
|
164
|
+
private _save;
|
|
165
|
+
/**
|
|
166
|
+
* @internal
|
|
167
|
+
*/
|
|
168
|
+
_setExcludedProperties(props: Set<unknown>): void;
|
|
169
|
+
/**
|
|
170
|
+
* Gets all data that is required to reinitialize editor instance.
|
|
171
|
+
*/
|
|
172
|
+
private _getData;
|
|
173
|
+
/**
|
|
174
|
+
* For each attached model root, returns its HTML editable element (if available).
|
|
175
|
+
*/
|
|
176
|
+
private _getEditables;
|
|
177
|
+
/**
|
|
178
|
+
* Traverses the error context and the current editor to find out whether these structures are connected
|
|
179
|
+
* to each other via properties.
|
|
180
|
+
*
|
|
181
|
+
* @internal
|
|
182
|
+
*/
|
|
183
|
+
_isErrorComingFromThisItem(error: CKEditorError): boolean;
|
|
184
|
+
/**
|
|
185
|
+
* Detects whether the `create()` call was made in config-based creator mode
|
|
186
|
+
* (i.e., the first argument is a config object rather than a source element or data).
|
|
187
|
+
*/
|
|
188
|
+
private _detectConfigBasedCreator;
|
|
189
|
+
/**
|
|
190
|
+
* Clones the editor configuration.
|
|
191
|
+
*/
|
|
192
|
+
private _cloneEditorConfiguration;
|
|
193
193
|
}
|
|
194
194
|
/**
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
* @internal
|
|
196
|
+
*/
|
|
197
197
|
export type EditorData = {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
198
|
+
roots: Record<string, {
|
|
199
|
+
content: string;
|
|
200
|
+
attributes: string;
|
|
201
|
+
modelElement: string;
|
|
202
|
+
isLoaded: boolean;
|
|
203
|
+
}>;
|
|
204
|
+
markers: Record<string, {
|
|
205
|
+
rangeJSON: {
|
|
206
|
+
start: any;
|
|
207
|
+
end: any;
|
|
208
|
+
};
|
|
209
|
+
usingOperation: boolean;
|
|
210
|
+
affectsData: boolean;
|
|
211
|
+
}>;
|
|
212
|
+
commentThreads: string;
|
|
213
|
+
suggestions: string;
|
|
214
214
|
};
|
|
215
215
|
/**
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
216
|
+
* Fired after the watchdog restarts the error in case of a crash.
|
|
217
|
+
*
|
|
218
|
+
* @eventName ~EditorWatchdog#restart
|
|
219
|
+
*/
|
|
220
220
|
export type EditorWatchdogRestartEvent = {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
221
|
+
name: "restart";
|
|
222
|
+
args: [];
|
|
223
|
+
return: undefined;
|
|
224
224
|
};
|
|
225
225
|
export type EditorWatchdogCreatorFunction<TEditor = Editor> = ((config: EditorConfig) => Promise<TEditor>) | ((elementOrData: HTMLElement | string | Record<string, string> | Record<string, HTMLElement> | undefined, config: EditorConfig) => Promise<TEditor>);
|
package/dist/index-content.css
CHANGED
package/dist/index-editor.css
CHANGED
package/dist/index.css
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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
|
-
export { ContextWatchdog, type ContextWatchdogRestartEvent, type ContextWatchdogItemErrorEvent, type ContextWatchdogItemErrorEventData, type ContextWatchdogItemRestartEvent, type ContextWatchdogItemRestartEventData, type ContextWatchdogItemConfiguration } from
|
|
9
|
-
export { EditorWatchdog, type EditorWatchdogCreatorFunction, type EditorWatchdogRestartEvent } from
|
|
10
|
-
export { Watchdog, type WatchdogConfig } from
|
|
11
|
-
export { ActionsRecorder } from
|
|
12
|
-
export type { ActionsRecorderConfig, ActionsRecorderEntry, ActionsRecorderEntryEditorSnapshot, ActionsRecorderErrorCallback, ActionsRecorderFilterCallback, ActionsRecorderMaxEntriesCallback } from
|
|
13
|
-
export type { WatchdogEventMap, WatchdogEventArgs, WatchdogEventCallback, WatchdogErrorEvent, WatchdogErrorEventData, WatchdogStateChangeEvent, WatchdogState } from
|
|
14
|
-
import
|
|
6
|
+
* @module watchdog
|
|
7
|
+
*/
|
|
8
|
+
export { ContextWatchdog, type ContextWatchdogRestartEvent, type ContextWatchdogItemErrorEvent, type ContextWatchdogItemErrorEventData, type ContextWatchdogItemRestartEvent, type ContextWatchdogItemRestartEventData, type ContextWatchdogItemConfiguration } from "./contextwatchdog.js";
|
|
9
|
+
export { EditorWatchdog, type EditorWatchdogCreatorFunction, type EditorWatchdogRestartEvent } from "./editorwatchdog.js";
|
|
10
|
+
export { Watchdog, type WatchdogConfig } from "./watchdog.js";
|
|
11
|
+
export { ActionsRecorder } from "./actionsrecorder.js";
|
|
12
|
+
export type { ActionsRecorderConfig, ActionsRecorderEntry, ActionsRecorderEntryEditorSnapshot, ActionsRecorderErrorCallback, ActionsRecorderFilterCallback, ActionsRecorderMaxEntriesCallback } from "./actionsrecorderconfig.js";
|
|
13
|
+
export type { WatchdogEventMap, WatchdogEventArgs, WatchdogEventCallback, WatchdogErrorEvent, WatchdogErrorEventData, WatchdogStateChangeEvent, WatchdogState } from "./watchdog.js";
|
|
14
|
+
import "./augmentation.js";
|