8
0
Pārlūkot izejas kodu

Add missing documentation.

Mateusz Samsel 6 gadi atpakaļ
vecāks
revīzija
2a479a36a2

+ 7 - 0
packages/ckeditor5-link/src/linkcommand.js

@@ -29,6 +29,13 @@ export default class LinkCommand extends Command {
 	constructor( editor ) {
 		super( editor );
 
+		/**
+		 * Keeps collection of {@link module:link/utils/manualdecorator~ManualDecorator}
+		 * recognized in {@link module:link/link~LinkConfig#decorators}.
+		 *
+		 * @readonly
+		 * @type {module:utils/collection~Collection}
+		 */
 		this.customAttributes = new Collection();
 	}
 

+ 20 - 0
packages/ckeditor5-link/src/linkediting.js

@@ -88,6 +88,15 @@ export default class LinkEditing extends Plugin {
 		this._setupLinkHighlight();
 	}
 
+	/**
+	 * Method process {@link module:link/link~LinkDecoratorAutomaticOption} by creating instance of
+	 * {@link module:link/utils/automaticdecorators~AutomaticDecorators}. If there are available automatic decorators, then
+	 * there is registered {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher} to handle
+	 * those configurations.
+	 *
+	 * @private
+	 * @param {Array.<module:link/link~LinkDecoratorAutomaticOption>} automaticDecoratorDefinitions
+	 */
 	enableAutomaticDecorators( automaticDecoratorDefinitions ) {
 		const editor = this.editor;
 		const automaticDecorators = new AutomaticDecorators();
@@ -112,6 +121,17 @@ export default class LinkEditing extends Plugin {
 		}
 	}
 
+	/**
+	 * Method process {@link module:link/link~LinkDecoratorManualOption} by transformation those configuration options into
+	 * {@link module:link/utils/manualdecorator~ManualDecorator}. Manual decorators are added to
+	 * {@link module:link/linkcommand~LinkCommand#customAttributes} collections, which might be considered as a model
+	 * for manual decorators state. It also provides proper
+	 * {@link module:engine/conversion/downcasthelpers~DowncastHelpers#attributeToElement attributeToElement} converter for each
+	 * manual decorator and extends model schema with adequate attributes.
+	 *
+	 * @private
+	 * @param {Array.<module:link/link~LinkDecoratorManualOption>} manualDecoratorDefinitions
+	 */
 	enableManualDecorators( manualDecoratorDefinitions ) {
 		if ( !manualDecoratorDefinitions.length ) {
 			return;

+ 38 - 1
packages/ckeditor5-link/src/ui/linkformview.js

@@ -33,7 +33,13 @@ import '../../theme/linkform.css';
  */
 export default class LinkFormView extends View {
 	/**
-	 * @inheritDoc
+	 * Creates an instance of the {@link module:link/ui/linkformview~LinkFormView} class.
+	 *
+	 * Also see {@link #render}.
+	 *
+	 * @param {module:utils/locale~Locale} [locale] The localization services instance.
+	 * @param {module:utils/collection~Collection} [customAttributes] Reference to custom attributes in
+	 * {@link module:link/linkcommand~LinkCommand#customAttributes}.
 	 */
 	constructor( locale, customAttributes ) {
 		super( locale );
@@ -78,10 +84,29 @@ export default class LinkFormView extends View {
 		 */
 		this.cancelButtonView = this._createButton( t( 'Cancel' ), cancelIcon, 'ck-button-cancel', 'cancel' );
 
+		/**
+		 * Keeps reference to {@link module:link/linkcommand~LinkCommand#customAttributes}.
+		 *
+		 * @readonly
+		 * @type {model:utils/collection~Collection}
+		 */
 		this.customAttributes = customAttributes;
 
+		/**
+		 * Keeps reference to {@link module:ui/button/switchbuttonview~SwitchButtonView} made based on {@link #customAttributes}.
+		 * It use {@link #_createCustomAttributesView} to generate proper collection.
+		 *
+		 * @readonly
+		 * @type {module:ui/viewcollection~ViewCollection}
+		 */
 		this.customAttributesView = this._createCustomAttributesView();
 
+		/**
+		 * Collection of views used as children elements in {@link module:link/ui/linkformview~LinkFormView}.
+		 *
+		 * @readonly
+		 * @type {module:ui/viewcollection~ViewCollection}
+		 */
 		this.children = this._createFormChildren();
 
 		/**
@@ -216,6 +241,12 @@ export default class LinkFormView extends View {
 		return button;
 	}
 
+	/**
+	 * Prepare {@link module:ui/viewcollection~ViewCollection} of {@link module:ui/button/switchbuttonview~SwitchButtonView}
+	 * made based on {@link #customAttributes}
+	 *
+	 * @returns {module:ui/viewcollection~ViewCollection} of Switch Buttons.
+	 */
 	_createCustomAttributesView() {
 		const checkboxes = this.createCollection();
 
@@ -238,6 +269,12 @@ export default class LinkFormView extends View {
 		return checkboxes;
 	}
 
+	/**
+	 * Creates {@link #children} for {@link module:link/ui/linkformview~LinkFormView}. If there exist {@link #customAttributes},
+	 * Then additional View wrapping all {@link #customAttributesView} will be added as a child of LinkFormView.
+	 *
+	 * @returns {module:ui/viewcollection~ViewCollection} children of LinkFormView.
+	 */
 	_createFormChildren() {
 		const children = this.createCollection();