Bladeren bron

Internal: Updated insert special character command references in the UI plugin.

Marek Lewandowski 6 jaren geleden
bovenliggende
commit
b7f39797e9

+ 2 - 5
packages/ckeditor5-special-characters/src/specialcharactersui.js

@@ -10,7 +10,6 @@
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
 import { createDropdown } from '@ckeditor/ckeditor5-ui/src/dropdown/utils';
 import specialCharactersIcon from '../theme/icons/specialcharacters.svg';
-import InsertSpecialCharacterCommand from './insertspecialcharactercommand';
 import CharacterGridView from './ui/charactergridview';
 import SpecialCharactersNavigationView from './ui/specialcharactersnavigationview';
 
@@ -33,9 +32,6 @@ export default class SpecialCharactersUI extends Plugin {
 		const editor = this.editor;
 		const t = editor.t;
 		const specialCharsPlugin = editor.plugins.get( 'SpecialCharacters' );
-		const command = new InsertSpecialCharacterCommand( editor );
-
-		editor.commands.add( 'specialCharacters', command );
 
 		// Add the `specialCharacters` dropdown button to feature components.
 		editor.ui.componentFactory.add( 'specialCharacters', locale => {
@@ -44,6 +40,7 @@ export default class SpecialCharactersUI extends Plugin {
 			const gridView = new CharacterGridView( this.locale, {
 				columns: 10
 			} );
+			const command = editor.commands.get( 'insertSpecialCharacter' );
 
 			gridView.delegate( 'execute' ).to( dropdownView );
 
@@ -65,7 +62,7 @@ export default class SpecialCharactersUI extends Plugin {
 
 			// Insert a special character when a tile was clicked.
 			dropdownView.on( 'execute', ( evt, data ) => {
-				editor.execute( 'specialCharacters', { item: data.name } );
+				editor.execute( 'insertSpecialCharacter', { item: data.name } );
 				editor.editing.view.focus();
 			} );
 

+ 3 - 2
packages/ckeditor5-special-characters/tests/specialcharactersui.js

@@ -33,7 +33,7 @@ describe( 'SpecialCharactersUI', () => {
 			} )
 			.then( newEditor => {
 				editor = newEditor;
-				command = editor.commands.get( 'specialCharacters' );
+				command = editor.commands.get( 'insertSpecialCharacter' );
 			} );
 	} );
 
@@ -78,6 +78,7 @@ describe( 'SpecialCharactersUI', () => {
 
 				command.isEnabled = false;
 				expect( dropdown.isEnabled ).to.be.false;
+				command.isEnabled = true;
 			} );
 		} );
 
@@ -90,7 +91,7 @@ describe( 'SpecialCharactersUI', () => {
 
 			sinon.assert.calledOnce( executeSpy );
 			sinon.assert.calledOnce( focusSpy );
-			sinon.assert.calledWithExactly( executeSpy.firstCall, 'specialCharacters', {
+			sinon.assert.calledWithExactly( executeSpy.firstCall, 'insertSpecialCharacter', {
 				item: 'Less-than or equal to'
 			} );
 		} );