Issue #924Opened March 4, 2018by jadebayo0 reactions

[Bug]: calling 'preview' command not working correctly

Question

This is a piece of code that i am an using:

this.editor = grapesjs.init(this.config) const commandManager = this.editor.Commands commandManager.get('preview').run(this.editor)

I want the editor to go into preview mode immediately upon loading. It does go into preview mode but the offsets are still displaying. Hovering over components still highlights. Is there some piece that needs to load before the command works properly. When clicking on the preview button manually it works fine but calling the command from code doesn't. Is there some event i can attach to to make sure that the editor has fully loaded before calling the command?

Answers (2)

artfMarch 6, 20180 reactions

Yeah, you should make use of this

editor.on('load', () => editor.runCommand('preview'))
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.