Parcourir la source

Simplify extractors.

Maciej Gołaszewski il y a 6 ans
Parent
commit
f128335573

+ 1 - 10
packages/ckeditor5-engine/src/view/styles.js

@@ -288,11 +288,6 @@ export class StylesProcessor {
 			return styles[ name ];
 		}
 
-		const data = {
-			name,
-			styles
-		};
-
 		if ( this._extractors.has( name ) ) {
 			const extractor = this._extractors.get( name );
 
@@ -300,11 +295,7 @@ export class StylesProcessor {
 				return get( styles, extractor );
 			}
 
-			const { path, value } = extractor( data );
-
-			if ( path ) {
-				return get( styles, path );
-			}
+			const value = extractor( name, styles );
 
 			if ( value ) {
 				return value;

+ 3 - 3
packages/ckeditor5-engine/src/view/styles/borderstyles.js

@@ -137,9 +137,9 @@ function getBorderPropertyPositionNormalizer( property, side ) {
 }
 
 function getBorderPositionExtractor( which ) {
-	return data => {
-		if ( data.styles.border ) {
-			return { value: extractBorderPosition( data.styles.border, which, data ) };
+	return ( name, styles ) => {
+		if ( styles.border ) {
+			return extractBorderPosition( styles.border, which );
 		}
 	};
 }