1. Introduction
The previous section explains the "Insert Code" feature in Wangeditor, which uses a popup box. The "Upload picture" In this section also has a popup box. How the Pop-up menu is configured, as described in the previous section, will not be repeated here, only the focus of the uploaded image.
In fact, the real upload image function, not I do, but borrowed a very powerful upload plugin--uploadify--Many friends should know this thing. So let's take a look at how to integrate uploadify, a powerful tool, into the wangeditor.
:https://github.com/wangfupeng1988/wangEditor
Demo Demo & All configuration instructions:http://www.cnblogs.com/wangfupeng1988/p/4198428.html
Chat QQ Group:164999061
2. Introduction Uploadify & do a simple back-office service
The detailed application of uploadify is not the focus of this article, there are various documents available on the Internet for reference. Example: http://www.cnblogs.com/fanyong/p/3736685.html
In addition, upload pictures definitely need a background service to receive pictures, I use ASP. NET to do a simple background service, just a. ashx document, paste the source code to everyone:
Data.ashx Source3. Configure the "Upload Picture" button
As in the previous section, how to configure the menu button, the previous article has been described very clearly, here is no longer one by one explanation, just say the focus:
3.1 Code structure
See the code structure, you should be very familiar with. Note the ' modal ' of the red box, which will be explained below.
3.2 ' Modal '
The previous section, "Inserting code," has already explained the functions and rules of ' modal '. Here to paste the ' modal ' source code below, and then explain a few points.
' modal ' source code
- Modal need is still a $div;
- Before returning to the $div, the Input-file element in the uploadify configuration;
- In the uploadify configuration, when the upload succeeds (onuploadsuccess), the Commoncommand command is executed. Note that this is not triggered by JavaScript events, so there is no e, and null is passed in instead.
3.3 Running the Web page
Start the background service, run the Web page, you can see the effect:
4. Summary
Uploading a picture is a very important feature of the rich text editor, until now it's been updated, a little belated. No way, things have to go step by step.
All the source code in this http://pan.baidu.com/s/1qWsN0Yg can be downloaded in the download, then open the website with Visual Studio and run.
-------------------------------------------------------------------------------------------------------------
:https://github.com/wangfupeng1988/wangEditor
Demo Demo & All configuration instructions:http://www.cnblogs.com/wangfupeng1988/p/4198428.html
Chat QQ Group:164999061
-------------------------------------------------------------------------------------------------------------
Please pay attention to my Weibo.
Also welcome to follow my tutorials:
" from design to model"" deep understanding of JavaScript prototype and closure series " "Microsoft petshop4.0 Source Interpretation Video" "Json2.js Source Interpretation video"
-------------------------------------------------------------------------------------------------------------
Lightweight Web Rich text box--wangeditor user's Manual (6)--Configure the "Upload image" function