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
PageKit: the GrapesJS application you'd have to build anyway
A source-available Next.js app around the open-source GrapesJS core β publishing, custom domains, leads, checkout and a plugin loader.
Tutorial
UnStudio for GrapesJS: 4 Plugins to Build Better Visual Editors
Meet UnStudio, a new GrapesJS plugin studio with four tools, safer and better editor: Command Palette, Responsive Pack, Autosave & Restore, and Autofill
Tutorial
Messaging on gjs.market: talk to a studio before you buy, not after
We've launched private messaging between buyers and studios. One thread per buyerβstudio pair, the whole history in one place.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.