Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Fix live preview area
Matthew Kennedybb90c1662a34
diff --git a/backend/app/assets/stylesheets/spree/backend/views/_cms_pages.scss b/backend/app/assets/stylesheets/spree/backend/views/_cms_pages.scssindex f2cf39c2ea..d25cc6ac5a 100644--- a/backend/app/assets/stylesheets/spree/backend/views/_cms_pages.scss+++ b/backend/app/assets/stylesheets/spree/backend/views/_cms_pages.scss@@ -57,29 +57,35 @@ button#cmsSectionEditorFullScreen {}}-body[data-sections-editor-full-screen] {- .hide-on-full-screen-mode {- display: none;- }+@include media-breakpoint-up(md) {+ body[data-sections-editor-full-screen] {+ .hide-on-full-screen-mode {+ display: none;+ }- #pageSectionsArea {- position: fixed;- top: 0;- left: 0;- z-index: 9999;- background: white;- padding: 15px 15px 0 15px;- height: 100vh;-- #cmsPagesectionsArea {- max-height: 90vh;+ #pageSectionsArea {+ position: fixed;+ top: 0;+ left: 0;+ z-index: 9999;+ background: white;+ padding: 15px 15px 0 15px;+ height: 100vh;++ #cmsPagesectionsArea {+ max-height: 90vh;+ }++ .embed-responsive-4by3 {+ height: 90vh;+ }}- .embed-responsive-4by3 {- height: 90vh;+ #draggableSectionsHolder {+ max-width: 350px;}- }- }+ }+}#pageLivePreview {transform-origin: top left;@@ -88,8 +94,13 @@ body[data-sections-editor-full-screen] {.desktopLiveView {#pageLivePreview {width: 200%;- height: 200%;- transform: scale(0.5);+ height:200%;+ top: 0%;+ left: 50%;+ bottom: 0%;+ right: 50%;+ transform: scale(0.5) translate(-50%);+ max-width: 2600px;}}@@ -97,8 +108,13 @@ body[data-sections-editor-full-screen] {#pageLivePreview {width: 85%;height: 133%;- transform: scale(0.75);- left: 19%;+ top: 0%;+ left: 50%;+ bottom: 0%;+ right: 50%;+ transform: scale(0.75) translate(-50%);+ max-width: 991px;+ min-width: 768px;}}@@ -106,22 +122,12 @@ body[data-sections-editor-full-screen] {#pageLivePreview {width: 60%;height: 133%;- transform: scale(0.75);- left: 28%;+ top: 0%;+ left: 50%;+ bottom: 0%;+ right: 50%;+ transform: scale(0.75) translate(-50%);+ max-width: 767px;+ min-width: 375px;}}--// ToDo: Fix zoom state on difrent screen sizes-// To get optimal use from the Live Editor Preview.-// Bootstrap media break points are not going to be suitable as-// it is in frame in a screen.-// @include media-breakpoint-up(lg) {-// .desktopLiveView {-// #pageLivePreview {-// width: 125%;-// height: 100%;-// transform: scale(0.75);--// }-// }-// }diff --git a/backend/app/views/spree/admin/cms_pages/_live_preview_area.html.erb b/backend/app/views/spree/admin/cms_pages/_live_preview_area.html.erbnew file mode 100644index 0000000000..cb2d9cc94e--- /dev/null+++ b/backend/app/views/spree/admin/cms_pages/_live_preview_area.html.erb@@ -0,0 +1,61 @@+ <div class="row">+ <div id="pageSectionsArea" class="col-12">++ <hr class="mt-4 hide-on-full-screen-mode">+ <div class="row">+ <div class="col d-flex justify-content-start">+ <%= button_link_to Spree.t('admin.cms.add_new_section'), spree.new_admin_cms_page_cms_section_path(@cms_page), icon: 'add.svg', class: 'no-wrap btn btn-success align-self-center' %>+ </div>+ <div class="col d-none d-md-flex justify-content-end">+ <div id="LiveViewSwitcher" class="btn-group btn-group-toggle" data-toggle="buttons">+ <label class="btn btn-outline-primary active">+ <input type="radio" name="options" id="mobileLiveView" autocomplete="off"> Mobile+ </label>+ <label class="btn btn-outline-primary">+ <input type="radio" name="options" id="tabletLiveView" autocomplete="off"> Tablet+ </label>+ <label class="btn btn-outline-primary">+ <input type="radio" name="options" id="desktopLiveView" autocomplete="off" checked> Desktop+ </label>+ </div>++ <div class="ml-2">+ <button id="cmsSectionEditorFullScreen" type="button" class="btn btn-outline-primary no-wrap" data-toggle="button" autocomplete="off"><%= raw Spree.t('admin.cms.full_screen_mode') %></button>+ </div>+ </div>+ </div>+ <div class="row no-gutters">+ <div id="draggableSectionsHolder" class="col-12 col-md-3 bg-light border">+ <% if @cms_page.cms_sections.any? %>+ <div id="cmsPagesectionsArea" class="card-body row m-0 p-1 no-gutters">+ <% @cms_page.cms_sections.each do |section| %>+ <%= render 'spree/admin/cms_pages/section_template', section: section %>+ <% end %>+ </div>++ <% else %>+ <div class="row">+ <div class="col-12">+ <div class="alert alert-info no-objects-found m-4">+ <%= raw Spree.t('admin.cms.no_sections_found_please_add_one') %>+ </div>+ </div>+ </div>+ <% end %>+ </div>++ <div class="d-none d-md-block col bg-secondary border border-left-0">+ <div id="liveViewCont" class="desktopLiveView">+ <div class="embed-responsive embed-responsive-4by3">+ <iframe class="embed-responsive-item"+ id="pageLivePreview"+ src="<%= preview_url(@cms_page) %>"+ sandbox="allow-same-origin allow-forms allow-popups allow-scripts allow-modals">+ </iframe>+ </div>+ </div>+ </div>++ </div>+ </div>+ </div>