Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Merge c62b302 into 47070b5
Browse files Browse the repository at this point in the history
  • Loading branch information
f1ames committed Jan 4, 2019
2 parents 47070b5 + c62b302 commit 9302480
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 19 deletions.
57 changes: 49 additions & 8 deletions src/conversion/downcastdispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,15 @@ export default class DowncastDispatcher {
/**
* Creates a `DowncastDispatcher` instance.
*
* @param {Object} [conversionApi] Interface passed by dispatcher to the events calls.
* @see module:engine/conversion/downcastdispatcher~DowncastConversionApi
* @param {Object} [conversionApi] Additional properties for interface that will be passed to events fired
* by `DowncastDispatcher`.
*/
constructor( conversionApi = {} ) {
/**
* Interface passed by dispatcher to the events callbacks.
*
* @member {Object}
* @member {module:engine/conversion/downcastdispatcher~DowncastConversionApi}
*/
this.conversionApi = extend( { dispatcher: this }, conversionApi );
}
Expand Down Expand Up @@ -487,7 +489,8 @@ export default class DowncastDispatcher {
* @param {Object} data Additional information about the change.
* @param {module:engine/model/item~Item} data.item Inserted item.
* @param {module:engine/model/range~Range} data.range Range spanning over inserted item.
* @param {Object} conversionApi Conversion interface to be used by callback, passed in `DowncastDispatcher` constructor.
* @param {module:engine/conversion/downcastdispatcher~DowncastConversionApi} conversionApi Conversion interface
* to be used by callback, passed in `DowncastDispatcher` constructor.
*/

/**
Expand All @@ -503,7 +506,8 @@ export default class DowncastDispatcher {
* @param {Object} data Additional information about the change.
* @param {module:engine/model/position~Position} data.position Position from which the node has been removed.
* @param {Number} data.length Offset size of the removed node.
* @param {Object} conversionApi Conversion interface to be used by callback, passed in `DowncastDispatcher` constructor.
* @param {module:engine/conversion/downcastdispatcher~DowncastConversionApi} conversionApi Conversion interface
* to be used by callback, passed in `DowncastDispatcher` constructor.
*/

/**
Expand All @@ -529,7 +533,8 @@ export default class DowncastDispatcher {
* @param {*} data.attributeOldValue Attribute value before the change. This is `null` when selection attribute is converted.
* @param {*} data.attributeNewValue New attribute value.
* @param {module:engine/conversion/modelconsumable~ModelConsumable} consumable Values to consume.
* @param {Object} conversionApi Conversion interface to be used by callback, passed in `DowncastDispatcher` constructor.
* @param {module:engine/conversion/downcastdispatcher~DowncastConversionApi} conversionApi Conversion interface
* to be used by callback, passed in `DowncastDispatcher` constructor.
*/

/**
Expand All @@ -538,7 +543,8 @@ export default class DowncastDispatcher {
* @event selection
* @param {module:engine/model/selection~Selection} selection Selection that is converted.
* @param {module:engine/conversion/modelconsumable~ModelConsumable} consumable Values to consume.
* @param {Object} conversionApi Conversion interface to be used by callback, passed in `DowncastDispatcher` constructor.
* @param {module:engine/conversion/downcastdispatcher~DowncastConversionApi} conversionApi Conversion interface
* to be used by callback, passed in `DowncastDispatcher` constructor.
*/

/**
Expand Down Expand Up @@ -573,7 +579,8 @@ export default class DowncastDispatcher {
* @param {module:engine/model/range~Range} data.markerRange Marker range.
* @param {String} data.markerName Marker name.
* @param {module:engine/conversion/modelconsumable~ModelConsumable} consumable Values to consume.
* @param {Object} conversionApi Conversion interface to be used by callback, passed in `DowncastDispatcher` constructor.
* @param {module:engine/conversion/downcastdispatcher~DowncastConversionApi} conversionApi Conversion interface
* to be used by callback, passed in `DowncastDispatcher` constructor.
*/

/**
Expand All @@ -588,7 +595,8 @@ export default class DowncastDispatcher {
* @param {Object} data Additional information about the change.
* @param {module:engine/model/range~Range} data.markerRange Marker range.
* @param {String} data.markerName Marker name.
* @param {Object} conversionApi Conversion interface to be used by callback, passed in `DowncastDispatcher` constructor.
* @param {module:engine/conversion/downcastdispatcher~DowncastConversionApi} conversionApi Conversion interface
* to be used by callback, passed in `DowncastDispatcher` constructor.
*/
}

Expand Down Expand Up @@ -617,3 +625,36 @@ function shouldMarkerChangeBeConverted( modelPosition, marker, mapper ) {

return !hasCustomHandling;
}

/**
* Conversion interface that is registered for given {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher}
* and is passed as one of parameters when {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher dispatcher}
* fires it's events.
*
* @interface DowncastConversionApi
*/

/**
* The {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher} instance.
*
* @member {module:engine/conversion/downcastdispatcher~DowncastDispatcher} #dispatcher
*/

/**
* Stores information about what parts of processed model item are still waiting to be handled. After a piece of model item
* was converted, appropriate consumable value should be {@link module:engine/conversion/modelconsumable~ModelConsumable#consume consumed}.
*
* @member {module:engine/conversion/modelconsumable~ModelConsumable} #consumable
*/

/**
* The {@link module:engine/conversion/mapper~Mapper} instance.
*
* @member {module:engine/conversion/mapper~Mapper} #mapper
*/

/**
* The {@link module:engine/view/downcastwriter~DowncastWriter} instance used to manipulate data during conversion.
*
* @member {module:engine/view/downcastwriter~DowncastWriter} #writer
*/
Empty file.
33 changes: 22 additions & 11 deletions src/conversion/upcastdispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export default class UpcastDispatcher {
/**
* Creates a `UpcastDispatcher` that operates using passed API.
*
* @see module:engine/conversion/upcastdispatcher~ViewConversionApi
* @see module:engine/conversion/upcastdispatcher~UpcastConversionApi
* @param {Object} [conversionApi] Additional properties for interface that will be passed to events fired
* by `UpcastDispatcher`.
*/
Expand Down Expand Up @@ -131,7 +131,7 @@ export default class UpcastDispatcher {
/**
* Interface passed by dispatcher to the events callbacks.
*
* @member {module:engine/conversion/upcastdispatcher~ViewConversionApi}
* @member {module:engine/conversion/upcastdispatcher~UpcastConversionApi}
*/
this.conversionApi = Object.assign( {}, conversionApi );

Expand Down Expand Up @@ -209,7 +209,7 @@ export default class UpcastDispatcher {

/**
* @private
* @see module:engine/conversion/upcastdispatcher~ViewConversionApi#convertItem
* @see module:engine/conversion/upcastdispatcher~UpcastConversionApi#convertItem
*/
_convertItem( viewItem, modelCursor ) {
const data = Object.assign( { viewItem, modelCursor, modelRange: null } );
Expand Down Expand Up @@ -239,7 +239,7 @@ export default class UpcastDispatcher {

/**
* @private
* @see module:engine/conversion/upcastdispatcher~ViewConversionApi#convertChildren
* @see module:engine/conversion/upcastdispatcher~UpcastConversionApi#convertChildren
*/
_convertChildren( viewItem, modelCursor ) {
const modelRange = new ModelRange( modelCursor );
Expand All @@ -259,7 +259,7 @@ export default class UpcastDispatcher {

/**
* @private
* @see module:engine/conversion/upcastdispatcher~ViewConversionApi#splitToAllowedParent
* @see module:engine/conversion/upcastdispatcher~UpcastConversionApi#splitToAllowedParent
*/
_splitToAllowedParent( node, modelCursor ) {
// Try to find allowed parent.
Expand Down Expand Up @@ -348,7 +348,7 @@ export default class UpcastDispatcher {
* Change this value for the next converter to tell where the conversion should continue.
* @param {module:engine/model/range~Range} data.modelRange The current state of conversion result. Every change to
* converted element should be reflected by setting or modifying this property.
* @param {ViewConversionApi} conversionApi Conversion utilities to be used by callback.
* @param {module:engine/model/upcastdispatcher~UpcastConversionApi} conversionApi Conversion utilities to be used by callback.
*/

/**
Expand Down Expand Up @@ -436,7 +436,7 @@ function createContextTree( contextDefinition, writer ) {
* and is passed as one of parameters when {@link module:engine/conversion/upcastdispatcher~UpcastDispatcher dispatcher}
* fires it's events.
*
* @interface ViewConversionApi
* @interface UpcastConversionApi
*/

/**
Expand Down Expand Up @@ -505,11 +505,10 @@ function createContextTree( contextDefinition, writer ) {
*/

/**
* Instance of {@link module:engine/conversion/viewconsumable~ViewConsumable}. It stores
* information about what parts of processed view item are still waiting to be handled. After a piece of view item
* Stores information about what parts of processed view item are still waiting to be handled. After a piece of view item
* was converted, appropriate consumable value should be {@link module:engine/conversion/viewconsumable~ViewConsumable#consume consumed}.
*
* @param {Object} #consumable
* @member {module:engine/conversion/viewconsumable~ViewConsumable} #consumable
*/

/**
Expand All @@ -520,5 +519,17 @@ function createContextTree( contextDefinition, writer ) {
* {@link module:engine/conversion/upcastdispatcher~UpcastDispatcher#event:element} is that `data` parameters allows you
* to pass parameters within a single event and `store` within the whole conversion.
*
* @param {Object} #store
* @member {Object} #store
*/

/**
* The model's schema instance.
*
* @member {module:engine/model/schema~Schema} #schema
*/

/**
* The {@link module:engine/model/writer~Writer} instance used to manipulate data during conversion.
*
* @member {module:engine/model/writer~Writer} #writer
*/

0 comments on commit 9302480

Please sign in to comment.