|
|
@@ -18,7 +18,7 @@ import areConnectedThroughProperties from '@ckeditor/ckeditor5-utils/src/areconn
|
|
|
/**
|
|
|
* A watchdog for CKEditor 5 editors.
|
|
|
*
|
|
|
- * See the {@glink features/watchdog Watchdog} feature guide to learn the rationale behind it and
|
|
|
+ * See the {@glink features/watchdog Watchdog feature guide} to learn the rationale behind it and
|
|
|
* how to use it.
|
|
|
*/
|
|
|
export default class Watchdog {
|
|
|
@@ -26,7 +26,7 @@ export default class Watchdog {
|
|
|
* @param {Object} [config] The watchdog plugin configuration.
|
|
|
* @param {Number} [config.crashNumberLimit=3] A threshold specifying the number of crashes
|
|
|
* when the watchdog stops restarting the editor in case of errors.
|
|
|
- * @param {Number} [config.waitingTime=5000] A minimum amount of milliseconds between saving editor data internally.
|
|
|
+ * @param {Number} [config.waitingTime=5000] A minimum amount of milliseconds between saving the editor data internally.
|
|
|
*/
|
|
|
constructor( { crashNumberLimit, waitingTime } = {} ) {
|
|
|
/**
|
|
|
@@ -44,7 +44,7 @@ export default class Watchdog {
|
|
|
this.crashes = [];
|
|
|
|
|
|
/**
|
|
|
- * Crash number limit (defaults to `3`). After this limit is reached the editor is not restarted by the watchdog.
|
|
|
+ * Crash number limit (defaults to `3`). After this limit is reached, the editor is not restarted by the watchdog.
|
|
|
* This is to prevent an infinite crash loop.
|
|
|
*
|
|
|
* @private
|
|
|
@@ -134,7 +134,7 @@ export default class Watchdog {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Sets the function that is responsible for editor creation.
|
|
|
+ * Sets the function that is responsible for the editor creation.
|
|
|
* It expects a function that should return a promise.
|
|
|
*
|
|
|
* watchdog.setCreator( ( element, config ) => ClassicEditor.create( element, config ) );
|
|
|
@@ -146,7 +146,7 @@ export default class Watchdog {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Sets the function that is responsible for editor destruction.
|
|
|
+ * Sets the function that is responsible for the editor destruction.
|
|
|
* It expects a function that should return a promise or `undefined`.
|
|
|
*
|
|
|
* watchdog.setDestructor( editor => editor.destroy() );
|
|
|
@@ -159,7 +159,7 @@ export default class Watchdog {
|
|
|
|
|
|
/**
|
|
|
* Creates a watched editor instance using the creator passed to the {@link #setCreator `setCreator()`} method or
|
|
|
- * {@link module:watchdog/watchdog~Watchdog.for `Watchdog.for()`} helper.
|
|
|
+ * the {@link module:watchdog/watchdog~Watchdog.for `Watchdog.for()`} helper.
|
|
|
*
|
|
|
* @param {HTMLElement|String} elementOrData
|
|
|
* @param {module:core/editor/editorconfig~EditorConfig} [config]
|
|
|
@@ -197,8 +197,8 @@ export default class Watchdog {
|
|
|
|
|
|
this._elementOrData = elementOrData;
|
|
|
|
|
|
- // Clone config because it might be shared within multiple watchdog instances. Otherwise
|
|
|
- // when an error occurs in one of these editors the watchdog will restart all of them.
|
|
|
+ // Clone configuration because it might be shared within multiple watchdog instances. Otherwise,
|
|
|
+ // when an error occurs in one of these editors, the watchdog will restart all of them.
|
|
|
this._config = cloneDeepWith( config, value => {
|
|
|
// Leave DOM references.
|
|
|
return isElement( value ) ? value : undefined;
|
|
|
@@ -268,7 +268,7 @@ export default class Watchdog {
|
|
|
|
|
|
/**
|
|
|
* Saves the editor data, so it can be restored after the crash even if the data cannot be fetched at
|
|
|
- * the moment of a crash.
|
|
|
+ * the moment of the crash.
|
|
|
*
|
|
|
* @private
|
|
|
*/
|
|
|
@@ -299,7 +299,7 @@ export default class Watchdog {
|
|
|
*
|
|
|
* @private
|
|
|
* @fires error
|
|
|
- * @param {Event} evt Error event.
|
|
|
+ * @param {Event} evt An error event.
|
|
|
*/
|
|
|
_handleGlobalErrorEvent( evt ) {
|
|
|
if ( !evt.error.is || !evt.error.is( 'CKEditorError' ) ) {
|
|
|
@@ -346,7 +346,7 @@ export default class Watchdog {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * A shorthand method for creating an instance of the watchdog. For the full usage see the
|
|
|
+ * A shorthand method for creating an instance of the watchdog. For the full usage, see the
|
|
|
* {@link ~Watchdog `Watchdog` class description}.
|
|
|
*
|
|
|
* Usage:
|