Baidu Editor supports independent Image Upload configuration and Baidu Editor

Source: Internet
Author: User

Baidu editor independent image transfer configuration, Baidu editor independent image

Step 1
Var _ editor = UE. getEditor ('editor ');
Find an id input for ue instantiation, as shown in figure

Step 2 instantiate and call the class
Var _ editor = UE. getEditor ('upload _ ue ');

_ Editor. ready (function (){
// Set the editor to be unavailable
// _ Editor. setDisabled (); Be sure to block this part.
// Hide the editor because the editor instance is not used.
_ Editor. hide ();

// Listen for Image Upload
_ Editor. addListener ('beforsersertimage', function (t, arg ){

// Assign the address to the corresponding input and only go to the path of the first image

Var imgs;
For (var a in arg ){
Imgs + = arg [a]. src + ',';
}

$ ("# Picture"). attr ("value", arg [0]. src );
// Preview the image
$ ("# Preview"). attr ("src", arg [0]. src );
})

});
// The Image Upload dialog box is displayed.
Function upImage (){
Var myImage = _ editor. getDialog ("insertimage ");
MyImage. open ();
}
Step 3: write html
\ <Input type = "text" id = "picture" name = "pic" value = "<{$ info. pic}>"/>
\ <Input type = "button" class = "datepicker" onclick = "upImage ();" value = "Upload image"/>

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.