diff options
Diffstat (limited to 'app/assets/javascripts/editor/components/source_editor_toolbar_button.vue')
-rw-r--r-- | app/assets/javascripts/editor/components/source_editor_toolbar_button.vue | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/app/assets/javascripts/editor/components/source_editor_toolbar_button.vue b/app/assets/javascripts/editor/components/source_editor_toolbar_button.vue index 6ce48ddf89a..38f586f0773 100644 --- a/app/assets/javascripts/editor/components/source_editor_toolbar_button.vue +++ b/app/assets/javascripts/editor/components/source_editor_toolbar_button.vue @@ -31,12 +31,19 @@ export default { return Object.entries(this.button).length > 0; }, }, + mounted() { + if (this.button.data) { + Object.entries(this.button.data).forEach(([attr, value]) => { + this.$el.dataset[attr] = value; + }); + } + }, methods: { - clickHandler() { + clickHandler(event) { if (this.button.onClick) { - this.button.onClick(); + this.button.onClick(event); } - this.$emit('click'); + this.$emit('click', event); }, }, }; @@ -52,7 +59,7 @@ export default { :icon="icon" :title="label" :aria-label="label" - data-qa-selector="editor_toolbar_button" - @click="clickHandler" + :class="button.class" + @click="clickHandler($event)" /> </template> |