Issue #2770✓ SolvedOpened May 13, 2020by tiptronic855 reactions

Set selected element

Quick answerby Mohsen-Khakbiz3

I think this should work

Read full answer below ↓

Question

Hello, is there a way to select an element after added to the body? When i add a link, i want to open the Component Settings immediately.

How can i do it ?

Thank you in advance

Answers (2)

👍 Most helpfulMohsen-KhakbizMay 13, 2020

I think this should work

editor.on('component:mount', function(model) {
	editor.select(model);
	const openBl = editor.Panels.getButton('views', 'open-tm');
	openBl && openBl.set('active', 1)
});
tiptronic85May 14, 2020

It works, thank you a lot. I add the code only for links and button and it is perfect.

if model.is('link')

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...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

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.