|
|
@@ -87,13 +87,13 @@ export default class HeadingEngine extends Plugin {
|
|
|
const options = editor.config.get( 'heading.options' );
|
|
|
|
|
|
if ( enterCommand ) {
|
|
|
+ // @TODO This should be handled by a post-fixer.
|
|
|
this.listenTo( enterCommand, 'afterExecute', ( evt, data ) => {
|
|
|
- const positionParent = editor.document.selection.getFirstPosition().parent;
|
|
|
- const batch = data.batch;
|
|
|
+ const positionParent = editor.model.document.selection.getFirstPosition().parent;
|
|
|
const isHeading = options.some( option => positionParent.is( option.modelElement ) );
|
|
|
|
|
|
if ( isHeading && !positionParent.is( defaultModelElement ) && positionParent.childCount === 0 ) {
|
|
|
- batch.rename( positionParent, defaultModelElement );
|
|
|
+ data.writer.rename( positionParent, defaultModelElement );
|
|
|
}
|
|
|
} );
|
|
|
}
|