SVG Component Not Draggable
@artf please see that It is very important for me to solve this problem.thanks
Read full answer below ↓Question
Hi, I am using grapesjs in angular 7.What I want to achieve when ever canvas drop method called I add svg component in canvas.I have add svg component on canvas drop method.But its not draggable. I attach my code and video for better understand.Thanks @artf if you help me.
<code>const domComponents = this._editor.DomComponents;</code>
<code>const wrapperChildren = domComponents.getComponents();</code>
<code>comp = wrapperChildren.add({</code>
<code> tagName: 'svg',</code>
<code>type: 'svg',</code>
<code>attributes: { viewBox: '0 0 100 100', xmlns: 'http://www.w3.org/2000/svg' },</code>
<code>stylable: true,</code>
<code>resizable: true,</code>
<code>removable: true, </code>// Can't remove it
<code>draggable: true, </code>// Can't move it
<code>copyable: true, </code>// Disable copy/past
<code>content: <circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" />, </code>
<code> });</code>

Answers (3)
@artf please see that It is very important for me to solve this problem.thanks
Unfortunately, HTML5 drag and drop API doesn’t work on SVG elements, so if you need to support it you have to wrap your SVG components (eg. in a div element)
@artf ok thanks
Related Questions and Answers
Continue research with similar issue discussions.
Issue #705
Drag placeholder for rendered elements
Hello! I'm digging through code and I'm trying to achieve a placeholder effect while dragging the element? Something similar already exists...
Issue #1629
Grapesjs- When i drag and drop the video into the canvas, i want it to be selected on Component Setting right away
WARNING READ and FOLLOW next 5 steps, then REMOVE them before posting the issueFollow CONTRIBUTING Guidelines https://github.com/artf/grape...
Issue #3135
[Help Wanted] How to easily override existing component ?
For example, I want to add a double click event handler on the default video component to open the assets manager. My basic idea was to get...
Issue #3115
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...
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.
Tutorial
Preset DevFuture 2.0 — New Update Released
Preset continues evolving as a clean, production-ready starting point for building visual editors powered by GrapesJS
Tutorial
AutographJS - Signature Solution for Modern Web Editors
The Problem: Signature Capture Is Still Harder Than It Should Be
Tutorial
GrapesJS vs Gutenberg: How to Build a Custom WordPress Page Builder
Compare GrapesJS and Gutenberg, learn when to use each, and follow a step-by-step guide to build a production WordPress page builder with GrapesJS.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.