Преглед изворни кода

Added default implementation of execute() because the constructor depends on that.

Piotrek Koszuliński пре 8 година
родитељ
комит
13337998c3
2 измењених фајлова са 9 додато и 13 уклоњено
  1. 8 8
      packages/ckeditor5-core/src/command.js
  2. 1 5
      packages/ckeditor5-core/tests/command.js

+ 8 - 8
packages/ckeditor5-core/src/command.js

@@ -86,13 +86,6 @@ export default class Command {
 		this.isEnabled = true;
 	}
 
-	/**
-	 * Destroys the command.
-	 */
-	destroy() {
-		this.stopListening();
-	}
-
 	/**
 	 * Executes the command.
 	 *
@@ -103,8 +96,15 @@ export default class Command {
 	 * This behavior is implemented by a high priority listener to the {@link #event:execute} event.
 	 *
 	 * @fires execute
-	 * @method #execute
 	 */
+	execute() {}
+
+	/**
+	 * Destroys the command.
+	 */
+	destroy() {
+		this.stopListening();
+	}
 
 	/**
 	 * Event fired by the {@link #execute} method. The command action is a listener to this event so it's

+ 1 - 5
packages/ckeditor5-core/tests/command.js

@@ -6,10 +6,6 @@
 import Command from '../src/command';
 import ModelTestEditor from './_utils/modeltesteditor';
 
-class SomeCommand extends Command {
-	execute() {}
-}
-
 describe( 'Command', () => {
 	let editor, command;
 
@@ -18,7 +14,7 @@ describe( 'Command', () => {
 			.create()
 			.then( newEditor => {
 				editor = newEditor;
-				command = new SomeCommand( editor );
+				command = new Command( editor );
 			} );
 	} );