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

Commit

Permalink
Merge branch 'master' into t/898
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinmar committed May 23, 2018
2 parents e9b4c50 + 868d79b commit 65e899f
Show file tree
Hide file tree
Showing 11 changed files with 705 additions and 375 deletions.
210 changes: 105 additions & 105 deletions src/conversion/conversion.js

Large diffs are not rendered by default.

330 changes: 170 additions & 160 deletions src/conversion/downcast-converters.js

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions src/conversion/downcast-selection-converters.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
/**
* Contains {@link module:engine/model/selection~Selection model selection} to
* {@link module:engine/view/documentselection~DocumentSelection view selection} converters for
* {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher}.
* {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher downcast dispatcher}.
*
* @module engine/conversion/downcast-selection-converters
*/

/**
* Function factory, creates a converter that converts non-collapsed {@link module:engine/model/selection~Selection model selection} to
* {@link module:engine/view/documentselection~DocumentSelection view selection}. The converter consumes appropriate
* value from `consumable` object and maps model positions from selection to view positions.
* Function factory that creates a converter which converts a non-collapsed {@link module:engine/model/selection~Selection model selection}
* to a {@link module:engine/view/documentselection~DocumentSelection view selection}. The converter consumes appropriate
* value from the `consumable` object and maps model positions from the selection to view positions.
*
* modelDispatcher.on( 'selection', convertRangeSelection() );
*
Expand Down Expand Up @@ -44,21 +44,21 @@ export function convertRangeSelection() {
}

/**
* Function factory, creates a converter that converts collapsed {@link module:engine/model/selection~Selection model selection} to
* {@link module:engine/view/documentselection~DocumentSelection view selection}. The converter consumes appropriate
* value from `consumable` object, maps model selection position to view position and breaks
* Function factory that creates a converter which converts a collapsed {@link module:engine/model/selection~Selection model selection} to
* a {@link module:engine/view/documentselection~DocumentSelection view selection}. The converter consumes appropriate
* value from the `consumable` object, maps the model selection position to the view position and breaks
* {@link module:engine/view/attributeelement~AttributeElement attribute elements} at the selection position.
*
* modelDispatcher.on( 'selection', convertCollapsedSelection() );
*
* Example of view state before and after converting collapsed selection:
* An example of the view state before and after converting the collapsed selection:
*
* <p><strong>f^oo<strong>bar</p>
* -> <p><strong>f</strong>^<strong>oo</strong>bar</p>
*
* By breaking attribute elements like `<strong>`, selection is in correct element. Then, when selection attribute is
* converted, the broken attributes might be merged again, or the position where the selection is may be wrapped
* in different, appropriate attribute elements.
* By breaking attribute elements like `<strong>`, the selection is in a correct element. Then, when the selection attribute is
* converted, broken attributes might be merged again, or the position where the selection is may be wrapped
* with different, appropriate attribute elements.
*
* See also {@link module:engine/conversion/downcast-selection-converters~clearAttributes} which does a clean-up
* by merging attributes.
Expand Down Expand Up @@ -87,9 +87,9 @@ export function convertCollapsedSelection() {
}

/**
* Function factory, creates a converter that clears artifacts after the previous
* Function factory that creates a converter which clears artifacts after the previous
* {@link module:engine/model/selection~Selection model selection} conversion. It removes all empty
* {@link module:engine/view/attributeelement~AttributeElement view attribute elements} and merge sibling attributes at all start and end
* {@link module:engine/view/attributeelement~AttributeElement view attribute elements} and merges sibling attributes at all start and end
* positions of all ranges.
*
* <p><strong>^</strong></p>
Expand All @@ -106,7 +106,7 @@ export function convertCollapsedSelection() {
* modelDispatcher.on( 'selection', clearAttributes() );
*
* See {@link module:engine/conversion/downcast-selection-converters~convertCollapsedSelection}
* which do the opposite by breaking attributes in the selection position.
* which does the opposite by breaking attributes in the selection position.
*
* @returns {Function} Selection converter.
*/
Expand Down
22 changes: 11 additions & 11 deletions src/conversion/upcast-converters.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import cloneDeep from '@ckeditor/ckeditor5-utils/src/lib/lodash/cloneDeep';
*
* upcastElementToElement( { view: 'p', model: 'paragraph' } );
*
* upcastElementToElement( { view: 'p', model: 'paragraph', priority: 'high' } );
* upcastElementToElement( { view: 'p', model: 'paragraph', converterPriority: 'high' } );
*
* upcastElementToElement( {
* view: {
Expand All @@ -52,7 +52,7 @@ import cloneDeep from '@ckeditor/ckeditor5-utils/src/lib/lodash/cloneDeep';
* @param {module:engine/view/matcher~MatcherPattern} config.view Pattern matching all view elements which should be converted.
* @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.priority='normal'] Converter priority.
* @param {module:utils/priorities~PriorityString} [config.converterPriority='normal'] Converter priority.
* @returns {Function} Conversion helper.
*/
export function upcastElementToElement( config ) {
Expand All @@ -64,7 +64,7 @@ export function upcastElementToElement( config ) {
const eventName = elementName ? 'element:' + elementName : 'element';

return dispatcher => {
dispatcher.on( eventName, converter, { priority: config.priority || 'normal' } );
dispatcher.on( eventName, converter, { priority: config.converterPriority || 'normal' } );
};
}

Expand All @@ -78,7 +78,7 @@ export function upcastElementToElement( config ) {
*
* upcastElementToAttribute( { view: 'strong', model: 'bold' } );
*
* upcastElementToAttribute( { view: 'strong', model: 'bold', priority: 'high' } );
* upcastElementToAttribute( { view: 'strong', model: 'bold', converterPriority: 'high' } );
*
* upcastElementToAttribute( {
* view: {
Expand Down Expand Up @@ -130,7 +130,7 @@ export function upcastElementToElement( config ) {
* @param {String|Object} config.model Model attribute key or an object with `key` and `value` properties, describing
* 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.priority='normal'] Converter priority.
* @param {module:utils/priorities~PriorityString} [config.converterPriority='normal'] Converter priority.
* @returns {Function} Conversion helper.
*/
export function upcastElementToAttribute( config ) {
Expand All @@ -144,7 +144,7 @@ export function upcastElementToAttribute( config ) {
const eventName = elementName ? 'element:' + elementName : 'element';

return dispatcher => {
dispatcher.on( eventName, converter, { priority: config.priority || 'normal' } );
dispatcher.on( eventName, converter, { priority: config.converterPriority || 'normal' } );
};
}

Expand All @@ -160,7 +160,7 @@ export function upcastElementToAttribute( config ) {
*
* upcastAttributeToAttribute( { view: { key: 'src' }, model: 'source' } );
*
* upcastAttributeToAttribute( { view: { key: 'src' }, model: 'source', priority: 'normal' } );
* upcastAttributeToAttribute( { view: { key: 'src' }, model: 'source', converterPriority: 'normal' } );
*
* upcastAttributeToAttribute( {
* view: {
Expand Down Expand Up @@ -209,7 +209,7 @@ export function upcastElementToAttribute( config ) {
* @param {String|Object} config.model Model attribute key or an object with `key` and `value` properties, describing
* 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.priority='low'] Converter priority.
* @param {module:utils/priorities~PriorityString} [config.converterPriority='low'] Converter priority.
* @returns {Function} Conversion helper.
*/
export function upcastAttributeToAttribute( config ) {
Expand All @@ -226,7 +226,7 @@ export function upcastAttributeToAttribute( config ) {
const converter = _prepareToAttributeConverter( config );

return dispatcher => {
dispatcher.on( 'element', converter, { priority: config.priority || 'low' } );
dispatcher.on( 'element', converter, { priority: config.converterPriority || 'low' } );
};
}

Expand All @@ -240,7 +240,7 @@ export function upcastAttributeToAttribute( config ) {
*
* upcastElementToMarker( { view: 'marker-search', model: 'search' } );
*
* upcastElementToMarker( { view: 'marker-search', model: 'search', priority: 'high' } );
* upcastElementToMarker( { view: 'marker-search', model: 'search', converterPriority: 'high' } );
*
* upcastElementToMarker( {
* view: 'marker-search',
Expand All @@ -263,7 +263,7 @@ export function upcastAttributeToAttribute( config ) {
* @param {module:engine/view/matcher~MatcherPattern} config.view Pattern matching all view elements which should be converted.
* @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.priority='normal'] Converter priority.
* @param {module:utils/priorities~PriorityString} [config.converterPriority='normal'] Converter priority.
* @returns {Function} Conversion helper.
*/
export function upcastElementToMarker( config ) {
Expand Down
Loading

0 comments on commit 65e899f

Please sign in to comment.