Uxp entrypoints.setup loads same panel always

Hi,

I cannot get multiple panels working in InDesign. Same code works fine in Photoshop.

Consider this example
index.js

const { entrypoints } = require("uxp");

entrypoints.setup({
	panels: {
		test1: {
	      	show: () => {	
	      		console.log('show test1')
	  		
	  		},
	  		create: () =>	{	
	      		console.log('create test1')
	  		
	  		},
	  	},
	  	test2: {
	      	show: () =>  {	
	      		console.log('show test2')
	  		
	  		},
	  		create: () =>	{	
	      		console.log('create test2')
	  		
	  		},
	  	}	
	  }	
})

index.html

<!DOCTYPE html>
<html>
<head>
  <script src="index.js"></script>    
</head>
<body>
  
</body>
</html>

manifest.json

{
    "id": "sadsad",
    "name": "FOO",
    "version": "0.0.3",
    "main": "index.html",
    "entrypoints": [
        
        {
            "description": "asasee wefa",
            "type": "panel",
            "id": "test1",
            "label":"test panel 1"
        },
        {
            "description": "adsadsa asd as ",
            "type": "panel",
            "id": "test2",
            "label":"test panel 2"
        }
    ]
}

Shows this in the console:

create test1
show test1
create test1
show test1

Seems to me like a bug in the InDesign UXP implementation or am I doing something wrong here?

InDesign version 19.4
UXP Developer tool 2.0.1

I think It’s a bug on InDesign.
other developers mentioned same problem in the past as well.
selecting panels from Plugin panel, it works properly, but selecting from top of the menu, this not correctly works at all.

http://forums.creativeclouddeveloper.com/t/multiple-panels-without-web-components/7588/8

1 Like

You are right, it works correctly using the plugins panel.

We have a plugin with 3 panels but this bug is preventing us from releasing it. Does anybody know if this bug is known at Adobe? Do they have a public issue tracker?

1 Like

I have the same issue. But I recognized that as soon as opening the panel an additional element is created - which is empty:

Still having this problem late October 2024

The issue tracker would be Issues · AdobeDocs/uxp-indesign · GitHub no?

I think that might be the repository for the documentation rather than somewhere to file bugs.

I’ve seen references to https://indesign.uservoice.com/ and I see that there is a subforum there for the SDK, scripting and things like that, so that might be the place to file a bug, but I honestly don’t know.

Philip

You can sidestep the bug that panels don’t open properly from your plugin’s submenu (in the Plug-Ins menu) by removing the submenu. The user will have to open your panels from the Plugins panel but that’s OK because they do open properly from there. At least the user won’t see empty phantom panels and wonder what’s going on!

These lines of code in the create lifecycle hook for the plugin remove the submenu:

entrypoints.setup({
	plugin: {
		create() {
			const pluginsMenu = app.menus.itemByName('Main').submenus.itemByName('Plug-Ins');
			const thisPluginSubmenu = pluginsMenu.submenus.itemByName(this.name);
			if (thisPluginSubmenu.isValid) thisPluginSubmenu.remove();

We’re referencing the Plug-ins menu in the Main menu. Then we’re referencing the submenu for our plugin by passing this.name (this here is the plugin info of our plugin). Then we are removing the submenu.

I am aware that if you need your plugin to work in different localised versions of InDesign/OS the code might need adapting a little – someone who knows more about this than I do might need to give the proper syntax.

I don’t think there are any unintended consequences to removing this submenu (if you take this code out again and reload your plugin, uxp/InDesign recreates the submenu), but please test and use at your own discretion. I am offering the code only as a workaround (hack) for the bug. Like everyone else, I wish Adobe would fix the bug.

Philip

I created a bug report please all vote :grin: