Parcourir la source

Simplified the implementation.

Kamil Piechaczek il y a 5 ans
Parent
commit
2eb33f9cf8

+ 3 - 7
packages/ckeditor5-font/src/fontsize/fontsizeediting.js

@@ -100,15 +100,11 @@ export default class FontSizeEditing extends Plugin {
 					return;
 				}
 
-				if ( String( attributeValue ).match( /^\d+/ ) ) {
-					if ( typeof attributeValue == 'number' ) {
-						attributeValue = `${ attributeValue }px`;
-					}
-
-					return writer.createAttributeElement( 'span', { style: 'font-size:' + attributeValue }, { priority: 7 } );
+				if ( typeof attributeValue == 'number' ) {
+					attributeValue = `${ attributeValue }px`;
 				}
 
-				return writer.createAttributeElement( 'span', { class: 'text-' + attributeValue }, { priority: 7 } );
+				return writer.createAttributeElement( 'span', { style: 'font-size:' + attributeValue }, { priority: 7 } );
 			}
 		} );
 

+ 0 - 6
packages/ckeditor5-font/tests/fontsize/fontsizeediting.js

@@ -94,12 +94,6 @@ describe( 'FontSizeEditing', () => {
 
 					expect( editor.getData() ).to.equal( '<p>f<span style="font-size:10px;">o</span>o</p>' );
 				} );
-
-				it( 'should convert a text value as a class', () => {
-					setModelData( doc, '<paragraph>f<$text fontSize="large">o</$text>o</paragraph>' );
-
-					expect( editor.getData() ).to.equal( '<p>f<span class="text-large">o</span>o</p>' );
-				} );
 			} );
 
 			describe( 'data pipeline conversions', () => {