Issue #905Opened February 27, 2018by konstantin550000 reactions

[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)

konstantin55000February 27, 20180 reactions

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

artfMarch 2, 20180 reactions

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'));
}
lock[bot]September 17, 20190 reactions

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.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.