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.