Maybe I’m doing something wrong — or this might be a bug.
When I add a flyout menu to a panel in a multi-panel plugin, the menu doesn’t appear in the panel I defined it for, but in another one. I can’t figure out how InDesign decides where to attach it, but it’s definitely not the panel I specified.
Here is an example:
manifest.json
...
"entrypoints": [
{ "type": "command", "id": "showAlert", "label": "Show alert" },
{ "type": "panel", "id": "test_main", "label": {"default": "Test-Plugin"} },
{ "type": "panel", "id": "test_one", "label": {"default": "Panel One"} },
{ "type": "panel", "id": "test_two", "label": {"default": "Panel Two"} }
],
...
main.js
entrypoints.setup({
commands: {
showAlert: () => showAlert()
},
panels: {
test_main: {
show({node} = {}) {},
menuItems: [
{id: "setWarpFactor", label: "Warp Factor 1"},
{id: "raiseShields", label: "Shields Up"},
{id: "makeItSo", label: "Engage"}
],
invokeMenu(id) {
console.log(`Panel Main: ${id} selected`);
handleFlyout(id);
}
},
test_one: {
show({node} = {}) {},
menuItems: [
{id: "flyout_one_1", label: "Flyout Entry 1"},
],
invokeMenu(id) {
console.log(`Panel One: ${id} selected`);
handleFlyout(id);
}
},
test_two: {
show({node} = {}) {},
menuItems: [
{id: "flyout_two_1", label: "Flyout Entry 1"},
],
invokeMenu(id) {
console.log(`Panel Two: ${id} selected`);
handleFlyout(id);
}
}
}
});
When I run the setup above, the only menu that has a flyout is test_two.
When I remove the menus from all other panels and only leave the menu in test_main, then the menu defined in test_main will be added to test_two, not to test_main.
I tried it with different amounts of panels, and it seems rather random to which panel the menu gets added. It is not always the last. If I have four panels, it will be added to the third. Anyways, it is ignored in which panel I added the menu in the main.js
Did I make a mistake in the setup, or is this a bug? Has someone similar experiences?