[Question] need to find nessesary event.
Question
Hello to all!
When dragging block into canvas, and drop it: ... we have an event to detect, what block we drop in.
editor.on('block:drag:stop', function(currentBlock) {
console.log('all good, currentBlock);
}
?: but when i drop block text, into form, (otherwords i nest one block into other) how can i detect : *into what specific block * nesting occurs?. What event is specified to detect such component. I've tried events canvas:dragenter and canvas:drop, but they dont bubbles , when drop component on canvas.
Thank you to all community , who helping with!
ps: somehow that events are never occurs
editor.on('canvas:dragenter', function(dt, currentComp) {
console.log('canvas dragenter', dt, currentComp);
});
editor.on('canvas:drop', function(dt, currentComp) {
console.log('canvas drop: ',dt, currentComp);
});
Answers (3)
If need to explaine more, about situation, please write. here i've tried to describe on video https://www.screencast.com/t/V2mGBFXp so when text dropping into form, i need event, to detect component form
Hi Konstantin, first of all, canvas:* events were introduced from the https://github.com/artf/grapesjs/releases/tag/v0.13.5 by using HTML5 D&D and from your screencast seems like you're not using it.
BTW what about checking the parent element from the current one
editor.on('block:drag:stop', droppedComponent => {
console.log('Am I inside the form?', droppedComponent.closest('form'));
}
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.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1617
[Question] How can I stop the drop from block:drag:start event? Also is there any event to listen Invalid target position?
First of all, I really appreciate your replies on my questions. Thank you for all. Question 1 : I've a situation where if a particular bloc...
Issue #1875
[QUESTION] ID changes when importing html or passing html in components prop in config.
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 no...
Issue #816
[QUESTION] Adds image block trough Editor API
Hi @artf , When I drag and drop a Image block within the canvas it triggers the active event for the image block thats runs the openModal m...
Issue #909
[Question] [Possible issue] events are not fire on canvas drag and drop.
Hello to everybody. The issue is: Events, just are not fire, after dragging on (into) canvas. editor.on('canvas:dragover') editor.on('canva...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.