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

Make label view fully optional & fix the docs

panr 5 лет назад
Родитель
Сommit
0e91a3c9f0
1 измененных файлов с 5 добавлено и 2 удалено
  1. 5 2
      packages/ckeditor5-ui/src/formheader/formheaderview.js

+ 5 - 2
packages/ckeditor5-ui/src/formheader/formheaderview.js

@@ -15,7 +15,9 @@ import '../../theme/components/formheader/formheader.css';
  * The class component representing a form header view. It should be used in more advanced forms to
  * describe the main purpose of the form.
  *
- * By default the component contains a bolded label view that has to be set. The label is usually a short (at most 3-word) string.
+ * By default the component contains an optional bolded label view, which text can be set through the options (`[options.label]`),
+ * while creating the component. The label text is usually a short (at most 3-word) string. If the label text isn't defined
+ * the label view will not appear.
  * The component can also be extended by any other elements, like: icons, dropdowns, etc.
  *
  * It is used i.a.
@@ -91,6 +93,7 @@ export default class FormHeaderView extends View {
 			]
 		} );
 
-		this.children.add( label );
+		// Append the label view only if label text has been set.
+		this.label && this.children.add( label );
 	}
 }