Problem/Motivation
Since #3629497: Render the Canvas in an iframe on the front theme the Canvas renders on the front theme, in an iframe, with the theme's scripts. The Preview beside it, in the split view, now mostly shows the same render at half the width. It still gives three things the Canvas does not: the draft on its pinned page with the theme's regions around it, the output without dropzones, boxes and placeholders, and working links and forms, which the Canvas blocks to select nodes. Visual builders whose editing surface is the real render preview in place, Webflow and Webstudio with a toggle, and the WordPress block editor adds a "Preview in new tab" link. A split view fits tools whose editor is a form, as Sanity's Presentation tool.
Proposed resolution
Replace the split view with a preview mode of the Canvas pane. A toggle in the Canvas header, also on the p shortcut, shows the preview page in a second iframe of the Canvas, with the same viewport and zoom, loaded on the first switch and refreshed only while shown. Editing is off while it shows, and switching back keeps the selection. Next to the toggle, an "Open in new tab" link opens the same page, kept live: the builder page posts on a BroadcastChannel when the preview token changes, and the tab reloads with its scroll kept. The preview island keeps its ID and becomes this control, a pane header island attached to the Canvas, so profiles need no migration, and the Preview island type goes.
Remaining tasks
- Preview mode in the Canvas pane: second iframe, refresh while shown, editing and libraries off, selection kept.
- The
previewisland as the Canvas header toggle and new tab link,pkept. - Live new tab through
BroadcastChannel, scroll kept. - Chrome indicator in the Canvas header, shown in preview mode.
- Remove the split view, the Preview pane and
IslandType::Preview. - Tests, change record.
User interface changes
No split view. The Canvas header gets a preview toggle and an "Open in new tab" link, and p toggles the preview mode instead of the split.
API changes
IslandType::Preview is removed, and the preview island becomes a Floating island attached to the Canvas.
Data model changes
None on the server: the island keeps its ID. The split view's browser storage, splitView, splitRatio and splitCollapsed, is no longer read.
AI Generated: Yes
Issue fork display_builder-3630345
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
pdureau commentedIt is amazing:
It works well:
DaisyUI
Bootstrap
DSFR
There are some little issues:
But nothing serious. My only warning: I feel a little slowness during usage compared to the current 1.0.x. No metric. Maybe it is the current state of my local environment...
I will check again when the MR will be ready.
Comment #3
mogtofu33 commentedYes there is currently performance issues, I am fixing some here and other on a follow up.
A big improvement for some cases is from #3630451: Source labels and prop source lists redo the full lookup on each call and #3630456: SourceValueItem::setValue() walks the whole source tree through its schema on each load.
Comment #4
mogtofu33 commentedComment #6
mogtofu33 commentedComment #7
pdureau commentedCurrently reviewing again, now the MR is created, but I don't see any new commit since yesterday morning.
Comment #8
mogtofu33 commentedAs discussed, performance fixes were on 2 other issue merged and rebased here:
Comment #9
mogtofu33 commentedComment #10
mogtofu33 commentedAnd for the UI Patterns patches, they are pretty relevant on a local automated benchmark:
Server, median ms
Browser, median ms, click to builder idle
Test page style, A column: A2. The first A run started with a shorter history and measured 5030 ms; see the history finding below.
Call counts, xhprof
Taken for D, C, and A on the article and the override builder page.
ContextDefinition::isSatisfiedBy()ContextDefinition::isSatisfiedBy()ContextDefinition::isSatisfiedBy()ContextDefinition::isSatisfiedBy()getChoices()getChoices()ensureNodeIds()ensureNodeIds()The first four rows compare C with D, the effect of !595. The last two compare A with C, the effect of !596.
Verdict
unchanged, select and style -10 to -20%. Test page -6%.
every instance, see below.
in 1.0 s instead of 2.6 s, a style change takes 368 ms instead of 738 ms.
Comment #11
pdureau commentedPerformance
Thanks for the exhaustive metrics.
However, I don't need those to move this ticket to RTBC: The perf is now good enough on my local environment, maybe thanks to #3630609: API controllers save the instance a second time after each change & #3630489: Instance history rewrites every revision to the entity cache after each change
Previous feedback
The other feedback are OK or not blocking:
Except light / dark mode
Emptying the local storage confirm it is OK when both have the same config light / dark / "system/auto".
But the placeholders are not readable
Is it somethign to address here before merging? Or in a dedicated ticket ?
Comment #13
mogtofu33 commentedComment #15
pdureau commented