Custom component not pulling through style on first add.
The thumbnail/image which it puts into the editor should be scaling to fit the container. I'm seeing it at original size on first-load, all subsequent block adds correctly fit whichever column they are dropped into. If you look at the export code, you can also see that the first time you drop a block in, it does not u...
Read full answer below βQuestion
Fiddle replicating the issue: https://jsfiddle.net/gd8mo3e4/1/
I have a custom component for creating a gallery of pdf documents. There's a custom asset manager that opens when the block is dropped into the editor, to allow you to choose the pdf which then changes the thumbnail.
The issue that i'm having is that on a fresh page reload, the first time you drop in a new pdf block, it isn't importing the styles from the model. If you delete it and add in a new block, it does.
You can see this by creating columns, and dropping a pdf block into it.
Answers (3)
The thumbnail/image which it puts into the editor should be scaling to fit the container. I'm seeing it at original size on first-load, all subsequent block adds correctly fit whichever column they are dropped into. If you look at the export code, you can also see that the first time you drop a blo...
A couple of screenshots demonstrating the behaviour I'm seeing... <img width="1021" alt="Screen Shot 2019-11-06 at 11 32 16" src="https://user-images.githubusercontent.com/19346508/68294968-394ba600-0089-11ea-941a-e441d3469c6f.png"> <img width="1003" alt="Screen Shot 2019-11-06 at 11 32 33" src="ht...
i guess this is related to this one and probably this one @artf mmm not really Changing modelThumbElement.setAttributes({"data-gallery":fileName}); to use addAttributes seems to fix it, but I'm not sure what is really happening (I'd expect the "wrong" behavior all the time, not only the first time)...
Related Questions and Answers
Continue research with similar issue discussions.
Issue #2211
[QUESTIONS] How to set style for pseudo elements (:after and :before)
Hi, I add STATE in style manager :before and :after but all the styles are applied to the component.
Issue #1860
[Bug] Enabling full size dropzone opens asset modal every time you drop a block onto the canvas.
I think what might be happening is that it's not checked if it's really an image that is being dropped onto the canvas? See these 2 links f...
Issue #1614
[Bug]: adding css variables as style manager property
trying to add css variable to style manager causing error: Uncaught TypeError: Cannot read property 'toUpperCase' of undefined fiddle Am i...
Issue #391
Namespace CSS?
Hi there, Is there a way to setup the grapesjs editor such that the CSS generated for the HTML content is namespaced? In other words, how t...
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 βBrowse Plugin Categories
Jump directly to plugin category pages on the marketplace.