Home > Web Front-end > JS Tutorial > How to select an image in rich text and insert it into the editor (with code)

How to select an image in rich text and insert it into the editor (with code)

不言
Release: 2018-08-25 13:45:29
Original
2810 people have browsed it

The content of this article is about how to select an img to insert into the editor in rich text (with code). It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

I am calling a popup layer on the editor, and after requesting the image data, how can I insert the selected image into the editor

How to select an image in rich text and insert it into the editor (with code)

Click on the picture to get the one in the picture li

 //监听li点击事件
          $("#yun").on("click",'li',function(e){
            var alt=e.target.alt
            callback && callback({
              src: img
              ,alt: alt
            });
            //关闭云盘
            layer.close(index);
          })
Copy after login

Print console.log(ehtml) to get the following structure

<img src="//www.×××.cn/upload/company/banner/201806302108090467.jpg" alt="201806302108090467.jpg">
Copy after login

I want to insert this into the picture to make it as convenient as inserting an expression. Click anywhere in the editor to insert this image.

Related recommendations:

Use the rich text editor to upload the image pop-up layer code implementation

How to delete the table using javascript Checked line (code)

The above is the detailed content of How to select an image in rich text and insert it into the editor (with code). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template