@ckeditor/ckeditor5-watchdog 41.2.0 → 41.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/content-index.css +4 -0
- package/dist/editor-index.css +4 -0
- package/dist/index.css +4 -0
- package/dist/index.js +1130 -0
- package/dist/index.js.map +1 -0
- package/dist/types/augmentation.d.ts +15 -0
- package/dist/types/contextwatchdog.d.ts +333 -0
- package/dist/types/editorwatchdog.d.ts +184 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/utils/areconnectedthroughproperties.d.ts +8 -0
- package/dist/types/utils/getsubnodes.d.ts +8 -0
- package/dist/types/watchdog.d.ts +229 -0
- package/package.json +2 -1
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module watchdog/contextwatchdog
|
|
7
|
+
*/
|
|
8
|
+
import type { Context, Editor, EditorConfig, ContextConfig } from 'ckeditor5/src/core.js';
|
|
9
|
+
import type { ArrayOrItem, CKEditorError } from 'ckeditor5/src/utils.js';
|
|
10
|
+
import Watchdog, { type WatchdogConfig, type WatchdogState } from './watchdog.js';
|
|
11
|
+
import EditorWatchdog, { type EditorCreatorFunction } from './editorwatchdog.js';
|
|
12
|
+
/**
|
|
13
|
+
* A watchdog for the {@link module:core/context~Context} class.
|
|
14
|
+
*
|
|
15
|
+
* See the {@glink features/watchdog Watchdog feature guide} to learn the rationale behind it and
|
|
16
|
+
* how to use it.
|
|
17
|
+
*/
|
|
18
|
+
export default class ContextWatchdog<TContext extends Context = Context> extends Watchdog {
|
|
19
|
+
/**
|
|
20
|
+
* A map of internal watchdogs for added items.
|
|
21
|
+
*/
|
|
22
|
+
protected _watchdogs: Map<string, EditorWatchdog<Editor>>;
|
|
23
|
+
/**
|
|
24
|
+
* The watchdog configuration.
|
|
25
|
+
*/
|
|
26
|
+
private readonly _watchdogConfig;
|
|
27
|
+
/**
|
|
28
|
+
* The current context instance.
|
|
29
|
+
*/
|
|
30
|
+
private _context;
|
|
31
|
+
/**
|
|
32
|
+
* Context properties (nodes/references) that are gathered during the initial context creation
|
|
33
|
+
* and are used to distinguish the origin of an error.
|
|
34
|
+
*/
|
|
35
|
+
private _contextProps;
|
|
36
|
+
/**
|
|
37
|
+
* An action queue, which is used to handle async functions queuing.
|
|
38
|
+
*/
|
|
39
|
+
private _actionQueues;
|
|
40
|
+
/**
|
|
41
|
+
* The configuration for the {@link module:core/context~Context}.
|
|
42
|
+
*/
|
|
43
|
+
private _contextConfig?;
|
|
44
|
+
/**
|
|
45
|
+
* The creation method.
|
|
46
|
+
*
|
|
47
|
+
* @see #setCreator
|
|
48
|
+
*/
|
|
49
|
+
protected _creator: (config: ContextConfig) => Promise<TContext>;
|
|
50
|
+
/**
|
|
51
|
+
* The destruction method.
|
|
52
|
+
*
|
|
53
|
+
* @see #setDestructor
|
|
54
|
+
*/
|
|
55
|
+
protected _destructor: (context: Context) => Promise<unknown>;
|
|
56
|
+
/**
|
|
57
|
+
* The watched item.
|
|
58
|
+
*/
|
|
59
|
+
_item: unknown;
|
|
60
|
+
/**
|
|
61
|
+
* The context watchdog class constructor.
|
|
62
|
+
*
|
|
63
|
+
* ```ts
|
|
64
|
+
* const watchdog = new ContextWatchdog( Context );
|
|
65
|
+
*
|
|
66
|
+
* await watchdog.create( contextConfiguration );
|
|
67
|
+
*
|
|
68
|
+
* await watchdog.add( item );
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* See the {@glink features/watchdog Watchdog feature guide} to learn more how to use this feature.
|
|
72
|
+
*
|
|
73
|
+
* @param Context The {@link module:core/context~Context} class.
|
|
74
|
+
* @param watchdogConfig The watchdog configuration.
|
|
75
|
+
*/
|
|
76
|
+
constructor(Context: {
|
|
77
|
+
create(...args: any): Promise<TContext>;
|
|
78
|
+
}, watchdogConfig?: WatchdogConfig);
|
|
79
|
+
/**
|
|
80
|
+
* Sets the function that is responsible for the context creation.
|
|
81
|
+
* It expects a function that should return a promise (or `undefined`).
|
|
82
|
+
*
|
|
83
|
+
* ```ts
|
|
84
|
+
* watchdog.setCreator( config => Context.create( config ) );
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
setCreator(creator: (config: ContextConfig) => Promise<TContext>): void;
|
|
88
|
+
/**
|
|
89
|
+
* Sets the function that is responsible for the context destruction.
|
|
90
|
+
* Overrides the default destruction function, which destroys only the context instance.
|
|
91
|
+
* It expects a function that should return a promise (or `undefined`).
|
|
92
|
+
*
|
|
93
|
+
* ```ts
|
|
94
|
+
* watchdog.setDestructor( context => {
|
|
95
|
+
* // Do something before the context is destroyed.
|
|
96
|
+
*
|
|
97
|
+
* return context
|
|
98
|
+
* .destroy()
|
|
99
|
+
* .then( () => {
|
|
100
|
+
* // Do something after the context is destroyed.
|
|
101
|
+
* } );
|
|
102
|
+
* } );
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
setDestructor(destructor: (context: Context) => Promise<unknown>): void;
|
|
106
|
+
/**
|
|
107
|
+
* The context instance. Keep in mind that this property might be changed when the context watchdog restarts,
|
|
108
|
+
* so do not keep this instance internally. Always operate on the `ContextWatchdog#context` property.
|
|
109
|
+
*/
|
|
110
|
+
get context(): Context | null;
|
|
111
|
+
/**
|
|
112
|
+
* Initializes the context watchdog. Once it is created, the watchdog takes care about
|
|
113
|
+
* recreating the context and the provided items, and starts the error handling mechanism.
|
|
114
|
+
*
|
|
115
|
+
* ```ts
|
|
116
|
+
* await watchdog.create( {
|
|
117
|
+
* plugins: []
|
|
118
|
+
* } );
|
|
119
|
+
* ```
|
|
120
|
+
*
|
|
121
|
+
* @param contextConfig The context configuration. See {@link module:core/context~Context}.
|
|
122
|
+
*/
|
|
123
|
+
create(contextConfig?: ContextConfig): Promise<unknown>;
|
|
124
|
+
/**
|
|
125
|
+
* Returns an item instance with the given `itemId`.
|
|
126
|
+
*
|
|
127
|
+
* ```ts
|
|
128
|
+
* const editor1 = watchdog.getItem( 'editor1' );
|
|
129
|
+
* ```
|
|
130
|
+
*
|
|
131
|
+
* @param itemId The item ID.
|
|
132
|
+
* @returns The item instance or `undefined` if an item with a given ID has not been found.
|
|
133
|
+
*/
|
|
134
|
+
getItem(itemId: string): unknown;
|
|
135
|
+
/**
|
|
136
|
+
* Gets the state of the given item. See {@link #state} for a list of available states.
|
|
137
|
+
*
|
|
138
|
+
* ```ts
|
|
139
|
+
* const editor1State = watchdog.getItemState( 'editor1' );
|
|
140
|
+
* ```
|
|
141
|
+
*
|
|
142
|
+
* @param itemId Item ID.
|
|
143
|
+
* @returns The state of the item.
|
|
144
|
+
*/
|
|
145
|
+
getItemState(itemId: string): WatchdogState;
|
|
146
|
+
/**
|
|
147
|
+
* Adds items to the watchdog. Once created, instances of these items will be available using the {@link #getItem} method.
|
|
148
|
+
*
|
|
149
|
+
* Items can be passed together as an array of objects:
|
|
150
|
+
*
|
|
151
|
+
* ```ts
|
|
152
|
+
* await watchdog.add( [ {
|
|
153
|
+
* id: 'editor1',
|
|
154
|
+
* type: 'editor',
|
|
155
|
+
* sourceElementOrData: document.querySelector( '#editor' ),
|
|
156
|
+
* config: {
|
|
157
|
+
* plugins: [ Essentials, Paragraph, Bold, Italic ],
|
|
158
|
+
* toolbar: [ 'bold', 'italic', 'alignment' ]
|
|
159
|
+
* },
|
|
160
|
+
* creator: ( element, config ) => ClassicEditor.create( element, config )
|
|
161
|
+
* } ] );
|
|
162
|
+
* ```
|
|
163
|
+
*
|
|
164
|
+
* Or one by one as objects:
|
|
165
|
+
*
|
|
166
|
+
* ```ts
|
|
167
|
+
* await watchdog.add( {
|
|
168
|
+
* id: 'editor1',
|
|
169
|
+
* type: 'editor',
|
|
170
|
+
* sourceElementOrData: document.querySelector( '#editor' ),
|
|
171
|
+
* config: {
|
|
172
|
+
* plugins: [ Essentials, Paragraph, Bold, Italic ],
|
|
173
|
+
* toolbar: [ 'bold', 'italic', 'alignment' ]
|
|
174
|
+
* },
|
|
175
|
+
* creator: ( element, config ) => ClassicEditor.create( element, config )
|
|
176
|
+
* ] );
|
|
177
|
+
* ```
|
|
178
|
+
*
|
|
179
|
+
* Then an instance can be retrieved using the {@link #getItem} method:
|
|
180
|
+
*
|
|
181
|
+
* ```ts
|
|
182
|
+
* const editor1 = watchdog.getItem( 'editor1' );
|
|
183
|
+
* ```
|
|
184
|
+
*
|
|
185
|
+
* Note that this method can be called multiple times, but for performance reasons it is better
|
|
186
|
+
* to pass all items together.
|
|
187
|
+
*
|
|
188
|
+
* @param itemConfigurationOrItemConfigurations An item configuration object or an array of item configurations.
|
|
189
|
+
*/
|
|
190
|
+
add(itemConfigurationOrItemConfigurations: ArrayOrItem<WatchdogItemConfiguration>): Promise<unknown>;
|
|
191
|
+
/**
|
|
192
|
+
* Removes and destroys item(s) with given ID(s).
|
|
193
|
+
*
|
|
194
|
+
* ```ts
|
|
195
|
+
* await watchdog.remove( 'editor1' );
|
|
196
|
+
* ```
|
|
197
|
+
*
|
|
198
|
+
* Or
|
|
199
|
+
*
|
|
200
|
+
* ```ts
|
|
201
|
+
* await watchdog.remove( [ 'editor1', 'editor2' ] );
|
|
202
|
+
* ```
|
|
203
|
+
*
|
|
204
|
+
* @param itemIdOrItemIds Item ID or an array of item IDs.
|
|
205
|
+
*/
|
|
206
|
+
remove(itemIdOrItemIds: ArrayOrItem<string>): Promise<unknown>;
|
|
207
|
+
/**
|
|
208
|
+
* Destroys the context watchdog and all added items.
|
|
209
|
+
* Once the context watchdog is destroyed, new items cannot be added.
|
|
210
|
+
*
|
|
211
|
+
* ```ts
|
|
212
|
+
* await watchdog.destroy();
|
|
213
|
+
* ```
|
|
214
|
+
*/
|
|
215
|
+
destroy(): Promise<unknown>;
|
|
216
|
+
/**
|
|
217
|
+
* Restarts the context watchdog.
|
|
218
|
+
*/
|
|
219
|
+
protected _restart(): Promise<unknown>;
|
|
220
|
+
/**
|
|
221
|
+
* Initializes the context watchdog.
|
|
222
|
+
*/
|
|
223
|
+
private _create;
|
|
224
|
+
/**
|
|
225
|
+
* Destroys the context instance and all added items.
|
|
226
|
+
*/
|
|
227
|
+
private _destroy;
|
|
228
|
+
/**
|
|
229
|
+
* Returns the watchdog for a given item ID.
|
|
230
|
+
*
|
|
231
|
+
* @param itemId Item ID.
|
|
232
|
+
*/
|
|
233
|
+
protected _getWatchdog(itemId: string): Watchdog;
|
|
234
|
+
/**
|
|
235
|
+
* Checks whether an error comes from the context instance and not from the item instances.
|
|
236
|
+
*
|
|
237
|
+
* @internal
|
|
238
|
+
*/
|
|
239
|
+
_isErrorComingFromThisItem(error: CKEditorError): boolean;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Fired after the watchdog restarts the context and the added items because of a crash.
|
|
243
|
+
*
|
|
244
|
+
* ```ts
|
|
245
|
+
* watchdog.on( 'restart', () => {
|
|
246
|
+
* console.log( 'The context has been restarted.' );
|
|
247
|
+
* } );
|
|
248
|
+
* ```
|
|
249
|
+
*
|
|
250
|
+
* @eventName ~ContextWatchdog#restart
|
|
251
|
+
*/
|
|
252
|
+
export type ContextWatchdogRestartEvent = {
|
|
253
|
+
name: 'restart';
|
|
254
|
+
args: [];
|
|
255
|
+
return: undefined;
|
|
256
|
+
};
|
|
257
|
+
/**
|
|
258
|
+
* Fired when a new error occurred in one of the added items.
|
|
259
|
+
*
|
|
260
|
+
* ```ts
|
|
261
|
+
* watchdog.on( 'itemError', ( evt, { error, itemId } ) => {
|
|
262
|
+
* console.log( `An error occurred in an item with the '${ itemId }' ID.` );
|
|
263
|
+
* } );
|
|
264
|
+
* ```
|
|
265
|
+
*
|
|
266
|
+
* @eventName ~ContextWatchdog#itemError
|
|
267
|
+
*/
|
|
268
|
+
export type ContextWatchdogItemErrorEvent = {
|
|
269
|
+
name: 'itemError';
|
|
270
|
+
args: [ContextWatchdogItemErrorEventData];
|
|
271
|
+
return: undefined;
|
|
272
|
+
};
|
|
273
|
+
/**
|
|
274
|
+
* The `itemError` event data.
|
|
275
|
+
*/
|
|
276
|
+
export type ContextWatchdogItemErrorEventData = {
|
|
277
|
+
itemId: string;
|
|
278
|
+
error: Error;
|
|
279
|
+
};
|
|
280
|
+
/**
|
|
281
|
+
* Fired after an item has been restarted.
|
|
282
|
+
*
|
|
283
|
+
* ```ts
|
|
284
|
+
* watchdog.on( 'itemRestart', ( evt, { itemId } ) => {
|
|
285
|
+
* console.log( 'An item with with the '${ itemId }' ID has been restarted.' );
|
|
286
|
+
* } );
|
|
287
|
+
* ```
|
|
288
|
+
*
|
|
289
|
+
* @eventName ~ContextWatchdog#itemRestart
|
|
290
|
+
*/
|
|
291
|
+
export type ContextWatchdogItemRestartEvent = {
|
|
292
|
+
name: 'itemRestart';
|
|
293
|
+
args: [ContextWatchdogItemRestartEventData];
|
|
294
|
+
return: undefined;
|
|
295
|
+
};
|
|
296
|
+
/**
|
|
297
|
+
* The `itemRestart` event data.
|
|
298
|
+
*/
|
|
299
|
+
export type ContextWatchdogItemRestartEventData = {
|
|
300
|
+
itemId: string;
|
|
301
|
+
};
|
|
302
|
+
/**
|
|
303
|
+
* The watchdog item configuration interface.
|
|
304
|
+
*/
|
|
305
|
+
export interface WatchdogItemConfiguration {
|
|
306
|
+
/**
|
|
307
|
+
* id A unique item identificator.
|
|
308
|
+
*/
|
|
309
|
+
id: string;
|
|
310
|
+
/**
|
|
311
|
+
* The type of the item to create. At the moment, only `'editor'` is supported.
|
|
312
|
+
*/
|
|
313
|
+
type: 'editor';
|
|
314
|
+
/**
|
|
315
|
+
* A function that initializes the item (the editor). The function takes editor initialization arguments
|
|
316
|
+
* and should return a promise. For example: `( el, config ) => ClassicEditor.create( el, config )`.
|
|
317
|
+
*/
|
|
318
|
+
creator: EditorCreatorFunction;
|
|
319
|
+
/**
|
|
320
|
+
* A function that destroys the item instance (the editor). The function
|
|
321
|
+
* takes an item and should return a promise. For example: `editor => editor.destroy()`
|
|
322
|
+
*/
|
|
323
|
+
destructor?: (editor: Editor) => Promise<unknown>;
|
|
324
|
+
/**
|
|
325
|
+
* The source element or data that will be passed
|
|
326
|
+
* as the first argument to the `Editor.create()` method.
|
|
327
|
+
*/
|
|
328
|
+
sourceElementOrData: string | HTMLElement;
|
|
329
|
+
/**
|
|
330
|
+
* An editor configuration.
|
|
331
|
+
*/
|
|
332
|
+
config: EditorConfig;
|
|
333
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module watchdog/editorwatchdog
|
|
7
|
+
*/
|
|
8
|
+
import type { CKEditorError } from 'ckeditor5/src/utils.js';
|
|
9
|
+
import type { Editor, EditorConfig, Context } from 'ckeditor5/src/core.js';
|
|
10
|
+
import Watchdog, { type WatchdogConfig } from './watchdog.js';
|
|
11
|
+
/**
|
|
12
|
+
* A watchdog for CKEditor 5 editors.
|
|
13
|
+
*
|
|
14
|
+
* See the {@glink features/watchdog Watchdog feature guide} to learn the rationale behind it and
|
|
15
|
+
* how to use it.
|
|
16
|
+
*/
|
|
17
|
+
export default class EditorWatchdog<TEditor extends Editor = Editor> extends Watchdog {
|
|
18
|
+
/**
|
|
19
|
+
* The current editor instance.
|
|
20
|
+
*/
|
|
21
|
+
private _editor;
|
|
22
|
+
/**
|
|
23
|
+
* Throttled save method. The `save()` method is called the specified `saveInterval` after `throttledSave()` is called,
|
|
24
|
+
* unless a new action happens in the meantime.
|
|
25
|
+
*/
|
|
26
|
+
private _throttledSave;
|
|
27
|
+
/**
|
|
28
|
+
* The latest saved editor data represented as a root name -> root data object.
|
|
29
|
+
*/
|
|
30
|
+
private _data?;
|
|
31
|
+
/**
|
|
32
|
+
* The last document version.
|
|
33
|
+
*/
|
|
34
|
+
private _lastDocumentVersion?;
|
|
35
|
+
/**
|
|
36
|
+
* The editor source element or data.
|
|
37
|
+
*/
|
|
38
|
+
private _elementOrData?;
|
|
39
|
+
/**
|
|
40
|
+
* Specifies whether the editor was initialized using document data (`true`) or HTML elements (`false`).
|
|
41
|
+
*/
|
|
42
|
+
private _initUsingData;
|
|
43
|
+
/**
|
|
44
|
+
* The latest record of the editor editable elements. Used to restart the editor.
|
|
45
|
+
*/
|
|
46
|
+
private _editables;
|
|
47
|
+
/**
|
|
48
|
+
* The editor configuration.
|
|
49
|
+
*/
|
|
50
|
+
private _config?;
|
|
51
|
+
/**
|
|
52
|
+
* The creation method.
|
|
53
|
+
*
|
|
54
|
+
* @see #setCreator
|
|
55
|
+
*/
|
|
56
|
+
protected _creator: EditorCreatorFunction<TEditor>;
|
|
57
|
+
/**
|
|
58
|
+
* The destruction method.
|
|
59
|
+
*
|
|
60
|
+
* @see #setDestructor
|
|
61
|
+
*/
|
|
62
|
+
protected _destructor: (editor: Editor) => Promise<unknown>;
|
|
63
|
+
private _excludedProps?;
|
|
64
|
+
/**
|
|
65
|
+
* @param Editor The editor class.
|
|
66
|
+
* @param watchdogConfig The watchdog plugin configuration.
|
|
67
|
+
*/
|
|
68
|
+
constructor(Editor: {
|
|
69
|
+
create(...args: any): Promise<TEditor>;
|
|
70
|
+
} | null, watchdogConfig?: WatchdogConfig);
|
|
71
|
+
/**
|
|
72
|
+
* The current editor instance.
|
|
73
|
+
*/
|
|
74
|
+
get editor(): TEditor | null;
|
|
75
|
+
/**
|
|
76
|
+
* @internal
|
|
77
|
+
*/
|
|
78
|
+
get _item(): TEditor | null;
|
|
79
|
+
/**
|
|
80
|
+
* Sets the function that is responsible for the editor creation.
|
|
81
|
+
* It expects a function that should return a promise.
|
|
82
|
+
*
|
|
83
|
+
* ```ts
|
|
84
|
+
* watchdog.setCreator( ( element, config ) => ClassicEditor.create( element, config ) );
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
setCreator(creator: EditorCreatorFunction<TEditor>): void;
|
|
88
|
+
/**
|
|
89
|
+
* Sets the function that is responsible for the editor destruction.
|
|
90
|
+
* Overrides the default destruction function, which destroys only the editor instance.
|
|
91
|
+
* It expects a function that should return a promise or `undefined`.
|
|
92
|
+
*
|
|
93
|
+
* ```ts
|
|
94
|
+
* watchdog.setDestructor( editor => {
|
|
95
|
+
* // Do something before the editor is destroyed.
|
|
96
|
+
*
|
|
97
|
+
* return editor
|
|
98
|
+
* .destroy()
|
|
99
|
+
* .then( () => {
|
|
100
|
+
* // Do something after the editor is destroyed.
|
|
101
|
+
* } );
|
|
102
|
+
* } );
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
setDestructor(destructor: (editor: Editor) => Promise<unknown>): void;
|
|
106
|
+
/**
|
|
107
|
+
* Restarts the editor instance. This method is called whenever an editor error occurs. It fires the `restart` event and changes
|
|
108
|
+
* the state to `initializing`.
|
|
109
|
+
*
|
|
110
|
+
* @fires restart
|
|
111
|
+
*/
|
|
112
|
+
protected _restart(): Promise<unknown>;
|
|
113
|
+
/**
|
|
114
|
+
* Creates the editor instance and keeps it running, using the defined creator and destructor.
|
|
115
|
+
*
|
|
116
|
+
* @param elementOrData The editor source element or the editor data.
|
|
117
|
+
* @param config The editor configuration.
|
|
118
|
+
* @param context A context for the editor.
|
|
119
|
+
*/
|
|
120
|
+
create(elementOrData?: HTMLElement | string | Record<string, string> | Record<string, HTMLElement>, config?: EditorConfig, context?: Context): Promise<unknown>;
|
|
121
|
+
/**
|
|
122
|
+
* Destroys the watchdog and the current editor instance. It fires the callback
|
|
123
|
+
* registered in {@link #setDestructor `setDestructor()`} and uses it to destroy the editor instance.
|
|
124
|
+
* It also sets the state to `destroyed`.
|
|
125
|
+
*/
|
|
126
|
+
destroy(): Promise<unknown>;
|
|
127
|
+
private _destroy;
|
|
128
|
+
/**
|
|
129
|
+
* Saves the editor data, so it can be restored after the crash even if the data cannot be fetched at
|
|
130
|
+
* the moment of the crash.
|
|
131
|
+
*/
|
|
132
|
+
private _save;
|
|
133
|
+
/**
|
|
134
|
+
* @internal
|
|
135
|
+
*/
|
|
136
|
+
_setExcludedProperties(props: Set<unknown>): void;
|
|
137
|
+
/**
|
|
138
|
+
* Gets all data that is required to reinitialize editor instance.
|
|
139
|
+
*/
|
|
140
|
+
private _getData;
|
|
141
|
+
/**
|
|
142
|
+
* For each attached model root, returns its HTML editable element (if available).
|
|
143
|
+
*/
|
|
144
|
+
private _getEditables;
|
|
145
|
+
/**
|
|
146
|
+
* Traverses the error context and the current editor to find out whether these structures are connected
|
|
147
|
+
* to each other via properties.
|
|
148
|
+
*
|
|
149
|
+
* @internal
|
|
150
|
+
*/
|
|
151
|
+
_isErrorComingFromThisItem(error: CKEditorError): boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Clones the editor configuration.
|
|
154
|
+
*/
|
|
155
|
+
private _cloneEditorConfiguration;
|
|
156
|
+
}
|
|
157
|
+
export type EditorData = {
|
|
158
|
+
roots: Record<string, {
|
|
159
|
+
content: string;
|
|
160
|
+
attributes: string;
|
|
161
|
+
isLoaded: boolean;
|
|
162
|
+
}>;
|
|
163
|
+
markers: Record<string, {
|
|
164
|
+
rangeJSON: {
|
|
165
|
+
start: any;
|
|
166
|
+
end: any;
|
|
167
|
+
};
|
|
168
|
+
usingOperation: boolean;
|
|
169
|
+
affectsData: boolean;
|
|
170
|
+
}>;
|
|
171
|
+
commentThreads: string;
|
|
172
|
+
suggestions: string;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Fired after the watchdog restarts the error in case of a crash.
|
|
176
|
+
*
|
|
177
|
+
* @eventName ~EditorWatchdog#restart
|
|
178
|
+
*/
|
|
179
|
+
export type EditorWatchdogRestartEvent = {
|
|
180
|
+
name: 'restart';
|
|
181
|
+
args: [];
|
|
182
|
+
return: undefined;
|
|
183
|
+
};
|
|
184
|
+
export type EditorCreatorFunction<TEditor = Editor> = (elementOrData: HTMLElement | string | Record<string, string> | Record<string, HTMLElement>, config: EditorConfig) => Promise<TEditor>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module watchdog
|
|
7
|
+
*/
|
|
8
|
+
export { default as ContextWatchdog } from './contextwatchdog.js';
|
|
9
|
+
export { default as EditorWatchdog } from './editorwatchdog.js';
|
|
10
|
+
export { default as Watchdog } from './watchdog.js';
|
|
11
|
+
import './augmentation.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Traverses both structures to find out whether there is a reference that is shared between both structures.
|
|
7
|
+
*/
|
|
8
|
+
export default function areConnectedThroughProperties(target1: unknown, target2: unknown, excludedNodes?: Set<unknown>): boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module watchdog/utils/getsubnodes
|
|
7
|
+
*/
|
|
8
|
+
export default function getSubNodes(head: unknown, excludedProperties?: Set<unknown>): Set<unknown>;
|