Motivation
We are supporting node-previews and layout builder previews, but canvas preview routes are not yet supported.
It would be nice to have a full frontend-rendered preview.
(There are no preview routes any more, it moved to a JS-centric solution)
Issue fork lupus_decoupled-3551654
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
fagoComment #3
fagoWorked with AI to figure out some options to implement. Checked those:
1. Canvas extension (sidebar panel)
— A module registers a canvas_extension.yml, extension shows
frontend URL in an iframe within the left sidebar. Problem: Panel is sidebar-sized, not
full-page. Not suiting.
2. Decorate CanvasPreviewRenderer
— Replace server-rendered HTML with an iframe loading the
"}. Problem: Nested iframe (Canvas already puts preview in an iframe). Width dropdown still works though. Might work well.frontend URL or lupus_csr. Returns {"html": "
3. Canvas core: add "preview URL" support
— Canvas learns a new preview mode where the iframe loads an external URL instead of server-rendered HTML. Width dropdown works natively.4. DOM injection hack
— A Drupal JS library on canvas boot routes injects a button next to Preview via DOM manipulation, opens frontend URL in new tab or overlay. We don't want to go there.Comment #4
fagoI quickly tried option 2 - does not work properly since there is no clear way to differentate between preview and editor rendering. Anyway, it#s cleanest to enhance canvas to support it and to propose a patch for it.