Baidu Editor multi-image batch Upload order confusion problem Ueditor

Source: Internet
Author: User

I used the last version of ueditor1.3.6, since the 1.4.2 version, "Front-end upload Module Unified use Webuploader", ueditor in the multi-image upload has been considering the problem of missing the picture order.
My website in the user uploads the picture article when, uses the multi-image uploads, the point confirmation, the edit box picture order is disorderly.
See Webuploader problem is multi-threaded upload, ueditor to "uploadsuccess" processing is a successful upload, added to the array, so if the picture upload complete order is chaotic, the final addition of the text box in the Order of chaos.
I have modified the JS here for your reference, I hope ueditor can improve the problem:
Vim Dialogs/image/image.js

716 Uploader.on (' uploadsuccess ', function (file, ret) {
717 var $file = $ (' # ' + file.id);
718 try {
719 var responsetext = (Ret._raw | | ret),
720 JSON = Utils.str2json (responsetext);
721 if (json.state = = ' SUCCESS ') {
722 _this.imagelist[$file. Index ()] = JSON; Modified here: stored in the order of the selected file list.
723 $file. Append (");
724} else {
725 $file. Find ('. Error '). Text (Json.state). Show ();
726}
727} catch (e) {
728 $file. Find ('. Error '). Text (Lang.errorserverupload). Show ();
729}
730});

for Dialogs/image/image.js, if the ln:722 line is modified as described above, then Ln : 769 rows or so of the getinsertlist function should also be modified synchronously. Avoid this type of situation: arr = [];arr[0]=obj0;arr[2]=obj2; then try to read Arr[1] properties.

Getinsertlist:function () {
var i, data, List = [],
align = Getalign (),
prefix = editor.getopt (' Imageurlprefix ');
for (i = 0; i < this.imageList.length; i++) {
data = This.imagelist[i];
if (data = = undefined) {//is derived from the modification of line: (722 or 721), to avoid partial image upload failure, or to select a picture that does not conform to the specification cannot participate in the upload resulting in the ImageList array undefined items appear
Continue
}
List.push ({
Src:prefix + Data.url,
_src:prefix + Data.url,
Title:data.title,
Alt:data.original,
Floatstyle:align
});
}
return list;
}

Baidu Editor multi-image batch Upload order confusion problem Ueditor

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.