Skip to content

Commit

Permalink
Pass breakpoints config to Previewer component
Browse files Browse the repository at this point in the history
  • Loading branch information
florrie-90 authored and ifox committed Aug 5, 2023
1 parent 5429a2f commit 88ec426
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions frontend/js/components/Previewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,15 @@
components: {
'a17-iframe': A17PreviewerFrame
},
props: ['breakpointsConfig'],
data: function () {
return {
loadedCurrent: false,
slipScreen: false,
activeBreakpoint: 1280,
lastActiveBreakpoint: 1280,
scrollPosition: 0,
breakpoints: [
breakpoints: this.breakpointsConfig || [
{
size: 1280,
name: 'preview-desktop'
Expand Down Expand Up @@ -115,11 +116,12 @@
methods: {
open: function (previewId = 0) {
const self = this
const desktopWidth = this.breakpoints.find(item => item.name === 'preview-desktop').size
// reset previewer state
this.loadedCurrent = false
this.activeBreakpoint = 1280
this.lastActiveBreakpoint = 1280
this.activeBreakpoint = desktopWidth || 1280
this.lastActiveBreakpoint = desktopWidth || 1280
function initPreview () {
if (self.$refs.overlay) self.$refs.overlay.open()
Expand Down
2 changes: 1 addition & 1 deletion views/layouts/form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
</a17-modal>
<a17-editor v-if="editor" ref="editor"
bg-color="{{ config('twill.block_editor.background_color') ?? '#FFFFFF' }}"></a17-editor>
<a17-previewer ref="preview"></a17-previewer>
<a17-previewer ref="preview" :breakpoints-config="{{ json_encode(config('twill.preview.breakpoints')) }}"></a17-previewer>
<a17-dialog ref="warningContentEditor" modal-title="{{ twillTrans('twill::lang.form.dialogs.delete.title') }}"
confirm-label="{{ twillTrans('twill::lang.form.dialogs.delete.confirm') }}">
<p class="modal--tiny-title">
Expand Down

0 comments on commit 88ec426

Please sign in to comment.