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

BUG: Device width is invalid by default #3679

Closed
2 tasks
imouou opened this issue Aug 6, 2021 · 1 comment
Closed
2 tasks

BUG: Device width is invalid by default #3679

imouou opened this issue Aug 6, 2021 · 1 comment

Comments

@imouou
Copy link

imouou commented Aug 6, 2021

Thanks for #3673

I have a new bug feedback.

Version:. 0.17.22

Are you able to reproduce the bug from the demo?

  • [* ] Yes
  • No

What is the expected behavior?
I want the default to be the width of the mobile device, so I configured min-width priority, but only the mobile width is displayed by default on the select box, and the page width has not changed. I use editor.setDevice('Mobile'); Yes, but in the new page management, the new page is also the same, I continue to use this method is invalid, so I think there should be a better way to deal with it.

Describe the bug detailed

What is the current behavior?

Describe the bug detailed

Are you able to attach screenshots, screencasts or a live demo?

  • [* ] Yes (attach)
  • No
var editor = grapesjs.init({
       ...
       mediaCondition: 'min-width',
        
        deviceManager: {
          devices: [{
              name: 'Mobile',
              width: '375px', // this value will be used on canvas width
              widthMedia: '', // this value will be used in CSS @media
          },{
            name: 'Desktop',
            width: '', // default size
            widthMedia: '', // this value will be used in CSS @media
          }]
        },
...
})

2021-08-06 10 29 54

@artf
Copy link
Member

artf commented Aug 13, 2021

Yeah, you're right, actually, there is no option to select the default device...
For now, as a workaround, do it manually after init:

const editor = grapesjs.init({...});
editor.setDevice('Mobile');

And as you're using the mobile-first approach, you would need to fix your Desktop device:

{
  name: 'Desktop',
  width: '', // default size
  widthMedia: '376px', // Tells the editor which media to apply for bigger screens
}

In the next release, I'll add the default option in the device manager configuration

deviceManager: {
          // The device `id` to select on start, if not indicated, the first available from `devices` will be used.
          default: 'Mobile',
          devices: [...],
},

@artf artf closed this as completed in 11610f0 Aug 13, 2021
felixx-kreebox pushed a commit to kreeboxvn/grapesjs that referenced this issue Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants