@@ -26,7 +26,7 @@ import cloneDeep from '@ckeditor/ckeditor5-utils/src/lib/lodash/cloneDeep';
2626 *
2727 * downcastElementToElement( { model: 'paragraph', view: 'p' } );
2828 *
29- * downcastElementToElement( { model: 'paragraph', view: 'div', priority : 'high' } );
29+ * downcastElementToElement( { model: 'paragraph', view: 'div', converterPriority : 'high' } );
3030 *
3131 * downcastElementToElement( {
3232 * model: 'fancyParagraph',
@@ -55,7 +55,7 @@ export function downcastElementToElement( config ) {
5555 config . view = _normalizeToElementConfig ( config . view , 'container' ) ;
5656
5757 return dispatcher => {
58- dispatcher . on ( 'insert:' + config . model , insertElement ( config . view ) , { priority : config . priority || 'normal' } ) ;
58+ dispatcher . on ( 'insert:' + config . model , insertElement ( config . view ) , { priority : config . converterPriority || 'normal' } ) ;
5959 } ;
6060}
6161
@@ -67,7 +67,7 @@ export function downcastElementToElement( config ) {
6767 *
6868 * downcastAttributeToElement( { model: 'bold', view: 'strong' } );
6969 *
70- * downcastAttributeToElement( { model: 'bold', view: 'b', priority : 'high' } );
70+ * downcastAttributeToElement( { model: 'bold', view: 'b', converterPriority : 'high' } );
7171 *
7272 * downcastAttributeToElement( {
7373 * model: 'invert',
@@ -123,7 +123,7 @@ export function downcastElementToElement( config ) {
123123 * @param {module:engine/view/elementdefinition~ElementDefinition|Function|Object } config.view View element definition or a function
124124 * that takes model attribute value and view writer as parameters and returns a view attribute element. If `config.model.values` is
125125 * given, `config.view` should be an object assigning values from `config.model.values` to view element definitions or functions.
126- * @param {module:utils/priorities~PriorityString } [config.priority ='normal'] Converter priority.
126+ * @param {module:utils/priorities~PriorityString } [config.converterPriority ='normal'] Converter priority.
127127 * @returns {Function } Conversion helper.
128128 */
129129export function downcastAttributeToElement ( config ) {
@@ -147,7 +147,7 @@ export function downcastAttributeToElement( config ) {
147147 const elementCreator = _getFromAttributeCreator ( config ) ;
148148
149149 return dispatcher => {
150- dispatcher . on ( eventName , wrap ( elementCreator ) , { priority : config . priority || 'normal' } ) ;
150+ dispatcher . on ( eventName , wrap ( elementCreator ) , { priority : config . converterPriority || 'normal' } ) ;
151151 } ;
152152}
153153
@@ -159,7 +159,7 @@ export function downcastAttributeToElement( config ) {
159159 *
160160 * downcastAttributeToAttribute( { model: 'source', view: 'src' } );
161161 *
162- * downcastAttributeToAttribute( { model: 'source', view: 'href', priority : 'high' } );
162+ * downcastAttributeToAttribute( { model: 'source', view: 'href', converterPriority : 'high' } );
163163 *
164164 * downcastAttributeToAttribute( {
165165 * model: {
@@ -201,7 +201,7 @@ export function downcastAttributeToElement( config ) {
201201 * array of `String`s. If `key` is `'style'`, `value` is an object with key-value pairs. In other cases, `value` is a `String`.
202202 * If `config.model.values` is set, `config.view` should be an object assigning values from `config.model.values` to
203203 * `{ key, value }` objects or a functions.
204- * @param {module:utils/priorities~PriorityString } [config.priority ='normal'] Converter priority.
204+ * @param {module:utils/priorities~PriorityString } [config.converterPriority ='normal'] Converter priority.
205205 * @returns {Function } Conversion helper.
206206 */
207207export function downcastAttributeToAttribute ( config ) {
@@ -225,7 +225,7 @@ export function downcastAttributeToAttribute( config ) {
225225 const elementCreator = _getFromAttributeCreator ( config ) ;
226226
227227 return dispatcher => {
228- dispatcher . on ( eventName , changeAttribute ( elementCreator ) , { priority : config . priority || 'normal' } ) ;
228+ dispatcher . on ( eventName , changeAttribute ( elementCreator ) , { priority : config . converterPriority || 'normal' } ) ;
229229 } ;
230230}
231231
@@ -238,7 +238,7 @@ export function downcastAttributeToAttribute( config ) {
238238 *
239239 * downcastMarkerToElement( { model: 'search', view: 'marker-search' } );
240240 *
241- * downcastMarkerToElement( { model: 'search', view: 'search-result', priority : 'high' } );
241+ * downcastMarkerToElement( { model: 'search', view: 'search-result', converterPriority : 'high' } );
242242 *
243243 * downcastMarkerToElement( {
244244 * model: 'search',
@@ -272,7 +272,7 @@ export function downcastAttributeToAttribute( config ) {
272272 * @param {String } config.model Name of the model marker (or model marker group) to convert.
273273 * @param {module:engine/view/elementdefinition~ElementDefinition|Function } config.view View element definition or a function
274274 * that takes model marker data as a parameter and returns view ui element.
275- * @param {module:utils/priorities~PriorityString } [config.priority ='normal'] Converter priority.
275+ * @param {module:utils/priorities~PriorityString } [config.converterPriority ='normal'] Converter priority.
276276 * @returns {Function } Conversion helper.
277277 */
278278export function downcastMarkerToElement ( config ) {
@@ -281,8 +281,8 @@ export function downcastMarkerToElement( config ) {
281281 config . view = _normalizeToElementConfig ( config . view , 'ui' ) ;
282282
283283 return dispatcher => {
284- dispatcher . on ( 'addMarker:' + config . model , insertUIElement ( config . view ) , { priority : config . priority || 'normal' } ) ;
285- dispatcher . on ( 'removeMarker:' + config . model , removeUIElement ( config . view ) , { priority : config . priority || 'normal' } ) ;
284+ dispatcher . on ( 'addMarker:' + config . model , insertUIElement ( config . view ) , { priority : config . converterPriority || 'normal' } ) ;
285+ dispatcher . on ( 'removeMarker:' + config . model , removeUIElement ( config . view ) , { priority : config . converterPriority || 'normal' } ) ;
286286 } ;
287287}
288288
@@ -307,7 +307,7 @@ export function downcastMarkerToElement( config ) {
307307 *
308308 * downcastMarkerToHighlight( { model: 'comment', view: { classes: 'comment' } } );
309309 *
310- * downcastMarkerToHighlight( { model: 'comment', view: { classes: 'new-comment' }, priority : 'high' } );
310+ * downcastMarkerToHighlight( { model: 'comment', view: { classes: 'new-comment' }, converterPriority : 'high' } );
311311 *
312312 * downcastMarkerToHighlight( {
313313 * model: 'comment',
@@ -331,14 +331,14 @@ export function downcastMarkerToElement( config ) {
331331 * @param {String } config.model Name of the model marker (or model marker group) to convert.
332332 * @param {module:engine/conversion/downcast-converters~HighlightDescriptor|Function } config.view Highlight descriptor
333333 * which will be used for highlighting or a function that takes model marker data as a parameter and returns a highlight descriptor.
334- * @param {module:utils/priorities~PriorityString } [config.priority ='normal'] Converter priority.
334+ * @param {module:utils/priorities~PriorityString } [config.converterPriority ='normal'] Converter priority.
335335 * @returns {Function } Conversion helper.
336336 */
337337export function downcastMarkerToHighlight ( config ) {
338338 return dispatcher => {
339- dispatcher . on ( 'addMarker:' + config . model , highlightText ( config . view ) , { priority : config . priority || 'normal' } ) ;
340- dispatcher . on ( 'addMarker:' + config . model , highlightElement ( config . view ) , { priority : config . priority || 'normal' } ) ;
341- dispatcher . on ( 'removeMarker:' + config . model , removeHighlight ( config . view ) , { priority : config . priority || 'normal' } ) ;
339+ dispatcher . on ( 'addMarker:' + config . model , highlightText ( config . view ) , { priority : config . converterPriority || 'normal' } ) ;
340+ dispatcher . on ( 'addMarker:' + config . model , highlightElement ( config . view ) , { priority : config . converterPriority || 'normal' } ) ;
341+ dispatcher . on ( 'removeMarker:' + config . model , removeHighlight ( config . view ) , { priority : config . converterPriority || 'normal' } ) ;
342342 } ;
343343}
344344
@@ -370,14 +370,19 @@ function _createViewElementFromDefinition( viewElementDefinition, viewWriter, vi
370370 }
371371
372372 let element ;
373+ const attributes = Object . assign ( { } , viewElementDefinition . attributes ) ;
373374
374375 if ( viewElementType == 'container' ) {
375- element = viewWriter . createContainerElement ( viewElementDefinition . name , Object . assign ( { } , viewElementDefinition . attributes ) ) ;
376+ element = viewWriter . createContainerElement ( viewElementDefinition . name , attributes ) ;
376377 } else if ( viewElementType == 'attribute' ) {
377- element = viewWriter . createAttributeElement ( viewElementDefinition . name , Object . assign ( { } , viewElementDefinition . attributes ) ) ;
378+ const options = {
379+ priority : viewElementDefinition . priority || ViewAttributeElement . DEFAULT_PRIORITY
380+ } ;
381+
382+ element = viewWriter . createAttributeElement ( viewElementDefinition . name , attributes , options ) ;
378383 } else {
379384 // 'ui'.
380- element = viewWriter . createUIElement ( viewElementDefinition . name , Object . assign ( { } , viewElementDefinition . attributes ) ) ;
385+ element = viewWriter . createUIElement ( viewElementDefinition . name , attributes ) ;
381386 }
382387
383388 if ( viewElementDefinition . styles ) {
0 commit comments