Absolute mode: editor is not defined
No community answers yet. Open the original discussion on GitHub to share your solution.
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.
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.
Issue #2207
[BUG]: Can't drag component if there is some space on top/left with Mode Absolute
Given the following code example... Results in no ability to drag and drop elements to correct position using drag icon on the panel. See F...
Issue #2359
Absolute mode, component's style missing when dragged into canvas
Hi guys, I'm working with grapesjs which version is '0.15.8', and in 'absolute' mode when I drag a block into canvas, I find the styles of...
Issue #3832
The css classes are removed and the autogenerated ids for each html tags gets changed ( Example : ivj5m-2) after each reload
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome Reproducible demo link Not there De...
Issue #2433
[Bug] Changing layerable in an an event at runtime doesn't immediately update
When I change the layerable option of a custom component in an event, it still shows up in the layers until you drag it once. Is there some...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins →Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.
Browse premium plugins →Related tutorials
In-depth guides on the same topic.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.