ソースを参照

Fixing after changes introduced in t/ckeditor5-engine/1236

Szymon Cofalik 7 年 前
コミット
01566cfb53

+ 6 - 11
packages/ckeditor5-heading/src/headingengine.js

@@ -9,10 +9,7 @@
 
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
 import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
-import {
-	modelElementToViewContainerElement,
-	viewToModelElement
-} from '@ckeditor/ckeditor5-engine/src/conversion/definition-based-converters';
+import { elementToElement } from '@ckeditor/ckeditor5-engine/src/conversion/two-way-converters';
 
 import HeadingCommand from './headingcommand';
 
@@ -53,8 +50,6 @@ export default class HeadingEngine extends Plugin {
 	 */
 	init() {
 		const editor = this.editor;
-		const data = editor.data;
-		const editing = editor.editing;
 		const options = editor.config.get( 'heading.options' );
 
 		for ( const option of options ) {
@@ -65,11 +60,11 @@ export default class HeadingEngine extends Plugin {
 					inheritAllFrom: '$block'
 				} );
 
-				// Build converter from model to view for data and editing pipelines.
-				modelElementToViewContainerElement( option, [ data.modelToView, editing.modelToView ] );
-
-				// Build converter from view to model for data pipeline.
-				viewToModelElement( option, [ data.viewToModel ] );
+				elementToElement( editor.conversion, {
+					model: option.model,
+					view: option.view,
+					upcastAlso: option.upcastAlso
+				} );
 
 				// Register the heading command for this option.
 				editor.commands.add( option.model, new HeadingCommand( editor, option.model ) );

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

@@ -86,8 +86,8 @@ describe( 'HeadingEngine', () => {
 							{
 								model: 'heading1',
 								view: 'h1',
-								acceptsAlso: [
-									{ name: 'p', attribute: { 'data-heading': 'h1' }, priority: 'high' }
+								upcastAlso: [
+									{ name: 'p', attribute: { 'data-heading': 'h1' } }
 								],
 								title: 'User H1'
 							}