SVG Component Not Draggable
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 #1381
Custom Embed Video in Video Component
@artf I want to include a custom embed code in Video component so that user can add any iframe containing video. Any help would be apprecia...
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...
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.