Parcourir la source

Adapt widget changes to use observable property in toolbar.

Mateusz Samsel il y a 6 ans
Parent
commit
18270dc945
1 fichiers modifiés avec 6 ajouts et 4 suppressions
  1. 6 4
      packages/ckeditor5-widget/src/widgettoolbarrepository.js

+ 6 - 4
packages/ckeditor5-widget/src/widgettoolbarrepository.js

@@ -111,15 +111,17 @@ export default class WidgetToolbarRepository extends Plugin {
 	 *
 	 * @param {String} toolbarId An id for the toolbar. Used to
 	 * @param {Object} options
+	 * @param {String} [options.ariaLabel] Label used by assistive technologies to describe this toolbar element.
 	 * @param {Array.<String>} options.items Array of toolbar items.
 	 * @param {Function} options.getRelatedElement Callback which returns an element the toolbar should be attached to.
 	 * @param {String} [options.balloonClassName='ck-toolbar-container'] CSS class for the widget balloon.
 	 */
-	register( toolbarId, { items, getRelatedElement, balloonClassName = 'ck-toolbar-container' } ) {
+	register( toolbarId, { ariaLabel, items, getRelatedElement, balloonClassName = 'ck-toolbar-container' } ) {
 		const editor = this.editor;
-		const locale = this.editor.locale;
-		const t = locale.t;
-		const toolbarView = new ToolbarView( locale, { ariaLabel: t( 'Widget\'s toolbar' ) } );
+		const t = editor.t;
+		const toolbarView = new ToolbarView( editor.locale );
+
+		toolbarView.ariaLabel = ariaLabel || t( 'Widget toolbar' );
 
 		if ( this._toolbarDefinitions.has( toolbarId ) ) {
 			/**