- Issue created by @mandclu
- πΊπΈUnited States itmaybejj
Well -- it's impossible for JS to "see" from a container into an iframe, so the JS is going to have to be injected into the decoupled theme itself, inside the iframe.
Probably the easiest approach would be a little loader JS that detects preview mode -- e.g., if the page is loaded with a particular query variable that would be set by the iframe, then include the Editoria11y JS library. That would provide all the checking and highlighting functions, and authors could use "ignore" buttons via localStorage -- the API and the Drupal module are only needed to provide a GUI for configuration, and for syncing dismissals.
If you wanted to phone home to the API, to write information to the dashboard and enable the "mark as OK for all users" buttons...well...that there would be a bit of a puzzle to solve for sending that data. I don't know if anything is built into the Next.js module to interact directly with the Drupal JSONAPI; I piggyback the Drupal API and its XSS tokens directly for my API JS. If some method for calling for Drupal tokens is available on the headless pages, this might actually be pretty turnkey -- we'd just need to make sure the decoupled pages have a bit of JS to call my files and provide them with the right config variables.
I can backseat drive this effort if anybody wants to work on it, but I can't volunteer to lead it.
- Status changed to Closed: won't fix
about 1 year ago 7:55pm 5 October 2023