Skip to content

Commit

Permalink
Merge pull request formio#755 from formio/bugfix/sidebar-button-eventt
Browse files Browse the repository at this point in the history
Make sidebar buttons work after adding component.
  • Loading branch information
travist authored Oct 27, 2018
2 parents c8f4443 + 7cefa2f commit acf4ad2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/WebformBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -654,14 +654,16 @@ export default class WebformBuilder extends Webform {
}

addBuilderButton(info, container) {
let button;
info.element = this.ce('div', {
style: 'margin: 5px 0;'
},
this.ce('span', {
button = this.ce('span', {
class: `btn btn-block ${info.style || 'btn-default'}`,
onClick: () => this.emit(info.event)
}, info.title)
);
// Make sure it persists across refreshes.
this.addEventListener(button, 'click', () => this.emit(info.event), true);
this.groups[info.key] = info;
this.insertInOrder(info, this.groups, info.element, container);
}
Expand Down

0 comments on commit acf4ad2

Please sign in to comment.