diff --git a/public/static/common/lib/ueditor/dialogs/attachment/attachment.css b/public/static/common/lib/ueditor/dialogs/attachment/attachment.css
index f0fc70963..b26cf0c77 100755
--- a/public/static/common/lib/ueditor/dialogs/attachment/attachment.css
+++ b/public/static/common/lib/ueditor/dialogs/attachment/attachment.css
@@ -737,6 +737,23 @@ i.file-preview.file-type-psd{
padding: 2px 0;
}
+/**
+ * 选择计数
+ */
+#fileList .select-count {
+ position: absolute;
+ top: 25px;
+ left: 5px;
+ background: #1194fa;
+ color: #fff;
+ font-weight: bold;
+ padding: 2px 5px;
+ border-radius: 15px;
+ min-width: 12px;
+ text-align: center;
+ display: none;
+}
+
/**
* 右侧小导航
diff --git a/public/static/common/lib/ueditor/dialogs/attachment/attachment.js b/public/static/common/lib/ueditor/dialogs/attachment/attachment.js
index f5a3f586e..3571a4ffb 100755
--- a/public/static/common/lib/ueditor/dialogs/attachment/attachment.js
+++ b/public/static/common/lib/ueditor/dialogs/attachment/attachment.js
@@ -515,7 +515,8 @@
var responseText = (ret._raw || ret),
json = utils.str2json(responseText);
if (json.code == 0) {
- _this.fileList.push(json.data);
+ //_this.fileList.push(json.data);
+ _this.fileList[$file.index()] = json.data;
$file.append('');
} else {
$file.find('.error').text(json.msg).show();
@@ -564,12 +565,15 @@
var i, link, data, list = [],
prefix = editor.getOpt('fileUrlPrefix');
for (i = 0; i < this.fileList.length; i++) {
- data = this.fileList[i];
- link = data.url;
- list.push({
- title: data.original || link.substr(link.lastIndexOf('/') + 1),
- url: prefix + link
- });
+ data = this.fileList[i] || null;
+ if(data != null && (data.url || null) != null)
+ {
+ link = data.url;
+ list.push({
+ title: data.original || link.substr(link.lastIndexOf('/') + 1),
+ url: prefix + link
+ });
+ }
}
return list;
}
@@ -616,14 +620,62 @@
li = target.parentNode;
if (li.tagName.toLowerCase() == 'li') {
+ // 选择顺序 start
+ var $select_count_container = $(li).find('.select-count');
+ // 选择顺序 end
+
if (domUtils.hasClass(li, 'selected')) {
domUtils.removeClasses(li, 'selected');
+
+ // 选择顺序 start
+ $select_count_container.css('display', 'none');
+ $select_count_container.text('');
+ // 选择顺序 end
} else {
domUtils.addClass(li, 'selected');
+
+ // 选择顺序 start
+ var count = 0;
+ $($G('fileList')).find('li.selected').each(function(k, v)
+ {
+ var temp = parseInt($(this).find('.select-count').text());
+ if(temp > count)
+ {
+ count = temp;
+ }
+ });
+ $select_count_container.css('display', 'block');
+ $select_count_container.text(count+1);
+ // 选择顺序 end
}
+
+ // 选择顺序 start
+ _this.selectSortHandle();
+ // 选择顺序 end
}
});
},
+ /* 选择顺序处理 */
+ selectSortHandle: function()
+ {
+ var arr = [];
+ $($G('fileList')).find('li.selected').each(function(k, v)
+ {
+ var count = parseInt($(this).find('.select-count').text())-1;
+ arr[count] = {
+ "count": count,
+ "e": $(this)
+ };
+ });
+ if(arr.length > 0)
+ {
+ arr = arr.sort();
+ for(var i in arr)
+ {
+ $(arr[i]['e']).find('.select-count').text(parseInt(i)+1);
+ }
+ }
+ },
/* 初始化第一次的数据 */
initData: function () {
@@ -723,6 +775,14 @@
original.innerHTML = list[i].original;
item.appendChild(original);
// 原名功能 end
+
+ // 选择计数 start
+ var select_count = document.createElement('span');
+ select_count.setAttribute('class', 'select-count');
+ select_count.style.display = 'none';
+ select_count.innerHTML = '';
+ item.appendChild(select_count);
+ // 选择计数 end
// 文件添加删除功能 start
item.appendChild($("x").click(function() {
@@ -735,8 +795,16 @@
} finally {
if(!confirm("确定要删除吗?")) return;
$.post(editor.getOpt("serverUrl") + "?action=deletefile", { "id": del.attr("data-id") }, function(response) {
- if (response.code == 0) del.parent().remove();
- else alert(response.msg);
+ if (response.code == 0)
+ {
+ del.parent().remove();
+
+ // 选择顺序 start
+ _this.selectSortHandle();
+ // 选择顺序 end
+ } else {
+ alert(response.msg);
+ }
});
}
})[0]);
@@ -779,13 +847,17 @@
if (domUtils.hasClass(lis[i], 'selected')) {
var url = lis[i].getAttribute('data-url');
var title = lis[i].getAttribute('data-title') || url.substr(url.lastIndexOf('/') + 1);
- list.push({
- title: title,
- url: url
- });
+ if((lis[i] || null) != null)
+ {
+ var index = parseInt($(lis[i]).find('.select-count').text())-1;
+ list[index] = {
+ title: title,
+ url: url
+ }
+ }
}
}
- return list;
+ return list.length ? list.sort() : list;
}
};
diff --git a/public/static/common/lib/ueditor/dialogs/image/image.css b/public/static/common/lib/ueditor/dialogs/image/image.css
index 7b2e7dc7b..b70a58c67 100755
--- a/public/static/common/lib/ueditor/dialogs/image/image.css
+++ b/public/static/common/lib/ueditor/dialogs/image/image.css
@@ -734,6 +734,23 @@
padding: 2px 0;
}
+/**
+ * 选择计数
+ */
+#imageList .select-count {
+ position: absolute;
+ top: 25px;
+ left: 5px;
+ background: #1194fa;
+ color: #fff;
+ font-weight: bold;
+ padding: 2px 5px;
+ border-radius: 15px;
+ min-width: 12px;
+ text-align: center;
+ display: none;
+}
+
/**
* 右侧小导航
*/
diff --git a/public/static/common/lib/ueditor/dialogs/image/image.html b/public/static/common/lib/ueditor/dialogs/image/image.html
index f6ab12ac9..86c46b923 100755
--- a/public/static/common/lib/ueditor/dialogs/image/image.html
+++ b/public/static/common/lib/ueditor/dialogs/image/image.html
@@ -93,5 +93,17 @@
+
+
+