Issue #714Opened January 5, 2018by michaellwatson0 reactions

Open Style Manager when selecting an element

Question

trying to do this

     editor.on('component:selected', (model) => {
          editor.runCommand('open-sm');
    });

gives the error this.sender.get is not a function

grapesjs.min.js toggleSm

Basically I want to open the style manager when clicking on an element.

Any help or info appreciated, thanks

Answers (2)

artfJanuary 5, 20180 reactions

Hi Michael, there is actually a kind of bug in 'open-sm' which doesn't allow calling the command with runCommand but the reason is that it was designed to be called just by its relative button, indeed I'd recommend doing this for your case

editor.on('component:selected', () => {
	const openSmBtn = editor.Panels.getButton('views', 'open-sm');
	openSmBtn.set('active', 1);
});
lock[bot]September 18, 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.