작곡가 옵션처럼 나만의 드롭다운(popupMenu)을 추가하는 방법?

I added the following code to my theme component and expected a new popupMenu to appear in the composer.

api.onToolbarCreate(toolbar => {
  toolbar.addButton({
      id: "align_center_button",
      group: "crud",
      icon: "align-center",
      popupMenu: true
  });
});

I thought I would be able to follow the code here where the options cog gets added and it would work.

        toolbar.addButton({
          id: "options",
          group: "extras",
          icon: "cog",
          title: "composer.options",
          sendAction: this.onExpandPopupMenuOptions.bind(this),
          popupMenu: true,
        });

I thought that I could create additional buttons with the group crud and they would show up in their own dropdown like the default options. Is this possible? Could I get an example of how to setup and bind options to your own popupMenu?

I don’t believe our javascript plugin API is set up to make it easy to add a secondary dropdown menu at this point. The toolbar customizations I can think of have all just added options to the existing drop down.

To get something to render you would need to change your group to "extras". The groups are hard-coded and relate to the various sections of composer buttons.

The other thing to watch out for is that the icon you choose needs to be added via your theme component or the svg icon subset site setting.

Beyond that, I’m afraid you’re treading into fairly uncharted territory.

Ah okay, that makes a lot of sense for the group sections.

I changed the group back to extras and now it does show up, but now it along with the existing options cog dropdown the same menu.

api.onToolbarCreate(toolbar => {
  toolbar.addButton({
      id: "align_center_button",
      group: "extras",
      icon: "align-center",
      popupMenu: true
  });
});

Would this be a possible feature to add to the plugin API? The ability to add custom items to your own dropdown independent of the existing options dropdown. I could see this being useful as our composer is starting to look a little cluttered with all the additional options we would like to have :slight_smile:

유용할 수 있다는 점을 충분히 이해합니다! Contribute > Feature 토픽을 열었군요. 정말 적절한 선택입니다. 이를 통해 관심도를 파악하고, 언젠가 미래에 해당 기능이 실제로 도입될 수 있도록 노력하겠습니다.

Thank you @tshenry I appreciate you looking into it!