Przeglądaj źródła

Rename Styles to StylesMap.

Maciej Gołaszewski 6 lat temu
rodzic
commit
e9fa1fe4f0

+ 2 - 2
packages/ckeditor5-engine/src/view/document.js

@@ -11,7 +11,7 @@ import DocumentSelection from './documentselection';
 import Collection from '@ckeditor/ckeditor5-utils/src/collection';
 import mix from '@ckeditor/ckeditor5-utils/src/mix';
 import ObservableMixin from '@ckeditor/ckeditor5-utils/src/observablemixin';
-import Styles from './styles';
+import StylesMap from './stylesmap';
 
 // @if CK_DEBUG_ENGINE // const { logDocument } = require( '../dev-utils/utils' );
 
@@ -162,7 +162,7 @@ export default class Document {
 	}
 
 	addStyleProcessorRules( callback ) {
-		callback( Styles.processor );
+		callback( StylesMap.processor );
 	}
 
 	/**

+ 3 - 3
packages/ckeditor5-engine/src/view/element.js

@@ -14,7 +14,7 @@ import objectToMap from '@ckeditor/ckeditor5-utils/src/objecttomap';
 import isIterable from '@ckeditor/ckeditor5-utils/src/isiterable';
 import Matcher from './matcher';
 import { isPlainObject } from 'lodash-es';
-import Styles from './styles';
+import StylesMap from './stylesmap';
 
 // @if CK_DEBUG_ENGINE // const { convertMapToTags } = require( '../dev-utils/utils' );
 
@@ -109,9 +109,9 @@ export default class Element extends Node {
 		 * Normalized styles.
 		 *
 		 * @protected
-		 * @member {module:engine/view/styles~Styles} module:engine/view/element~Element#_styles
+		 * @member {module:engine/view/stylesmap~StylesMap} module:engine/view/element~Element#_styles
 		 */
-		this._styles = new Styles();
+		this._styles = new StylesMap();
 
 		if ( this._attrs.has( 'style' ) ) {
 			// Remove style attribute and handle it by styles map.

+ 7 - 7
packages/ckeditor5-engine/src/view/styles.js → packages/ckeditor5-engine/src/view/stylesmap.js

@@ -4,7 +4,7 @@
  */
 
 /**
- * @module engine/view/styles
+ * @module engine/view/stylesmap
  */
 
 import { get, isObject, merge, set, unset } from 'lodash-es';
@@ -14,7 +14,7 @@ import { get, isObject, merge, set, unset } from 'lodash-es';
  *
  * Handles styles normalization.
  */
-export default class Styles {
+export default class StylesMap {
 	/**
 	 * Creates Styles instance.
 	 */
@@ -29,7 +29,7 @@ export default class Styles {
 		// that two editors are connected through single style processor instance.
 		Object.defineProperty( this, '_styleProcessor', {
 			get() {
-				return styleProcessor || Styles.processor;
+				return styleProcessor || StylesMap.processor;
 			},
 			enumerable: false
 		} );
@@ -214,7 +214,7 @@ export default class Styles {
 	/**
 	 * Returns style properties names as the would appear when using {@link #getInlineStyle}
 	 *
-	 * @returns {module:engine/view/styles~PropertyEntry}
+	 * @returns {module:engine/view/stylesmap~PropertyEntry}
 	 */
 	getStyleNames() {
 		const entries = this._getStylesEntries();
@@ -233,7 +233,7 @@ export default class Styles {
 	 * Returns normalized styles entries for further processing.
 	 *
 	 * @private
-	 * @returns {module:engine/view/styles~PropertyEntry}
+	 * @returns {module:engine/view/stylesmap~PropertyEntry}
 	 */
 	_getStylesEntries() {
 		const parsed = [];
@@ -263,7 +263,7 @@ export class StylesProcessor {
 	 * @private
 	 * @param {String} styleName
 	 * @param {Object|String} normalizedValue
-	 * @returns {module:engine/view/styles~PropertyEntry}
+	 * @returns {module:engine/view/stylesmap~PropertyEntry}
 	 */
 	getReducedForm( styleName, normalizedValue ) {
 		if ( this._reducers.has( styleName ) ) {
@@ -505,5 +505,5 @@ function appendStyleValue( stylesObject, nameOrPath, valueOrObject ) {
  */
 
 /**
- * @typedef {Array.<Array.<String>>} module:engine/view/styles~PropertyEntry
+ * @typedef {Array.<Array.<String>>} module:engine/view/stylesmap~PropertyEntry
  */

+ 2 - 2
packages/ckeditor5-engine/tests/view/styles/backgroundstyles.js

@@ -3,7 +3,7 @@
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  */
 
-import Styles, { StylesProcessor } from '../../../src/view/styles';
+import StylesMap, { StylesProcessor } from '../../../src/view/stylesmap';
 import { addBackgroundStylesProcessor } from '../../../src/view/styles/backgroundstyles';
 
 describe( 'Background styles normalization', () => {
@@ -12,7 +12,7 @@ describe( 'Background styles normalization', () => {
 	beforeEach( () => {
 		const stylesProcessor = new StylesProcessor();
 		addBackgroundStylesProcessor( stylesProcessor );
-		styles = new Styles( stylesProcessor );
+		styles = new StylesMap( stylesProcessor );
 	} );
 
 	it( 'should normalize background', () => {

+ 2 - 2
packages/ckeditor5-engine/tests/view/styles/borderstyles.js

@@ -3,7 +3,7 @@
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  */
 
-import Styles, { StylesProcessor } from '../../../src/view/styles';
+import StylesMap, { StylesProcessor } from '../../../src/view/stylesmap';
 import { addBorderStylesProcessor } from '../../../src/view/styles/borderstyles';
 
 describe( 'Border styles normalization', () => {
@@ -12,7 +12,7 @@ describe( 'Border styles normalization', () => {
 	beforeEach( () => {
 		const converter = new StylesProcessor();
 		addBorderStylesProcessor( converter );
-		styles = new Styles( converter );
+		styles = new StylesMap( converter );
 	} );
 
 	it( 'should parse border shorthand', () => {

+ 2 - 2
packages/ckeditor5-engine/tests/view/styles/marginstyles.js

@@ -3,7 +3,7 @@
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  */
 
-import Styles, { StylesProcessor } from '../../../src/view/styles';
+import StylesMap, { StylesProcessor } from '../../../src/view/stylesmap';
 import { addMarginStylesProcessor } from '../../../src/view/styles/marginstyles';
 
 describe( 'Margin styles normalizer', () => {
@@ -12,7 +12,7 @@ describe( 'Margin styles normalizer', () => {
 	beforeEach( () => {
 		const converter = new StylesProcessor();
 		addMarginStylesProcessor( converter );
-		styles = new Styles( converter );
+		styles = new StylesMap( converter );
 	} );
 
 	it( 'should set all margins (1 value defined)', () => {

+ 2 - 2
packages/ckeditor5-engine/tests/view/styles/paddingstyles.js

@@ -3,7 +3,7 @@
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  */
 
-import Styles, { StylesProcessor } from '../../../src/view/styles';
+import StylesMap, { StylesProcessor } from '../../../src/view/stylesmap';
 import { addPaddingStylesProcessor } from '../../../src/view/styles/paddingstyles';
 
 describe( 'Padding styles normalization', () => {
@@ -12,7 +12,7 @@ describe( 'Padding styles normalization', () => {
 	beforeEach( () => {
 		const converter = new StylesProcessor();
 		addPaddingStylesProcessor( converter );
-		styles = new Styles( converter );
+		styles = new StylesMap( converter );
 	} );
 
 	it( 'should set all paddings (1 value defined)', () => {

+ 3 - 3
packages/ckeditor5-engine/tests/view/styles.js → packages/ckeditor5-engine/tests/view/stylesmap.js

@@ -3,11 +3,11 @@
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  */
 
-import Styles, { StylesProcessor } from '../../src/view/styles';
+import StylesMap, { StylesProcessor } from '../../src/view/stylesmap';
 import encodedImage from './_utils/encodedimage.txt';
 import { addPaddingStylesProcessor } from '../../src/view/styles/paddingstyles';
 
-describe( 'Styles', () => {
+describe( 'StylesMap', () => {
 	let styles, converter;
 
 	beforeEach( () => {
@@ -24,7 +24,7 @@ describe( 'Styles', () => {
 		} ) );
 
 		addPaddingStylesProcessor( converter );
-		styles = new Styles( converter );
+		styles = new StylesMap( converter );
 	} );
 
 	describe( 'size getter', () => {