|
|
@@ -14,28 +14,16 @@ import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
|
|
|
* to the {@link module:font/fontsize~FontSizeOption} format.
|
|
|
*
|
|
|
* @param {Array.<String|Number|Object>} configuredOptions An array of options taken from the configuration.
|
|
|
- * @param {Object} [options={}]
|
|
|
- * @param {Boolean} [options.supportAllValues=false]
|
|
|
* @returns {Array.<module:font/fontsize~FontSizeOption>}
|
|
|
*/
|
|
|
-export function normalizeOptions( configuredOptions, options = {} ) {
|
|
|
- const supportAllValues = options.supportAllValues || false;
|
|
|
-
|
|
|
+export function normalizeOptions( configuredOptions ) {
|
|
|
// Convert options to objects.
|
|
|
return configuredOptions
|
|
|
- .map( item => getOptionDefinition( item, supportAllValues ) )
|
|
|
+ .map( item => getOptionDefinition( item ) )
|
|
|
// Filter out undefined values that `getOptionDefinition` might return.
|
|
|
.filter( option => !!option );
|
|
|
}
|
|
|
|
|
|
-// The values should be synchronized with values specified in the "/theme/fontsize.css" file.
|
|
|
-export const FONT_SIZE_PRESET_UNITS = {
|
|
|
- tiny: '0.7em',
|
|
|
- small: '0.85em',
|
|
|
- big: '1.4em',
|
|
|
- huge: '1.8em'
|
|
|
-};
|
|
|
-
|
|
|
// Default named presets map. Always create a new instance of the preset object in order to avoid modifying references.
|
|
|
const namedPresets = {
|
|
|
get tiny() {
|
|
|
@@ -86,12 +74,10 @@ const namedPresets = {
|
|
|
|
|
|
// Returns an option definition either from preset or creates one from number shortcut.
|
|
|
// If object is passed then this method will return it without alternating it. Returns undefined for item than cannot be parsed.
|
|
|
-// If supportAllValues=true, model will be set to a specified unit value instead of text.
|
|
|
//
|
|
|
// @param {String|Number|Object} item
|
|
|
-// @param {Boolean} supportAllValues
|
|
|
// @returns {undefined|module:font/fontsize~FontSizeOption}
|
|
|
-function getOptionDefinition( option, supportAllValues ) {
|
|
|
+function getOptionDefinition( option ) {
|
|
|
// Check whether passed option is a full item definition provided by user in configuration.
|
|
|
if ( isFullItemDefinition( option ) ) {
|
|
|
return attachPriority( option );
|
|
|
@@ -101,10 +87,6 @@ function getOptionDefinition( option, supportAllValues ) {
|
|
|
|
|
|
// Item is a named preset.
|
|
|
if ( preset ) {
|
|
|
- if ( supportAllValues ) {
|
|
|
- preset.model = FONT_SIZE_PRESET_UNITS[ option ];
|
|
|
- }
|
|
|
-
|
|
|
return attachPriority( preset );
|
|
|
}
|
|
|
|