Issue #2160Opened July 23, 2019by martysweet0 reactions

Absolute mode: editor is not defined

Question

Hi,

Great project, thanks! In relation to issue #1936 there is a bug on the following line which causes exceptions when attempting to drag an absolute component when the variable editor is not defined in the window scope, for example, if you have instantiated the editor inside a React class, or not used the name editor.

https://github.com/artf/grapesjs/blob/1ebcf47d4ad3c9e7cdc8196a1c10043157fe6a64/src/commands/index.js#L153-L155

I believe the correct implementation for this would be the following, where ed is passed into the tlb-move run function. https://github.com/artf/grapesjs/blob/1ebcf47d4ad3c9e7cdc8196a1c10043157fe6a64/src/commands/index.js#L120-L121

            dragger = ed.runCommand('core:component-drag', {

This can be reproduced on jsfiddle by changing editor to e, thus taking it out of window scope. https://jsfiddle.net/xd4j6vwa/2/

Workaround Set editor in the window scope, for example window.editor = this.editor;

Answers (0)

No answers yet.

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.