Issue #2396Opened November 11, 2019by naveen-156973 reactions

Can't select the model using editor.select()

Question

I am trying to select the first component in the editor by using editor.select(editor.DomComponents.getComponents().models[0]). It is not working.

Answers (3)

naveen-15697November 11, 20191 reactions

@artf , @pouyamiralayi :I need this condition inside the 'canvas:drop' event editor.on('canvas:drop', ()=>{ ... ... // My code to select the first component is here //... ... })

pouyamiralayiNovember 11, 20191 reactions

@naveen-15697 you can achieve this with:

editor.on('block:drag:stop', (m) => {
    if(m){
       editor.select(editor.getComponents().models[0])
    }
})

cheers!

naveen-15697November 11, 20191 reactions

@pouyamiralayi Thanks! It's working now.

@artf , But, Why it is not working in 'canvas:drop' event?

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.