8
0
Piotrek Koszuliński 6 лет назад
Родитель
Сommit
09a4a08f5e
2 измененных файлов с 41 добавлено и 37 удалено
  1. 33 31
      packages/ckeditor5-core/src/context.js
  2. 8 6
      packages/ckeditor5-core/src/contextplugin.js

+ 33 - 31
packages/ckeditor5-core/src/context.js

@@ -234,43 +234,45 @@ export default class Context {
 	 *		const commonConfig = { ... }; // Configuration for all the plugins and editors.
 	 *		const editorPlugins = [ ... ]; // Regular `Plugin`s here.
 	 *
-	 *		Context.create( {
-	 *			// Only `ContextPlugin`s here.
-	 *			plugins: [ ... ],
+	 *		Context
+	 *			.create( {
+	 *				// Only `ContextPlugin`s here.
+	 *				plugins: [ ... ],
 	 *
-	 *			// Configure language for all the editors (it cannot be overwritten).
-	 *			language: { ... },
+	 *				// Configure language for all the editors (it cannot be overwritten).
+	 *				language: { ... },
 	 *
-	 *			// Configuration for context plugins.
-	 *			comments: { ... },
-	 *			...
+	 *				// Configuration for context plugins.
+	 *				comments: { ... },
+	 *				...
 	 *
-	 *			// Default configuration for editor plugins.
-	 *			toolbar: { ... },
-	 *			image: { ... },
-	 *			...
-	 *		} ).then( context => {
-	 *			const promises = [];
+	 *				// Default configuration for editor plugins.
+	 *				toolbar: { ... },
+	 *				image: { ... },
+	 *				...
+	 *			} )
+	 *			.then( context => {
+	 *				const promises = [];
 	 *
-	 *			promises.push( ClassicEditor.create(
-	 *				document.getElementById( 'editor1' ),
-	 *				{
-	 *					editorPlugins,
-	 *					context
-	 *				}
-	 *			) );
+	 *				promises.push( ClassicEditor.create(
+	 *					document.getElementById( 'editor1' ),
+	 *					{
+	 *						editorPlugins,
+	 *						context
+	 *					}
+	 *				) );
 	 *
-	 *			promises.push( ClassicEditor.create(
-	 *				document.getElementById( 'editor2' ),
-	 *				{
-	 *					editorPlugins,
-	 *					context,
-	 *					toolbar: { ... } // You can overwrite context's configuration.
-	 *				}
-	 *			) );
+	 *				promises.push( ClassicEditor.create(
+	 *					document.getElementById( 'editor2' ),
+	 *					{
+	 *						editorPlugins,
+	 *						context,
+	 *						toolbar: { ... } // You can overwrite context's configuration.
+	 *					}
+	 *				) );
 	 *
-	 *			return Promise.all( promises );
-	 *		} );
+	 *				return Promise.all( promises );
+	 *			} );
 	 *
 	 * @param {Object} [config] The context config.
 	 * @returns {Promise} A promise resolved once the context is ready. The promise resolves with the created context instance.

+ 8 - 6
packages/ckeditor5-core/src/contextplugin.js

@@ -13,14 +13,16 @@ import mix from '@ckeditor/ckeditor5-utils/src/mix';
 /**
  * The base class for {@link module:core/context~Context} plugin classes.
  *
- * A context plugin can either be initialized for an editor or for a context. In other words, it can either
+ * A context plugin can either be initialized for an {@link module:core/editor/editor~Editor editor} or for
+ * a {@link module:core/context~Context context}. In other words, it can either
  * work within one editor instance or with one or more editor instances that use a single context.
- * It's the context plugin's role to implement handling for both modes.
+ * It is the context plugin's role to implement handling for both modes.
  *
- * A list of rules for the context plugin:
- * * it should be possible, for the context plugin to requires another context plugin,
- * * it should be possible, for the {@link module:core/plugin~Plugin editor plugin} to requires context plugin,
- * * it should NOT be possible, for the context plugin to require the {@link module:core/plugin~Plugin editor plugin}.
+ * A couple of rules for interaction between editor plugins and context plugins:
+ *
+ * * a context plugin can require another context plugin,
+ * * an {@link module:core/plugin~Plugin editor plugin} can require a context plugin,
+ * * a context plugin MUST NOT require an {@link module:core/plugin~Plugin editor plugin}.
  *
  * @implements module:core/plugin~PluginInterface
  * @mixes module:utils/observablemixin~ObservableMixin