Fixed Responsive Sizes issues - 414px is not really 414 because of scrollbars.
This commit is contained in:
@@ -16,7 +16,10 @@
|
|||||||
previewFrameUrl: '{{ previewFrameUrl }}',
|
previewFrameUrl: '{{ previewFrameUrl }}',
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<div class="preview">
|
||||||
<iframe id="preview_frame" src="{{ previewFrameUrl }}" class="breakpoint"></iframe>
|
<iframe id="preview_frame" src="{{ previewFrameUrl }}" class="breakpoint"></iframe>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script src="/scripts/dist/index.min.js"></script>
|
<script src="/scripts/dist/index.min.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
<script src="/scripts/frame-index.js"></script>
|
||||||
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
|
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
|
||||||
<script src="https://unpkg.com/swiper@8/swiper-bundle.min.js"></script>{{#if config.jsUrl }}
|
<script src="https://unpkg.com/swiper@8/swiper-bundle.min.js"></script>{{#if config.jsUrl }}
|
||||||
{{#each config.jsUrl }}<script src="{{ this }}"></script>
|
{{#each config.jsUrl }}<script src="{{ this }}"></script>
|
||||||
|
|||||||
Vendored
+15
-6
@@ -9486,8 +9486,7 @@ function Responsive(props = {}) {
|
|||||||
function updateController() {
|
function updateController() {
|
||||||
let frameBreakpoint = breakpoint;
|
let frameBreakpoint = breakpoint;
|
||||||
if (typeof frameBreakpoint !== 'string') {
|
if (typeof frameBreakpoint !== 'string') {
|
||||||
const browserGap = 17; // Scrollbars + Borders
|
frameBreakpoint = frameBreakpoint + 'px';
|
||||||
frameBreakpoint = frameBreakpoint + browserGap + 'px';
|
|
||||||
}
|
}
|
||||||
previewFrame.style.setProperty('--breakpoint', frameBreakpoint);
|
previewFrame.style.setProperty('--breakpoint', frameBreakpoint);
|
||||||
previewFrame.classList.add('has-breakpoint');
|
previewFrame.classList.add('has-breakpoint');
|
||||||
@@ -9687,10 +9686,10 @@ const PreviewButtonStyle = qe.button`
|
|||||||
`;
|
`;
|
||||||
const PreviewStyle = qe.div`
|
const PreviewStyle = qe.div`
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 3rem;
|
top: calc(var(--top_panel_height) - 2px);
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 14px; // Scrollbars
|
||||||
|
|
||||||
background-color: rgba(0, 0, 0, 0.1);
|
background-color: rgba(0, 0, 0, 0.1);
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -9857,7 +9856,8 @@ function DesignPreview({
|
|||||||
if (!previewOption) {
|
if (!previewOption) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return window.innerWidth / 2 - previewOption.widthDimension / 2;
|
const scrollbarOffset = 7;
|
||||||
|
return window.innerWidth / 2 - previewOption.widthDimension / 2 - scrollbarOffset;
|
||||||
}
|
}
|
||||||
function responsiveModeChangesHandler(e) {
|
function responsiveModeChangesHandler(e) {
|
||||||
if (e.data !== 'responsiveUpdate') {
|
if (e.data !== 'responsiveUpdate') {
|
||||||
@@ -10000,10 +10000,19 @@ function setupDataOptions(rootAttributes) {
|
|||||||
root.render(html);
|
root.render(html);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const previewFrame = document.getElementById('preview_frame');
|
||||||
const rootAttributes = {
|
const rootAttributes = {
|
||||||
previewFrame: document.getElementById('preview_frame')
|
previewFrame
|
||||||
};
|
};
|
||||||
setupResponsiveness(rootAttributes);
|
setupResponsiveness(rootAttributes);
|
||||||
setupDataOptions(rootAttributes);
|
setupDataOptions(rootAttributes);
|
||||||
setupPublish(rootAttributes);
|
setupPublish(rootAttributes);
|
||||||
|
window.addEventListener('message', function (e) {
|
||||||
|
const RESIZE_CODE = 'resize:';
|
||||||
|
if (typeof e.data !== 'string' || !e.data.startsWith(RESIZE_CODE)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const data = JSON.parse(e.data.substring(RESIZE_CODE.length));
|
||||||
|
previewFrame.style.height = data.height + 'px';
|
||||||
|
});
|
||||||
//# sourceMappingURL=index.min.js.map
|
//# sourceMappingURL=index.min.js.map
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -0,0 +1,16 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
setupResizeListener();
|
||||||
|
|
||||||
|
///
|
||||||
|
|
||||||
|
function setupResizeListener() {
|
||||||
|
const RESIZE_CODE = 'resize:';
|
||||||
|
|
||||||
|
const resizeObserver = new ResizeObserver(entries => {
|
||||||
|
const height = document.body.offsetHeight;
|
||||||
|
window.parent.postMessage(RESIZE_CODE + JSON.stringify({height}), '*');
|
||||||
|
})
|
||||||
|
|
||||||
|
resizeObserver.observe(document.body);
|
||||||
|
}
|
||||||
@@ -4,10 +4,21 @@ import {setupResponsiveness} from './toolbar/responsive.jsx';
|
|||||||
import {setupPublish} from "./toolbar/publish.jsx";
|
import {setupPublish} from "./toolbar/publish.jsx";
|
||||||
import {setupDataOptions} from "./toolbar/data-options/DataOptions.jsx";
|
import {setupDataOptions} from "./toolbar/data-options/DataOptions.jsx";
|
||||||
|
|
||||||
|
const previewFrame = document.getElementById('preview_frame');
|
||||||
const rootAttributes = {
|
const rootAttributes = {
|
||||||
previewFrame: document.getElementById('preview_frame'),
|
previewFrame,
|
||||||
}
|
}
|
||||||
|
|
||||||
setupResponsiveness(rootAttributes);
|
setupResponsiveness(rootAttributes);
|
||||||
setupDataOptions(rootAttributes);
|
setupDataOptions(rootAttributes);
|
||||||
setupPublish(rootAttributes)
|
setupPublish(rootAttributes)
|
||||||
|
|
||||||
|
window.addEventListener('message', function (e) {
|
||||||
|
const RESIZE_CODE = 'resize:';
|
||||||
|
if (typeof e.data !== 'string' || !e.data.startsWith(RESIZE_CODE)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = JSON.parse(e.data.substring(RESIZE_CODE.length))
|
||||||
|
previewFrame.style.height = data.height + 'px';
|
||||||
|
});
|
||||||
|
|||||||
@@ -130,7 +130,8 @@ export function DesignPreview({previewOption = {widthDimension: 0}}) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return window.innerWidth / 2 - previewOption.widthDimension / 2;
|
const scrollbarOffset = 7;
|
||||||
|
return window.innerWidth / 2 - previewOption.widthDimension / 2 - scrollbarOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
function responsiveModeChangesHandler(e) {
|
function responsiveModeChangesHandler(e) {
|
||||||
|
|||||||
@@ -30,10 +30,10 @@ export const PreviewButtonStyle = styled.button`
|
|||||||
|
|
||||||
export const PreviewStyle = styled.div`
|
export const PreviewStyle = styled.div`
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 3rem;
|
top: calc(var(--top_panel_height) - 2px);
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 14px; // Scrollbars
|
||||||
|
|
||||||
background-color: rgba(0, 0, 0, 0.1);
|
background-color: rgba(0, 0, 0, 0.1);
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -65,8 +65,7 @@ function Responsive(props = {}) {
|
|||||||
function updateController() {
|
function updateController() {
|
||||||
let frameBreakpoint = breakpoint;
|
let frameBreakpoint = breakpoint;
|
||||||
if (typeof frameBreakpoint !== 'string') {
|
if (typeof frameBreakpoint !== 'string') {
|
||||||
const browserGap = 17; // Scrollbars + Borders
|
frameBreakpoint = frameBreakpoint + 'px';
|
||||||
frameBreakpoint = (frameBreakpoint + browserGap) + 'px';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
previewFrame.style.setProperty('--breakpoint', frameBreakpoint);
|
previewFrame.style.setProperty('--breakpoint', frameBreakpoint);
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
.preview {
|
||||||
|
overflow-y: scroll;
|
||||||
|
height: calc(100% - var(--top_panel_height));
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
#preview_frame {
|
#preview_frame {
|
||||||
display: block;
|
display: block;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
@@ -7,10 +13,11 @@
|
|||||||
--breakpoint_top_spacing: 30px;
|
--breakpoint_top_spacing: 30px;
|
||||||
|
|
||||||
margin-top: var(--top_spacing);
|
margin-top: var(--top_spacing);
|
||||||
height: calc(100% - var(--top_panel_height) - var(--top_spacing));
|
height: 100%;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
|
|
||||||
border: 1px solid #E2E8F0;
|
border: 0;
|
||||||
|
outline: 1px solid #E2E8F0;
|
||||||
|
|
||||||
transition: max-width .3s ease-in-out, width .3s ease-in-out, margin-top .3s ease-in-out;
|
transition: max-width .3s ease-in-out, width .3s ease-in-out, margin-top .3s ease-in-out;
|
||||||
|
|
||||||
@@ -19,7 +26,6 @@
|
|||||||
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: var(--breakpoint);
|
max-width: var(--breakpoint);
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -56,6 +56,8 @@ body {
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
}
|
}
|
||||||
.page_toolbar__middle {
|
.page_toolbar__middle {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -104,6 +106,12 @@ body {
|
|||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.preview {
|
||||||
|
overflow-y: scroll;
|
||||||
|
height: calc(100% - var(--top_panel_height));
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
#preview_frame {
|
#preview_frame {
|
||||||
display: block;
|
display: block;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
@@ -111,16 +119,16 @@ body {
|
|||||||
--top_spacing: 0px;
|
--top_spacing: 0px;
|
||||||
--breakpoint_top_spacing: 30px;
|
--breakpoint_top_spacing: 30px;
|
||||||
margin-top: var(--top_spacing);
|
margin-top: var(--top_spacing);
|
||||||
height: calc(100% - var(--top_panel_height) - var(--top_spacing));
|
height: 100%;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
border: 1px solid #E2E8F0;
|
border: 0;
|
||||||
|
outline: 1px solid #E2E8F0;
|
||||||
transition: max-width 0.3s ease-in-out, width 0.3s ease-in-out, margin-top 0.3s ease-in-out;
|
transition: max-width 0.3s ease-in-out, width 0.3s ease-in-out, margin-top 0.3s ease-in-out;
|
||||||
}
|
}
|
||||||
#preview_frame.has-breakpoint {
|
#preview_frame.has-breakpoint {
|
||||||
--breakpoint: 100%;
|
--breakpoint: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: var(--breakpoint);
|
max-width: var(--breakpoint);
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.open_in_new_tab {
|
.open_in_new_tab {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"sourceRoot":"","sources":["page--main.scss","_buttons.scss","_overlay.scss","_page--breakpoints.scss"],"names":[],"mappings":"AAAA;EACE;EACA;;;AAGF;EACE;EACA;EAEA;;;ACTF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAGF;EACE;EACA;;;ACtBJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AFIF;EACE;EACA;EAEA;EACA;EACA;EAEA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;;AAEA;EACE;;AAEA;EAHF;IAII;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAKF;EADF;IAEI;;;AAKN;EAEE;EACA;EACA;EACA;;AAGF;EACE;;;AG7EJ;EACE;EACA;EACA;EAEA;EACA;EAEA;EACA;EACA;EAEA;EAEA;;AAEA;EACE;EAEA;EACA;EACA;;;AH+DJ;EACE;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA","file":"page--main.css"}
|
{"version":3,"sourceRoot":"","sources":["page--main.scss","_buttons.scss","_overlay.scss","_page--preview.scss"],"names":[],"mappings":"AAAA;EACE;EACA;;;AAGF;EACE;EACA;EAEA;;;ACTF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAGF;EACE;EACA;;;ACtBJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AFIF;EACE;EACA;EAEA;EACA;EACA;EAEA;EACA;EACA;EAEA;EACA;;AAEA;EACE;EACA;EACA;EACA;;AAEA;EACE;;AAEA;EAHF;IAII;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAKF;EADF;IAEI;;;AAKN;EAEE;EACA;EACA;EACA;;AAGF;EACE;;;AGhFJ;EACE;EACA;EACA;;;AAGF;EACE;EACA;EACA;EAEA;EACA;EAEA;EACA;EACA;EAEA;EACA;EAEA;;AAEA;EACE;EAEA;EACA;;;AH4DJ;EACE;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA","file":"page--main.css"}
|
||||||
@@ -25,6 +25,9 @@ body {
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
|
||||||
&__middle {
|
&__middle {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@@ -80,7 +83,7 @@ body {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@import "page--breakpoints";
|
@import "page--preview";
|
||||||
|
|
||||||
.open_in_new_tab {
|
.open_in_new_tab {
|
||||||
--size: 1.5rem;
|
--size: 1.5rem;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
overflow-y: scroll;
|
overflow-y: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
main {
|
main {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
overflow-y: scroll;
|
overflow-y: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
main {
|
main {
|
||||||
|
|||||||
Reference in New Issue
Block a user