Ver Fonte

Add div wrappers to link form view.

Mateusz Samsel há 6 anos atrás
pai
commit
023cb0fcdf
1 ficheiros alterados com 35 adições e 6 exclusões
  1. 35 6
      packages/ckeditor5-link/src/ui/linkformview.js

+ 35 - 6
packages/ckeditor5-link/src/ui/linkformview.js

@@ -82,6 +82,8 @@ export default class LinkFormView extends View {
 
 		this.customAttributesView = this._createCustomAttributesView();
 
+		this.children = this._createFormChildren();
+
 		/**
 		 * A collection of views which can be focused in the form.
 		 *
@@ -124,12 +126,7 @@ export default class LinkFormView extends View {
 				tabindex: '-1'
 			},
 
-			children: [
-				this.urlInputView,
-				this.saveButtonView,
-				this.cancelButtonView,
-				...this.customAttributesView,
-			]
+			children: this.children
 		} );
 	}
 
@@ -239,6 +236,38 @@ export default class LinkFormView extends View {
 		} );
 		return checkboxes;
 	}
+
+	_createFormChildren() {
+		const children = this.createCollection();
+
+		const requiredButtonView = new View();
+		requiredButtonView.setTemplate( {
+			tag: 'div',
+			children: [
+				this.urlInputView,
+				this.saveButtonView,
+				this.cancelButtonView
+			],
+			attributes: {
+				class: 'ck-link-form_required-buttons'
+			}
+		} );
+		children.add( requiredButtonView );
+
+		if ( this.customAttributes.length ) {
+			const additionalButtonsView = new View();
+			additionalButtonsView.setTemplate( {
+				tag: 'div',
+				children: [ ...this.customAttributesView ],
+				attributes: {
+					class: 'ck-link-form_additional-buttons'
+				}
+			} );
+			children.add( additionalButtonsView );
+		}
+
+		return children;
+	}
 }
 
 /**