{"version":3,"sources":["webpack:///./node_modules/@ckeditor/ckeditor5-font/src/fontsize/fontsizecommand.js","webpack:///./node_modules/@ckeditor/ckeditor5-font/src/fontsize/utils.js","webpack:///./node_modules/@ckeditor/ckeditor5-font/src/fontsize/fontsizeediting.js","webpack:///./node_modules/@ckeditor/ckeditor5-font/src/fontsize/fontsizeui.js","webpack:///./node_modules/@ckeditor/ckeditor5-font/src/fontsize.js"],"names":["FontSizeCommand","editor","Object","classCallCheck","this","_super","call","FONT_SIZE","FontCommand","normalizeOptions","configuredOptions","map","item","getOptionDefinition","filter","option","namedPresets","tiny","title","model","view","name","classes","priority","small","big","huge","isFullItemDefinition","attachPriority","preset","findPreset","undefined","isNumericalDefinition","generatePixelPreset","definition","String","concat","parseFloat","styles","font-size","esm_typeof","numberValue","CKEditorError","isNaN","styleFontSize","FontSizeEditing","_this","config","define","options","supportAllValues","schema","extend","allowAttributes","setAttributeProperties","isFormatting","copyOnEnter","get","buildDefinition","_prepareAnyValueConverters","_prepareCompatibilityConverter","conversion","attributeToElement","commands","add","presets","values","value","isLength","isPercentage","length","for","attributeValue","_ref","writer","createAttributeElement","style","elementToAttribute","key","viewElement","getStyle","attributes","size","getAttribute","isRelative","parseInt","maxSize","clampedSize","Math","min","max","Plugin","FontSizeUI","t","_getLocalizedOptions","command","ui","componentFactory","locale","dropdownView","createDropdown","addListToDropdown","_prepareListOptions","buttonView","set","label","icon","fontSizeIcon","tooltip","extendTemplate","class","bind","to","listenTo","evt","execute","source","commandName","commandParam","editing","focus","localizedTitles","Default","Tiny","Small","Big","Huge","assign","_step","itemDefinitions","Collection","_iterator","_createForOfIteratorHelper","_loop","def","type","Model","withText","s","n","done","err","e","f","FontSize"],"mappings":";;;;OAsBqBA,6CAIpB,SAAAA,EAAaC,GAAS,OAAAC,OAAAC,EAAA,KAAAD,CAAAE,KAAAJ,GAAAK,EAAAC,KAAAF,KACdH,EAAQM,kBAL4BC;;;;;ACJtC,SAASC,EAAkBC,GAEjC,OAAOA,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IpB,WACC,OAASnG,EAAiB+C,2BAM3B,WACC,MAAO,kBAZ6BD","file":"js/chunk-2d0b2939.73708eaf.js","sourcesContent":["/**\n * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module font/fontsize/fontsizecommand\n */\n\nimport FontCommand from '../fontcommand';\nimport { FONT_SIZE } from '../utils';\n\n/**\n * The font size command. It is used by {@link module:font/fontsize/fontsizeediting~FontSizeEditing}\n * to apply the font size.\n *\n *\t\teditor.execute( 'fontSize', { value: 'small' } );\n *\n * **Note**: Executing the command without the value removes the attribute from the model.\n *\n * @extends module:font/fontcommand~FontCommand\n */\nexport default class FontSizeCommand extends FontCommand {\n\t/**\n\t * @inheritDoc\n\t */\n\tconstructor( editor ) {\n\t\tsuper( editor, FONT_SIZE );\n\t}\n}\n","/**\n * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module font/fontsize/utils\n */\n\nimport { CKEditorError } from 'ckeditor5/src/utils';\n\n/**\n * Normalizes and translates the {@link module:font/fontsize~FontSizeConfig#options configuration options}\n * to the {@link module:font/fontsize~FontSizeOption} format.\n *\n * @param {Array.} configuredOptions An array of options taken from the configuration.\n * @returns {Array.}\n */\nexport function normalizeOptions( configuredOptions ) {\n\t// Convert options to objects.\n\treturn configuredOptions\n\t\t.map( item => getOptionDefinition( item ) )\n\t\t// Filter out undefined values that `getOptionDefinition` might return.\n\t\t.filter( option => !!option );\n}\n\n// Default named presets map. Always create a new instance of the preset object in order to avoid modifying references.\nconst namedPresets = {\n\tget tiny() {\n\t\treturn {\n\t\t\ttitle: 'Tiny',\n\t\t\tmodel: 'tiny',\n\t\t\tview: {\n\t\t\t\tname: 'span',\n\t\t\t\tclasses: 'text-tiny',\n\t\t\t\tpriority: 7\n\t\t\t}\n\t\t};\n\t},\n\tget small() {\n\t\treturn {\n\t\t\ttitle: 'Small',\n\t\t\tmodel: 'small',\n\t\t\tview: {\n\t\t\t\tname: 'span',\n\t\t\t\tclasses: 'text-small',\n\t\t\t\tpriority: 7\n\t\t\t}\n\t\t};\n\t},\n\tget big() {\n\t\treturn {\n\t\t\ttitle: 'Big',\n\t\t\tmodel: 'big',\n\t\t\tview: {\n\t\t\t\tname: 'span',\n\t\t\t\tclasses: 'text-big',\n\t\t\t\tpriority: 7\n\t\t\t}\n\t\t};\n\t},\n\tget huge() {\n\t\treturn {\n\t\t\ttitle: 'Huge',\n\t\t\tmodel: 'huge',\n\t\t\tview: {\n\t\t\t\tname: 'span',\n\t\t\t\tclasses: 'text-huge',\n\t\t\t\tpriority: 7\n\t\t\t}\n\t\t};\n\t}\n};\n\n// Returns an option definition either from preset or creates one from number shortcut.\n// If object is passed then this method will return it without alternating it. Returns undefined for item than cannot be parsed.\n//\n// @param {String|Number|Object} item\n// @returns {undefined|module:font/fontsize~FontSizeOption}\nfunction getOptionDefinition( option ) {\n\t// Check whether passed option is a full item definition provided by user in configuration.\n\tif ( isFullItemDefinition( option ) ) {\n\t\treturn attachPriority( option );\n\t}\n\n\tconst preset = findPreset( option );\n\n\t// Item is a named preset.\n\tif ( preset ) {\n\t\treturn attachPriority( preset );\n\t}\n\n\t// 'Default' font size. It will be used to remove the fontSize attribute.\n\tif ( option === 'default' ) {\n\t\treturn {\n\t\t\tmodel: undefined,\n\t\t\ttitle: 'Default'\n\t\t};\n\t}\n\n\t// At this stage we probably have numerical value to generate a preset so parse it's value.\n\t// Discard any faulty values.\n\tif ( isNumericalDefinition( option ) ) {\n\t\treturn;\n\t}\n\n\t// Return font size definition from size value.\n\treturn generatePixelPreset( option );\n}\n\n// Creates a predefined preset for pixel size.\n//\n// @param {Number} definition Font size in pixels.\n// @returns {module:font/fontsize~FontSizeOption}\nfunction generatePixelPreset( definition ) {\n\t// Extend a short (numeric value) definition.\n\tif ( typeof definition === 'number' || typeof definition === 'string' ) {\n\t\tdefinition = {\n\t\t\ttitle: String( definition ),\n\t\t\tmodel: `${ parseFloat( definition ) }px`\n\t\t};\n\t}\n\n\tdefinition.view = {\n\t\tname: 'span',\n\t\tstyles: {\n\t\t\t'font-size': definition.model\n\t\t}\n\t};\n\n\treturn attachPriority( definition );\n}\n\n// Adds the priority to the view element definition if missing. It's required due to ckeditor/ckeditor5#2291\n//\n// @param {Object} definition\n// @param {Object} definition.title\n// @param {Object} definition.model\n// @param {Object} definition.view\n// @returns {Object}\nfunction attachPriority( definition ) {\n\tif ( !definition.view.priority ) {\n\t\tdefinition.view.priority = 7;\n\t}\n\n\treturn definition;\n}\n\n// Returns a prepared preset definition. If passed an object, a name of preset should be defined as `model` value.\n//\n// @param {String|Object} definition\n// @param {String} definition.model A preset name.\n// @returns {Object|undefined}\nfunction findPreset( definition ) {\n\treturn namedPresets[ definition ] || namedPresets[ definition.model ];\n}\n\n// We treat `definition` as completed if it is an object that contains `title`, `model` and `view` values.\n//\n// @param {Object} definition\n// @param {String} definition.title\n// @param {String} definition.model\n// @param {Object} definition.view\n// @returns {Boolean}\nfunction isFullItemDefinition( definition ) {\n\treturn typeof definition === 'object' && definition.title && definition.model && definition.view;\n}\n\n// We treat `definition` as numerical if it is a number, number-like (string) or an object with the `title` key.\n//\n// @param {Object|Number|String} definition\n// @param {Object} definition.title\n// @returns {Boolean}\nfunction isNumericalDefinition( definition ) {\n\tlet numberValue;\n\n\tif ( typeof definition === 'object' ) {\n\t\tif ( !definition.model ) {\n\t\t\t/**\n\t\t\t * Provided value as an option for {@link module:font/fontsize~FontSize} seems to invalid.\n\t\t\t *\n\t\t\t * See valid examples described in the {@link module:font/fontsize~FontSizeConfig#options plugin configuration}.\n\t\t\t *\n\t\t\t * @error font-size-invalid-definition\n\t\t\t */\n\t\t\tthrow new CKEditorError( 'font-size-invalid-definition', null, definition );\n\t\t} else {\n\t\t\tnumberValue = parseFloat( definition.model );\n\t\t}\n\t} else {\n\t\tnumberValue = parseFloat( definition );\n\t}\n\n\treturn isNaN( numberValue );\n}\n","/**\n * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module font/fontsize/fontsizeediting\n */\n\nimport { Plugin } from 'ckeditor5/src/core';\nimport { CKEditorError } from 'ckeditor5/src/utils';\nimport { isLength, isPercentage } from 'ckeditor5/src/engine';\n\nimport FontSizeCommand from './fontsizecommand';\nimport { normalizeOptions } from './utils';\nimport { buildDefinition, FONT_SIZE } from '../utils';\n\n// Mapping of `` styling to CSS's `font-size` values.\nconst styleFontSize = [\n\t'x-small', // Size \"0\" equal to \"1\".\n\t'x-small',\n\t'small',\n\t'medium',\n\t'large',\n\t'x-large',\n\t'xx-large',\n\t'xxx-large'\n];\n\n/**\n * The font size editing feature.\n *\n * It introduces the {@link module:font/fontsize/fontsizecommand~FontSizeCommand command} and the `fontSize`\n * attribute in the {@link module:engine/model/model~Model model} which renders in the {@link module:engine/view/view view}\n * as a `` element with either:\n * * a style attribute (`...`),\n * * or a class attribute (`...`)\n *\n * depending on the {@link module:font/fontsize~FontSizeConfig configuration}.\n *\n * @extends module:core/plugin~Plugin\n */\nexport default class FontSizeEditing extends Plugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'FontSizeEditing';\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tconstructor( editor ) {\n\t\tsuper( editor );\n\n\t\t// Define default configuration using named presets.\n\t\teditor.config.define( FONT_SIZE, {\n\t\t\toptions: [\n\t\t\t\t'tiny',\n\t\t\t\t'small',\n\t\t\t\t'default',\n\t\t\t\t'big',\n\t\t\t\t'huge'\n\t\t\t],\n\t\t\tsupportAllValues: false\n\t\t} );\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tinit() {\n\t\tconst editor = this.editor;\n\n\t\t// Allow fontSize attribute on text nodes.\n\t\teditor.model.schema.extend( '$text', { allowAttributes: FONT_SIZE } );\n\t\teditor.model.schema.setAttributeProperties( FONT_SIZE, {\n\t\t\tisFormatting: true,\n\t\t\tcopyOnEnter: true\n\t\t} );\n\n\t\tconst supportAllValues = editor.config.get( 'fontSize.supportAllValues' );\n\n\t\t// Define view to model conversion.\n\t\tconst options = normalizeOptions( this.editor.config.get( 'fontSize.options' ) )\n\t\t\t.filter( item => item.model );\n\t\tconst definition = buildDefinition( FONT_SIZE, options );\n\n\t\t// Set-up the two-way conversion.\n\t\tif ( supportAllValues ) {\n\t\t\tthis._prepareAnyValueConverters( definition );\n\t\t\tthis._prepareCompatibilityConverter();\n\t\t} else {\n\t\t\teditor.conversion.attributeToElement( definition );\n\t\t}\n\n\t\t// Add FontSize command.\n\t\teditor.commands.add( FONT_SIZE, new FontSizeCommand( editor ) );\n\t}\n\n\t/**\n\t * These converters enable keeping any value found as `style=\"font-size: *\"` as a value of an attribute on a text even\n\t * if it is not defined in the plugin configuration.\n\t *\n\t * @param {Object} definition {@link module:engine/conversion/conversion~ConverterDefinition Converter definition} out of input data.\n\t * @private\n\t */\n\t_prepareAnyValueConverters( definition ) {\n\t\tconst editor = this.editor;\n\n\t\t// If `fontSize.supportAllValues=true`, we do not allow to use named presets in the plugin's configuration.\n\t\tconst presets = definition.model.values.filter( value => {\n\t\t\treturn !isLength( String( value ) ) && !isPercentage( String( value ) );\n\t\t} );\n\n\t\tif ( presets.length ) {\n\t\t\t/**\n\t\t\t * If {@link module:font/fontsize~FontSizeConfig#supportAllValues `config.fontSize.supportAllValues`} is `true`,\n\t\t\t * you need to use numerical values as font size options.\n\t\t\t *\n\t\t\t * See valid examples described in the {@link module:font/fontsize~FontSizeConfig#options plugin configuration}.\n\t\t\t *\n\t\t\t * @error font-size-invalid-use-of-named-presets\n\t\t\t * @param {Array.} presets Invalid values.\n\t\t\t */\n\t\t\tthrow new CKEditorError(\n\t\t\t\t'font-size-invalid-use-of-named-presets',\n\t\t\t\tnull, { presets }\n\t\t\t);\n\t\t}\n\n\t\teditor.conversion.for( 'downcast' ).attributeToElement( {\n\t\t\tmodel: FONT_SIZE,\n\t\t\tview: ( attributeValue, { writer } ) => {\n\t\t\t\tif ( !attributeValue ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\treturn writer.createAttributeElement( 'span', { style: 'font-size:' + attributeValue }, { priority: 7 } );\n\t\t\t}\n\t\t} );\n\n\t\teditor.conversion.for( 'upcast' ).elementToAttribute( {\n\t\t\tmodel: {\n\t\t\t\tkey: FONT_SIZE,\n\t\t\t\tvalue: viewElement => viewElement.getStyle( 'font-size' )\n\t\t\t},\n\t\t\tview: {\n\t\t\t\tname: 'span',\n\t\t\t\tstyles: {\n\t\t\t\t\t'font-size': /.*/\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t}\n\n\t/**\n\t * Adds support for legacy `` formatting.\n\t *\n\t * @private\n\t */\n\t_prepareCompatibilityConverter() {\n\t\tconst editor = this.editor;\n\n\t\teditor.conversion.for( 'upcast' ).elementToAttribute( {\n\t\t\tview: {\n\t\t\t\tname: 'font',\n\t\t\t\tattributes: {\n\t\t\t\t\t// Documentation mentions sizes from 1 to 7. To handle old content we support all values\n\t\t\t\t\t// up to 999 but clamp it to the valid range. Why 999? It should cover accidental values\n\t\t\t\t\t// similar to percentage, e.g. 100%, 200% which could be the usual mistake for font size.\n\t\t\t\t\t'size': /^[+-]?\\d{1,3}$/\n\t\t\t\t}\n\t\t\t},\n\t\t\tmodel: {\n\t\t\t\tkey: FONT_SIZE,\n\t\t\t\tvalue: viewElement => {\n\t\t\t\t\tconst value = viewElement.getAttribute( 'size' );\n\t\t\t\t\tconst isRelative = value[ 0 ] === '-' || value[ 0 ] === '+';\n\n\t\t\t\t\tlet size = parseInt( value, 10 );\n\n\t\t\t\t\tif ( isRelative ) {\n\t\t\t\t\t\t// Add relative size (which can be negative) to the default size = 3.\n\t\t\t\t\t\tsize = 3 + size;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst maxSize = styleFontSize.length - 1;\n\t\t\t\t\tconst clampedSize = Math.min( Math.max( size, 0 ), maxSize );\n\n\t\t\t\t\treturn styleFontSize[ clampedSize ];\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t}\n}\n","/**\n * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module font/fontsize/fontsizeui\n */\n\nimport { Plugin } from 'ckeditor5/src/core';\nimport { Model, createDropdown, addListToDropdown } from 'ckeditor5/src/ui';\nimport { Collection } from 'ckeditor5/src/utils';\n\nimport { normalizeOptions } from './utils';\nimport { FONT_SIZE } from '../utils';\n\nimport fontSizeIcon from '../../theme/icons/font-size.svg';\nimport '../../theme/fontsize.css';\n\n/**\n * The font size UI plugin. It introduces the `'fontSize'` dropdown.\n *\n * @extends module:core/plugin~Plugin\n */\nexport default class FontSizeUI extends Plugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'FontSizeUI';\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tinit() {\n\t\tconst editor = this.editor;\n\t\tconst t = editor.t;\n\n\t\tconst options = this._getLocalizedOptions();\n\n\t\tconst command = editor.commands.get( FONT_SIZE );\n\n\t\t// Register UI component.\n\t\teditor.ui.componentFactory.add( FONT_SIZE, locale => {\n\t\t\tconst dropdownView = createDropdown( locale );\n\t\t\taddListToDropdown( dropdownView, _prepareListOptions( options, command ) );\n\n\t\t\t// Create dropdown model.\n\t\t\tdropdownView.buttonView.set( {\n\t\t\t\tlabel: t( 'Font Size' ),\n\t\t\t\ticon: fontSizeIcon,\n\t\t\t\ttooltip: true\n\t\t\t} );\n\n\t\t\tdropdownView.extendTemplate( {\n\t\t\t\tattributes: {\n\t\t\t\t\tclass: [\n\t\t\t\t\t\t'ck-font-size-dropdown'\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\tdropdownView.bind( 'isEnabled' ).to( command );\n\n\t\t\t// Execute command when an item from the dropdown is selected.\n\t\t\tthis.listenTo( dropdownView, 'execute', evt => {\n\t\t\t\teditor.execute( evt.source.commandName, { value: evt.source.commandParam } );\n\t\t\t\teditor.editing.view.focus();\n\t\t\t} );\n\n\t\t\treturn dropdownView;\n\t\t} );\n\t}\n\n\t/**\n\t * Returns options as defined in `config.fontSize.options` but processed to account for\n\t * editor localization, i.e. to display {@link module:font/fontsize~FontSizeOption}\n\t * in the correct language.\n\t *\n\t * Note: The reason behind this method is that there is no way to use {@link module:utils/locale~Locale#t}\n\t * when the user configuration is defined because the editor does not exist yet.\n\t *\n\t * @private\n\t * @returns {Array.}.\n\t */\n\t_getLocalizedOptions() {\n\t\tconst editor = this.editor;\n\t\tconst t = editor.t;\n\n\t\tconst localizedTitles = {\n\t\t\tDefault: t( 'Default' ),\n\t\t\tTiny: t( 'Tiny' ),\n\t\t\tSmall: t( 'Small' ),\n\t\t\tBig: t( 'Big' ),\n\t\t\tHuge: t( 'Huge' )\n\t\t};\n\n\t\tconst options = normalizeOptions( editor.config.get( FONT_SIZE ).options );\n\n\t\treturn options.map( option => {\n\t\t\tconst title = localizedTitles[ option.title ];\n\n\t\t\tif ( title && title != option.title ) {\n\t\t\t\t// Clone the option to avoid altering the original `namedPresets` from `./utils.js`.\n\t\t\t\toption = Object.assign( {}, option, { title } );\n\t\t\t}\n\n\t\t\treturn option;\n\t\t} );\n\t}\n}\n\n// Prepares FontSize dropdown items.\n// @private\n// @param {Array.} options\n// @param {module:font/fontsize/fontsizecommand~FontSizeCommand} command\nfunction _prepareListOptions( options, command ) {\n\tconst itemDefinitions = new Collection();\n\n\tfor ( const option of options ) {\n\t\tconst def = {\n\t\t\ttype: 'button',\n\t\t\tmodel: new Model( {\n\t\t\t\tcommandName: FONT_SIZE,\n\t\t\t\tcommandParam: option.model,\n\t\t\t\tlabel: option.title,\n\t\t\t\tclass: 'ck-fontsize-option',\n\t\t\t\twithText: true\n\t\t\t} )\n\t\t};\n\n\t\tif ( option.view && option.view.styles ) {\n\t\t\tdef.model.set( 'labelStyle', `font-size:${ option.view.styles[ 'font-size' ] }` );\n\t\t}\n\n\t\tif ( option.view && option.view.classes ) {\n\t\t\tdef.model.set( 'class', `${ def.model.class } ${ option.view.classes }` );\n\t\t}\n\n\t\tdef.model.bind( 'isOn' ).to( command, 'value', value => value === option.model );\n\n\t\t// Add the option to the collection.\n\t\titemDefinitions.add( def );\n\t}\n\n\treturn itemDefinitions;\n}\n","/**\n * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module font/fontsize\n */\n\nimport { Plugin } from 'ckeditor5/src/core';\nimport FontSizeEditing from './fontsize/fontsizeediting';\nimport FontSizeUI from './fontsize/fontsizeui';\n\n/**\n * The font size plugin.\n *\n * For a detailed overview, check the {@glink features/font font feature} documentation\n * and the {@glink api/font package page}.\n *\n * This is a \"glue\" plugin which loads the {@link module:font/fontsize/fontsizeediting~FontSizeEditing} and\n * {@link module:font/fontsize/fontsizeui~FontSizeUI} features in the editor.\n *\n * @extends module:core/plugin~Plugin\n */\nexport default class FontSize extends Plugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get requires() {\n\t\treturn [ FontSizeEditing, FontSizeUI ];\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'FontSize';\n\t}\n}\n\n/**\n * The font size option descriptor.\n *\n * @typedef {Object} module:font/fontsize~FontSizeOption\n *\n * @property {String} title The user-readable title of the option.\n * @property {String} model The attribute's unique value in the model.\n * @property {module:engine/view/elementdefinition~ElementDefinition} view View element configuration.\n * @property {Array.} [upcastAlso] An array with all matched elements that\n * the view-to-model conversion should also accept.\n */\n\n/**\n * The configuration of the font size feature.\n * It is introduced by the {@link module:font/fontsize/fontsizeediting~FontSizeEditing} feature.\n *\n * Read more in {@link module:font/fontsize~FontSizeConfig}.\n *\n * @member {module:font/fontsize~FontSizeConfig} module:core/editor/editorconfig~EditorConfig#fontSize\n */\n\n/**\n * The configuration of the font size feature.\n * This option is used by the {@link module:font/fontsize/fontsizeediting~FontSizeEditing} feature.\n *\n * \t\tClassicEditor\n * \t\t\t.create( {\n * \t\t\t\tfontSize: ... // Font size feature configuration.\n *\t\t\t} )\n * \t\t\t.then( ... )\n * \t\t\t.catch( ... );\n *\n * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.\n *\n * @interface module:font/fontsize~FontSizeConfig\n */\n\n/**\n * Available font size options. Expressed as predefined presets, numerical \"pixel\" values\n * or the {@link module:font/fontsize~FontSizeOption}.\n *\n * The default value is:\n *\n *\t\tconst fontSizeConfig = {\n *\t\t\toptions: [\n *\t\t\t\t'tiny',\n * \t\t\t\t'small',\n * \t\t\t\t'default',\n * \t\t\t\t'big',\n * \t\t\t\t'huge'\n *\t\t\t]\n *\t\t};\n *\n * It defines 4 sizes: **tiny**, **small**, **big**, and **huge**. These values will be rendered as `` elements in the view.\n * The **default** defines a text without the `fontSize` attribute.\n *\n * Each `` has the the `class` attribute set to the corresponding size name. For instance, this is what the **small** size looks\n * like in the view:\n *\n * \t\t...\n *\n * As an alternative, the font size might be defined using numerical values (either as a `Number` or as a `String`):\n *\n * \t\tconst fontSizeConfig = {\n * \t\t\toptions: [ 9, 10, 11, 12, 13, 14, 15 ]\n * \t\t};\n *\n * Also, you can define a label in the dropdown for numerical values:\n *\n *\t\tconst fontSizeConfig = {\n *\t\t\toptions: [\n *\t\t\t\t{\n * \t\t\t\t \ttitle: 'Small',\n * \t\t\t\t \tmodel: '8px\n * \t\t\t\t},\n * \t\t\t\t'default',\n * \t\t\t\t{\n * \t\t\t\t \ttitle: 'Big',\n * \t\t\t\t \tmodel: '14px\n * \t\t\t\t}\n *\t\t\t]\n *\t\t};\n *\n * Font size can be applied using the command API. To do that, use the `'fontSize'` command and pass the desired font size as a `value`.\n * For example, the following code will apply the `fontSize` attribute with the **tiny** value to the current selection:\n *\n *\t\teditor.execute( 'fontSize', { value: 'tiny' } );\n *\n * Executing the `fontSize` command without value will remove the `fontSize` attribute from the current selection.\n *\n * @member {Array.} module:font/fontsize~FontSizeConfig#options\n */\n\n/**\n * By default the plugin removes any `font-size` value that does not match the plugin's configuration. It means that if you paste content\n * with font sizes that the editor does not understand, the `font-size` attribute will be removed and the content will be displayed\n * with the default size.\n *\n * You can preserve pasted font size values by switching the `supportAllValues` option to `true`:\n *\n *\t\tconst fontSizeConfig = {\n *\t\t\toptions: [ 9, 10, 11, 12, 'default', 14, 15 ],\n *\t\t\tsupportAllValues: true\n *\t\t};\n *\n * **Note:** This option can only be used with numerical values as font size options.\n *\n * With this configuration font sizes not specified in the editor configuration will not be removed when pasting the content.\n *\n * @member {Boolean} module:font/fontsize~FontSizeConfig#supportAllValues\n */\n"],"sourceRoot":""}