Răsfoiți Sursa

Fixing after changes introduced in t/ckeditor5-engine/1236

Szymon Cofalik 8 ani în urmă
părinte
comite
f8dc698342

+ 11 - 8
packages/ckeditor5-alignment/src/alignmentediting.js

@@ -59,20 +59,23 @@ export default class AlignmentEditing extends Plugin {
 
 
 		// Convert `text-align` style property from element to model attribute alignment.
 		// Convert `text-align` style property from element to model attribute alignment.
 		editor.conversion.for( 'upcast' )
 		editor.conversion.for( 'upcast' )
-			.use( upcastAttributeToAttribute( {
+			.add( upcastAttributeToAttribute( {
 				view: {
 				view: {
 					key: 'style',
 					key: 'style',
 					value: /text-align/
 					value: /text-align/
 				},
 				},
-				model: viewElement => {
-					const textAlign = viewElement.getStyle( 'text-align' );
+				model: {
+					key: 'alignment',
+					value: viewElement => {
+						const textAlign = viewElement.getStyle( 'text-align' );
 
 
-					// Do not convert empty, default or unknown alignment values.
-					if ( !textAlign || isDefault( textAlign ) || !enabledOptions.includes( textAlign ) ) {
-						return;
-					}
+						// Do not convert empty, default or unknown alignment values.
+						if ( !textAlign || isDefault( textAlign ) || !enabledOptions.includes( textAlign ) ) {
+							return;
+						}
 
 
-					return { key: 'alignment', value: textAlign };
+						return textAlign;
+					}
 				}
 				}
 			} ) );
 			} ) );
 
 

+ 2 - 2
packages/ckeditor5-alignment/tests/alignmentediting.js

@@ -161,8 +161,8 @@ describe( 'AlignmentEditing', () => {
 
 
 	describe( 'should be extensible', () => {
 	describe( 'should be extensible', () => {
 		it( 'converters in the data pipeline', () => {
 		it( 'converters in the data pipeline', () => {
-			blockDefaultConversion( editor.data.modelToView );
-			blockDefaultConversion( editor.editing.modelToView );
+			blockDefaultConversion( editor.data.downcastDispatcher );
+			blockDefaultConversion( editor.editing.downcastDispatcher );
 
 
 			const data = '<p style="text-align:justify;">x</p>';
 			const data = '<p style="text-align:justify;">x</p>';