瀏覽代碼

Docs, docs, docs.

Piotrek Koszuliński 6 年之前
父節點
當前提交
dc7157332f
共有 2 個文件被更改,包括 17 次插入14 次删除
  1. 4 2
      packages/ckeditor5-engine/src/view/downcastwriter.js
  2. 13 12
      packages/ckeditor5-engine/src/view/element.js

+ 4 - 2
packages/ckeditor5-engine/src/view/downcastwriter.js

@@ -343,10 +343,12 @@ export default class DowncastWriter {
 	/**
 	 * Removes specified style from the element.
 	 *
-	 *		writer.removeStyle( 'color', element );  // Removes 'color' style.
+	 *		writer.removeStyle( 'color', element ); // Removes 'color' style.
 	 *		writer.removeStyle( [ 'color', 'border-top' ], element ); // Removes both 'color' and 'border-top' styles.
 	 *
-	 * **Note**: Handles also normalized styles if defined. See {@link module:engine/view/stylesmap~StylesMap#remove}.
+	 * **Note**: This method can work with normalized style names if
+	 * {@link module:engine/view/document~Document#addStyleProcessorRules a particular style processor rule is enabled}.
+	 * See {@link module:engine/view/stylesmap~StylesMap#remove `StylesMap#remove()`} for details.
 	 *
 	 * @param {Array.<String>|String} property
 	 * @param {module:engine/view/element~Element} element

+ 13 - 12
packages/ckeditor5-engine/src/view/element.js

@@ -377,28 +377,27 @@ export default class Element extends Node {
 	}
 
 	/**
-	 * Returns style value for given property.
-	 * Undefined is returned if style does not exist.
+	 * Returns style value for the given property mae.
+	 * If the style does not exist `undefined` is returned.
 	 *
-	 * *Note*: This method will only return normalized styles if a style processor was defined. Otherwise the style names are not
-	 * normalized.
+	 * **Note**: This method can work with normalized style names if
+	 * {@link module:engine/view/document~Document#addStyleProcessorRules a particular style processor rule is enabled}.
+	 * See {@link module:engine/view/stylesmap~StylesMap#get `StylesMap#get()`} for details.
 	 *
-	 * For an element with style set to: 'margin:1px
+	 * For an element with style set to `'margin:1px'`:
 	 *
 	 *		// Enable 'margin' shorthand processing:
 	 *		editor.editing.view.document.addStyleProcessorRules( addMarginRules );
 	 *
 	 *		const element = view.change( writer => {
 	 *			const element = writer.createElement();
-	 *			writer.setStyle( 'margin', '1px' )
-	 *			writer.setStyle( 'margin-bottom', '3em' )
+	 *			writer.setStyle( 'margin', '1px' );
+	 *			writer.setStyle( 'margin-bottom', '3em' );
 	 *
 	 *			return element;
 	 *		} );
 	 *
-	 *		element.getStyle( 'margin' );
-	 *
-	 *		// will return 'margin: 1px 1px 3em;'
+	 *		element.getStyle( 'margin' ); // -> 'margin: 1px 1px 3em;'
 	 *
 	 * @param {String} property
 	 * @returns {String|undefined}
@@ -429,8 +428,10 @@ export default class Element extends Node {
 	 *
 	 * Will return a `2px` string.
 	 *
-	 * *Note*: This method will only return normalized styles if a style processor was defined. Otherwise the style names are not
-	 * normalized.
+	 * **Note**: This method will return normalized values only if
+	 * {@link module:engine/view/document~Document#addStyleProcessorRules a particular style processor rule is enabled}.
+	 * See {@link module:engine/view/stylesmap~StylesMap#getNormalized `StylesMap#getNormalized()`} for details.
+	 *
 	 *
 	 * @param {String} property Name of CSS property
 	 * @returns {Object|String|undefined}