Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Layout: Add design layout focus and preview updaters #4140

Closed
wants to merge 6 commits into from

Conversation

sirbrillig
Copy link
Member

Relies on #4136 being merged first.

To quote @mtias from #4019 where much of this code originates:

This PR creates a new layoutFocus area called "design". We can then set focus from anywhere in the app as easily as layoutFocus.set( 'design' ) and design tools will slide in and the preview appear.

When the design layout is active, two panels appear and cover up the rest of the Calypso UI: DesignMenu (as a sidebar) and DesignPreview as a main area.

  • DesignMenu is currently empty but can contain design tools to update the preview.
  • DesignPreview is a wrapper for WebPreview that allows for customizations to be applied to the DOM of the preview iframe.

When the customizations prop in DesignPreview is set to an object, that object will be passed through a series of functions called "updaters" to update the iframe's content. Those functions are defined in client/lib/design-preview. Each one will be passed two arguments whenever the customizations prop is changed:

  1. The document object of the iframe.
  2. The current value of customizations.

The customizations object and the previewMarkup used by the preview will be stored in the Redux state tree, but that is in a separate PR (#4153).

This PR does not create any design tools by default, only sets the stage for them to be created. Nor does it activate the new layout focus anywhere in Calypso yet (that's in #4156).

Also, the new layout is only available if the config feature flag design-layout is enabled, which is only true in development right now.

@sirbrillig sirbrillig self-assigned this Mar 17, 2016
@sirbrillig sirbrillig added Framework [Status] In Progress [Feature] Customizer The site customizer for traditional, non-block themes. labels Mar 17, 2016
@sirbrillig sirbrillig force-pushed the add/design-layout-focus branch from 1ebfaea to d76d286 Compare March 17, 2016 23:34
@sirbrillig sirbrillig force-pushed the add/design-layout-focus branch 4 times, most recently from 1b2b1b8 to 5290920 Compare March 18, 2016 15:40
@sirbrillig sirbrillig force-pushed the add/design-layout-focus branch from 8f20f75 to 37fcb1e Compare March 18, 2016 17:20
@sirbrillig sirbrillig force-pushed the add/design-layout-focus branch 2 times, most recently from 5e7ce01 to 4efe679 Compare March 21, 2016 21:08
@sirbrillig sirbrillig added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] In Progress labels Mar 21, 2016
@sirbrillig
Copy link
Member Author

Ping @mtias if you have a moment.

}
)( Layout );
function mapStateToProps( state ) {
const { isLoading, section, hasSidebar, isFullScreen, chunkName } = state.ui;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is introducing changes that we have removed (hasSidebar, chunkName, etc).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, thanks! Those must have been left over from my old branch. I think I'll just revert this chunk anyway, since I'm not actually using it in this PR.

@mtias mtias added [Status] Needs Author Reply and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Mar 22, 2016
sirbrillig and others added 4 commits March 22, 2016 11:35
It will be visible whenever layoutFocus is set to `design`.

DesignPreview is a wrapper for WebPreview that allows for customizations to be
applied to the DOM of the preview iframe.

When the `customizations` prop is set to an object, that object will be passed
through a series of functions to update the iframe's contents. Those functions
are defined in `client/lib/design-preview`. Each one will be passed two
arguments whenever the `customizations` prop is changed:

1. The document object of the iframe.
2. The current value of `customizations`.
Add "back" link to sidebar following sites and editor convention.
@sirbrillig sirbrillig force-pushed the add/design-layout-focus branch from 4efe679 to 37acfc5 Compare March 22, 2016 15:36
@sirbrillig
Copy link
Member Author

Rebased to move the undocumented endpoint to the next PR (which adds actions) and clean up the DesignPreview element (moving it to /my-sites and removing unused changes).

@sirbrillig sirbrillig force-pushed the add/design-layout-focus branch from 37acfc5 to f6efc27 Compare March 22, 2016 15:41
@sirbrillig
Copy link
Member Author

To test, hook the 'customize' button in the my-sites sidebar to activate the new layout:

git cherry-pick 44ba593

Then click the button and see if the design preview and design menu become visible. The preview will not load anything because there is no markup being passed.

@sirbrillig sirbrillig added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] Needs Author Reply labels Mar 22, 2016
@sirbrillig sirbrillig changed the title Layout: Add design layout focus Layout: Add design layout focus and preview updaters Mar 22, 2016
@mcsf mcsf mentioned this pull request Apr 4, 2016
6 tasks
@sirbrillig
Copy link
Member Author

Setting to in-progress as some things have changed (current active development is in #4429)

@sirbrillig sirbrillig added [Status] In Progress and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Apr 11, 2016
@sirbrillig sirbrillig closed this May 20, 2016
@sirbrillig sirbrillig reopened this May 20, 2016
@sirbrillig sirbrillig closed this May 20, 2016
@sirbrillig sirbrillig deleted the add/design-layout-focus branch May 20, 2016 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Customizer The site customizer for traditional, non-block themes. Framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants