From 1cb7cd958542c35e14d4480f76dd9be8d932e522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20Koszuli=C5=84ski?= Date: Tue, 13 Jun 2017 11:07:12 +0200 Subject: [PATCH] Aligned command API usage to the changes done in ckeditor5-core#89. --- src/enter.js | 2 +- src/entercommand.js | 6 +++--- tests/entercommand.js | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/enter.js b/src/enter.js index 1173887..44eda41 100644 --- a/src/enter.js +++ b/src/enter.js @@ -30,7 +30,7 @@ export default class Enter extends Plugin { editingView.addObserver( EnterObserver ); - editor.commands.set( 'enter', new EnterCommand( editor ) ); + editor.commands.add( 'enter', new EnterCommand( editor ) ); // TODO We may use the keystroke handler for that. this.listenTo( editingView, 'enter', ( evt, data ) => { diff --git a/src/entercommand.js b/src/entercommand.js index 61d523a..5825820 100644 --- a/src/entercommand.js +++ b/src/entercommand.js @@ -7,19 +7,19 @@ * @module enter/entercommand */ -import Command from '@ckeditor/ckeditor5-core/src/command/command'; +import Command from '@ckeditor/ckeditor5-core/src/command'; import Position from '@ckeditor/ckeditor5-engine/src/model/position'; /** * Enter command. It is used by the {@link module:enter/enter~Enter Enter feature} to handle the Enter key. * - * @extends modue:core/command/command~Command + * @extends module:core/command~Command */ export default class EnterCommand extends Command { /** * @inheritDoc */ - _doExecute() { + execute() { const doc = this.editor.document; const batch = doc.batch(); diff --git a/tests/entercommand.js b/tests/entercommand.js index 7484b03..05900bd 100644 --- a/tests/entercommand.js +++ b/tests/entercommand.js @@ -17,7 +17,7 @@ describe( 'EnterCommand', () => { doc = editor.document; command = new EnterCommand( editor ); - editor.commands.set( 'enter', command ); + editor.commands.add( 'enter', command ); schema = doc.schema; @@ -53,7 +53,7 @@ describe( 'EnterCommand', () => { } ); } ); - describe( '_doExecute', () => { + describe( 'execute()', () => { describe( 'collapsed selection', () => { test( 'does nothing in the root', @@ -146,7 +146,7 @@ describe( 'EnterCommand', () => { // @TODO: Add option for setting selection direction to model utils. doc.selection._lastRangeBackward = true; - command._doExecute(); + command.execute(); expect( getData( doc ) ).to.equal( '

[]

' ); } ); @@ -158,7 +158,7 @@ describe( 'EnterCommand', () => { setData( doc, '

[x]

' ); - command._doExecute(); + command.execute(); expect( spy.calledOnce ).to.be.true; } ); @@ -168,7 +168,7 @@ describe( 'EnterCommand', () => { it( title, () => { setData( doc, input ); - command._doExecute(); + command.execute(); expect( getData( doc ) ).to.equal( output ); } );