Ver Fonte

Docs: Move FontSizeConfig options documentation to FontSize.

Maciej Gołaszewski há 8 anos atrás
pai
commit
8d0d365c98

+ 78 - 0
packages/ckeditor5-font/src/fontsize.js

@@ -34,3 +34,81 @@ export default class FontSize extends Plugin {
 		return 'FontSize';
 	}
 }
+
+/**
+ * Font size option descriptor. Compatible with {@link module:engine/conversion/definition-based-converters~ConverterDefinition}.
+ *
+ * @typedef {Object} module:font/fontsize~FontSizeOption
+ *
+ * @property {String} title The user-readable title of the option.
+ * @property {String} model Attribute's unique value in the model.
+ * @property {module:engine/view/viewelementdefinition~ViewElementDefinition} view View element configuration.
+ * @property {Array.<module:engine/view/viewelementdefinition~ViewElementDefinition>} [acceptsAlso] An array with all matched elements that
+ * view to model conversion should also accept.
+ */
+
+/**
+ * The configuration of the font size feature.
+ * Introduced by the {@link module:font/fontsize/fontsizeediting~FontSizeEditing} feature.
+ *
+ * Read more in {@link module:font/fontsize~FontSizeConfig}.
+ *
+ * @member {module:font/fontsize~FontSizeConfig} module:core/editor/editorconfig~EditorConfig#fontSize
+ */
+
+/**
+ * The configuration of the font size feature.
+ * The option is used by the {@link module:font/fontsize/fontsizeediting~FontSizeEditing} feature.
+ *
+ * 		ClassicEditor
+ * 			.create( {
+ * 				fontSize: ... // Font size feature config.
+ *			} )
+ * 			.then( ... )
+ * 			.catch( ... );
+ *
+ * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
+ *
+ * @interface module:font/fontsize~FontSizeConfig
+ */
+
+/**
+ * Available font size options. Defined either using predefined presets, numeric pixel values
+ * or {@link module:font/fontsize~FontSizeOption}.
+ *
+ * The default value is:
+ *
+ *		const fontSizeConfig = {
+ *			options: [
+ *				'tiny',
+ * 				'small',
+ * 				'normal',
+ * 				'big',
+ * 				'huge'
+ *			]
+ *		};
+ *
+ * It defines 4 sizes: "tiny", "small", "big" and "huge". Those values will be rendered as `span` elements in view. The "normal" defines
+ * text without a `fontSize` attribute set.
+ *
+ * Each rendered span in the view will have class attribute set corresponding to size name.
+ * For instance for "small" size the view will render:
+ *
+ * 		<span class="text-small">...</span>
+ *
+ * As an alternative the font size might be defined using numeric values (either as Number or as String):
+ *
+ * 		const fontSizeConfig = {
+ * 			options: [ 9, 10, 11, 12, 13, 14, 15 ]
+ * 		};
+ *
+ * To use defined font sizes from {@link module:core/commandcollection~CommandCollection} use `fontSize` command and pass desired
+ * font size as a value.
+ * For example, the below code will apply `fontSize` attribute with `tiny` value to the current selection:
+ *
+ *		editor.execute( 'fontSize', { value: 'tiny' } );
+ *
+ * Executing `fontSize` command without value will remove `fontSize` attribute from the current selection.
+ *
+ * @member {Array.<String|Number|module:font/fontsize~FontSizeOption>} module:font/fontsize~FontSizeConfig#options
+ */

+ 0 - 79
packages/ckeditor5-font/src/fontsize/fontsizeediting.js

@@ -68,82 +68,3 @@ export default class FontSizeEditing extends Plugin {
 		editor.model.schema.extend( '$text', { allowAttributes: 'fontSize' } );
 	}
 }
-
-/**
- * Font size option descriptor. Compatible with {@link module:engine/conversion/definition-based-converters~ConverterDefinition}.
- *
- * @typedef {Object} module:font/fontsize/fontsizeediting~FontSizeOption
- *
- * @property {String} title The user-readable title of the option.
- * @property {String} model Attribute's unique value in the model.
- * @property {module:engine/view/viewelementdefinition~ViewElementDefinition} view View element configuration.
- * @property {Array.<module:engine/view/viewelementdefinition~ViewElementDefinition>} [acceptsAlso] An array with all matched elements that
- * view to model conversion should also accept.
- */
-
-/**
- * The configuration of the font size feature.
- * Introduced by the {@link module:font/fontsize/fontsizeediting~FontSizeEditing} feature.
- *
- * Read more in {@link module:font/fontsize/fontsizeediting~FontSizeConfig}.
- *
- * @member {module:font/fontsize/fontsizeediting~FontSizeConfig} module:core/editor/editorconfig~EditorConfig#fontSize
- */
-
-/**
- * The configuration of the font size feature.
- * The option is used by the {@link module:font/fontsize/fontsizeediting~FontSizeEditing} feature.
- *
- * 		ClassicEditor
- * 			.create( {
- * 				fontSize: ... // Font size feature config.
- *			} )
- * 			.then( ... )
- * 			.catch( ... );
- *
- * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
- *
- * @interface module:font/fontsize/fontsizeediting~FontSizeConfig
- */
-
-/**
- * Available font size options. Defined either using predefined presets, numeric pixel values
- * or {@link module:font/fontsize/fontsizeediting~FontSizeOption}.
- *
- * The default value is:
- *
- *		const fontSizeConfig = {
- *			options: [
- *				'tiny',
- * 				'small',
- * 				'normal',
- * 				'big',
- * 				'huge'
- *			]
- *		};
- *
- * It defines 4 sizes: "tiny", "small", "big" and "huge". Those values will be rendered as `span` elements in view. The "normal" defines
- * text without a `fontSize` attribute set.
- *
- * Each rendered span in the view will have class attribute set corresponding to size name.
- * For instance for "small" size the view will render:
- *
- * 		<span class="text-small">...</span>
- *
- * As an alternative the font size might be defined using numeric values (either as Number or as String):
- *
- * 		const fontSizeConfig = {
- * 			options: [ 9, 10, 11, 12, 13, 14, 15 ]
- * 		};
- *
- * To use defined font sizes from {@link module:core/commandcollection~CommandCollection} use `fontSize` command and pass desired
- * font size as a value.
- * For example, the below code will apply `fontSize` attribute with `tiny` value to the current selection:
- *
- *		editor.execute( 'fontSize', { value: 'tiny' } );
- *
- * Executing `fontSize` command without value will remove `fontSize` attribute from the current selection.
- *
- * @member {Array.<String|Number|module:font/fontsize/fontsizeediting~FontSizeOption>}
- *  module:font/fontsize/fontsizeediting~FontSizeConfig#options
- */

+ 2 - 2
packages/ckeditor5-font/src/fontsize/fontsizeui.js

@@ -79,14 +79,14 @@ export default class FontSizeUI extends Plugin {
 
 	/**
 	 * Returns options as defined in `config.fontSize.options` but processed to consider
-	 * editor localization, i.e. to display {@link module:font/fontsize/fontsizeediting~FontSizeOption}
+	 * editor localization, i.e. to display {@link module:font/fontsize~FontSizeOption}
 	 * in the correct language.
 	 *
 	 * Note: The reason behind this method is that there's no way to use {@link module:utils/locale~Locale#t}
 	 * when the user config is defined because the editor does not exist yet.
 	 *
 	 * @private
-	 * @returns {Array.<module:font/fontsize/fontsizeediting~FontSizeOption>}.
+	 * @returns {Array.<module:font/fontsize~FontSizeOption>}.
 	 */
 	_getLocalizedOptions() {
 		const editor = this.editor;

+ 5 - 5
packages/ckeditor5-font/src/fontsize/utils.js

@@ -8,11 +8,11 @@
  */
 
 /**
- * Returns {@link module:font/fontsize/fontsizeediting~FontSizeConfig#options} array with options normalized in the
- * {@link module:font/fontsize/fontsizeediting~FontSizeOption} format, translated.
+ * Returns {@link module:font/fontsize~FontSizeConfig#options} array with options normalized in the
+ * {@link module:font/fontsize~FontSizeOption} format, translated.
  *
  * @param {Array.<String|Number|Object>} configuredOptions An array of options taken from configuration.
- * @returns {Array.<module:font/fontsize/fontsizeediting~FontSizeOption>}
+ * @returns {Array.<module:font/fontsize~FontSizeOption>}
  */
 export function normalizeOptions( configuredOptions ) {
 	// Convert options to objects.
@@ -62,7 +62,7 @@ const namedPresets = {
 // If object is passed then this method will return it without alternating it. Returns undefined for item than cannot be parsed.
 //
 // @param {String|Number|Object} item
-// @returns {undefined|module:font/fontsize/fontsizeediting~FontSizeOption}
+// @returns {undefined|module:font/fontsize~FontSizeOption}
 function getOptionDefinition( option ) {
 	// Treat any object as full item definition provided by user in configuration.
 	if ( typeof option === 'object' ) {
@@ -97,7 +97,7 @@ function getOptionDefinition( option ) {
 // Creates a predefined preset for pixel size.
 //
 // @param {Number} size Font size in pixels.
-// @returns {module:font/fontsize/fontsizeediting~FontSizeOption}
+// @returns {module:font/fontsize~FontSizeOption}
 function generatePixelPreset( size ) {
 	const sizeName = String( size );