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

Commit

Permalink
Merge d8723e1 into 47070b5
Browse files Browse the repository at this point in the history
  • Loading branch information
f1ames committed Jan 4, 2019
2 parents 47070b5 + d8723e1 commit b7391ff
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 21 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 module:engine/conversion/downcastdispatcher~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
*/
3 changes: 2 additions & 1 deletion src/conversion/downcasthelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ export default class DowncastHelpers extends ConversionHelpers {
*
* If a function is passed as the `config.view` parameter, it will be used to generate both boundary elements. The function
* receives the `data` object as a parameter and should return an instance of the
* {@link module:engine/view/uielement~UIElement view UI element}. The `data` and `conversionApi` objects are passed from
* {@link module:engine/view/uielement~UIElement view UI element}. The `data` object and
* {@link module:engine/conversion/downcastdispatcher~DowncastConversionApi `conversionApi`} are passed from
* {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:addMarker}. Additionally,
* the `data.isOpening` parameter is passed, which is set to `true` for the marker start boundary element, and `false` to
* the marker end boundary element.
Expand Down
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/conversion/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 module:engine/conversion/upcastdispatcher~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
*/
2 changes: 1 addition & 1 deletion src/conversion/upcasthelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ function onlyViewNameIsDefined( config ) {
//
// @param {module:engine/model/range~Range} modelRange Model range on which attribute should be set.
// @param {Object} modelAttribute Model attribute to set.
// @param {Object} conversionApi Conversion API.
// @param {module:engine/conversion/upcastdispatcher~UpcastConversionApi} conversionApi Conversion API.
// @param {Boolean} shallow If set to `true` the attribute will be set only on top-level nodes. Otherwise, it will be set
// on all elements in the range.
// @returns {Boolean} `true` if attribute was set on at least one node from given `modelRange`.
Expand Down

0 comments on commit b7391ff

Please sign in to comment.