HELP: Replace the green drop indicator line on drag/drop hover #6730
Replies: 1 comment
-
|
You can’t fully replace the default green drop indicator with your own DOM element out of the box in GrapesJS. However, there are three practical approaches depending on how far you want to go: Style it via CSS (quick & supported) The green line (.gjs-placeholder) is not part of the Spot system, but it can be overridden via CSS: /* Horizontal drop line */ /* Vertical drop line */ This is the simplest and most stable approach, but you're limited to visual tweaks only. ⚙️ 2. Advanced approach (events + custom UI) If you need more control, you can hook into the drag lifecycle and render your own placeholder: editor.on('component:drag:start', () => { editor.on('component:drag', ({ target, parent, index }) => { editor.on('canvas:dragover', () => { editor.on('canvas:drop', () => { With this approach, you can: Hide the default placeholder (via CSS) If your goal is something like: “A real block that takes up space inside the canvas while dragging” Then you're not just customizing — you're replacing the entire drag-and-drop UX. This involves: Tracking drag position 👉 This is non-trivial and typically requires a plugin-level implementation. ✨ Example of a complete solution There is already an implementation of this approach: https://gjs.market/products/placeholder-2-0-new-dragging-effect-for-components What it does: ❌ Removes the default green line completely |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey wizards, need some help
Has anyone been able to replace it with your own element, let's say a box that takes up space in the canvas?
I've looked at the paid plugins and I can't use that, even if you point me to what APIs and overall solution to work with, I could creatae it myself.
I appreciate any help I can get, thank you!

Beta Was this translation helpful? Give feedback.
All reactions