Lightweight web rich text box -- wangEditor User Manual (6) -- configure the "Upload image" function,

Source: Internet
Author: User

Lightweight web rich text box -- wangEditor User Manual (6) -- configure the "Upload image" function,
1. Introduction

The previous section describes the "insert code" function in wangEditor and uses the pop-up box. The "Upload image" in this section also needs a pop-up box. How to configure the menu in the pop-up box has been discussed in the previous section. Here we will not repeat the description, but will only talk about the key content of the uploaded image.

In fact, the real function of uploading images is not my own, but I borrowed a powerful upload plug-in called uploadify, which many of my friends should know. Let's take a look at how to integrate uploadify, a powerful tool, into wangEditor.

:Https://github.com/wangfupeng1988/wangEditor

Demo & all configuration instructions:Http://www.cnblogs.com/wangfupeng1988/p/4198428.html

Chat QQ group:164999061

2. Introduce uploadify & make a simple background service

The detailed application of uploadify is not the focus of this Article. There are various documents available for reference on the Internet. Example: http://www.cnblogs.com/fanyong/p/3736685.html

In addition, uploading images requires a background service to receive images. I used asp.net to provide a simple background service, and paste the source code into the. ashx file:

Data. ashx source code 3. Configure the "Upload image" button

As in the previous section, how to configure the menu button is clearly described in the previous article. I will not explain it one by one here, but I will only focus on it:

3.1 code structure

You should be familiar with the code structure. Pay attention to the 'modal' in the red box, which will be explained below.

3.2 'modal'

In the previous section "insert code", the role and rules of 'modal' have been described. Paste the 'modal' source code below and describe the following points.

'Modal' source code
  1. Modal still requires a $ div;
  2. Before returning $ div, configure uploadify for the input-file element;
  3. In uploadify configuration, when the upload is successful (onUploadSuccess), run the commonCommand command. Note: This is not triggered by a javascript event. Therefore, if e is not used, null is input instead.
3.3 running webpage

Start the background service and run the webpage to see the effect:

4. Summary

Uploading images is a very important feature of the Rich Text Editor. It is a little too late to update images until now. No way, things have to go one step at a time.

All source code used in this section can be downloaded at http://pan.baidu.com/s/1qwsn0yg. then, you can use Visual Studio to open the website and run it.

Bytes -------------------------------------------------------------------------------------------------------------

:Https://github.com/wangfupeng1988/wangEditor

Demo & all configuration instructions:Http://www.cnblogs.com/wangfupeng1988/p/4198428.html

Chat QQ group:164999061

Bytes -------------------------------------------------------------------------------------------------------------

Welcome to my Weibo.

You are also welcome to follow my tutorial:

From design to ModelDeep understanding of javascript prototype and closure SeriesMicrosoft petshop4.0 source code explanation video json2.js source code interpretation video

Bytes -------------------------------------------------------------------------------------------------------------

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.