Sfoglia il codice sorgente

Other: Aligned the implementation to the new Command API (see https://github.com/ckeditor/ckeditor5-core/issues/88).

BREAKING CHANGES: The command API has been changed.
Szymon Kupś 8 anni fa
parent
commit
20d1772632

+ 1 - 1
packages/ckeditor5-basic-styles/src/boldengine.js

@@ -47,6 +47,6 @@ export default class BoldEngine extends Plugin {
 			.toAttribute( BOLD, true );
 
 		// Create bold command.
-		editor.commands.set( BOLD, new ToggleAttributeCommand( editor, BOLD ) );
+		editor.commands.add( BOLD, new ToggleAttributeCommand( editor, BOLD ) );
 	}
 }

+ 1 - 1
packages/ckeditor5-basic-styles/src/italicengine.js

@@ -47,6 +47,6 @@ export default class ItalicEngine extends Plugin {
 			.toAttribute( ITALIC, true );
 
 		// Create italic command.
-		editor.commands.set( ITALIC, new ToggleAttributeCommand( editor, ITALIC ) );
+		editor.commands.add( ITALIC, new ToggleAttributeCommand( editor, ITALIC ) );
 	}
 }

+ 0 - 2
packages/ckeditor5-basic-styles/tests/boldengine.js

@@ -37,8 +37,6 @@ describe( 'BoldEngine', () => {
 
 	describe( 'command', () => {
 		it( 'should register bold command', () => {
-			expect( editor.commands.has( 'bold' ) ).to.be.true;
-
 			const command = editor.commands.get( 'bold' );
 
 			expect( command ).to.be.instanceOf( ToggleAttributeCommand );

+ 4 - 2
packages/ckeditor5-basic-styles/tests/italicengine.js

@@ -26,6 +26,10 @@ describe( 'ItalicEngine', () => {
 		} );
 	} );
 
+	afterEach( () => {
+		return editor.destroy();
+	} );
+
 	it( 'should be loaded', () => {
 		expect( editor.plugins.get( ItalicEngine ) ).to.be.instanceOf( ItalicEngine );
 	} );
@@ -37,8 +41,6 @@ describe( 'ItalicEngine', () => {
 
 	describe( 'command', () => {
 		it( 'should register italic command', () => {
-			expect( editor.commands.has( 'italic' ) ).to.be.true;
-
 			const command = editor.commands.get( 'italic' );
 
 			expect( command ).to.be.instanceOf( ToggleAttributeCommand );