How can I specify position for dragging elements ?
i don't have components iam using blocks according to this: i have a div with id="drag-here" i assume your block is something like this: the approach for your container block would be: and for target blocks: cheers!
Read full answer below ↓Question
Hi iam doing a project with this library and i want to specify position for dragging components in it for example i have a div with id="drag-here" i want all components to be dragged in this div only
i hope you can understand me , thank you all
Answers (3)
i don't have components iam using blocks
according to this:
i have a div with id="drag-here"
i assume your block is something like this:
content: '<div id="drag-here"></div>'
the approach for your container block would be:
editor.BlockManager.add('drag-here',{
lablel:'Drag Here',
content:'<div id="drag-here" data-gjs-droppable="true" style="width:100px;height:100px; background:red;"></div>'
})
and for target blocks:
editor.BlockManager.add('drop',{
lablel:'Drop',
content:'<div data-gjs-draggable="div#drag-here" style="width:50px;height:50px; background:blue;"></div>'
})
cheers!
i have a div with id="drag-here" i want all components to be dragged in this div only
if by this you mean you want all components to be draggable only in your target component, you can use draggable property.
by specifying draggable on your components like this:
draggable: 'target, target *'
cheers!
by specifying draggable on your components like this:
thank you for fast replay , but i don't have components iam using blocks
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3251
How can I specify position of dropped element ?
I want to specify the position of dragging element. for example, if I have a header block which no matter where you drag, it should be plac...
Issue #3399
Convert JSON to HTML server-side
So first of all, thank you @artf for this amazing project. I have a question: Is it possible to easily convert the components-JSON to HTML...
Issue #3231
how to change gjs-ckeditor-format component
hi guys, we all know that gjs-ckeditor-plugin working with [data-gjs-type]="text" components. I wanna know , could we change this option? I...
Issue #1464
Customizing the Component Position
First of all thank you guys for this awesome library, And I have one Clarification that is how do i customize the drop position example if...
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 →Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.