In my panel, I have several different html files (for better code organization), so I need to load them dynamically in JS.
Some of those html loaded files contain onClick events (like buttons), and I get these errors when loading htmls (got while setting innerHtml of my main index.html elements and replacing with content of the other htmls).
Uncaught UxpRuntimeError: Refusing to load event handler tag as executable code. The node was injected using innerHTML.
I tried to define allowCodeGenerationFromStrings in the manifest to true (inside the requiredPermissions object), but it does not change anything. However the description of this property should fix it if I understood it correctly ? Or did I miss something ?
You should remove JS from HTML files and move to a dedicated JS file, where you find the required element by ID or some other selector and add event listener to it. Something like:
document.querySelector('#element-id').addEventListener('click', (event) => {
// handle your click here
})
allowCodeGenerationFromStrings should be used only during development, usually for something like Webpack. Not sure about PremierePro, but at least Ps plugins with this enabled are not approved to the Marketplace
While I am not impacted by this., this is not obvious and IMO poor customer experience.
@bbb_999 Maybe advocate on customer behalf to have this change to be explicit in next release ?
Either change the name (expl: debug_allowCodeGenerationFromStrings) or emit a warning when starting the plugin or …
1 * It would make sense to make it painfully obvious to UXP developer that this property should not be used for production UXP code (esp if doing so would be rejection from the marketplace).
Any options that make it obvious that this should NOT be used for production is fine.
For expl :
Rename this property to something like “debugOnly_allowCodeGenerationFromStrings“
Mark it as private / not available
Emit a warning when dev lauch on its local machine (maybe a dialog box popup from UDT upon launch )
… or whatever you think make sense
2 * Have the docs reflect this - it appears to say it is OK (albeit not recommended).