How to control the height of the editor dynamically to avoid clunky scrolling
try to work with vh instead of px. eg: give the editor height: '80vh', your navbar height: '20vh'. This way, the vertical scroll will never be shown or needed as long as the sum of all elements's vh β€ 100 Hope this helps.
Read full answer below βQuestion
I've noticed if in the initialise function I set a height it will set based on a specific pixel amount e.g. height: "500px". However if you try to set with a percentage e.g. height: "90%" the editor has no height at all. Also I'm wondering what is setting the height if nothing is set because it appears to be automatically calculating a pixel amount that consumes the entire page (e.g. 100%). I actually have the editor wrapped inside a standard page template we have in the back-end of our CMS, and this page template actually has more content in side menu bars which forces the page to become a s...
Answers (4)
try to work with vh instead of px.
eg: give the editor height: '80vh', your navbar height: '20vh'. This way, the vertical scroll will never be shown or needed as long as the sum of all elements's vh β€ 100
Hope this helps.
try to work with
vhinstead ofpx.eg: give the editor
height: '80vh', your navbarheight: '20vh'. This way, the vertical scroll will never be shown or needed as long as the sum of all elements'svhβ€ 100Hope this helps.
thanks this is useful!
This is more a layout issue and not related to the GrapesJS editor itself.
Thanks for reporting this, @samichamoun. Great suggestion about How to control the height of the editor dynamically to avoid clunky scrolling! While this specific feature isn't yet in the core API, there are several ways to achieve similar behavior. Using the event system: Alternative approaches: L...
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3558
Support Content-Security-Policy
To reduce the possible attack surface if the editor is used in "hostile" environments (e.g. in SaaS platforms) support for CSP is required....
Issue #3269
Translating html string
Great library! It meets all the requirements but one: website text translation. I've searched high and low through the issue queue and docs...
Issue #4250
Init() method typings error
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome v 100.0.4896.75 Reproducible demo l...
Issue #3194
How do I repurpose the Spectrum Color Picker?
I would like to repurpose the color picker used in GrapesJS. I have to use a color picker for some project level settings. These settings a...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins βPremium plugins ship with support, regular updates, and production-ready features β save days of integration work.
Browse premium plugins βRelated tutorials
In-depth guides on the same topic.
Tutorial
GrapesJS DevTools: A Developer Panel Inside Your Editor
If you've ever debugged GrapesJS with console.log(editor.getSelected()) and a dozen throwaway event listeners β this post is for you.
Tutorial
How to Build a Production GrapesJS Editor: The Complete Walkthrough of Brief, Preset, Plugins, and Services
A complete walkthrough of building a production GrapesJS editor: how to choose a preset, pick plugins, and scope setup services without burning a sprint.
Tutorial
Big Updates: TinyMCE 8 and Placeholder 2.0 for GrapesJS
In May we shipped major updates to two of our most popular GrapesJS plugins β TinyMCE Inline Text Editor and Placeholder.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.