Ver código fonte

Other: Unify ViewElement converters for attribute and element.

Maciej Gołaszewski 8 anos atrás
pai
commit
8181797dec

+ 2 - 2
packages/ckeditor5-heading/src/headingengine.js

@@ -86,10 +86,10 @@ export default class HeadingEngine extends Plugin {
 				editor.document.schema.registerItem( option.model, '$block' );
 
 				// Build converter from model to view for data and editing pipelines.
-				modelElementToView( option.model, option.view, [ data.modelToView, editing.modelToView ] );
+				modelElementToView( option, [ data.modelToView, editing.modelToView ] );
 
 				// Build converter from view to model for data pipeline.
-				viewToModelElement( option.model, option.view, [ data.viewToModel ] );
+				viewToModelElement( option, [ data.viewToModel ] );
 
 				// Register the heading command for this option.
 				editor.commands.add( option.model, new HeadingCommand( editor, option.model ) );

+ 5 - 9
packages/ckeditor5-heading/tests/headingengine.js

@@ -85,15 +85,10 @@ describe( 'HeadingEngine', () => {
 							{ model: 'paragraph', title: 'paragraph' },
 							{
 								model: 'heading1',
-								view: {
-									from: [
-										{ name: 'h1' },
-										{ name: 'p', attribute: { 'data-heading': 'h1' }, priority: 'high' }
-									],
-									to: {
-										name: 'h1'
-									}
-								},
+								view: 'h1',
+								acceptsAlso: [
+									{ name: 'p', attribute: { 'data-heading': 'h1' }, priority: 'high' }
+								],
 								title: 'User H1'
 							}
 						]
@@ -172,3 +167,4 @@ describe( 'HeadingEngine', () => {
 		} );
 	} );
 } );
+