Piotrek Koszuliński před 5 roky
rodič
revize
fa6b3a56f7

+ 1 - 1
packages/ckeditor5-font/docs/features/font.md

@@ -189,7 +189,7 @@ ClassicEditor
 ```
 
 <info-box info>
-	When this options is enabled, available options for the {@link module:font/fontsize~FontSize} plugin should be numerical values.
+	This option can be used only in combination with [numerical values](#using-numerical-values).
 </info-box>
 
 ## Configuring the font color and font background color features

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

@@ -139,11 +139,11 @@ export default class FontSize extends Plugin {
  * You can preserve pasted font size values by switching the option:
  *
  *		const fontSizeConfig = {
- *			options: [ 9, 10, 11, 12, 13, 14, 15 ],
- *			supportAllValues: true,
+ *			options: [ 9, 10, 11, 12, 'default', 14, 15 ],
+ *			supportAllValues: true
  *		};
  *
- * You need to also define numerical options for the plugin.
+ * **Note:** This option can only be used with numerical values as font size options.
  *
  * Now, the font sizes, not specified in the editor's configuration, won't be removed when pasting the content.
  *

+ 9 - 6
packages/ckeditor5-font/src/fontsize/fontsizeediting.js

@@ -100,16 +100,19 @@ export default class FontSizeEditing extends Plugin {
 
 		if ( presets.length ) {
 			/**
-			 * If {@link module:font/fontsize~FontSizeConfig#supportAllValues} is `true`, you need to use numerical values as
-			 * font size options.
+			 * If {@link module:font/fontsize~FontSizeConfig#supportAllValues `config.fontSize.supportAllValues`} is `true`,
+			 * you need to use numerical values as font size options.
 			 *
 			 * See valid examples described in the {@link module:font/fontsize~FontSizeConfig#options plugin configuration}.
 			 *
-			 * @error font-size-named-presets
+			 * @error font-size-invalid-use-of-named-presets
+			 * @param {Array.<String>} presets Invalid values.
 			 */
-			const message = 'font-size-named-presets: ' +
-				'If set `fontSize.supportAllValues` on `true`, you cannot use named presets as plugin\'s configuration.';
-			throw new CKEditorError( message, null, { presets } );
+			throw new CKEditorError(
+				'font-size-invalid-use-of-named-presets: ' +
+				'If config.fontSize.supportAllValues is set to true, you need to use numerical values as font size options.',
+				null, { presets }
+			);
 		}
 
 		editor.conversion.for( 'downcast' ).attributeToElement( {

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

@@ -126,7 +126,7 @@ describe( 'FontSizeEditing', () => {
 							throw new Error( 'Supposed to be rejected' );
 						},
 						error => {
-							assertCKEditorError( error, /font-size-named-presets/, null, {
+							assertCKEditorError( error, /font-size-invalid-use-of-named-presets/, null, {
 								presets: [ 'tiny', 'small', 'big', 'huge' ]
 							} );
 						}