Webkit: drag-and-drop elements (div, span) in content container

Does anyone know how to drag and drop all div / span content inside a contenteditable container in Chrome?

I have something like this:

 <div contenteditable="true"> <p>Some text</p> <span class="image_frame" contenteditable="false" //don't want to edit its content> <img src="/test.jpg" style="position:relative;z-index=-1;//hack to not copy the image"> </span> </div> 

I would like to move the span element with the image between "Some" and "text". This works in Firefox.

+4
source share
1 answer

You can add the html5 draggable = "true" attribute to the span element. I tested it on chrome (version 23.0.1271.64 m) and its shot between "some" and "text" .. I hope this helps.

+2
source

Source: https://habr.com/ru/post/1380046/


All Articles