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.
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
BUG: 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 #3115
BUG: component droped position is wrong when I changed canvas size under Absolute/Designer mode
WARNING I changed the canvas size and I drop a compent from blocks panel. The result is compent postion is wrong. By the way, the editor is...
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.