[QUESTION] Set selected element
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)
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)
});
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.
Issue #4335
BUG: No way to upload background video component in the editor , Please suggest if there is any way to upload background video
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome v9 Reproducible demo link Not there...
Issue #1879
[Question] Traits manager - image type field.
Hello, I want to add a new field in traits manager (components settings). This field should select an image from the assets manager and ret...
Issue #956
[QUESTION] How to load a new trait I added in a built-in component?
Hi guys I added a trait for my Link element which is a built-in component for gjs-blocks-basic. When I drag a new link component to the can...
Issue #2404
Question: how to observe children changes in component
Is there an easy way to subscribe/listen to changes in the components/children of my custom component type? Perhaps an event I can subscrib...
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.