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: Loading initial project data from a designer-mode project results in wrong canvas size #4489

Closed
2 tasks done
contentfree opened this issue Jul 30, 2022 · 4 comments
Closed
2 tasks done

Comments

@contentfree
Copy link
Contributor

GrapesJS version

  • I confirm to use the latest version of GrapesJS

What browser are you using?

Chrome v103

Reproducible demo link

https://codesandbox.io/s/laughing-austin-k12mc3?file=/index.js

Describe the bug

If you view the linked CodeSandbox and find the commented out line providing the projectData to the editor, you will see that the canvas gets resized away from the size specified by the device. In a debugger, it seems that updateDim is called multiple times at initialization: the first time with the correct device size and then again with empty width and height which then leads to the gjs-frame-wrapper's sizing getting removed.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@contentfree
Copy link
Contributor Author

contentfree commented Jul 30, 2022

I can kinda force it to the correct canvas size by:

  1. Not providing projectData in the initial config,
  2. Loading the projectData via editor.loadProjectData(...) after initialization and
  3. Then running editor.Canvas.getModel().updateDevice(); though it animates from the full width back to device size.

It seems that loading the project data happens after the default device is rendered (maybe?) and somehow blows out the current frame, rerendering some default. (I don't know what the default is since I'm only providing a single device config, which appears to be ignored on the second render).

Also, leaving out any one of the three steps above results in the full-width canvas instead of the correct narrow canvas

@artf
Copy link
Member

artf commented Aug 3, 2022

Thanks @contentfree I'll try to fix that for the next release

@artf artf closed this as completed in 7a596db Aug 3, 2022
@contentfree
Copy link
Contributor Author

Thanks @artf. I'll keep my eye open for the next release (looks like your kanban board is empty now … so should be imminent?)

@artf
Copy link
Member

artf commented Aug 4, 2022

I'll probably try to monitor and fix some other bugs before releasing a new version but I guess it might be something around the end of the next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants