8
0
Просмотр исходного кода

Update links in conversion helpers documentation.

Maciej Gołaszewski 7 лет назад
Родитель
Сommit
c7263061f0

+ 7 - 6
packages/ckeditor5-engine/src/conversion/conversion.js

@@ -104,9 +104,9 @@ export default class Conversion {
 	 * {@link module:engine/conversion/conversion~ConversionHelpers conversion helpers} returned by this function.
 	 *
 	 *		editor.conversion.for( 'downcast' )
-	 *			.add( conversionHelperA )
-	 *			.add( conversionHelperB )
-	 *			.elementToElement( config );
+	 *			.add( conversionHelperA ) // Adds a custom converter A.
+	 *			.add( conversionHelperB ) // Adds a custom converter B.
+	 *			.elementToElement( config ); // Adds a custom element-to-element downcast converter.
 	 *
 	 * In this example `conversionHelperA` and `conversionHelperB` will be called for all dispatchers from the `'model'` group.
 	 *
@@ -129,6 +129,7 @@ export default class Conversion {
 	 * * {@link module:engine/conversion/upcast-converters~UpcastHelpers#elementToElement Upcast element-to-element converter},
 	 * * {@link module:engine/conversion/upcast-converters~UpcastHelpers#elementToAttribute Upcast attribute-to-element converter},
 	 * * {@link module:engine/conversion/upcast-converters~UpcastHelpers#attributeToAttribute Upcast attribute-to-attribute converter}.
+	 * * {@link module:engine/conversion/upcast-converters~UpcastHelpers#elementToMarker Upcast element-to-marker converter}.
 	 *
 	 * An example of using conversion helpers to convert the `paragraph` model element to the `p` view element (and back):
 	 *
@@ -142,7 +143,6 @@ export default class Conversion {
 	 * @param {String} groupName The name of dispatchers group to add the converters to.
 	 * @returns {module:engine/conversion/conversion~ConversionHelpers|module:engine/conversion/downcast-converters~DowncastHelpers|
 	 * module:engine/conversion/upcast-converters~UpcastHelpers}
-	 * An object with the `.add()` method, providing a way to add converters.
 	 */
 	/* eslint-enable max-len */
 	for( groupName ) {
@@ -593,7 +593,7 @@ export default class Conversion {
 /**
  * Base class for conversion utilises.
  *
- * @interface ConversionHelpers
+ * @interface module:engine/conversion/conversion~ConversionHelpers
  */
 
 /**
@@ -603,7 +603,8 @@ export default class Conversion {
  *
  * @method module:engine/conversion/conversion~ConversionHelpers#add
  * @param {Function} conversionHelper The function to be called on event.
- * @returns {module:engine/conversion/conversion~Conversion}
+ * @returns {module:engine/conversion/conversion~ConversionHelpers|module:engine/conversion/downcast-converters~DowncastHelpers|
+ * module:engine/conversion/upcast-converters~UpcastHelpers}
  */
 
 // Helper function for the `Conversion` `.add()` method.

+ 5 - 4
packages/ckeditor5-engine/src/conversion/downcast-converters.js

@@ -1003,6 +1003,7 @@ export const helpers = {
 	 * @param {module:engine/view/elementdefinition~ElementDefinition|Function} config.view A view element definition or a function
 	 * that takes the model element and {@link module:engine/view/downcastwriter~DowncastWriter view downcast writer}
 	 * as parameters and returns a view container element.
+	 * @returns {module:engine/conversion/downcast-converters~DowncastHelpers}
 	 */
 	elementToElement( config ) {
 		return this.add( _downcastElementToElement( config ) );
@@ -1011,7 +1012,6 @@ export const helpers = {
 	/**
 	 * Model attribute to view element conversion helper.
 	 *
-	 *
 	 * This conversion results in wrapping view nodes with a view attribute element. For example, a model text node with
 	 * `"Foo"` as data and the `bold` attribute becomes `<strong>Foo</strong>` in the view.
 	 *
@@ -1088,6 +1088,7 @@ export const helpers = {
 	 * as parameters and returns a view attribute element. If `config.model.values` is
 	 * given, `config.view` should be an object assigning values from `config.model.values` to view element definitions or functions.
 	 * @param {module:utils/priorities~PriorityString} [config.converterPriority='normal'] Converter priority.
+	 * @returns {module:engine/conversion/downcast-converters~DowncastHelpers}
 	 */
 	attributeToElement( config ) {
 		return this.add( _downcastAttributeToElement( config ) );
@@ -1153,7 +1154,7 @@ export const helpers = {
 	 * If `config.model.values` is set, `config.view` should be an object assigning values from `config.model.values` to
 	 * `{ key, value }` objects or a functions.
 	 * @param {module:utils/priorities~PriorityString} [config.converterPriority='normal'] Converter priority.
-	 * @returns {Function} Conversion helper.
+	 * @returns {module:engine/conversion/downcast-converters~DowncastHelpers}
 	 */
 	attributeToAttribute( config ) {
 		return this.add( _downcastAttributeToAttribute( config ) );
@@ -1215,7 +1216,7 @@ export const helpers = {
 	 * @param {module:engine/view/elementdefinition~ElementDefinition|Function} config.view A view element definition or a function
 	 * that takes the model marker data as a parameter and returns a view UI element.
 	 * @param {module:utils/priorities~PriorityString} [config.converterPriority='normal'] Converter priority.
-	 * @returns {Function} Conversion helper.
+	 * @returns {module:engine/conversion/downcast-converters~DowncastHelpers}
 	 */
 	markerToElement( config ) {
 		return this.add( _downcastMarkerToElement( config ) );
@@ -1274,7 +1275,7 @@ export const helpers = {
 	 * @param {module:engine/conversion/downcast-converters~HighlightDescriptor|Function} config.view A highlight descriptor
 	 * that will be used for highlighting or a function that takes the model marker data as a parameter and returns a highlight descriptor.
 	 * @param {module:utils/priorities~PriorityString} [config.converterPriority='normal'] Converter priority.
-	 * @returns {Function} Conversion helper.
+	 * @returns {module:engine/conversion/downcast-converters~DowncastHelpers}
 	 */
 	markerToHighlight( config ) {
 		return this.add( _downcastMarkerToHighlight( config ) );

+ 4 - 4
packages/ckeditor5-engine/src/conversion/upcast-converters.js

@@ -516,7 +516,7 @@ export const helpers = {
 	 * @param {String|module:engine/model/element~Element|Function} config.model Name of the model element, a model element
 	 * instance or a function that takes a view element and returns a model element. The model element will be inserted in the model.
 	 * @param {module:utils/priorities~PriorityString} [config.converterPriority='normal'] Converter priority.
-	 * @returns {Function} Conversion helper.
+	 * @returns {module:engine/conversion/upcast-converters~UpcastHelpers}
 	 */
 	elementToElement( config ) {
 		return this.add( _upcastElementToElement( config ) );
@@ -602,7 +602,7 @@ export const helpers = {
 	 * the model attribute. `value` property may be set as a function that takes a view element and returns the value.
 	 * If `String` is given, the model attribute value will be set to `true`.
 	 * @param {module:utils/priorities~PriorityString} [config.converterPriority='normal'] Converter priority.
-	 * @returns {module:engine/conversion/conversion~Conversion} Conversion helper.
+	 * @returns {module:engine/conversion/upcast-converters~UpcastHelpers}
 	 */
 	elementToAttribute( config ) {
 		return this.add( _upcastElementToAttribute( config ) );
@@ -696,7 +696,7 @@ export const helpers = {
 	 * the model attribute. `value` property may be set as a function that takes a view element and returns the value.
 	 * If `String` is given, the model attribute value will be same as view attribute value.
 	 * @param {module:utils/priorities~PriorityString} [config.converterPriority='low'] Converter priority.
-	 * @returns {Function} Conversion helper.
+	 * @returns {module:engine/conversion/upcast-converters~UpcastHelpers}
 	 */
 	attributeToAttribute( config ) {
 		return this.add( _upcastAttributeToAttribute( config ) );
@@ -745,7 +745,7 @@ export const helpers = {
 	 * @param {String|Function} config.model Name of the model marker, or a function that takes a view element and returns
 	 * a model marker name.
 	 * @param {module:utils/priorities~PriorityString} [config.converterPriority='normal'] Converter priority.
-	 * @returns {Function} Conversion helper.
+	 * @returns {module:engine/conversion/upcast-converters~UpcastHelpers}
 	 */
 	elementToMarker( config ) {
 		return this.add( _upcastElementToMarker( config ) );