Szymon Kupś преди 9 години
родител
ревизия
4d7d3f4ac2

+ 3 - 3
packages/ckeditor5-image/src/imagestyle/imagestyle.js

@@ -53,14 +53,14 @@ export default class ImageStyle extends Plugin {
 	_createButton( style ) {
 		const editor = this.editor;
 		const command = editor.commands.get( 'imagestyle' );
-		const t = editor.t;
 
 		editor.ui.componentFactory.add( style.name, ( locale ) => {
 			const view = new ButtonView( locale );
 
 			view.set( {
-				label: t( style.title ),
-				icon: style.icon
+				label: style.title,
+				icon: style.icon,
+				tooltip: true
 			} );
 
 			view.bind( 'isEnabled' ).to( command, 'isEnabled' );

+ 1 - 0
packages/ckeditor5-image/src/imagestyle/imagestylecommand.js

@@ -24,6 +24,7 @@ export default class ImageStyleCommand extends Command {
 	 */
 	constructor( editor, styles ) {
 		super( editor );
+
 		/**
 		 * The current style value.
 		 *

+ 13 - 2
packages/ckeditor5-image/src/imagestyle/imagestyleengine.js

@@ -33,6 +33,7 @@ export default class ImageStyleEngine extends Plugin {
 	 */
 	init() {
 		const editor = this.editor;
+		const t = editor.t;
 		const doc = editor.document;
 		const schema = doc.schema;
 		const data = editor.data;
@@ -41,10 +42,10 @@ export default class ImageStyleEngine extends Plugin {
 		// Define default configuration.
 		editor.config.define( 'image.styles', [
 			// This option is equal to situation when no style is applied.
-			{ name: 'imageStyleFull', title: 'Full size image', icon: fullSizeIcon, value: null },
+			{ name: 'imageStyleFull', title: t( 'Full size image' ), icon: fullSizeIcon, value: null },
 
 			// This represents side image.
-			{ name: 'imageStyleSide', title: 'Side image', icon: sideIcon, value: 'side', className: 'image-style-side' }
+			{ name: 'imageStyleSide', title: t( 'Side image' ), icon: sideIcon, value: 'side', className: 'image-style-side' }
 		] );
 
 		// Get configuration.
@@ -79,6 +80,16 @@ export default class ImageStyleEngine extends Plugin {
 /**
  * Image style format descriptor.
  *
+ *	import fullIcon from 'path/to/icon.svg`;
+ *
+ *	const imageStyleFormat = {
+ *		name: 'fullSizeImage',
+ *		value: 'full',
+ *		icon: fullIcon,
+ *		title: `Full size image`,
+ *		class: `image-full-size`
+ *	}
+ *
  * @typedef {Object} module:image/imagestyle/imagestyleengine~ImageStyleFormat
  * @property {String} name Name of the style, it will be used to store style's button under that name in editor's
  * {@link module:ui/componentfactory~ComponentFactory ComponentFactory}.

+ 1 - 1
packages/ckeditor5-image/src/imagetoolbar.js

@@ -69,7 +69,7 @@ export default class ImageToolbar extends Plugin {
 		Template.extend( panel.template, {
 			attributes: {
 				class: [
-					'ck-toolbar__container',
+					'ck-toolbar__container'
 				]
 			}
 		} );