Is there a way for a plugin to only have a dialog as a UI? So basically instead of a “panel” entry point to have a “dialog”?
I could do something like: make the panel (from the manifest) really small, then in the panel’s create method to call the dialog show. But it feels like a very ugly solution, and I have no idea how to close the panel after closing the dialog.
Any suggestions?
No need for a panel, use a command-only plugin. Actually the command is also redundant.
In my plugin.create I install menu items thru InDesign object model, as main path to show the dialog.
Hi Dirk, thanks for answering.
Can you elaborate a bit, please? The command idea would work best, but as far as I can see, I can only create “native” InDesign dialogs with it (app.dialogs.add()
), which wouldn’t allow me to use React.
Why? Same as you render initial DOM on a panel, you can render it on a dialog, can’t you?
Edited: strike it, I’m stupid.
commands: {
'silly-command': {
run() {
// Create a root for the React app
const container = document.createElement('dialog');
const r = container.appendChild(document.createElement('div'));
r.id = 'root';
document.body.appendChild(container);
const root = createRoot(r);
root.render(
<StrictMode>
<App />
</StrictMode>
);
container.uxpShowModal({
resize: 'both',
size: { width: 500, height: 450 },
title:'URL Processor'});
},
},
Works ok-ish.
Thank you @Karmalakas and @Dirk
3 Likes