Selaa lähdekoodia

Cleaned-up the UI of the feature.

Aleksander Nowodzinski 6 vuotta sitten
vanhempi
commit
4a494e0506

+ 2 - 0
packages/ckeditor5-special-characters/src/specialcharacters.js

@@ -12,6 +12,8 @@ import Typing from '@ckeditor/ckeditor5-typing/src/typing';
 import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
 import SpecialCharactersUI from './specialcharactersui';
 
+import '../theme/specialcharacters.css';
+
 /**
  * The special characters feature.
  *

+ 43 - 52
packages/ckeditor5-special-characters/src/specialcharactersui.js

@@ -11,8 +11,8 @@ 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 SpecialCharactersTableView from './ui/specialcharacterstableview';
-import SpecialCharactersSelectView from './ui/specialcharactersselectview';
+import CharacterGridView from './ui/charactergridview';
+import SpecialCharactersNavigationView from './ui/specialcharactersnavigationview';
 
 /**
  * The special characters UI plugin.
@@ -23,78 +23,69 @@ export default class SpecialCharactersUI extends Plugin {
 	init() {
 		const editor = this.editor;
 		const t = editor.t;
-		const specialCharacterPlugin = editor.plugins.get( 'SpecialCharacters' );
-		const label = t( 'Special characters' );
-
+		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 => {
-			// Prepare the dropdown element.
 			const dropdownView = createDropdown( locale );
-
-			dropdownView.buttonView.set( {
-				label,
-				icon: specialCharactersIcon,
-				tooltip: true
+			const navigationView = new SpecialCharactersNavigationView( locale, specialCharsPlugin.getGroups() );
+			const symbolGridView = new CharacterGridView( this.locale, {
+				columns: 10
 			} );
 
-			dropdownView.bind( 'isEnabled' ).to( command );
+			symbolGridView.delegate( 'execute' ).to( dropdownView );
+
+			// Set the initial content of the special characters grid.
+			this._updateGrid( specialCharsPlugin, navigationView.currentGroupName, symbolGridView );
 
-			const specialCharactersSelectView = new SpecialCharactersSelectView( locale, {
-				labelText: label,
-				selectOptions: getSelectViewOptions()
+			// Update the grid of special characters when a user changed the character group.
+			navigationView.on( 'execute', () => {
+				this._updateGrid( specialCharsPlugin, navigationView.currentGroupName, symbolGridView );
 			} );
 
-			const symbolTableView = new SpecialCharactersTableView( locale, {
-				columns: 10 // TODO: Read from config.
+			dropdownView.buttonView.set( {
+				label: t( 'Special characters' ),
+				icon: specialCharactersIcon,
+				tooltip: true
 			} );
 
-			symbolTableView.delegate( 'execute' ).to( dropdownView, 'execute' );
+			dropdownView.bind( 'isEnabled' ).to( command );
 
 			// Insert a special character when a tile was clicked.
 			dropdownView.on( 'execute', ( evt, data ) => {
-				command.execute( { item: data.title } );
+				editor.execute( 'specialCharacters', { item: data.name } );
+				editor.editing.view.focus();
 			} );
 
-			// Draw special characters tiles when the dropdown is open.
-			dropdownView.on( 'change:isOpen', ( evt, name, isVisible ) => {
-				if ( !isVisible ) {
-					return;
-				}
-
-				printCharacters( specialCharactersSelectView, symbolTableView.symbolGridView );
-			} );
-
-			// Draw special characters tiles for specified category (when a user has changed it).
-			specialCharactersSelectView.on( 'input', () => {
-				printCharacters( specialCharactersSelectView, symbolTableView.symbolGridView );
-			} );
-
-			dropdownView.panelView.children.add( specialCharactersSelectView );
-			dropdownView.panelView.children.add( symbolTableView );
+			dropdownView.panelView.children.add( navigationView );
+			dropdownView.panelView.children.add( symbolGridView );
 
 			return dropdownView;
 		} );
+	}
 
-		function printCharacters( selectView, gridView ) {
-			// TODO: Keyboard navigation.
-			gridView.items.clear();
-
-			const groupName = selectView.value;
-			const characterTitles = specialCharacterPlugin.getCharactersForGroup( groupName );
-
-			for ( const title of characterTitles ) {
-				const character = specialCharacterPlugin.getCharacter( title );
-
-				gridView.items.add( gridView.createSymbolTile( character, title ) );
-			}
-		}
-
-		function getSelectViewOptions() {
-			return [ ...specialCharacterPlugin.getGroups() ]
-				.map( groupName => ( { label: groupName, value: groupName } ) );
+	/**
+	 * Updates the symbol grid depending on the currently selected character group.
+	 *
+	 * @private
+	 * @param {module:special-characters/specialcharacters~SpecialCharacters} specialCharsPlugin
+	 * @param {module:special-characters/ui/specialcharactersnavigationview~SpecialCharactersNavigationView#currentGroupName}
+	 * currentGroupName
+	 * @param {module:special-characters/ui/charactergridview~CharacterGridView} gridView
+	 */
+	_updateGrid( specialCharsPlugin, currentGroupName, gridView ) {
+		// Updating the grid starts with removing all tiles belonging to the old group.
+		gridView.tiles.clear();
+
+		const characterTitles = specialCharsPlugin.getCharactersForGroup( currentGroupName );
+
+		for ( const title of characterTitles ) {
+			const character = specialCharsPlugin.getCharacter( title );
+
+			gridView.tiles.add( gridView.createTile( character, title ) );
 		}
 	}
 }

+ 89 - 0
packages/ckeditor5-special-characters/src/ui/charactergridview.js

@@ -0,0 +1,89 @@
+/**
+ * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
+ */
+
+/**
+ * @module special-characters/ui/charactergridview
+ */
+
+import View from '@ckeditor/ckeditor5-ui/src/view';
+import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
+
+import '../../theme/charactergrid.css';
+
+/**
+ * A grid of character tiles. Allows browsing special characters and selecting the character to
+ * be inserted into the content.
+ *
+ * @extends module:ui/view~View
+ */
+export default class CharacterGridView extends View {
+	/**
+	 * Creates an instance of a character grid containing tiles representing special characters.
+	 *
+	 * @param {module:utils/locale~Locale} [locale] The localization services instance.
+	 * @param {Object} options Component configuration
+	 * @param {Number} options.columns A number of columns in the grid.
+	 */
+	constructor( locale, options ) {
+		super( locale );
+
+		const viewStyleAttribute = {};
+
+		if ( options && options.columns ) {
+			viewStyleAttribute.gridTemplateColumns = `repeat( ${ options.columns }, 1fr)`;
+		}
+
+		/**
+		 * Collection of the child tile views. Each tile represents some particular character.
+		 *
+		 * @readonly
+		 * @member {module:ui/viewcollection~ViewCollection}
+		 */
+		this.tiles = this.createCollection();
+
+		this.setTemplate( {
+			tag: 'div',
+			children: this.tiles,
+			attributes: {
+				class: [
+					'ck',
+					'ck-character-grid'
+				],
+				style: viewStyleAttribute
+			}
+		} );
+
+		/**
+		 * Fired when any {@link #tiles grid tiles} is clicked.
+		 *
+		 * @event execute
+		 * @param {Object} data Additional information about the event.
+		 * @param {String} data.name Name of the tile that caused the event (e.g. "greek small letter epsilon").
+		 */
+	}
+
+	/**
+	 * Creates a new tile for the grid.
+	 *
+	 * @param {String} character A human-readable character displayed as label (e.g. "ε").
+	 * @param {String} name A name of the character (e.g. "greek small letter epsilon").
+	 * @returns {module:ui/button/button~ButtonView}
+	 */
+	createTile( character, name ) {
+		const tile = new ButtonView( this.locale );
+
+		tile.set( {
+			label: character,
+			withText: true,
+			class: 'ck-character-grid__tile'
+		} );
+
+		tile.on( 'execute', () => {
+			this.fire( 'execute', { name } );
+		} );
+
+		return tile;
+	}
+}

+ 141 - 0
packages/ckeditor5-special-characters/src/ui/specialcharactersnavigationview.js

@@ -0,0 +1,141 @@
+/**
+ * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
+ */
+
+/**
+ * @module special-characters/ui/specialcharactersnavigationview
+ */
+
+import View from '@ckeditor/ckeditor5-ui/src/view';
+import Collection from '@ckeditor/ckeditor5-utils/src/collection';
+import Model from '@ckeditor/ckeditor5-ui/src/model';
+import LabelView from '@ckeditor/ckeditor5-ui/src/label/labelview';
+import {
+	createDropdown,
+	addListToDropdown
+} from '@ckeditor/ckeditor5-ui/src/dropdown/utils';
+
+/**
+ * A class representing the navigation part of the special characters UI. It is responsible
+ * for describing the feature and selecting a particular character group by the user.
+ *
+ * @extends module:ui/view~View
+ */
+export default class SpecialCharactersNavigationView extends View {
+	/**
+	 * Creates an instance of the {@link module:special-characters/ui/specialcharactersnavigationview~SpecialCharactersNavigationView}
+	 * class.
+	 *
+	 * @param {module:utils/locale~Locale} locale The localization services instance.
+	 * @param {Iterable.<String>} groupNames Names of the character groups.
+	 */
+	constructor( locale, groupNames ) {
+		super( locale );
+
+		const t = locale.t;
+
+		/**
+		 * Label of the navigation view describing its purpose.
+		 *
+		 * @member {module:ui/label/labelview~LabelView}
+		 */
+		this.labelView = new LabelView( locale );
+		this.labelView.text = t( 'Special characters' );
+
+		/**
+		 * A dropdown that allows selecting a group of special characters to be displayed.
+		 *
+		 * @member {module:ui/dropdown/dropdownview~DropdownView}
+		 */
+		this.groupDropdownView = this._createGroupSelector( groupNames );
+
+		this.setTemplate( {
+			tag: 'div',
+			attributes: {
+				class: [
+					'ck',
+					'ck-special-characters-navigation'
+				]
+			},
+			children: [
+				this.labelView,
+				this.groupDropdownView
+			]
+		} );
+	}
+
+	/**
+	 * Returns a name of the character groups currently selected in the {@link #groupDropdownView}.
+	 *
+	 * @returns {String}
+	 */
+	get currentGroupName() {
+		return this.groupDropdownView.value;
+	}
+
+	/**
+	 * Returns a dropdown that allows selecting character groups.
+	 *
+	 * @private
+	 * @param {Iterable.<String>} groupNames Names of the character groups.
+	 * @returns {module:ui/dropdown/dropdownview~DropdownView}
+	 */
+	_createGroupSelector( groupNames ) {
+		const locale = this.locale;
+		const t = locale.t;
+		const dropdown = createDropdown( locale );
+		const groupDefinitions = this._getCharacterGroupListItemDefinitions( dropdown, groupNames );
+
+		dropdown.set( 'value', groupDefinitions.first.model.label );
+
+		dropdown.buttonView.bind( 'label' ).to( dropdown, 'value' );
+
+		dropdown.buttonView.set( {
+			isOn: false,
+			withText: true,
+			tooltip: t( 'Character category' )
+		} );
+
+		dropdown.on( 'execute', evt => {
+			dropdown.value = evt.source.label;
+		} );
+
+		dropdown.delegate( 'execute' ).to( this );
+
+		addListToDropdown( dropdown, groupDefinitions );
+
+		return dropdown;
+	}
+
+	/**
+	 * Returns list item definitions to be used in the character group dropdown
+	 * representing specific character groups.
+	 *
+	 * @private
+	 * @param {module:ui/dropdown/dropdownview~DropdownView} dropdown
+	 * @param {Iterable.<String>} groupNames Names of the character groups.
+	 * @returns {Iterable.<module:ui/dropdown/utils~ListDropdownItemDefinition>}
+	 */
+	_getCharacterGroupListItemDefinitions( dropdown, groupNames ) {
+		const groupDefs = new Collection();
+
+		for ( const name of groupNames ) {
+			const definition = {
+				type: 'button',
+				model: new Model( {
+					label: name,
+					withText: true
+				} )
+			};
+
+			definition.model.bind( 'isOn' ).to( dropdown, 'value', value => {
+				return value === definition.model.label;
+			} );
+
+			groupDefs.add( definition );
+		}
+
+		return groupDefs;
+	}
+}

+ 0 - 83
packages/ckeditor5-special-characters/src/ui/specialcharactersselectview.js

@@ -1,83 +0,0 @@
-/**
- * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
- */
-
-/**
- * @module special-characters/ui/specialcharactersselectview
- */
-
-import View from '@ckeditor/ckeditor5-ui/src/view';
-import LabelView from '@ckeditor/ckeditor5-ui/src/label/labelview';
-import SelectView from '@ckeditor/ckeditor5-ui/src/select/selectview';
-import uid from '@ckeditor/ckeditor5-utils/src/uid';
-
-/**
- * @extends module:ui/view~View
- */
-export default class SpecialCharactersSelectView extends View {
-	/**
-	 * Creates a view to be inserted as a child of {@link module:ui/dropdown/dropdownview~DropdownView}.
-	 *
-	 * @param {module:utils/locale~Locale} [locale] The localization services instance.
-	 * @param {Object} options
-	 * @param {String} options.labelText A label for the select element.
-	 * @param {Array.<module:ui/select/selectview~SelectViewItem>} options.selectOptions Options to chose in the select view.
-	 */
-	constructor( locale, options ) {
-		super( locale );
-
-		const inputUid = `ck-select-${ uid() }`;
-
-		/**
-		 * A label for the select view.
-		 *
-		 * @member {module:ui/label/labelview~LabelView}
-		 */
-		this.label = new LabelView( this.locale );
-
-		/**
-		 * Select view for changing a category of special characters.
-		 *
-		 * @member {module:ui/select/selectview~SelectView}
-		 */
-		this.selectView = new SelectView( this.locale, options.selectOptions );
-		this.selectView.delegate( 'input' ).to( this );
-
-		this.label.for = inputUid;
-		this.label.text = options.labelText;
-		this.label.extendTemplate( {
-			attributes: {
-				class: [
-					'ck',
-					'ck-symbol-grid__label'
-				]
-			}
-		} );
-
-		this.selectView.id = inputUid;
-
-		this.setTemplate( {
-			tag: 'div',
-			attributes: {
-				class: [
-					'ck',
-					'ck-grid-table'
-				]
-			},
-			children: [
-				this.label,
-				this.selectView
-			]
-		} );
-	}
-
-	/**
-	 * Returns a value from the select view.
-	 *
-	 * @returns {String}
-	 */
-	get value() {
-		return this.selectView.element.value;
-	}
-}

+ 0 - 160
packages/ckeditor5-special-characters/src/ui/specialcharacterstableview.js

@@ -1,160 +0,0 @@
-/**
- * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
- */
-
-/**
- * @module special-characters/ui/specialcharacterstableview
- */
-
-import View from '@ckeditor/ckeditor5-ui/src/view';
-import FocusTracker from '@ckeditor/ckeditor5-utils/src/focustracker';
-import FocusCycler from '@ckeditor/ckeditor5-ui/src/focuscycler';
-import KeystrokeHandler from '@ckeditor/ckeditor5-utils/src/keystrokehandler';
-import SymbolGridView from './symbolgridview';
-
-// TODO: Keyboard navigation does not work.
-
-/**
- * @extends module:ui/view~View
- */
-export default class SpecialCharactersTableView extends View {
-	/**
-	 * Creates a view to be inserted as a child of {@link module:ui/dropdown/dropdownview~DropdownView}.
-	 *
-	 * @param {module:utils/locale~Locale} [locale] The localization services instance.
-	 * @param {Object} config The configuration object.
-	 * @param {Array.<module:special-characters/specialcharacters~SpecialCharacterDefinition>} config.symbolDefinitions An array with
-	 * definitions of special characters to be displayed in the table.
-	 * @param {Number} config.columns The number of columns in the color grid.
-	 */
-	constructor( locale, { symbolDefinitions = [], columns } ) {
-		super( locale );
-
-		/**
-		 * A collection of the children of the table.
-		 *
-		 * @readonly
-		 * @member {module:ui/viewcollection~ViewCollection}
-		 */
-		this.items = this.createCollection();
-
-		/**
-		 * Tracks information about the DOM focus in the list.
-		 *
-		 * @readonly
-		 * @member {module:utils/focustracker~FocusTracker}
-		 */
-		this.focusTracker = new FocusTracker();
-
-		/**
-		 * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
-		 *
-		 * @readonly
-		 * @member {module:utils/keystrokehandler~KeystrokeHandler}
-		 */
-		this.keystrokes = new KeystrokeHandler();
-
-		/**
-		 * The number of columns in the special characters grid.
-		 *
-		 * @type {Number}
-		 */
-		this.columns = columns;
-
-		/**
-		 * An array with definitions of special characters to be displayed in the table.
-		 *
-		 * @member {Array.<module:special-characters/specialcharacters~SpecialCharacterDefinition>}
-		 */
-		this.symbolDefinitions = symbolDefinitions;
-
-		/**
-		 * Preserves the reference to {@link module:special-characters/ui/symbolgridview~SymbolGridView} used to create
-		 * the default (static) symbol set.
-		 *
-		 * @readonly
-		 * @member {module:special-characters/ui/symbolgridview~SymbolGridView}
-		 */
-		this.symbolGridView = this._createSymbolGridView();
-
-		/**
-		 * Helps cycling over focusable {@link #items} in the list.
-		 *
-		 * @readonly
-		 * @protected
-		 * @member {module:ui/focuscycler~FocusCycler}
-		 */
-		this._focusCycler = new FocusCycler( {
-			focusables: this.items,
-			focusTracker: this.focusTracker,
-			keystrokeHandler: this.keystrokes,
-			actions: {
-				// Navigate list items backwards using the Arrow Up key.
-				focusPrevious: 'arrowup',
-
-				// Navigate list items forwards using the Arrow Down key.
-				focusNext: 'arrowdown',
-			}
-		} );
-
-		this.setTemplate( {
-			tag: 'div',
-			attributes: {
-				class: [
-					'ck',
-					'ck-grid-table'
-				]
-			},
-			children: this.items
-		} );
-
-		this.items.add( this.symbolGridView );
-	}
-
-	/**
-	 * @inheritDoc
-	 */
-	render() {
-		super.render();
-
-		// Items added before rendering should be known to the #focusTracker.
-		for ( const item of this.items ) {
-			this.focusTracker.add( item.element );
-		}
-
-		// Start listening for the keystrokes coming from #element.
-		this.keystrokes.listenTo( this.element );
-	}
-
-	/**
-	 * Focuses the first focusable element in {@link #items}.
-	 */
-	focus() {
-		this._focusCycler.focusFirst();
-	}
-
-	/**
-	 * Focuses the last focusable element in {@link #items}.
-	 */
-	focusLast() {
-		this._focusCycler.focusLast();
-	}
-
-	/**
-	 * Creates a static symbol table grid based on the editor configuration.
-	 *
-	 * @private
-	 * @returns {module:special-characters/ui/symbolgridview~SymbolGridView}
-	 */
-	_createSymbolGridView() {
-		const symbolGrid = new SymbolGridView( this.locale, {
-			symbolDefinitions: this.symbolDefinitions,
-			columns: this.columns
-		} );
-
-		symbolGrid.delegate( 'execute' ).to( this );
-
-		return symbolGrid;
-	}
-}

+ 0 - 173
packages/ckeditor5-special-characters/src/ui/symbolgridview.js

@@ -1,173 +0,0 @@
-/**
- * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
- */
-
-/**
- * @module special-characters/ui/symbolgridview
- */
-
-import View from '@ckeditor/ckeditor5-ui/src/view';
-import SymbolTileView from './symboltileview';
-import FocusTracker from '@ckeditor/ckeditor5-utils/src/focustracker';
-import FocusCycler from '@ckeditor/ckeditor5-ui/src/focuscycler';
-import KeystrokeHandler from '@ckeditor/ckeditor5-utils/src/keystrokehandler';
-import '../../theme/components/symbolgrid/symbolgrid.css';
-
-/**
- * A grid of {@link module:special-characters/ui/symboltileview~SymbolTileView symbol tiles}.
- *
- * @extends module:ui/view~View
- */
-export default class SymbolGridView extends View {
-	/**
-	 * Creates an instance of a symbol grid containing {@link module:special-characters/ui/symboltileview~SymbolTileView tiles}.
-	 *
-	 * @param {module:utils/locale~Locale} [locale] The localization services instance.
-	 * @param {Object} options Component configuration
-	 * @param {Array.<module:special-characters/specialcharacters~SpecialCharacterDefinition>} [options.symbolDefinitions] Array with
-	 * definitions required to create the {@link module:special-characters/ui/symboltileview~SymbolTileView tiles}.
-	 * @param {Number} options.columns A number of columns to display the tiles.
-	 */
-	constructor( locale, options ) {
-		super( locale );
-
-		const symbolDefinitions = options && options.symbolDefinitions || [];
-		const viewStyleAttribute = {};
-
-		if ( options && options.columns ) {
-			viewStyleAttribute.gridTemplateColumns = `repeat( ${ options.columns }, 1fr)`;
-		}
-
-		/**
-		 * Collection of the child tile views.
-		 *
-		 * @readonly
-		 * @member {module:ui/viewcollection~ViewCollection}
-		 */
-		this.items = this.createCollection();
-
-		/**
-		 * Tracks information about DOM focus in the grid.
-		 *
-		 * @readonly
-		 * @member {module:utils/focustracker~FocusTracker}
-		 */
-		this.focusTracker = new FocusTracker();
-
-		/**
-		 * Instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
-		 *
-		 * @readonly
-		 * @member {module:utils/keystrokehandler~KeystrokeHandler}
-		 */
-		this.keystrokes = new KeystrokeHandler();
-
-		/**
-		 * Helps cycling over focusable {@link #items} in the grid.
-		 *
-		 * @readonly
-		 * @protected
-		 * @member {module:ui/focuscycler~FocusCycler}
-		 */
-		this._focusCycler = new FocusCycler( {
-			focusables: this.items,
-			focusTracker: this.focusTracker,
-			keystrokeHandler: this.keystrokes,
-			actions: {
-				// Navigate grid items backwards using the arrowup key.
-				focusPrevious: 'arrowleft',
-
-				// Navigate grid items forwards using the arrowdown key.
-				focusNext: 'arrowright',
-			}
-		} );
-
-		this.items.on( 'add', ( evt, symbolTile ) => {
-			symbolTile.isOn = symbolTile.symbol === this.selectedsymbol;
-		} );
-
-		symbolDefinitions.forEach( item => {
-			const symbolTile = this.createSymbolTile( item.character, item.title );
-
-			this.items.add( symbolTile );
-		} );
-
-		this.setTemplate( {
-			tag: 'div',
-			children: this.items,
-			attributes: {
-				class: [
-					'ck',
-					'ck-symbol-grid'
-				],
-				style: viewStyleAttribute
-			}
-		} );
-	}
-
-	/**
-	 * Focuses the first focusable in {@link #items}.
-	 */
-	focus() {
-		if ( this.items.length ) {
-			this.items.first.focus();
-		}
-	}
-
-	/**
-	 * Focuses the last focusable in {@link #items}.
-	 */
-	focusLast() {
-		if ( this.items.length ) {
-			this.items.last.focus();
-		}
-	}
-
-	/**
-	 * @inheritDoc
-	 */
-	render() {
-		super.render();
-
-		// Items added before rendering should be known to the #focusTracker.
-		for ( const item of this.items ) {
-			this.focusTracker.add( item.element );
-		}
-
-		this.items.on( 'add', ( evt, item ) => {
-			this.focusTracker.add( item.element );
-		} );
-
-		this.items.on( 'remove', ( evt, item ) => {
-			this.focusTracker.remove( item.element );
-		} );
-
-		// Start listening for the keystrokes coming from #element.
-		this.keystrokes.listenTo( this.element );
-	}
-
-	/**
-	 * Creates a new tile for the grid.
-	 *
-	 * @param {String} character A character that will be displayed on the button.
-	 * @param {String} title A label that described the character.
-	 * @returns {module:special-characters/ui/symboltileview~SymbolTileView}
-	 */
-	createSymbolTile( character, title ) {
-		const symbolTile = new SymbolTileView();
-
-		symbolTile.set( {
-			symbol: character,
-			label: character,
-			tooltip: title,
-			withText: true
-		} );
-
-		symbolTile.on( 'execute', () => {
-			this.fire( 'execute', { title } );
-		} );
-
-		return symbolTile;
-	}
-}

+ 0 - 35
packages/ckeditor5-special-characters/src/ui/symboltileview.js

@@ -1,35 +0,0 @@
-/**
- * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
- */
-
-/**
- * @module special-characters/ui/symboltileview
- */
-
-import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
-
-/**
- * @extends module:ui/button/buttonview~ButtonView
- */
-export default class SymbolTileView extends ButtonView {
-	constructor( locale ) {
-		super( locale );
-
-		/**
-		 * String representing a symbol shown as tile's value.
-		 *
-		 * @type {String}
-		 */
-		this.set( 'symbol' );
-
-		this.extendTemplate( {
-			attributes: {
-				class: [
-					'ck',
-					'ck-symbol-grid__tile',
-				]
-			}
-		} );
-	}
-}

+ 2 - 2
packages/ckeditor5-special-characters/theme/components/symbolgrid/symbolgrid.css

@@ -3,6 +3,6 @@
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  */
 
- .ck.ck-symbol-grid {
+.ck.ck-character-grid {
 	display: grid;
-}
+}

+ 12 - 0
packages/ckeditor5-special-characters/theme/specialcharacters.css

@@ -0,0 +1,12 @@
+/*
+ * Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
+ */
+
+.ck.ck-special-characters-navigation {
+	display: flex;
+	flex-direction: row;
+	flex-wrap: nowrap;
+	align-items: center;
+	justify-content: space-between;
+}