Skip to content

Commit

Permalink
Mainly wording.
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinmar committed Apr 21, 2020
1 parent 8377b38 commit fa6b3a5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/ckeditor5-font/docs/features/font.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions packages/ckeditor5-font/src/fontsize.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
15 changes: 9 additions & 6 deletions packages/ckeditor5-font/src/fontsize/fontsizeediting.js
Original file line number Diff line number Diff line change
Expand Up @@ -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( {
Expand Down
2 changes: 1 addition & 1 deletion packages/ckeditor5-font/tests/fontsize/fontsizeediting.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' ]
} );
}
Expand Down

0 comments on commit fa6b3a5

Please sign in to comment.