浏览代码

Apply suggestions from code review

API docs and feature docs fixes.

Co-Authored-By: Szymon Cofalik <s.cofalik@cksource.com>

Maciej Bukowski 5 年之前
父节点
当前提交
84293787ef

+ 4 - 4
packages/ckeditor5-watchdog/docs/features/watchdog.md

@@ -184,7 +184,7 @@ watchdog.add( {
 } );
 ```
 
-The Watchdog will keep the context and editor (and other types of items in the future) instances running
+The Watchdog will keep the context and editor instances running
 that are added via the {@link module:watchdog/contextwatchdog~ContextWatchdog#add `ContextWatchdog#add` method}. This method can be called multiple times during the `ContextWatchdog` lifetime.
 
 To destroy one of the editor instances use the {@link module:watchdog/contextwatchdog~ContextWatchdog#remove `ContextWatchdog#remove` method}. This method can be called multiple times during the `ContextWatchdog` lifetime as well.
@@ -202,7 +202,7 @@ watchdog.remove( [ 'editor1' ] );
 The ContextWatchdog feature provides the following API:
 
 ```js
-// A simple initialization way with default Context creation and destruction functions:
+// A simple initialization with default Context creation and destruction functions:
 const watchdog = ContextWatchdog.for( Context, contextConfig, watchdogConfig )
 
 // An advanced initialization where custom creation and destruction functions can be passed:
@@ -251,7 +251,7 @@ const contextState = watchdog.state;
 // Note that the editor errors are not re-fired in the `ContextWatchdog#error`.
 watchdog.on( 'error', () => {} );
 
-// An event fired when the context is back to the `ready` state.
+// An event fired when the context is set back to the `ready` state (after it was in `error` state).
 // Similarly, this event is not thrown for internal editor instances.
 watchdog.on( 'restart', () => {} );
 ```
@@ -276,4 +276,4 @@ Note that the ContextWatchdog spreads its configuration to the added items.
 
 ## Limitations
 
-The watchdog does not handle errors thrown during the editor or context initialization (by e.g. `Editor.create()`) and editor destruction (e.g. `Editor#destroy()`). Errors thrown at these stages mean that there is a serious problem in the code integrating the editor with your application and such problem cannot be easily fixed by restarting the editor.
+The watchdog does not handle errors thrown during the editor or context initialization (by e.g. `Editor.create()`) and editor destruction (e.g. `Editor#destroy()`). Errors thrown at these stages mean that there is a problem in the code integrating the editor with your application and such a problem cannot be fixed by restarting the editor.

+ 5 - 5
packages/ckeditor5-watchdog/src/contextwatchdog.js

@@ -108,7 +108,7 @@ export default class ContextWatchdog extends Watchdog {
 	}
 
 	/**
-	 * Returns the instance created from the item configuration by its name. It's type depends on the item type
+     * Returns the item with the given `itemName` that was created by this watchdog.
 	 * the instance can be retrieved from the watchdog. Note that this might return `undefined` if the item is not created
 	 * yet.
 	 *
@@ -244,7 +244,7 @@ export default class ContextWatchdog extends Watchdog {
 	}
 
 	/**
-	 * Destroys the `ContextWatchdog` and all added items. This method can't be undone.
+	 * Destroys the `ContextWatchdog` and all added items.
 	 * Once the `ContextWatchdog` is destroyed new items can not be added.
 	 *
 	 * @returns {Promise}
@@ -495,11 +495,11 @@ class ActionQueue {
  *
  * @typedef {Object} module:watchdog/contextwatchdog~EditorWatchdogConfiguration
  *
- * @property {'editor'} type A type of the item to create. In this case it should be set to the `editor`.
+ * @property {'editor'} type Type of the item to create. At the moment, only `'editor'` is supported.
  *
- * @property {Function} creator A function that needs to be called to initialize the editor.
+ * @property {Function} creator A function that initializes the editor.
  *
- * @property {Function} [destructor] A function that is responsible for destructing the editor.
+ * @property {Function} [destructor] A function that destroys the editor.
  *
  * @property {String|HTMLElement} sourceElementOrData The source element or data which will be passed
  * as the first argument to the `Editor.create()` method.

+ 1 - 1
packages/ckeditor5-watchdog/tests/contextwatchdog.js

@@ -35,7 +35,7 @@ describe( 'ContextWatchdog', () => {
 		sinon.restore();
 	} );
 
-	it( 'should disable adding items once the Watchdog is destroyed', async () => {
+	it( 'should disable adding items once the ContextWatchdog is destroyed', async () => {
 		watchdog = ContextWatchdog.for( Context, {} );
 
 		await watchdog.destroy();

+ 2 - 2
packages/ckeditor5-watchdog/tests/editorwatchdog.js

@@ -481,7 +481,7 @@ describe( 'EditorWatchdog', () => {
 			await watchdog.destroy();
 		} );
 
-		it( 'Watchdog should warn if the CKEditorError missing its context', async () => {
+		it( 'Watchdog should warn if the CKEditorError is missing its context', async () => {
 			const watchdog = new EditorWatchdog();
 
 			watchdog.setCreator( ( el, config ) => ClassicTestEditor.create( el, config ) );
@@ -533,7 +533,7 @@ describe( 'EditorWatchdog', () => {
 			await watchdog.destroy();
 		} );
 
-		it( 'editor should be restarted with the data before the crash #1', () => {
+		it( 'editor should be restarted with the data from before the crash #1', () => {
 			const watchdog = new EditorWatchdog();
 
 			watchdog.setCreator( ( el, config ) => ClassicTestEditor.create( el, config ) );