Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Other: Aligned the implementation to the new Command API (see https:/…
Browse files Browse the repository at this point in the history
…/github.com/ckeditor/ckeditor5-core/issues/88).

BREAKING CHANGES: The command API has been changed.
  • Loading branch information
szymonkups committed Jun 13, 2017
2 parents 0a03d71 + 1cb7cd9 commit d75b448
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/enter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) => {
Expand Down
6 changes: 3 additions & 3 deletions src/entercommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <kbd>Enter</kbd> 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();

Expand Down
10 changes: 5 additions & 5 deletions tests/entercommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -53,7 +53,7 @@ describe( 'EnterCommand', () => {
} );
} );

describe( '_doExecute', () => {
describe( 'execute()', () => {
describe( 'collapsed selection', () => {
test(
'does nothing in the root',
Expand Down Expand Up @@ -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( '<p>[]</p>' );
} );
Expand All @@ -158,7 +158,7 @@ describe( 'EnterCommand', () => {

setData( doc, '<p>[x]</p>' );

command._doExecute();
command.execute();

expect( spy.calledOnce ).to.be.true;
} );
Expand All @@ -168,7 +168,7 @@ describe( 'EnterCommand', () => {
it( title, () => {
setData( doc, input );

command._doExecute();
command.execute();

expect( getData( doc ) ).to.equal( output );
} );
Expand Down

0 comments on commit d75b448

Please sign in to comment.