Skip to content

Commit a366616

Browse files
committed
fix: control container option
1 parent dc5ad07 commit a366616

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

src/js/components/controls/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,8 @@ export class Controls {
289289

290290
this.dom = element
291291
this.groups = groups
292-
this.currentGroup = groups[0]
292+
const [firstGroup] = groups
293+
this.currentGroup = firstGroup
293294

294295
this.actions = {
295296
filter: term => {
@@ -396,7 +397,8 @@ export class Controls {
396397

397398
applyOptions = (controlOptions = {}) => {
398399
this.options = {}
399-
const { groupOrder = [], elements = [] } = controlOptions
400+
const { groupOrder = [], elements = [], container } = controlOptions
401+
this.container = container
400402
this.groupOrder = unique(groupOrder.concat(['common', 'html', 'layout']))
401403
this.options = merge(this.defaults, controlOptions)
402404
this.options.elements = elements.concat(defaultElements)

src/js/editor.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,13 @@ export class FormeoEditor {
116116
* @return {void}
117117
*/
118118
render() {
119-
const _this = this
120-
const controls = this.controls.dom
121119
this.stages = Object.values(Components.get('stages'))
122120
const elemConfig = {
123121
attrs: {
124122
className: 'formeo formeo-editor',
125-
id: _this.formId,
123+
id: this.formId,
126124
},
127-
content: [this.stages.map(({ dom }) => dom), controls],
125+
content: [this.stages.map(({ dom }) => dom)],
128126
}
129127

130128
if (i18n.current.dir) {
@@ -134,14 +132,17 @@ export class FormeoEditor {
134132

135133
this.editor = dom.create(elemConfig)
136134

137-
if (_this.editorContainer) {
138-
dom.empty(_this.editorContainer)
139-
_this.editorContainer.appendChild(this.editor)
135+
const controlsContainer = this.controls.container || this.editor
136+
controlsContainer.appendChild(this.controls.dom)
137+
138+
if (this.editorContainer) {
139+
dom.empty(this.editorContainer)
140+
this.editorContainer.appendChild(this.editor)
140141
}
141142

142143
Events.formeoLoaded = new window.CustomEvent('formeoLoaded', {
143144
detail: {
144-
formeo: _this,
145+
formeo: this,
145146
},
146147
})
147148

0 commit comments

Comments
 (0)