瀏覽代碼

Wording mostly.

Piotrek Koszuliński 5 年之前
父節點
當前提交
805608e4d5

+ 6 - 2
packages/ckeditor5-html-embed/src/htmlembed.js

@@ -37,11 +37,11 @@ export default class HtmlEmbed extends Plugin {
 }
 
 /**
- * The configuration of the html embed feature.
+ * The configuration of the HTML embed feature.
  *
  *		ClassicEditor
  *			.create( editorElement, {
- * 				htmlEmbed: ... // Html embed feature options.
+ * 				htmlEmbed: ... // HTML embed feature options.
  *			} )
  *			.then( ... )
  *			.catch( ... );
@@ -52,9 +52,13 @@ export default class HtmlEmbed extends Plugin {
  */
 
 /**
+ * TODO
+ *
  * @member {Boolean} [module:html-embed/htmlembed~HtmlEmbedConfig#previewsInData=false]
  */
 
 /**
+ * TODO
+ *
  * @member {Function} [module:html-embed/htmlembed~HtmlEmbedConfig#sanitizeHtml]
  */

+ 5 - 7
packages/ckeditor5-html-embed/src/htmlembedediting.js

@@ -44,13 +44,12 @@ export default class HtmlEmbedEditing extends Plugin {
 			previewsInData: false,
 			sanitizeHtml: rawHtml => {
 				/**
-				 * When using the HTML embed feature with `htmlEmbed.previewsInData=true` option, it's strongly recommended to
+				 * When using the HTML embed feature with `htmlEmbed.previewsInData=true` option, it is strongly recommended to
 				 * define a sanitize function that will clean up an input HTML in order to avoid XSS vulnerability.
 				 *
 				 * For a detailed overview, check the {@glink features/html-embed HTML embed feature} documentation.
 				 *
 				 * @error html-embed-provide-sanitize-function
-				 * @param {String} name The name of the component.
 				 */
 				logWarning( 'html-embed-provide-sanitize-function' );
 
@@ -69,17 +68,14 @@ export default class HtmlEmbedEditing extends Plugin {
 		const editor = this.editor;
 		const schema = editor.model.schema;
 
-		const htmlEmbedInsertCommand = new HtmlEmbedInsertCommand( editor );
-		const htmlEmbedUpdateCommand = new HtmlEmbedUpdateCommand( editor );
-
 		schema.register( 'rawHtml', {
 			isObject: true,
 			allowWhere: '$block',
 			allowAttributes: [ 'value' ]
 		} );
 
-		editor.commands.add( 'htmlEmbedUpdate', htmlEmbedUpdateCommand );
-		editor.commands.add( 'htmlEmbedInsert', htmlEmbedInsertCommand );
+		editor.commands.add( 'htmlEmbedUpdate', new HtmlEmbedUpdateCommand( editor ) );
+		editor.commands.add( 'htmlEmbedInsert', new HtmlEmbedInsertCommand( editor ) );
 
 		this._setupConversion();
 	}
@@ -104,6 +100,8 @@ export default class HtmlEmbedEditing extends Plugin {
 				classes: 'raw-html-embed'
 			},
 			model: ( viewElement, { writer } ) => {
+				// Note: The below line has a side-effect – the children are *moved* to the DF so
+				// viewElement becomes empty. It's fine here.
 				const fragment = upcastWriter.createDocumentFragment( viewElement.getChildren() );
 				const innerHtml = htmlProcessor.toData( fragment );
 

+ 2 - 2
packages/ckeditor5-html-embed/src/htmlembedinsertcommand.js

@@ -11,11 +11,11 @@ import Command from '@ckeditor/ckeditor5-core/src/command';
 import { findOptimalInsertionPosition } from '@ckeditor/ckeditor5-widget/src/utils';
 
 /**
- * The insert raw html element command.
+ * The insert raw HTML element command.
  *
  * The command is registered by {@link module:html-embed/htmlembedediting~HtmlEmbedEditing} as `'htmlEmbedInsert'`.
  *
- * To insert the raw html element at the current selection, execute the command:
+ * To insert the raw HTML element at the current selection, execute the command:
  *
  *		editor.execute( 'htmlEmbedInsert' );
  *

+ 2 - 2
packages/ckeditor5-html-embed/src/htmlembedupdatecommand.js

@@ -10,11 +10,11 @@
 import Command from '@ckeditor/ckeditor5-core/src/command';
 
 /**
- * The update raw html value command.
+ * The update raw HTML value command.
  *
  * The command is registered by {@link module:html-embed/htmlembedediting~HtmlEmbedEditing} as `'htmlEmbedUpdate'`.
  *
- * To update the value of the raw html element at the current selection, execute the command:
+ * To update the value of the raw HTML element at the current selection, execute the command:
  *
  *		editor.execute( 'htmlEmbedUpdate', '<b>HTML.</b>' );
  *