From fa6b3a56f78b8b8ec606740e5c883242b6277583 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20Koszuli=C5=84ski?= Date: Tue, 21 Apr 2020 15:46:10 +0200 Subject: [PATCH] Mainly wording. --- packages/ckeditor5-font/docs/features/font.md | 2 +- packages/ckeditor5-font/src/fontsize.js | 6 +++--- .../src/fontsize/fontsizeediting.js | 15 +++++++++------ .../tests/fontsize/fontsizeediting.js | 2 +- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/packages/ckeditor5-font/docs/features/font.md b/packages/ckeditor5-font/docs/features/font.md index 4b47b788fd5..78d1eccf199 100644 --- a/packages/ckeditor5-font/docs/features/font.md +++ b/packages/ckeditor5-font/docs/features/font.md @@ -189,7 +189,7 @@ ClassicEditor ``` - 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). ## Configuring the font color and font background color features diff --git a/packages/ckeditor5-font/src/fontsize.js b/packages/ckeditor5-font/src/fontsize.js index bfa60683665..6ad1eca91d0 100644 --- a/packages/ckeditor5-font/src/fontsize.js +++ b/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. * diff --git a/packages/ckeditor5-font/src/fontsize/fontsizeediting.js b/packages/ckeditor5-font/src/fontsize/fontsizeediting.js index 9fe271bc278..428b945d1bd 100644 --- a/packages/ckeditor5-font/src/fontsize/fontsizeediting.js +++ b/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.} 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( { diff --git a/packages/ckeditor5-font/tests/fontsize/fontsizeediting.js b/packages/ckeditor5-font/tests/fontsize/fontsizeediting.js index b2843967f40..a358825435c 100644 --- a/packages/ckeditor5-font/tests/fontsize/fontsizeediting.js +++ b/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' ] } ); }