8
0
Просмотр исходного кода

Changed 'normal' font size to 'default' to keep the same naming convention as the font family feature.

Aleksander Nowodzinski 8 лет назад
Родитель
Сommit
0692b9d8d4

+ 2 - 2
packages/ckeditor5-font/src/fontsize.js

@@ -82,14 +82,14 @@ export default class FontSize extends Plugin {
  *			options: [
  *				'tiny',
  * 				'small',
- * 				'normal',
+ * 				'default',
  * 				'big',
  * 				'huge'
  *			]
  *		};
  *
  * It defines 4 sizes: **tiny**, **small**, **big**, and **huge**. These values will be rendered as `span` elements in view.
- * The **normal** defines a text without the `fontSize` attribute.
+ * The **default** defines a text without the `fontSize` attribute.
  *
  * Each `span` has the `class` attribute set to the corresponding size name. For instance, this is what the **small** size looks
  * like in the view:

+ 1 - 1
packages/ckeditor5-font/src/fontsize/fontsizeediting.js

@@ -40,7 +40,7 @@ export default class FontSizeEditing extends Plugin {
 			options: [
 				'tiny',
 				'small',
-				'normal',
+				'default',
 				'big',
 				'huge'
 			]

+ 1 - 1
packages/ckeditor5-font/src/fontsize/fontsizeui.js

@@ -84,7 +84,7 @@ export default class FontSizeUI extends Plugin {
 		const t = editor.t;
 
 		const localizedTitles = {
-			Normal: t( 'Normal' ),
+			Default: t( 'Default' ),
 			Tiny: t( 'Tiny' ),
 			Small: t( 'Small' ),
 			Big: t( 'Big' ),

+ 3 - 3
packages/ckeditor5-font/src/fontsize/utils.js

@@ -74,11 +74,11 @@ function getOptionDefinition( option ) {
 		return namedPresets[ option ];
 	}
 
-	// 'Normal' font size. It will be used to remove the fontSize attribute.
-	if ( option === 'normal' ) {
+	// 'Default' font size. It will be used to remove the fontSize attribute.
+	if ( option === 'default' ) {
 		return {
 			model: undefined,
-			title: 'Normal'
+			title: 'Default'
 		};
 	}
 

+ 3 - 3
packages/ckeditor5-font/tests/fontsize/fontsizeediting.js

@@ -39,7 +39,7 @@ describe( 'FontSizeEditing', () => {
 	describe( 'config', () => {
 		describe( 'default value', () => {
 			it( 'should be set', () => {
-				expect( editor.config.get( 'fontSize.options' ) ).to.deep.equal( [ 'tiny', 'small', 'normal', 'big', 'huge' ] );
+				expect( editor.config.get( 'fontSize.options' ) ).to.deep.equal( [ 'tiny', 'small', 'default', 'big', 'huge' ] );
 			} );
 		} );
 	} );
@@ -52,7 +52,7 @@ describe( 'FontSizeEditing', () => {
 					fontSize: {
 						options: [
 							'tiny',
-							'normal',
+							'default',
 							18,
 							{
 								title: 'My setting',
@@ -106,7 +106,7 @@ describe( 'FontSizeEditing', () => {
 					fontSize: {
 						options: [
 							'tiny',
-							'normal',
+							'default',
 							18,
 							{
 								title: 'My setting',

+ 9 - 9
packages/ckeditor5-font/tests/fontsize/fontsizeui.js

@@ -23,7 +23,7 @@ describe( 'FontSizeUI', () => {
 	before( () => {
 		addTranslations( 'en', {
 			'Font Size': 'Font Size',
-			'Normal': 'Normal',
+			'Default': 'Default',
 			'Tiny': 'Tiny',
 			'Small': 'Small',
 			'Big': 'Big',
@@ -32,7 +32,7 @@ describe( 'FontSizeUI', () => {
 
 		addTranslations( 'pl', {
 			'Font Size': 'Rozmiar czcionki',
-			'Normal': 'Normalny',
+			'Default': 'Domyślny',
 			'Tiny': 'Tyci',
 			'Small': 'Mały',
 			'Big': 'Duży',
@@ -99,7 +99,7 @@ describe( 'FontSizeUI', () => {
 
 			command.value = undefined;
 
-			// The third item is 'normal' font size.
+			// The third item is 'default' font size.
 			expect( listView.items.map( item => item.isActive ) ).to.deep.equal( [ false, false, true, false, false ] );
 
 			command.value = 'tiny';
@@ -129,7 +129,7 @@ describe( 'FontSizeUI', () => {
 						.create( element, {
 							plugins: [ FontSizeEditing, FontSizeUI ],
 							fontSize: {
-								options: [ 'tiny', 'small', 'normal', 'big', 'huge' ]
+								options: [ 'tiny', 'small', 'default', 'big', 'huge' ]
 							}
 						} )
 						.then( newEditor => {
@@ -160,7 +160,7 @@ describe( 'FontSizeUI', () => {
 						.create( element, {
 							plugins: [ FontSizeEditing, FontSizeUI ],
 							fontSize: {
-								options: [ 10, 12, 'normal', 16, 18 ]
+								options: [ 10, 12, 'default', 16, 18 ]
 							}
 						} )
 						.then( newEditor => {
@@ -197,15 +197,15 @@ describe( 'FontSizeUI', () => {
 
 		describe( 'localization', () => {
 			beforeEach( () => {
-				return localizedEditor( [ 'tiny', 'small', 'normal', 'big', 'huge' ] );
+				return localizedEditor( [ 'tiny', 'small', 'default', 'big', 'huge' ] );
 			} );
 
 			it( 'does not alter normalizeOptions() internals', () => {
-				const options = normalizeOptions( [ 'tiny', 'small', 'normal', 'big', 'huge' ] );
+				const options = normalizeOptions( [ 'tiny', 'small', 'default', 'big', 'huge' ] );
 				expect( options ).to.deep.equal( [
 					{ title: 'Tiny', model: 'tiny', view: { name: 'span', class: 'text-tiny' } },
 					{ title: 'Small', model: 'small', view: { name: 'span', class: 'text-small' } },
-					{ title: 'Normal', model: undefined },
+					{ title: 'Default', model: undefined },
 					{ title: 'Big', model: 'big', view: { name: 'span', class: 'text-big' } },
 					{ title: 'Huge', model: 'huge', view: { name: 'span', class: 'text-huge' } }
 				] );
@@ -223,7 +223,7 @@ describe( 'FontSizeUI', () => {
 				expect( listView.items.map( item => item.label ) ).to.deep.equal( [
 					'Tyci',
 					'Mały',
-					'Normalny',
+					'Domyślny',
 					'Duży',
 					'Ogromny'
 				] );

+ 5 - 5
packages/ckeditor5-font/tests/fontsize/utils.js

@@ -8,7 +8,7 @@ import { normalizeOptions } from '../../src/fontsize/utils';
 describe( 'FontSizeEditing Utils', () => {
 	describe( 'normalizeOptions()', () => {
 		it( 'should discard unsupported values', () => {
-			expect( normalizeOptions( [ () => {}, 'normal', 'unknown' ] ) ).to.deep.equal( [ { title: 'Normal', model: undefined } ] );
+			expect( normalizeOptions( [ () => {}, 'default', 'unknown' ] ) ).to.deep.equal( [ { title: 'Default', model: undefined } ] );
 		} );
 
 		it( 'should pass through object definition', () => {
@@ -27,10 +27,10 @@ describe( 'FontSizeEditing Utils', () => {
 
 		describe( 'named presets', () => {
 			it( 'should return defined presets', () => {
-				expect( normalizeOptions( [ 'tiny', 'small', 'normal', 'big', 'huge' ] ) ).to.deep.equal( [
+				expect( normalizeOptions( [ 'tiny', 'small', 'default', 'big', 'huge' ] ) ).to.deep.equal( [
 					{ title: 'Tiny', model: 'tiny', view: { name: 'span', class: 'text-tiny' } },
 					{ title: 'Small', model: 'small', view: { name: 'span', class: 'text-small' } },
-					{ title: 'Normal', model: undefined },
+					{ title: 'Default', model: undefined },
 					{ title: 'Big', model: 'big', view: { name: 'span', class: 'text-big' } },
 					{ title: 'Huge', model: 'huge', view: { name: 'span', class: 'text-huge' } }
 				] );
@@ -39,10 +39,10 @@ describe( 'FontSizeEditing Utils', () => {
 
 		describe( 'numeric presets', () => {
 			it( 'should return generated presets', () => {
-				expect( normalizeOptions( [ '10', 12, 'normal', '14.1', 18.3 ] ) ).to.deep.equal( [
+				expect( normalizeOptions( [ '10', 12, 'default', '14.1', 18.3 ] ) ).to.deep.equal( [
 					{ title: '10', model: 10, view: { name: 'span', style: { 'font-size': '10px' } } },
 					{ title: '12', model: 12, view: { name: 'span', style: { 'font-size': '12px' } } },
-					{ title: 'Normal', model: undefined },
+					{ title: 'Default', model: undefined },
 					{ title: '14.1', model: 14.1, view: { name: 'span', style: { 'font-size': '14.1px' } } },
 					{ title: '18.3', model: 18.3, view: { name: 'span', style: { 'font-size': '18.3px' } } }
 				] );

+ 1 - 1
packages/ckeditor5-font/tests/manual/font-size-numeric.html

@@ -4,7 +4,7 @@
 	<p><span style="font-size: 10px;">Some text with font-size set to: 10px.</span></p>
 	<p><span style="font-size: 12px;">Some text with font-size set to: 12px.</span></p>
 	<p><span style="font-size: 14px;">Some text with font-size set to: 14px.</span></p>
-	<p>Some text with normal size (font-size not set to).</p>
+	<p>Some text with the default size</p>
 	<p><span style="font-size: 18px;">Some text with font-size set to: 18px.</span></p>
 	<p><span style="font-size: 20px;">Some text with font-size set to: 20px.</span></p>
 	<p><span style="font-size: 22px;">Some text with font-size set to: 22px.</span></p>

+ 1 - 1
packages/ckeditor5-font/tests/manual/font-size-numeric.js

@@ -15,7 +15,7 @@ ClassicEditor
 		toolbar: [
 			'headings', '|', 'fontSize', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote', 'undo', 'redo'
 		],
-		fontSize: { options: [ 10, 12, 14, 'normal', 18, 20, 22 ] }
+		fontSize: { options: [ 10, 12, 14, 'default', 18, 20, 22 ] }
 	} )
 	.then( editor => {
 		window.editor = editor;

+ 1 - 1
packages/ckeditor5-font/tests/manual/font-size-numeric.md

@@ -1,7 +1,7 @@
 ### Loading
 
 The data should be loaded with:
-- 7 paragraphs with font sizes (10, 12, 14, normal, 18, 20, 22),
+- 7 paragraphs with font sizes (10, 12, 14, default, 18, 20, 22),
 
 ### Testing