Browse Source

Move Styles class as a default export of view/styles.

Maciej Gołaszewski 6 năm trước cách đây
mục cha
commit
869a8939a9
1 tập tin đã thay đổi với 74 bổ sung74 xóa
  1. 74 74
      packages/ckeditor5-engine/src/view/styles.js

+ 74 - 74
packages/ckeditor5-engine/src/view/styles.js

@@ -16,80 +16,6 @@ import MarginStyles from './styles/marginstyles';
 import PaddingStyles from './styles/paddingstyles';
 import BackgroundStyles from './styles/backgroundstyles';
 
-export class StylesProcessor {
-	/**
-	 * Returns reduced form of style property form normalized object.
-	 *
-	 * @private
-	 * @param {String} styleName
-	 * @param {Object|String} normalizedValue
-	 * @returns {module:engine/view/styles~PropertyEntry}
-	 */
-	getReducedForm( styleName, normalizedValue ) {
-		const data = {
-			value: normalizedValue
-		};
-
-		this.fire( 'reduce:' + styleName, data );
-
-		return data.reduced || [ [ styleName, normalizedValue ] ];
-	}
-
-	getNormalized( name, styles ) {
-		if ( !name ) {
-			return merge( {}, styles );
-		}
-
-		if ( styles[ name ] ) {
-			return styles[ name ];
-		}
-
-		const data = {
-			name,
-			styles
-		};
-
-		this.fire( `extract:${ name }`, data );
-
-		if ( data.path ) {
-			return get( styles, data.path );
-		}
-
-		if ( data.value ) {
-			return data.value;
-		}
-
-		return get( styles, toPath( name ) );
-	}
-
-	/**
-	 * Parse style property value to a normalized form.
-	 *
-	 * @param {String} propertyName Name of style property.
-	 * @param {String} value Value of style property.
-	 * @param {Object} styles
-	 * @private
-	 */
-	toNormalizedForm( propertyName, value, styles ) {
-		if ( isObject( value ) ) {
-			appendStyleValue( styles, toPath( propertyName ), value );
-
-			return;
-		}
-
-		const data = {
-			path: propertyName,
-			value
-		};
-
-		this.fire( 'normalize:' + propertyName, data );
-
-		appendStyleValue( styles, data.path, data.value );
-	}
-}
-
-mix( StylesProcessor, EmitterMixin );
-
 /**
  * Styles class.
  *
@@ -322,6 +248,80 @@ export default class Styles {
 	}
 }
 
+export class StylesProcessor {
+	/**
+	 * Returns reduced form of style property form normalized object.
+	 *
+	 * @private
+	 * @param {String} styleName
+	 * @param {Object|String} normalizedValue
+	 * @returns {module:engine/view/styles~PropertyEntry}
+	 */
+	getReducedForm( styleName, normalizedValue ) {
+		const data = {
+			value: normalizedValue
+		};
+
+		this.fire( 'reduce:' + styleName, data );
+
+		return data.reduced || [ [ styleName, normalizedValue ] ];
+	}
+
+	getNormalized( name, styles ) {
+		if ( !name ) {
+			return merge( {}, styles );
+		}
+
+		if ( styles[ name ] ) {
+			return styles[ name ];
+		}
+
+		const data = {
+			name,
+			styles
+		};
+
+		this.fire( `extract:${ name }`, data );
+
+		if ( data.path ) {
+			return get( styles, data.path );
+		}
+
+		if ( data.value ) {
+			return data.value;
+		}
+
+		return get( styles, toPath( name ) );
+	}
+
+	/**
+	 * Parse style property value to a normalized form.
+	 *
+	 * @param {String} propertyName Name of style property.
+	 * @param {String} value Value of style property.
+	 * @param {Object} styles
+	 * @private
+	 */
+	toNormalizedForm( propertyName, value, styles ) {
+		if ( isObject( value ) ) {
+			appendStyleValue( styles, toPath( propertyName ), value );
+
+			return;
+		}
+
+		const data = {
+			path: propertyName,
+			value
+		};
+
+		this.fire( 'normalize:' + propertyName, data );
+
+		appendStyleValue( styles, data.path, data.value );
+	}
+}
+
+mix( StylesProcessor, EmitterMixin );
+
 BorderStyles.attach( Styles.processor );
 MarginStyles.attach( Styles.processor );
 PaddingStyles.attach( Styles.processor );