Adarshvk98 opened a new pull request, #4055:
URL: https://github.com/apache/incubator-kie-tools/pull/4055

   Problem:
   
   The standalone BPMN and DMN editors inline the whole envelope bundle inside 
a `<script>` in the iframe's `srcdoc`, so the browser reads the bundle as HTML 
first. If the bundle contains `<!--` followed later by `<script` (for example 
inside a regex or a string in a dependency), the HTML parser ignores the real 
`</script>`, the rest of the page becomes script text and the editor area 
renders blank.
   
   Whether that happens depends only on the order of modules in the bundle. 
With webpack 5.110 and later, the production bundle puts Monaco's XML grammar 
(which contains `<!--`) before React DOM (which contains `<script>`), and both 
editors render blank.
   
   Fix:
   
   `srcdoc` now only holds the empty page, and the envelope is added as a 
script element once the iframe loads, so it's never parsed as HTML. The editors 
are still a single `index.js` with the same API, and they load faster since the 
browser no longer scans the bundle as HTML.
   
   Testing:
   
   1. Build both editors in prod mode: `pnpm -F 
@kie-tools/bpmn-editor-standalone -F @kie-tools/dmn-editor-standalone 
build:prod`
   2. Serve the builds: `npx http-server packages/bpmn-editor-standalone/dist 
-p 8181 -c-1` and `npx http-server packages/dmn-editor-standalone/dist -p 8183 
-c-1`
   3. Open http://localhost:8181/index.html and check the BPMN editor shows 
"Create Your BPMN Process". Open http://localhost:8183/index.html and check the 
DMN editor shows "DMN 1.6" with the empty diagram.
   4. Make a change in each editor and check Undo, Redo and Download still work.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to