Skip to content

Commit

Permalink
Fix an issue where fields weren’t being initialized properly when in …
Browse files Browse the repository at this point in the history
…Matrix/Super Table/Neo blocks
  • Loading branch information
engram-design committed Feb 20, 2024
1 parent bc0d48b commit 6f25e55
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/resources/dist/js/buttonbox.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/resources/dist/js/buttonbox.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 9 additions & 6 deletions src/resources/src/js/buttonbox.js
Expand Up @@ -83,15 +83,18 @@ Craft.ButtonBoxFancyOptions = Garnish.Base.extend({
this.$select = this.$elem.find('select');
this.$btn = this.$elem.find('.menubtn');

var menuBtn = this.$btn.data('menubtn');
// Give it a second to resolve properly, particularly for Matrix/Super Table/Neo blocks
setTimeout(() => {
var menuBtn = this.$btn.data('menubtn');

if (menuBtn && menuBtn.menu) {
this.$menu = menuBtn.menu.$container;
if (menuBtn && menuBtn.menu) {
this.$menu = menuBtn.menu.$container;

if (this.$menu) {
menuBtn.menu.settings.onOptionSelect = $.proxy(this, 'onMenuOptionSelect');
if (this.$menu) {
menuBtn.menu.settings.onOptionSelect = $.proxy(this, 'onMenuOptionSelect');
}
}
}
}, 100);
},

onMenuOptionSelect: function(option) {
Expand Down

0 comments on commit 6f25e55

Please sign in to comment.