简体   繁体   English

在Summernote文本编辑器中拖放图像

[英]Drag&Drop images in the Summernote Text Editor

I want to understand if I can do Drag&Drop image in my text editor plugin . 我想了解是否可以在文本编辑器插件中进行拖放图像。 I'm using angularjs v1.5.0 with it. 我正在使用angularjs v1.5.0。 When image was uploaded I want to have possible dragging it. 图片上传后,我希望可以拖动它。

There are a lot of solution for dragging, but I did not find how can I do this when there is the text inside. 拖动有很多解决方案,但是当里面有文字时,我没有找到如何做的。 For example: There is some text and image in the editor " < img src='lala.jpg'> Some Text Here " and after dragging I need that " Some Text < img src='lala.jpg'> Here ". 例如:编辑器中有一些文本和图像“ <img src ='lala.jpg'>这里有一些文本 ”,拖动后,我需要“ 一些文本<img src ='lala.jpg'>这里 ”。 I included drag&drop plugin and image became with styling position: relative, top|left. 我包括了拖放插件,并且图像变成了具有样式位置:相对,顶部|左侧。 Yes, its dragging, but without text floating. 是的,它是拖动的,但没有文本浮动。 What can I do with it? 我该怎么办?

Thanks for any help or ideas 感谢您的帮助或想法

set image tag do draggable and when you fire the 'Drop' event, you will get x and y position for the image. 将图片标签设置为可拖动,当您触发“ Drop”事件时,您将获得图片的x和y位置。 Calculate your string width and height and break the text where image should be placed. 计算字符串的宽度和高度,并中断应放置图像的文本。 Then, put the tag exactly where it should be... 然后,将标签准确放置在应放置的位置...

Calculate text width with JavaScript 使用JavaScript计算文字宽度

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM