8
0
Pārlūkot izejas kodu

Docs: Move FontFamilyConfig options documentation to FontFamily.

Maciej Gołaszewski 8 gadi atpakaļ
vecāks
revīzija
5c868199ae

+ 76 - 0
packages/ckeditor5-font/src/fontfamily.js

@@ -34,3 +34,79 @@ export default class FontFamily extends Plugin {
 		return 'FontFamily';
 	}
 }
+
+/**
+ * Font family option descriptor. Compatible with {@link module:engine/conversion/definition-based-converters~ConverterDefinition}.
+ *
+ * @typedef {Object} module:font/fontfamily~FontFamilyOption
+ *
+ * @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 family feature.
+ * Introduced by the {@link module:font/fontfamily/fontfamilyediting~FontFamilyEditing} feature.
+ *
+ * Read more in {@link module:font/fontfamily~FontFamilyConfig}.
+ *
+ * @member {module:font/fontfamily~FontFamilyConfig} module:core/editor/editorconfig~EditorConfig#fontFamily
+ */
+
+/**
+ * The configuration of the font family feature.
+ * The option is used by the {@link module:font/fontfamily/fontfamilyediting~FontFamilyEditing} feature.
+ *
+ *		ClassicEditor
+ *			.create( {
+ * 				fontFamily: ... // Font family feature config.
+ *			} )
+ *			.then( ... )
+ *			.catch( ... );
+ *
+ * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
+ *
+ * @interface module:font/fontfamily~FontFamilyConfig
+ */
+
+/**
+ * Available font family options. Defined either as array of strings.
+ *
+ * The default value is
+ *
+ *		const fontFamilyConfig = {
+ *			options: [
+ *				'default',
+ *				'Arial, Helvetica, sans-serif',
+ *				'Courier New, Courier, monospace',
+ *				'Georgia, serif',
+ *				'Lucida Sans Unicode, Lucida Grande, sans-serif',
+ *				'Tahoma, Geneva, sans-serif',
+ *				'Times New Roman, Times, serif',
+ *				'Trebuchet MS, Helvetica, sans-serif',
+ *				'Verdana, Geneva, sans-serif'
+ *			]
+ *		};
+ *
+ * which configures 8 font family options. Each option consist one or more font-family names separated with coma. The first font name is
+ * used as dropdown item description in UI. The family names that consist spaces should not have quotes (as opposed to CSS standard).
+ * Appropriate quotes will be added in the view. For example, for the "Lucida Sans Unicode" the editor will render:
+ *
+ * 		<span style="font-family:'Lucida Sans Unicode', 'Lucida Grande', sans-serif">...</span>
+ *
+ * The "default" option is used to remove fontFamily from selection. In such case the text will
+ * be represented in view using default content CSS font-family.
+
+ * To use defined font families from {@link module:core/commandcollection~CommandCollection} use `fontFamily` command and pass desired
+ * font family as a value.
+ * For example, the below code will apply `fontFamily` attribute with `tiny` value to the current selection:
+ *
+ *		editor.execute( 'fontFamily', { value: 'tiny' } );
+ *
+ * Executing `fontFamily` command without value will remove `fontFamily` attribute from the current selection.
+ *
+ * @member {Array.<String|module:font/fontfamily~FontFamilyOption>} module:font/fontfamily~FontFamilyConfig#options
+ */

+ 0 - 77
packages/ckeditor5-font/src/fontfamily/fontfamilyediting.js

@@ -69,80 +69,3 @@ export default class FontFamilyEditing extends Plugin {
 		editor.commands.add( 'fontFamily', new FontFamilyCommand( editor ) );
 	}
 }
-
-/**
- * Font family option descriptor. Compatible with {@link module:engine/conversion/definition-based-converters~ConverterDefinition}.
- *
- * @typedef {Object} module:font/fontfamily/fontfamilyediting~FontFamilyOption
- *
- * @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 family feature.
- * Introduced by the {@link module:font/fontfamily/fontfamilyediting~FontFamilyEditing} feature.
- *
- * Read more in {@link module:font/fontfamily/fontfamilyediting~FontFamilyConfig}.
- *
- * @member {module:font/fontfamily/fontfamilyediting~FontFamilyConfig} module:core/editor/editorconfig~EditorConfig#fontFamily
- */
-
-/**
- * The configuration of the font family feature.
- * The option is used by the {@link module:font/fontfamily/fontfamilyediting~FontFamilyEditing} feature.
- *
- *		ClassicEditor
- *			.create( {
- * 				fontFamily: ... // Font family feature config.
- *			} )
- *			.then( ... )
- *			.catch( ... );
- *
- * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
- *
- * @interface module:font/fontfamily/fontfamilyediting~FontFamilyConfig
- */
-
-/**
- * Available font family options. Defined either as array of strings.
- *
- * The default value is
- *
- *		const fontFamilyConfig = {
- *			options: [
- *				'default',
- *				'Arial, Helvetica, sans-serif',
- *				'Courier New, Courier, monospace',
- *				'Georgia, serif',
- *				'Lucida Sans Unicode, Lucida Grande, sans-serif',
- *				'Tahoma, Geneva, sans-serif',
- *				'Times New Roman, Times, serif',
- *				'Trebuchet MS, Helvetica, sans-serif',
- *				'Verdana, Geneva, sans-serif'
- *			]
- *		};
- *
- * which configures 8 font family options. Each option consist one or more font-family names separated with coma. The first font name is
- * used as dropdown item description in UI. The family names that consist spaces should not have quotes (as opposed to CSS standard).
- * Appropriate quotes will be added in the view. For example, for the "Lucida Sans Unicode" the editor will render:
- *
- * 		<span style="font-family:'Lucida Sans Unicode', 'Lucida Grande', sans-serif">...</span>
- *
- * The "default" option is used to remove fontFamily from selection. In such case the text will
- * be represented in view using default content CSS font-family.
-
- * To use defined font families from {@link module:core/commandcollection~CommandCollection} use `fontFamily` command and pass desired
- * font family as a value.
- * For example, the below code will apply `fontFamily` attribute with `tiny` value to the current selection:
- *
- *		editor.execute( 'fontFamily', { value: 'tiny' } );
- *
- * Executing `fontFamily` command without value will remove `fontFamily` attribute from the current selection.
- *
- * @member {Array.<String|module:font/fontfamily/fontfamilyediting~FontFamilyOption>}
- *  module:font/fontfamily/fontfamilyediting~FontFamilyConfig#options
- */

+ 2 - 2
packages/ckeditor5-font/src/fontfamily/fontfamilyui.js

@@ -84,14 +84,14 @@ export default class FontFamilyUI extends Plugin {
 
 	/**
 	 * Returns options as defined in `config.fontFamily.options` but processed to consider
-	 * editor localization, i.e. to display {@link module:font/fontfamily/fontfamilyediting~FontFamilyOption}
+	 * editor localization, i.e. to display {@link module:font/fontfamily~FontFamilyOption}
 	 * 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/fontfamily/fontfamilyediting~FontFamilyOption>}.
+	 * @returns {Array.<module:font/fontfamily~FontFamilyOption>}.
 	 */
 	_getLocalizedOptions() {
 		const editor = this.editor;

+ 4 - 4
packages/ckeditor5-font/src/fontfamily/utils.js

@@ -8,11 +8,11 @@
  */
 
 /**
- * Returns {@link module:font/fontfamily/fontfamilyediting~FontFamilyConfig#options} array with options normalized in the
- * {@link module:font/fontfamily/fontfamilyediting~FontFamilyOption} format.
+ * Returns {@link module:font/fontfamily~FontFamilyConfig#options} array with options normalized in the
+ * {@link module:font/fontfamily~FontFamilyOption} format.
  *
  * @param {Array.<String|Object>} configuredOptions An array of options taken from configuration.
- * @returns {Array.<module:font/fontfamily/fontfamilyediting~FontFamilyOption>}
+ * @returns {Array.<module:font/fontfamily~FontFamilyOption>}
  */
 export function normalizeOptions( configuredOptions ) {
 	// Convert options to objects.
@@ -26,7 +26,7 @@ export function normalizeOptions( configuredOptions ) {
 // If object is passed then this method will return it without alternating it. Returns undefined for item than cannot be parsed.
 //
 // @param {String|Object} option
-// @returns {undefined|module:font/fontfamily/fontfamilyediting~FontFamilyOption}
+// @returns {undefined|module:font/fontfamily~FontFamilyOption}
 function getOptionDefinition( option ) {
 	// Treat any object as full item definition provided by user in configuration.
 	if ( typeof option === 'object' ) {