GrapesJS / grapesjs

Free and Open source Web Builder Framework. Next generation tool for building templates without coding
https://grapesjs.com
BSD 3-Clause "New" or "Revised" License
22.36k stars 4.05k forks source link

BUG: dragMode:'absolute' behaves strange #5339

Closed rozek closed 1 year ago

rozek commented 1 year ago

GrapesJS version

What browser are you using?

Version 1.56.20 Chromium: 115.0.5790.171 (Offizieller Build) (arm64)

Reproducible demo link

none

Describe the bug

I want the components in my editor to be moveable by dragging. After some research, I found that

let Editor = grapesjs.init({
  dragMode:'absolute',

is needed to achieve this functionality. At least, my components can now be moved...but, since the editor uses a wrapper around the actual component view, the wrapper position may be correct, but the view position is now measured relative to the wrapper, which is wrong:

moving-component

The technical reason for this behaviour (and why I consider this as a "bug") is that both the wrapper and its content get the same HTML id assigned to them - which is always wrong as such ids must be unique within an HTML document:

The elements in the DOM:

DOM

...and their CSS settings:

Style

As a consequence, the same styling is applied to both

Code of Conduct

rozek commented 1 year ago

sorry - this was a problem on my side which became obvious within the editor only - sorry for bothering!