Hi, I built a component and block that I can drag and drop in the canvas. My issue is that some styles rely on the ID. I know this might not be ideal, but it's like this at the moment. My problem is when I reload the editor with my previous values by passing it in the components prop, all my ID's are changed. Is there...
artf
@simplecommerce new release published
simplecommerce
Anyone have any idea for this issue? My issue happens when I use for example, bootstrap tabs, in order to make them work and load the right tab, it uses the ID, but since the ID is being regenerated when I load the editor with my component...
sbiwaichoon
same issue here.if i have use that id in code, id change when(id-2) reload template to grapejs (auto added "-2" to my id) , if i dont use that id in any part of my code, is fine, id wont change
Hi, I just had a quick question because I could not figure out how to do it or did not find an issue related to it. I am just trying to call a function when any changes is done on the canvas. For example, I am adding a block or removing a block. I am changing the attributes using the style manager. Or drag and droppin...
a-bashtannik
@simplecommerce , try also this, maybe fit better for you
arthuralmeidap
The way you did is the simplest way to achieve that in my opinion.
arthuralmeidap
What do you want to achieve at the end? You could use something like editor.on('all', () => //your code here ); but this is not practical at all. there are many events being triggered by GrapesJS and I don't think this will suit your needs.
I'm trying to add multiple components which are in my canvas into the block manager but I believe because of an id issue they're not visible properly. What exactly does the id refer to? Here's my code:
WebEtSolutions
Hi, Your LinkedIn sign-in id is the same that your GooglePlus sign-in. The key of block must be unique. Bye
arthuralmeidap
The id is used internally to track each block individually. As @WebEtSolutions said you should put unique identifiers to each new block
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 for minimal repro versions. https://codesandbox.io/s/jlqpl2kj95 (dropzone set to 1, just drop any block onto the canvas and the asset modal will open) https://codesandbox.io/s/k2roq...
I'd like to do something like this. so once a user drops the test component into the canvas, I'd like to open up asset manager modal where you can upload an image by running 'open-assets' command. Thank you very much Artur
NicoEngler
To achieve this, you can listen to the drag event of the editor:
SeongwoonHong
@NicoEngler Thank you for reply! although, I'm not sure how to insert an image from image modal into the link-block component if i do this, nothing happens even after i select an image from the modal @artf Is there any way to do that? Plus...
NicoEngler
I´m afraid I can't assist further without playing around with the code myself. Though I can help debugging if you shoot up an example on codepen or similar.
I had been using editor events and I noticed that component:mount event fires multiple times when a component is dragged from blocks to canvas, you can confirm it in your JSFiddle Starter.
artf
@ateebahmed please don't open issues like this. Follow the template
ateebahmed
okay will reopen it
lock[bot]
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
I want to select my component whenever it is dragged from blocks to canvas and rendered, I have tried with registering events on component:add, component:mount and calling editor.select(component), passing the component I get from callback, but it is not properly initialize or has properties missing, like its type is...
I am using editor's events to get component after some action like component:add, block:drag:stop, but in both events I can't get my component that I dragged on canvas. when I call component.is('my-component-type'), it gives false, I need to perform actions based on its type, which I can't when I get that from event's...
artf
You're doing something wrong, works as expected here https://jsfiddle.net/nfkha41p/ Next time, create a reproducible demo first, then open an issue...
ateebahmed
Actually I can't produce it with built-in components but I'm using a custom component which extends default text component, will paste the code as I could not find which property to set to get the component type, although I had set type: '...
naveen-15697
You're doing something wrong, works as expected here https://jsfiddle.net/nfkha41p/Next time, create a reproducible demo first, then open an issue... @artf Here, when I drag a first component, I get three alerts. But I need only the parent...
Hello, I have used changesCount to resizeEditor if any change occurs to the canvas. But when I select any element in canvas like, clicking any div in canvas increases changesCount so the editor resizes it. So, I want to disable changesCount on selecting any element, it should only increase its count when some change i...
artf
No, you can't disable it
lock[bot]
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.