8
0
Просмотр исходного кода

Import SVG files straight to JS.

Piotrek Koszuliński 9 лет назад
Родитель
Сommit
27e188074b
1 измененных файлов с 8 добавлено и 4 удалено
  1. 8 4
      packages/ckeditor5-list/src/list.js

+ 8 - 4
packages/ckeditor5-list/src/list.js

@@ -12,6 +12,9 @@ import ListEngine from './listengine';
 import ButtonView from 'ckeditor5-ui/src/button/buttonview';
 import { parseKeystroke } from 'ckeditor5-utils/src/keyboard';
 
+import numberedListIcon from '../theme/icons/numberedlist.svg';
+import bulletedListIcon from '../theme/icons/bulletedlist.svg';
+
 /**
  * The lists feature. It introduces the `numberedList` and `bulletedList` buttons which
  * allows to convert paragraphs to/from list items and indent/outdent them.
@@ -34,8 +37,8 @@ export default class List extends Plugin {
 	init() {
 		// Create two buttons and link them with numberedList and bulletedList commands.
 		const t = this.editor.t;
-		this._addButton( 'numberedList', t( 'Numbered List' ) );
-		this._addButton( 'bulletedList', t( 'Bulleted List' ) );
+		this._addButton( 'numberedList', t( 'Numbered List' ), numberedListIcon );
+		this._addButton( 'bulletedList', t( 'Bulleted List' ), bulletedListIcon );
 
 		// Overwrite default enter key behavior.
 		// If enter key is pressed with selection collapsed in empty list item, outdent it instead of breaking it.
@@ -82,8 +85,9 @@ export default class List extends Plugin {
 	 * @private
 	 * @param {String} commandName Name of the command.
 	 * @param {Object} label Button label.
+	 * @param {String} icon Source of the icon.
 	 */
-	_addButton( commandName, label ) {
+	_addButton( commandName, label, icon ) {
 		const editor = this.editor;
 		const command = editor.commands.get( commandName );
 
@@ -92,7 +96,7 @@ export default class List extends Plugin {
 
 			buttonView.set( {
 				label: label,
-				icon: commandName.toLowerCase()
+				icon: icon
 			} );
 
 			// Bind button model to command.