|
@@ -8,6 +8,7 @@
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
import EditorUIView from '../../editorui/editoruiview';
|
|
import EditorUIView from '../../editorui/editoruiview';
|
|
|
|
|
+import LabelView from '../../label/labelview';
|
|
|
import uid from '@ckeditor/ckeditor5-utils/src/uid';
|
|
import uid from '@ckeditor/ckeditor5-utils/src/uid';
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -25,7 +26,6 @@ export default class BoxedEditorUIView extends EditorUIView {
|
|
|
constructor( locale ) {
|
|
constructor( locale ) {
|
|
|
super( locale );
|
|
super( locale );
|
|
|
|
|
|
|
|
- const t = this.t;
|
|
|
|
|
const ariaLabelUid = uid();
|
|
const ariaLabelUid = uid();
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -46,6 +46,15 @@ export default class BoxedEditorUIView extends EditorUIView {
|
|
|
*/
|
|
*/
|
|
|
this.main = this.createCollection();
|
|
this.main = this.createCollection();
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Voice label of the UI.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @protected
|
|
|
|
|
+ * @readonly
|
|
|
|
|
+ * @member {module:ui/view~View} #_voiceLabelView
|
|
|
|
|
+ */
|
|
|
|
|
+ this._voiceLabelView = this._createVoiceLabel( ariaLabelUid );
|
|
|
|
|
+
|
|
|
this.setTemplate( {
|
|
this.setTemplate( {
|
|
|
tag: 'div',
|
|
tag: 'div',
|
|
|
|
|
|
|
@@ -62,17 +71,7 @@ export default class BoxedEditorUIView extends EditorUIView {
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
children: [
|
|
children: [
|
|
|
- {
|
|
|
|
|
- tag: 'span',
|
|
|
|
|
- attributes: {
|
|
|
|
|
- id: `cke-editor__aria-label_${ ariaLabelUid }`,
|
|
|
|
|
- class: 'cke-voice-label'
|
|
|
|
|
- },
|
|
|
|
|
- children: [
|
|
|
|
|
- // TODO: Editor name?
|
|
|
|
|
- t( 'Rich Text Editor' )
|
|
|
|
|
- ]
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ this._voiceLabelView,
|
|
|
{
|
|
{
|
|
|
tag: 'div',
|
|
tag: 'div',
|
|
|
attributes: {
|
|
attributes: {
|
|
@@ -92,4 +91,26 @@ export default class BoxedEditorUIView extends EditorUIView {
|
|
|
]
|
|
]
|
|
|
} );
|
|
} );
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Creates a voice label view instance.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @private
|
|
|
|
|
+ * @returns {module:ui/label/labelview~LabelView}
|
|
|
|
|
+ */
|
|
|
|
|
+ _createVoiceLabel( ariaLabelUid ) {
|
|
|
|
|
+ const t = this.t;
|
|
|
|
|
+ const voiceLabel = new LabelView();
|
|
|
|
|
+
|
|
|
|
|
+ voiceLabel.text = t( 'Rich Text Editor' );
|
|
|
|
|
+
|
|
|
|
|
+ voiceLabel.extendTemplate( {
|
|
|
|
|
+ attributes: {
|
|
|
|
|
+ id: `cke-editor__aria-label_${ ariaLabelUid }`,
|
|
|
|
|
+ class: 'cke-voice-label'
|
|
|
|
|
+ }
|
|
|
|
|
+ } );
|
|
|
|
|
+
|
|
|
|
|
+ return voiceLabel;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|