`
This commit is contained in:
Vendored
+307
-187
@@ -5642,6 +5642,136 @@ var es7_array_includes = __webpack_require__("6762");
|
|||||||
// EXTERNAL MODULE: ./node_modules/core-js/modules/es6.string.includes.js
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es6.string.includes.js
|
||||||
var es6_string_includes = __webpack_require__("2fdb");
|
var es6_string_includes = __webpack_require__("2fdb");
|
||||||
|
|
||||||
|
// EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
|
||||||
|
var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__("8bbf");
|
||||||
|
var external_commonjs_vue_commonjs2_vue_root_Vue_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_vue_commonjs2_vue_root_Vue_);
|
||||||
|
|
||||||
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es6.regexp.constructor.js
|
||||||
|
var es6_regexp_constructor = __webpack_require__("3b2b");
|
||||||
|
|
||||||
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es7.object.values.js
|
||||||
|
var es7_object_values = __webpack_require__("8615");
|
||||||
|
|
||||||
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es6.regexp.to-string.js
|
||||||
|
var es6_regexp_to_string = __webpack_require__("6b54");
|
||||||
|
|
||||||
|
// CONCATENATED MODULE: ./packages/utils/validate.js
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function isPlainObject(obj) {
|
||||||
|
return Object.prototype.toString.call(obj) === "[object Object]";
|
||||||
|
}
|
||||||
|
function isString(str) {
|
||||||
|
return typeof str == "string";
|
||||||
|
}
|
||||||
|
function isToday(time) {
|
||||||
|
return new Date().getTime() - time < 86400000;
|
||||||
|
}
|
||||||
|
function isEmpty(obj) {
|
||||||
|
if (!obj) return true;
|
||||||
|
if (Array.isArray(obj) && obj.length == 0) return true;
|
||||||
|
if (isPlainObject(obj) && Object.values(obj).length == 0) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
function isUrl(str) {
|
||||||
|
var reg = "^((https|http|ftp|rtsp|mms)?://)" + "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" + //ftp的user@
|
||||||
|
"(([0-9]{1,3}.){3}[0-9]{1,3}" + // IP形式的URL- 199.194.52.184
|
||||||
|
"|" + // 允许IP和DOMAIN(域名)
|
||||||
|
"([0-9a-z_!~*'()-]+.)*" + // 域名- www.
|
||||||
|
"([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]." + // 二级域名
|
||||||
|
"[a-z]{2,6})" + // first level domain- .com or .museum
|
||||||
|
"(:[0-9]{1,4})?" + // 端口- :80
|
||||||
|
"((/?)|" + // 如果没有文件名,则不需要斜杠
|
||||||
|
"(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$";
|
||||||
|
return new RegExp(reg).test(str) ? true : false;
|
||||||
|
}
|
||||||
|
function isFunction(val) {
|
||||||
|
return val && typeof val === "function";
|
||||||
|
}
|
||||||
|
function isEng(val) {
|
||||||
|
return /^[A-Za-z]+$/.test(val);
|
||||||
|
}
|
||||||
|
// CONCATENATED MODULE: ./packages/directives/contextmenu.js
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var popover;
|
||||||
|
|
||||||
|
var hidePopover = function hidePopover() {
|
||||||
|
if (popover) popover.style.display = 'none';
|
||||||
|
};
|
||||||
|
|
||||||
|
var showPopover = function showPopover() {
|
||||||
|
if (popover) popover.style.display = 'block';
|
||||||
|
};
|
||||||
|
|
||||||
|
document.addEventListener('click', function (e) {
|
||||||
|
hidePopover();
|
||||||
|
});
|
||||||
|
/* harmony default export */ var contextmenu = ({
|
||||||
|
hide: hidePopover,
|
||||||
|
bind: function bind(el, binding, vnode) {
|
||||||
|
el.addEventListener('contextmenu', function (e) {
|
||||||
|
if (isEmpty(binding.value) || !Array.isArray(binding.value)) return;
|
||||||
|
e.preventDefault();
|
||||||
|
components_popover.methods.closeAll();
|
||||||
|
var component;
|
||||||
|
var visibleItems = [];
|
||||||
|
if (binding.modifiers.message) component = vnode.context;else if (binding.modifiers.contact) component = vnode.child;
|
||||||
|
|
||||||
|
if (!popover) {
|
||||||
|
popover = document.createElement('div');
|
||||||
|
popover.className = 'lemon-contextmenu';
|
||||||
|
document.body.appendChild(popover);
|
||||||
|
}
|
||||||
|
|
||||||
|
popover.innerHTML = binding.value.map(function (item) {
|
||||||
|
var visible;
|
||||||
|
|
||||||
|
if (isFunction(item.visible)) {
|
||||||
|
visible = item.visible(component);
|
||||||
|
} else {
|
||||||
|
visible = item.visible === undefined ? true : item.visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (visible) {
|
||||||
|
visibleItems.push(item);
|
||||||
|
var icon = item.icon ? "<i class=\"lemon-contextmenu__icon ".concat(item.icon, "\"></i>") : '';
|
||||||
|
return "<div style=\"color:".concat(item.color, "\" title=\"").concat(item.text, "\" class=\"lemon-contextmenu__item\">").concat(icon, "<span>").concat(item.text, "</span></div>");
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}).join("");
|
||||||
|
popover.style.top = "".concat(e.pageY, "px");
|
||||||
|
popover.style.left = "".concat(e.pageX, "px");
|
||||||
|
popover.childNodes.forEach(function (node, index) {
|
||||||
|
var _visibleItems$index = visibleItems[index],
|
||||||
|
click = _visibleItems$index.click,
|
||||||
|
_render = _visibleItems$index.render;
|
||||||
|
node.addEventListener('click', function (e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
if (isFunction(click)) click(e, component, hidePopover);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (isFunction(_render)) {
|
||||||
|
var ins = external_commonjs_vue_commonjs2_vue_root_Vue_default.a.extend({
|
||||||
|
render: function render(h) {
|
||||||
|
return _render(h, component, hidePopover);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var renderComponent = new ins().$mount();
|
||||||
|
node.querySelector('span').innerHTML = renderComponent.$el.outerHTML;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
showPopover();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
inserted: function inserted(el, binding, vnode) {}
|
||||||
|
});
|
||||||
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/popover.vue?vue&type=script&lang=js&
|
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/popover.vue?vue&type=script&lang=js&
|
||||||
|
|
||||||
|
|
||||||
@@ -5652,12 +5782,6 @@ var es6_string_includes = __webpack_require__("2fdb");
|
|||||||
|
|
||||||
var popoverCloseQueue = [];
|
var popoverCloseQueue = [];
|
||||||
|
|
||||||
var popoverCloseAll = function popoverCloseAll() {
|
|
||||||
return popoverCloseQueue.forEach(function (callback) {
|
|
||||||
return callback();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
var triggerEvents = {
|
var triggerEvents = {
|
||||||
hover: function hover(el) {},
|
hover: function hover(el) {},
|
||||||
focus: function focus(el) {
|
focus: function focus(el) {
|
||||||
@@ -5675,6 +5799,7 @@ var triggerEvents = {
|
|||||||
|
|
||||||
el.addEventListener("click", function (e) {
|
el.addEventListener("click", function (e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
contextmenu.hide();
|
||||||
|
|
||||||
_this2.changeVisible();
|
_this2.changeVisible();
|
||||||
});
|
});
|
||||||
@@ -5731,8 +5856,6 @@ var triggerEvents = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [h("div", {
|
}, [h("div", {
|
||||||
"class": "lemon-popover__title"
|
|
||||||
}), h("div", {
|
|
||||||
"class": "lemon-popover__content"
|
"class": "lemon-popover__content"
|
||||||
}, [this.$slots.content]), h("div", {
|
}, [this.$slots.content]), h("div", {
|
||||||
"class": "lemon-popover__arrow"
|
"class": "lemon-popover__arrow"
|
||||||
@@ -5792,9 +5915,14 @@ var triggerEvents = {
|
|||||||
this.visible ? this.close() : this.open();
|
this.visible ? this.close() : this.open();
|
||||||
},
|
},
|
||||||
open: function open() {
|
open: function open() {
|
||||||
popoverCloseAll();
|
this.closeAll();
|
||||||
this.visible = true;
|
this.visible = true;
|
||||||
},
|
},
|
||||||
|
closeAll: function closeAll() {
|
||||||
|
popoverCloseQueue.forEach(function (callback) {
|
||||||
|
return callback();
|
||||||
|
});
|
||||||
|
},
|
||||||
close: function close() {
|
close: function close() {
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
}
|
}
|
||||||
@@ -5825,17 +5953,21 @@ var popover_component = normalizeComponent(
|
|||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
/* harmony default export */ var popover = (popover_component.exports);
|
/* harmony default export */ var components_popover = (popover_component.exports);
|
||||||
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/button.vue?vue&type=script&lang=js&
|
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/button.vue?vue&type=script&lang=js&
|
||||||
/* harmony default export */ var buttonvue_type_script_lang_js_ = ({
|
/* harmony default export */ var buttonvue_type_script_lang_js_ = ({
|
||||||
name: "LemonButton",
|
name: "LemonButton",
|
||||||
props: {
|
props: {
|
||||||
|
color: {
|
||||||
|
type: String,
|
||||||
|
default: 'default'
|
||||||
|
},
|
||||||
disabled: Boolean
|
disabled: Boolean
|
||||||
},
|
},
|
||||||
render: function render() {
|
render: function render() {
|
||||||
var h = arguments[0];
|
var h = arguments[0];
|
||||||
return h("button", {
|
return h("button", {
|
||||||
"class": "lemon-button",
|
"class": ['lemon-button', "lemon-button--color-".concat(this.color)],
|
||||||
"attrs": {
|
"attrs": {
|
||||||
"disabled": this.disabled,
|
"disabled": this.disabled,
|
||||||
"type": "button"
|
"type": "button"
|
||||||
@@ -5940,12 +6072,19 @@ var badge_component = normalizeComponent(
|
|||||||
|
|
||||||
/* harmony default export */ var avatarvue_type_script_lang_js_ = ({
|
/* harmony default export */ var avatarvue_type_script_lang_js_ = ({
|
||||||
name: "LemonAvatar",
|
name: "LemonAvatar",
|
||||||
|
inject: ['IMUI'],
|
||||||
props: {
|
props: {
|
||||||
src: String,
|
src: String,
|
||||||
icon: {
|
icon: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "lemon-icon-people"
|
default: "lemon-icon-people"
|
||||||
},
|
},
|
||||||
|
circle: {
|
||||||
|
type: Boolean,
|
||||||
|
default: function _default() {
|
||||||
|
return this.IMUI ? this.IMUI.avatarCricle : false;
|
||||||
|
}
|
||||||
|
},
|
||||||
size: {
|
size: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 32
|
default: 32
|
||||||
@@ -5962,7 +6101,9 @@ var badge_component = normalizeComponent(
|
|||||||
var h = arguments[0];
|
var h = arguments[0];
|
||||||
return h("span", {
|
return h("span", {
|
||||||
"style": this.style,
|
"style": this.style,
|
||||||
"class": "lemon-avatar",
|
"class": ['lemon-avatar', {
|
||||||
|
'lemon-avatar--circle': this.circle
|
||||||
|
}],
|
||||||
"on": {
|
"on": {
|
||||||
"click": function click(e) {
|
"click": function click(e) {
|
||||||
return _this.$emit("click", e);
|
return _this.$emit("click", e);
|
||||||
@@ -6026,54 +6167,6 @@ var avatar_component = normalizeComponent(
|
|||||||
var helper = __webpack_require__("2638");
|
var helper = __webpack_require__("2638");
|
||||||
var helper_default = /*#__PURE__*/__webpack_require__.n(helper);
|
var helper_default = /*#__PURE__*/__webpack_require__.n(helper);
|
||||||
|
|
||||||
// EXTERNAL MODULE: ./node_modules/core-js/modules/es6.regexp.constructor.js
|
|
||||||
var es6_regexp_constructor = __webpack_require__("3b2b");
|
|
||||||
|
|
||||||
// EXTERNAL MODULE: ./node_modules/core-js/modules/es7.object.values.js
|
|
||||||
var es7_object_values = __webpack_require__("8615");
|
|
||||||
|
|
||||||
// EXTERNAL MODULE: ./node_modules/core-js/modules/es6.regexp.to-string.js
|
|
||||||
var es6_regexp_to_string = __webpack_require__("6b54");
|
|
||||||
|
|
||||||
// CONCATENATED MODULE: ./packages/utils/validate.js
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function isPlainObject(obj) {
|
|
||||||
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
||||||
}
|
|
||||||
function isString(str) {
|
|
||||||
return typeof str == "string";
|
|
||||||
}
|
|
||||||
function isToday(time) {
|
|
||||||
return new Date().getTime() - time < 86400000;
|
|
||||||
}
|
|
||||||
function isEmpty(obj) {
|
|
||||||
if (!obj) return true;
|
|
||||||
if (Array.isArray(obj) && obj.length == 0) return true;
|
|
||||||
if (isPlainObject(obj) && Object.values(obj).length == 0) return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
function isUrl(str) {
|
|
||||||
var reg = "^((https|http|ftp|rtsp|mms)?://)" + "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" + //ftp的user@
|
|
||||||
"(([0-9]{1,3}.){3}[0-9]{1,3}" + // IP形式的URL- 199.194.52.184
|
|
||||||
"|" + // 允许IP和DOMAIN(域名)
|
|
||||||
"([0-9a-z_!~*'()-]+.)*" + // 域名- www.
|
|
||||||
"([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]." + // 二级域名
|
|
||||||
"[a-z]{2,6})" + // first level domain- .com or .museum
|
|
||||||
"(:[0-9]{1,4})?" + // 端口- :80
|
|
||||||
"((/?)|" + // 如果没有文件名,则不需要斜杠
|
|
||||||
"(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$";
|
|
||||||
return new RegExp(reg).test(str) ? true : false;
|
|
||||||
}
|
|
||||||
function isFunction(val) {
|
|
||||||
return val && typeof val === "function";
|
|
||||||
}
|
|
||||||
function isEng(val) {
|
|
||||||
return /^[A-Za-z]+$/.test(val);
|
|
||||||
}
|
|
||||||
// EXTERNAL MODULE: ./node_modules/core-js/modules/es7.object.get-own-property-descriptors.js
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es7.object.get-own-property-descriptors.js
|
||||||
var es7_object_get_own_property_descriptors = __webpack_require__("8e6e");
|
var es7_object_get_own_property_descriptors = __webpack_require__("8e6e");
|
||||||
|
|
||||||
@@ -6223,9 +6316,6 @@ function mergeDeep(o1, o2) {
|
|||||||
|
|
||||||
return o1;
|
return o1;
|
||||||
}
|
}
|
||||||
function toEmojiName(str) {
|
|
||||||
return str.replace(/<img emoji-name=\"([^\"]*?)\" [^>]*>/gi, "[!$1]");
|
|
||||||
}
|
|
||||||
function formatByte(value) {
|
function formatByte(value) {
|
||||||
if (null == value || value == "") {
|
if (null == value || value == "") {
|
||||||
return "0 Bytes";
|
return "0 Bytes";
|
||||||
@@ -6426,13 +6516,18 @@ var isInitTool = false;
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
data: function data() {
|
data: function data() {
|
||||||
|
this.clipboardBlob = null;
|
||||||
return {
|
return {
|
||||||
|
//剪切板图片URL
|
||||||
|
clipboardUrl: '',
|
||||||
submitDisabled: true,
|
submitDisabled: true,
|
||||||
proxyTools: [],
|
proxyTools: [],
|
||||||
accept: ""
|
accept: ""
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created: function created() {
|
created: function created() {
|
||||||
|
var _this = this;
|
||||||
|
|
||||||
if (this.tools && this.tools.length > 0) {
|
if (this.tools && this.tools.length > 0) {
|
||||||
this.initTools(this.tools);
|
this.initTools(this.tools);
|
||||||
} else {
|
} else {
|
||||||
@@ -6444,9 +6539,13 @@ var isInitTool = false;
|
|||||||
name: 'uploadImage'
|
name: 'uploadImage'
|
||||||
}]);
|
}]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.IMUI.$on('change-contact', function () {
|
||||||
|
_this.closeClipboardImage();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
render: function render() {
|
render: function render() {
|
||||||
var _this = this;
|
var _this2 = this;
|
||||||
|
|
||||||
var h = arguments[0];
|
var h = arguments[0];
|
||||||
var toolLeft = [];
|
var toolLeft = [];
|
||||||
@@ -6468,7 +6567,7 @@ var isInitTool = false;
|
|||||||
"class": "lemon-editor__emoji"
|
"class": "lemon-editor__emoji"
|
||||||
}, [h("template", {
|
}, [h("template", {
|
||||||
"slot": "content"
|
"slot": "content"
|
||||||
}, [_this._renderEmojiTabs()]), h("div", {
|
}, [_this2._renderEmojiTabs()]), h("div", {
|
||||||
"class": classes,
|
"class": classes,
|
||||||
"attrs": {
|
"attrs": {
|
||||||
"title": title
|
"title": title
|
||||||
@@ -6494,7 +6593,27 @@ var isInitTool = false;
|
|||||||
});
|
});
|
||||||
return h("div", {
|
return h("div", {
|
||||||
"class": "lemon-editor"
|
"class": "lemon-editor"
|
||||||
}, [h("input", {
|
}, [this.clipboardUrl && h("div", {
|
||||||
|
"class": "lemon-editor__clipboard-image"
|
||||||
|
}, [h("img", {
|
||||||
|
"attrs": {
|
||||||
|
"src": this.clipboardUrl
|
||||||
|
}
|
||||||
|
}), h("div", [h("lemon-button", {
|
||||||
|
"style": {
|
||||||
|
marginRight: '10px'
|
||||||
|
},
|
||||||
|
"on": {
|
||||||
|
"click": this.closeClipboardImage
|
||||||
|
},
|
||||||
|
"attrs": {
|
||||||
|
"color": "grey"
|
||||||
|
}
|
||||||
|
}, ["\u53D6\u6D88"]), h("lemon-button", {
|
||||||
|
"on": {
|
||||||
|
"click": this.sendClipboardImage
|
||||||
|
}
|
||||||
|
}, ["\u53D1\u9001\u56FE\u7247"])])]), h("input", {
|
||||||
"style": "display:none",
|
"style": "display:none",
|
||||||
"attrs": {
|
"attrs": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
@@ -6542,11 +6661,21 @@ var isInitTool = false;
|
|||||||
}, [this.sendText])])])]);
|
}, [this.sendText])])])]);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
closeClipboardImage: function closeClipboardImage() {
|
||||||
|
this.clipboardUrl = '';
|
||||||
|
this.clipboardBlob = null;
|
||||||
|
},
|
||||||
|
sendClipboardImage: function sendClipboardImage() {
|
||||||
|
if (!this.clipboardBlob) return;
|
||||||
|
this.$emit("upload", this.clipboardBlob);
|
||||||
|
this.closeClipboardImage();
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化工具栏
|
* 初始化工具栏
|
||||||
*/
|
*/
|
||||||
initTools: function initTools(data) {
|
initTools: function initTools(data) {
|
||||||
var _this2 = this;
|
var _this3 = this;
|
||||||
|
|
||||||
var h = this.$createElement;
|
var h = this.$createElement;
|
||||||
if (!data) return;
|
if (!data) return;
|
||||||
@@ -6563,7 +6692,7 @@ var isInitTool = false;
|
|||||||
name: 'uploadFile',
|
name: 'uploadFile',
|
||||||
title: "文件上传",
|
title: "文件上传",
|
||||||
click: function click() {
|
click: function click() {
|
||||||
return _this2.selectFile("*");
|
return _this3.selectFile("*");
|
||||||
},
|
},
|
||||||
render: function render(menu) {
|
render: function render(menu) {
|
||||||
return h("i", {
|
return h("i", {
|
||||||
@@ -6574,7 +6703,7 @@ var isInitTool = false;
|
|||||||
name: 'uploadImage',
|
name: 'uploadImage',
|
||||||
title: "图片上传",
|
title: "图片上传",
|
||||||
click: function click() {
|
click: function click() {
|
||||||
return _this2.selectFile("image/*");
|
return _this3.selectFile("image/*");
|
||||||
},
|
},
|
||||||
render: function render(menu) {
|
render: function render(menu) {
|
||||||
return h("i", {
|
return h("i", {
|
||||||
@@ -6619,7 +6748,7 @@ var isInitTool = false;
|
|||||||
this._saveLastRange();
|
this._saveLastRange();
|
||||||
},
|
},
|
||||||
_renderEmojiTabs: function _renderEmojiTabs() {
|
_renderEmojiTabs: function _renderEmojiTabs() {
|
||||||
var _this3 = this;
|
var _this4 = this;
|
||||||
|
|
||||||
var h = this.$createElement;
|
var h = this.$createElement;
|
||||||
|
|
||||||
@@ -6633,7 +6762,7 @@ var isInitTool = false;
|
|||||||
"class": "lemon-editor__emoji-item",
|
"class": "lemon-editor__emoji-item",
|
||||||
"on": {
|
"on": {
|
||||||
"click": function click() {
|
"click": function click() {
|
||||||
return _this3._handleSelectEmoji(item);
|
return _this4._handleSelectEmoji(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -6703,12 +6832,36 @@ var isInitTool = false;
|
|||||||
var clipboardData = e.clipboardData || window.clipboardData;
|
var clipboardData = e.clipboardData || window.clipboardData;
|
||||||
var text = clipboardData.getData("Text");
|
var text = clipboardData.getData("Text");
|
||||||
|
|
||||||
if (window.clipboardData) {
|
if (text) {
|
||||||
this.$refs.textarea.innerHTML = text;
|
if (window.clipboardData) {
|
||||||
|
this.$refs.textarea.innerHTML = text;
|
||||||
|
} else {
|
||||||
|
exec(text, "insertText");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
exec(text, "insertText");
|
var _this$_getClipboardBl = this._getClipboardBlob(clipboardData),
|
||||||
|
blob = _this$_getClipboardBl.blob,
|
||||||
|
blobUrl = _this$_getClipboardBl.blobUrl;
|
||||||
|
|
||||||
|
this.clipboardBlob = blob;
|
||||||
|
this.clipboardUrl = blobUrl;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
_getClipboardBlob: function _getClipboardBlob(clipboard) {
|
||||||
|
var blob, blobUrl;
|
||||||
|
|
||||||
|
for (var i = 0; i < clipboard.items.length; ++i) {
|
||||||
|
if (clipboard.items[i].kind == 'file' && clipboard.items[i].type.indexOf('image/') !== -1) {
|
||||||
|
blob = clipboard.items[i].getAsFile();
|
||||||
|
blobUrl = (window.URL || window.webkitURL).createObjectURL(blob);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
blob: blob,
|
||||||
|
blobUrl: blobUrl
|
||||||
|
};
|
||||||
|
},
|
||||||
_handleKeyup: function _handleKeyup(e) {
|
_handleKeyup: function _handleKeyup(e) {
|
||||||
this._saveLastRange();
|
this._saveLastRange();
|
||||||
|
|
||||||
@@ -6726,7 +6879,7 @@ var isInitTool = false;
|
|||||||
// .replace(/<div>|<p>/g, "\r\n")
|
// .replace(/<div>|<p>/g, "\r\n")
|
||||||
// .replace(/<\/div>|<\/p>/g, "")
|
// .replace(/<\/div>|<\/p>/g, "")
|
||||||
// );
|
// );
|
||||||
return toEmojiName(this.$refs.textarea.innerHTML);
|
return this.IMUI.emojiImageToName(this.$refs.textarea.innerHTML);
|
||||||
},
|
},
|
||||||
_checkSubmitDisabled: function _checkSubmitDisabled() {
|
_checkSubmitDisabled: function _checkSubmitDisabled() {
|
||||||
this.submitDisabled = !clearHtmlExcludeImg(this.$refs.textarea.innerHTML.trim());
|
this.submitDisabled = !clearHtmlExcludeImg(this.$refs.textarea.innerHTML.trim());
|
||||||
@@ -6739,11 +6892,11 @@ var isInitTool = false;
|
|||||||
this._checkSubmitDisabled();
|
this._checkSubmitDisabled();
|
||||||
},
|
},
|
||||||
_handleChangeFile: function _handleChangeFile(e) {
|
_handleChangeFile: function _handleChangeFile(e) {
|
||||||
var _this4 = this;
|
var _this5 = this;
|
||||||
|
|
||||||
var fileInput = this.$refs.fileInput;
|
var fileInput = this.$refs.fileInput;
|
||||||
Array.from(fileInput.files).forEach(function (file) {
|
Array.from(fileInput.files).forEach(function (file) {
|
||||||
_this4.$emit("upload", file);
|
_this5.$emit("upload", file);
|
||||||
});
|
});
|
||||||
fileInput.value = "";
|
fileInput.value = "";
|
||||||
},
|
},
|
||||||
@@ -6755,7 +6908,7 @@ var isInitTool = false;
|
|||||||
this.$forceUpdate();
|
this.$forceUpdate();
|
||||||
},
|
},
|
||||||
setValue: function setValue(val) {
|
setValue: function setValue(val) {
|
||||||
this.$refs.textarea.innerHTML = val;
|
this.$refs.textarea.innerHTML = this.IMUI.emojiNameToImage(val);
|
||||||
|
|
||||||
this._checkSubmitDisabled();
|
this._checkSubmitDisabled();
|
||||||
}
|
}
|
||||||
@@ -6787,86 +6940,6 @@ var editor_component = normalizeComponent(
|
|||||||
)
|
)
|
||||||
|
|
||||||
/* harmony default export */ var editor = (editor_component.exports);
|
/* harmony default export */ var editor = (editor_component.exports);
|
||||||
// EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
|
|
||||||
var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__("8bbf");
|
|
||||||
var external_commonjs_vue_commonjs2_vue_root_Vue_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_vue_commonjs2_vue_root_Vue_);
|
|
||||||
|
|
||||||
// CONCATENATED MODULE: ./packages/directives/dropdown.js
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var dropdown_popover;
|
|
||||||
|
|
||||||
var hidePopover = function hidePopover() {
|
|
||||||
if (dropdown_popover) dropdown_popover.style.display = 'none';
|
|
||||||
};
|
|
||||||
|
|
||||||
var showPopover = function showPopover() {
|
|
||||||
if (dropdown_popover) dropdown_popover.style.display = 'block';
|
|
||||||
};
|
|
||||||
|
|
||||||
document.addEventListener('click', function (e) {
|
|
||||||
hidePopover();
|
|
||||||
});
|
|
||||||
/* harmony default export */ var dropdown = ({
|
|
||||||
hide: hidePopover,
|
|
||||||
bind: function bind(el, binding, vnode) {
|
|
||||||
el.addEventListener('contextmenu', function (e) {
|
|
||||||
if (isEmpty(binding.value) || !Array.isArray(binding.value)) return;
|
|
||||||
e.preventDefault();
|
|
||||||
var component;
|
|
||||||
var visibleItems = [];
|
|
||||||
if (binding.modifiers.message) component = vnode.context;else if (binding.modifiers.contact) component = vnode.child;
|
|
||||||
|
|
||||||
if (!dropdown_popover) {
|
|
||||||
dropdown_popover = document.createElement('div');
|
|
||||||
dropdown_popover.className = 'lemon-dropdown';
|
|
||||||
document.body.appendChild(dropdown_popover);
|
|
||||||
}
|
|
||||||
|
|
||||||
dropdown_popover.innerHTML = binding.value.map(function (item) {
|
|
||||||
var visible;
|
|
||||||
|
|
||||||
if (isFunction(item.visible)) {
|
|
||||||
visible = item.visible(component);
|
|
||||||
} else {
|
|
||||||
visible = item.visible === undefined ? true : item.visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (visible) {
|
|
||||||
visibleItems.push(item);
|
|
||||||
var icon = item.icon ? "<i class=\"lemon-dropdown__icon ".concat(item.icon, "\"></i>") : '';
|
|
||||||
return "<div style=\"color:".concat(item.color, "\" title=\"").concat(item.text, "\" class=\"lemon-dropdown__item\">").concat(icon, "<span>").concat(item.text, "</span></div>");
|
|
||||||
}
|
|
||||||
|
|
||||||
return '';
|
|
||||||
}).join("");
|
|
||||||
dropdown_popover.style.top = "".concat(e.pageY, "px");
|
|
||||||
dropdown_popover.style.left = "".concat(e.pageX, "px");
|
|
||||||
dropdown_popover.childNodes.forEach(function (node, index) {
|
|
||||||
var _visibleItems$index = visibleItems[index],
|
|
||||||
click = _visibleItems$index.click,
|
|
||||||
_render = _visibleItems$index.render;
|
|
||||||
node.addEventListener('click', function (e) {
|
|
||||||
e.stopPropagation();
|
|
||||||
if (isFunction(click)) click(e, component, hidePopover);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (isFunction(_render)) {
|
|
||||||
var ins = external_commonjs_vue_commonjs2_vue_root_Vue_default.a.extend({
|
|
||||||
render: function render(h) {
|
|
||||||
return _render(h, component, hidePopover);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
var renderComponent = new ins().$mount();
|
|
||||||
node.querySelector('span').innerHTML = renderComponent.$el.outerHTML;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
showPopover();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
inserted: function inserted(el, binding, vnode) {}
|
|
||||||
});
|
|
||||||
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/messages.vue?vue&type=script&lang=js&
|
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/messages.vue?vue&type=script&lang=js&
|
||||||
|
|
||||||
|
|
||||||
@@ -6998,7 +7071,7 @@ document.addEventListener('click', function (e) {
|
|||||||
switch (_context2.prev = _context2.next) {
|
switch (_context2.prev = _context2.next) {
|
||||||
case 0:
|
case 0:
|
||||||
target = e.target;
|
target = e.target;
|
||||||
dropdown.hide();
|
contextmenu.hide();
|
||||||
|
|
||||||
if (!(target.scrollTop == 0 && this._loading == false && this._loadend == false)) {
|
if (!(target.scrollTop == 0 && this._loading == false && this._loadend == false)) {
|
||||||
_context2.next = 8;
|
_context2.next = 8;
|
||||||
@@ -7199,7 +7272,7 @@ var messages_component = normalizeComponent(
|
|||||||
"class": "lemon-message__content-flex"
|
"class": "lemon-message__content-flex"
|
||||||
}, [h("div", {
|
}, [h("div", {
|
||||||
"directives": [{
|
"directives": [{
|
||||||
name: "dropdown",
|
name: "lemon-contextmenu",
|
||||||
value: this.IMUI.contextmenu,
|
value: this.IMUI.contextmenu,
|
||||||
modifiers: {
|
modifiers: {
|
||||||
"message": true
|
"message": true
|
||||||
@@ -7277,6 +7350,7 @@ var basic_component = normalizeComponent(
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function textvue_type_script_lang_js_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
function textvue_type_script_lang_js_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||||
|
|
||||||
function textvue_type_script_lang_js_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { textvue_type_script_lang_js_ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { textvue_type_script_lang_js_ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
function textvue_type_script_lang_js_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { textvue_type_script_lang_js_ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { textvue_type_script_lang_js_ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||||
@@ -7296,7 +7370,7 @@ function textvue_type_script_lang_js_objectSpread(target) { for (var i = 1; i <
|
|||||||
}, {
|
}, {
|
||||||
"scopedSlots": {
|
"scopedSlots": {
|
||||||
content: function content(props) {
|
content: function content(props) {
|
||||||
var content = _this.IMUI.replaceEmojiName(props.content);
|
var content = _this.IMUI.emojiNameToImage(props.content);
|
||||||
|
|
||||||
return h("span", helper_default()([{}, {
|
return h("span", helper_default()([{}, {
|
||||||
"domProps": {
|
"domProps": {
|
||||||
@@ -7595,7 +7669,7 @@ var CONTACT_TYPE = ["many", "single"];
|
|||||||
return "[图片]";
|
return "[图片]";
|
||||||
},
|
},
|
||||||
text: function text(message) {
|
text: function text(message) {
|
||||||
return this.replaceEmojiName(clearHtml(message.content));
|
return this.emojiNameToImage(clearHtml(message.content));
|
||||||
},
|
},
|
||||||
event: function event(message) {
|
event: function event(message) {
|
||||||
return '[通知]';
|
return '[通知]';
|
||||||
@@ -7692,6 +7766,7 @@ function () {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function componentsvue_type_script_lang_js_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
function componentsvue_type_script_lang_js_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||||
|
|
||||||
function componentsvue_type_script_lang_js_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { componentsvue_type_script_lang_js_ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { componentsvue_type_script_lang_js_ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
function componentsvue_type_script_lang_js_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { componentsvue_type_script_lang_js_ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { componentsvue_type_script_lang_js_ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||||
@@ -7769,6 +7844,7 @@ var renderDrawerContent = function renderDrawerContent() {};
|
|||||||
sendText: String,
|
sendText: String,
|
||||||
contextmenu: Array,
|
contextmenu: Array,
|
||||||
contactContextmenu: Array,
|
contactContextmenu: Array,
|
||||||
|
avatarCricle: Boolean,
|
||||||
user: {
|
user: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: function _default() {
|
default: function _default() {
|
||||||
@@ -7780,6 +7856,7 @@ var renderDrawerContent = function renderDrawerContent() {};
|
|||||||
this.CacheContactContainer = new memory_MemoryCache();
|
this.CacheContactContainer = new memory_MemoryCache();
|
||||||
this.CacheMenuContainer = new memory_MemoryCache();
|
this.CacheMenuContainer = new memory_MemoryCache();
|
||||||
this.CacheMessageLoaded = new memory_MemoryCache();
|
this.CacheMessageLoaded = new memory_MemoryCache();
|
||||||
|
this.CacheDraft = new memory_MemoryCache();
|
||||||
return {
|
return {
|
||||||
drawerVisible: !this.hideDrawer,
|
drawerVisible: !this.hideDrawer,
|
||||||
currentContactId: null,
|
currentContactId: null,
|
||||||
@@ -7896,6 +7973,8 @@ var renderDrawerContent = function renderDrawerContent() {};
|
|||||||
if (scrollToBottom == true) {
|
if (scrollToBottom == true) {
|
||||||
this.messageViewToBottom();
|
this.messageViewToBottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.CacheDraft.remove(message.toContactId);
|
||||||
} else {
|
} else {
|
||||||
updateContact.unread = '+1';
|
updateContact.unread = '+1';
|
||||||
}
|
}
|
||||||
@@ -7930,6 +8009,8 @@ var renderDrawerContent = function renderDrawerContent() {};
|
|||||||
lastContent: _this4.lastContentRender(message),
|
lastContent: _this4.lastContentRender(message),
|
||||||
lastSendTime: message.sendTime
|
lastSendTime: message.sendTime
|
||||||
});
|
});
|
||||||
|
|
||||||
|
_this4.CacheDraft.remove(message.toContactId);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
_handleUpload: function _handleUpload(file) {
|
_handleUpload: function _handleUpload(file) {
|
||||||
@@ -8074,14 +8155,14 @@ var renderDrawerContent = function renderDrawerContent() {};
|
|||||||
_renderSidebarMessage: function _renderSidebarMessage() {
|
_renderSidebarMessage: function _renderSidebarMessage() {
|
||||||
var _this9 = this;
|
var _this9 = this;
|
||||||
|
|
||||||
return this._renderSidebar([useScopedSlot(this.$scopedSlots["sidebar-message-top"]), this.lastMessages.map(function (contact) {
|
return this._renderSidebar([useScopedSlot(this.$scopedSlots["sidebar-message-top"], null, this), this.lastMessages.map(function (contact) {
|
||||||
return _this9._renderContact({
|
return _this9._renderContact({
|
||||||
contact: contact,
|
contact: contact,
|
||||||
timeFormat: _this9.contactTimeFormat
|
timeFormat: _this9.contactTimeFormat
|
||||||
}, function () {
|
}, function () {
|
||||||
return _this9.changeContact(contact.id);
|
return _this9.changeContact(contact.id);
|
||||||
}, _this9.$scopedSlots["sidebar-message"]);
|
}, _this9.$scopedSlots["sidebar-message"]);
|
||||||
})], DEFAULT_MENU_LASTMESSAGES);
|
})], DEFAULT_MENU_LASTMESSAGES, useScopedSlot(this.$scopedSlots["sidebar-message-fixedtop"], null, this));
|
||||||
},
|
},
|
||||||
_renderContact: function _renderContact(props, onClick, slot) {
|
_renderContact: function _renderContact(props, onClick, slot) {
|
||||||
var _this10 = this;
|
var _this10 = this;
|
||||||
@@ -8105,7 +8186,7 @@ var renderDrawerContent = function renderDrawerContent() {};
|
|||||||
"lemon-contact--active": this.currentContactId == props.contact.id
|
"lemon-contact--active": this.currentContactId == props.contact.id
|
||||||
},
|
},
|
||||||
"directives": [{
|
"directives": [{
|
||||||
name: "dropdown",
|
name: "lemon-contextmenu",
|
||||||
value: this.contactContextmenu,
|
value: this.contactContextmenu,
|
||||||
modifiers: {
|
modifiers: {
|
||||||
"contact": true
|
"contact": true
|
||||||
@@ -8127,7 +8208,7 @@ var renderDrawerContent = function renderDrawerContent() {};
|
|||||||
|
|
||||||
var h = this.$createElement;
|
var h = this.$createElement;
|
||||||
var prevIndex;
|
var prevIndex;
|
||||||
return this._renderSidebar([useScopedSlot(this.$scopedSlots["sidebar-contact-top"]), this.contacts.map(function (contact) {
|
return this._renderSidebar([useScopedSlot(this.$scopedSlots["sidebar-contact-top"], null, this), this.contacts.map(function (contact) {
|
||||||
if (!contact.index) return;
|
if (!contact.index) return;
|
||||||
contact.index = contact.index.replace(/\[[0-9]*\]/, "");
|
contact.index = contact.index.replace(/\[[0-9]*\]/, "");
|
||||||
var node = [contact.index !== prevIndex && h("p", {
|
var node = [contact.index !== prevIndex && h("p", {
|
||||||
@@ -8140,9 +8221,9 @@ var renderDrawerContent = function renderDrawerContent() {};
|
|||||||
}, _this11.$scopedSlots["sidebar-contact"])];
|
}, _this11.$scopedSlots["sidebar-contact"])];
|
||||||
prevIndex = contact.index;
|
prevIndex = contact.index;
|
||||||
return node;
|
return node;
|
||||||
})], DEFAULT_MENU_CONTACTS);
|
})], DEFAULT_MENU_CONTACTS, useScopedSlot(this.$scopedSlots["sidebar-contact-fixedtop"], null, this));
|
||||||
},
|
},
|
||||||
_renderSidebar: function _renderSidebar(children, name) {
|
_renderSidebar: function _renderSidebar(children, name, fixedtop) {
|
||||||
var h = this.$createElement;
|
var h = this.$createElement;
|
||||||
return h("div", {
|
return h("div", {
|
||||||
"class": "lemon-sidebar",
|
"class": "lemon-sidebar",
|
||||||
@@ -8153,7 +8234,11 @@ var renderDrawerContent = function renderDrawerContent() {};
|
|||||||
"on": {
|
"on": {
|
||||||
"scroll": this._handleSidebarScroll
|
"scroll": this._handleSidebarScroll
|
||||||
}
|
}
|
||||||
}, [children]);
|
}, [h("div", {
|
||||||
|
"class": "lemon-sidebar__fixed-top"
|
||||||
|
}, [fixedtop]), h("div", {
|
||||||
|
"class": "lemon-sidebar__scroll"
|
||||||
|
}, [children])]);
|
||||||
},
|
},
|
||||||
_renderDrawer: function _renderDrawer() {
|
_renderDrawer: function _renderDrawer() {
|
||||||
var h = this.$createElement;
|
var h = this.$createElement;
|
||||||
@@ -8266,14 +8351,13 @@ var renderDrawerContent = function renderDrawerContent() {};
|
|||||||
return nodes;
|
return nodes;
|
||||||
},
|
},
|
||||||
_handleSidebarScroll: function _handleSidebarScroll() {
|
_handleSidebarScroll: function _handleSidebarScroll() {
|
||||||
dropdown.hide();
|
contextmenu.hide();
|
||||||
},
|
},
|
||||||
_addContact: function _addContact(data, t) {
|
_addContact: function _addContact(data, t) {
|
||||||
var type = {
|
var type = {
|
||||||
0: "unshift",
|
0: "unshift",
|
||||||
1: "push"
|
1: "push"
|
||||||
}[t]; //this.contacts[type](cloneDeep(data));
|
}[t];
|
||||||
|
|
||||||
this.contacts[type](data);
|
this.contacts[type](data);
|
||||||
},
|
},
|
||||||
_addMessage: function _addMessage(data, contactId, t) {
|
_addMessage: function _addMessage(data, contactId, t) {
|
||||||
@@ -8312,12 +8396,15 @@ var renderDrawerContent = function renderDrawerContent() {};
|
|||||||
* @param {String} str 被替换的字符串
|
* @param {String} str 被替换的字符串
|
||||||
* @return {String} 替换后的字符串
|
* @return {String} 替换后的字符串
|
||||||
*/
|
*/
|
||||||
replaceEmojiName: function replaceEmojiName(str) {
|
emojiNameToImage: function emojiNameToImage(str) {
|
||||||
return str.replace(/\[!(\w+)\]/gi, function (str, match) {
|
return str.replace(/\[!(\w+)\]/gi, function (str, match) {
|
||||||
var file = match;
|
var file = match;
|
||||||
return emojiMap[file] ? "<img src=\"".concat(emojiMap[file], "\" />") : "[!".concat(match, "]");
|
return emojiMap[file] ? "<img emoji-name=\"".concat(match, "\" src=\"").concat(emojiMap[file], "\" />") : "[!".concat(match, "]");
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
emojiImageToName: function emojiImageToName(str) {
|
||||||
|
return str.replace(/<img emoji-name=\"([^\"]*?)\" [^>]*>/gi, "[!$1]");
|
||||||
|
},
|
||||||
updateCurrentMessages: function updateCurrentMessages() {
|
updateCurrentMessages: function updateCurrentMessages() {
|
||||||
if (!allMessages[this.currentContactId]) allMessages[this.currentContactId] = [];
|
if (!allMessages[this.currentContactId]) allMessages[this.currentContactId] = [];
|
||||||
this.currentMessages = allMessages[this.currentContactId];
|
this.currentMessages = allMessages[this.currentContactId];
|
||||||
@@ -8340,48 +8427,79 @@ var renderDrawerContent = function renderDrawerContent() {};
|
|||||||
regeneratorRuntime.mark(function _callee2(contactId, menuName) {
|
regeneratorRuntime.mark(function _callee2(contactId, menuName) {
|
||||||
var _this13 = this;
|
var _this13 = this;
|
||||||
|
|
||||||
|
var h, prevCurrentContactId, editorValue, draft;
|
||||||
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
||||||
while (1) {
|
while (1) {
|
||||||
switch (_context2.prev = _context2.next) {
|
switch (_context2.prev = _context2.next) {
|
||||||
case 0:
|
case 0:
|
||||||
|
h = this.$createElement;
|
||||||
|
|
||||||
if (!menuName) {
|
if (!menuName) {
|
||||||
_context2.next = 4;
|
_context2.next = 5;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.changeMenu(menuName);
|
this.changeMenu(menuName);
|
||||||
_context2.next = 6;
|
_context2.next = 7;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 5:
|
||||||
if (!(this._changeContactLock || this.currentContactId == contactId)) {
|
if (!(this._changeContactLock || this.currentContactId == contactId)) {
|
||||||
_context2.next = 6;
|
_context2.next = 7;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _context2.abrupt("return", false);
|
return _context2.abrupt("return", false);
|
||||||
|
|
||||||
case 6:
|
case 7:
|
||||||
|
prevCurrentContactId = this.currentContactId; //保存上个聊天目标的草稿
|
||||||
|
|
||||||
|
if (prevCurrentContactId) {
|
||||||
|
editorValue = this.getEditorValue();
|
||||||
|
|
||||||
|
if (editorValue) {
|
||||||
|
this.CacheDraft.set(prevCurrentContactId, editorValue);
|
||||||
|
this.updateContact({
|
||||||
|
id: prevCurrentContactId,
|
||||||
|
lastContent: [h("span", {
|
||||||
|
"style": "color:red;"
|
||||||
|
}, ["[\u8349\u7A3F]"]), h("span", helper_default()([{}, {
|
||||||
|
"domProps": {
|
||||||
|
innerHTML: this.lastContentRender({
|
||||||
|
type: 'text',
|
||||||
|
content: editorValue
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}]))]
|
||||||
|
});
|
||||||
|
this.setEditorValue('');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.currentContactId = contactId;
|
this.currentContactId = contactId;
|
||||||
|
|
||||||
if (this.currentContactId) {
|
if (this.currentContactId) {
|
||||||
_context2.next = 9;
|
_context2.next = 12;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _context2.abrupt("return", false);
|
return _context2.abrupt("return", false);
|
||||||
|
|
||||||
case 9:
|
case 12:
|
||||||
this.$emit("change-contact", this.currentContact, this);
|
this.$emit("change-contact", this.currentContact, this);
|
||||||
|
|
||||||
if (!isFunction(this.currentContact.renderContainer)) {
|
if (!isFunction(this.currentContact.renderContainer)) {
|
||||||
_context2.next = 12;
|
_context2.next = 15;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _context2.abrupt("return");
|
return _context2.abrupt("return");
|
||||||
|
|
||||||
case 12:
|
case 15:
|
||||||
|
//填充草稿内容
|
||||||
|
draft = this.CacheDraft.get(contactId) || "";
|
||||||
|
if (draft) this.setEditorValue(draft);
|
||||||
|
|
||||||
if (this.CacheMessageLoaded.has(contactId)) {
|
if (this.CacheMessageLoaded.has(contactId)) {
|
||||||
this.$refs.messages.loaded();
|
this.$refs.messages.loaded();
|
||||||
} else {
|
} else {
|
||||||
@@ -8402,7 +8520,7 @@ var renderDrawerContent = function renderDrawerContent() {};
|
|||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
case 14:
|
case 19:
|
||||||
case "end":
|
case "end":
|
||||||
return _context2.stop();
|
return _context2.stop();
|
||||||
}
|
}
|
||||||
@@ -8611,6 +8729,8 @@ var renderDrawerContent = function renderDrawerContent() {};
|
|||||||
var index = this.findContactIndexById(id);
|
var index = this.findContactIndexById(id);
|
||||||
if (index === -1) return false;
|
if (index === -1) return false;
|
||||||
this.contacts.splice(index, 1);
|
this.contacts.splice(index, 1);
|
||||||
|
this.CacheDraft.remove(id);
|
||||||
|
this.CacheMessageLoaded.remove(id);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -8686,7 +8806,7 @@ var renderDrawerContent = function renderDrawerContent() {};
|
|||||||
return this.currentMessages;
|
return this.currentMessages;
|
||||||
},
|
},
|
||||||
setEditorValue: function setEditorValue(val) {
|
setEditorValue: function setEditorValue(val) {
|
||||||
this.$refs.editor.setValue(this.replaceEmojiName(val));
|
this.$refs.editor.setValue(this.emojiNameToImage(val));
|
||||||
},
|
},
|
||||||
getEditorValue: function getEditorValue() {
|
getEditorValue: function getEditorValue() {
|
||||||
return this.$refs.editor.getFormatValue();
|
return this.$refs.editor.getFormatValue();
|
||||||
@@ -8744,7 +8864,7 @@ var common = __webpack_require__("6a2b");
|
|||||||
// CONCATENATED MODULE: ./packages/directives/index.js
|
// CONCATENATED MODULE: ./packages/directives/index.js
|
||||||
|
|
||||||
|
|
||||||
external_commonjs_vue_commonjs2_vue_root_Vue_default.a.directive('dropdown', dropdown);
|
external_commonjs_vue_commonjs2_vue_root_Vue_default.a.directive('LemonContextmenu', contextmenu);
|
||||||
// CONCATENATED MODULE: ./packages/index.js
|
// CONCATENATED MODULE: ./packages/index.js
|
||||||
|
|
||||||
|
|
||||||
@@ -8765,7 +8885,7 @@ external_commonjs_vue_commonjs2_vue_root_Vue_default.a.directive('dropdown', dro
|
|||||||
|
|
||||||
|
|
||||||
var version = "1.4.2";
|
var version = "1.4.2";
|
||||||
var packages_components = [components, components_contact, messages, editor, avatar, badge, components_button, popover, tabs, basic, message_text, message_image, file, message_event];
|
var packages_components = [components, components_contact, messages, editor, avatar, badge, components_button, components_popover, tabs, basic, message_text, message_image, file, message_event];
|
||||||
|
|
||||||
var install = function install(Vue) {
|
var install = function install(Vue) {
|
||||||
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+307
-187
@@ -5651,6 +5651,136 @@ var es7_array_includes = __webpack_require__("6762");
|
|||||||
// EXTERNAL MODULE: ./node_modules/core-js/modules/es6.string.includes.js
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es6.string.includes.js
|
||||||
var es6_string_includes = __webpack_require__("2fdb");
|
var es6_string_includes = __webpack_require__("2fdb");
|
||||||
|
|
||||||
|
// EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
|
||||||
|
var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__("8bbf");
|
||||||
|
var external_commonjs_vue_commonjs2_vue_root_Vue_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_vue_commonjs2_vue_root_Vue_);
|
||||||
|
|
||||||
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es6.regexp.constructor.js
|
||||||
|
var es6_regexp_constructor = __webpack_require__("3b2b");
|
||||||
|
|
||||||
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es7.object.values.js
|
||||||
|
var es7_object_values = __webpack_require__("8615");
|
||||||
|
|
||||||
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es6.regexp.to-string.js
|
||||||
|
var es6_regexp_to_string = __webpack_require__("6b54");
|
||||||
|
|
||||||
|
// CONCATENATED MODULE: ./packages/utils/validate.js
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function isPlainObject(obj) {
|
||||||
|
return Object.prototype.toString.call(obj) === "[object Object]";
|
||||||
|
}
|
||||||
|
function isString(str) {
|
||||||
|
return typeof str == "string";
|
||||||
|
}
|
||||||
|
function isToday(time) {
|
||||||
|
return new Date().getTime() - time < 86400000;
|
||||||
|
}
|
||||||
|
function isEmpty(obj) {
|
||||||
|
if (!obj) return true;
|
||||||
|
if (Array.isArray(obj) && obj.length == 0) return true;
|
||||||
|
if (isPlainObject(obj) && Object.values(obj).length == 0) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
function isUrl(str) {
|
||||||
|
var reg = "^((https|http|ftp|rtsp|mms)?://)" + "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" + //ftp的user@
|
||||||
|
"(([0-9]{1,3}.){3}[0-9]{1,3}" + // IP形式的URL- 199.194.52.184
|
||||||
|
"|" + // 允许IP和DOMAIN(域名)
|
||||||
|
"([0-9a-z_!~*'()-]+.)*" + // 域名- www.
|
||||||
|
"([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]." + // 二级域名
|
||||||
|
"[a-z]{2,6})" + // first level domain- .com or .museum
|
||||||
|
"(:[0-9]{1,4})?" + // 端口- :80
|
||||||
|
"((/?)|" + // 如果没有文件名,则不需要斜杠
|
||||||
|
"(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$";
|
||||||
|
return new RegExp(reg).test(str) ? true : false;
|
||||||
|
}
|
||||||
|
function isFunction(val) {
|
||||||
|
return val && typeof val === "function";
|
||||||
|
}
|
||||||
|
function isEng(val) {
|
||||||
|
return /^[A-Za-z]+$/.test(val);
|
||||||
|
}
|
||||||
|
// CONCATENATED MODULE: ./packages/directives/contextmenu.js
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var popover;
|
||||||
|
|
||||||
|
var hidePopover = function hidePopover() {
|
||||||
|
if (popover) popover.style.display = 'none';
|
||||||
|
};
|
||||||
|
|
||||||
|
var showPopover = function showPopover() {
|
||||||
|
if (popover) popover.style.display = 'block';
|
||||||
|
};
|
||||||
|
|
||||||
|
document.addEventListener('click', function (e) {
|
||||||
|
hidePopover();
|
||||||
|
});
|
||||||
|
/* harmony default export */ var contextmenu = ({
|
||||||
|
hide: hidePopover,
|
||||||
|
bind: function bind(el, binding, vnode) {
|
||||||
|
el.addEventListener('contextmenu', function (e) {
|
||||||
|
if (isEmpty(binding.value) || !Array.isArray(binding.value)) return;
|
||||||
|
e.preventDefault();
|
||||||
|
components_popover.methods.closeAll();
|
||||||
|
var component;
|
||||||
|
var visibleItems = [];
|
||||||
|
if (binding.modifiers.message) component = vnode.context;else if (binding.modifiers.contact) component = vnode.child;
|
||||||
|
|
||||||
|
if (!popover) {
|
||||||
|
popover = document.createElement('div');
|
||||||
|
popover.className = 'lemon-contextmenu';
|
||||||
|
document.body.appendChild(popover);
|
||||||
|
}
|
||||||
|
|
||||||
|
popover.innerHTML = binding.value.map(function (item) {
|
||||||
|
var visible;
|
||||||
|
|
||||||
|
if (isFunction(item.visible)) {
|
||||||
|
visible = item.visible(component);
|
||||||
|
} else {
|
||||||
|
visible = item.visible === undefined ? true : item.visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (visible) {
|
||||||
|
visibleItems.push(item);
|
||||||
|
var icon = item.icon ? "<i class=\"lemon-contextmenu__icon ".concat(item.icon, "\"></i>") : '';
|
||||||
|
return "<div style=\"color:".concat(item.color, "\" title=\"").concat(item.text, "\" class=\"lemon-contextmenu__item\">").concat(icon, "<span>").concat(item.text, "</span></div>");
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}).join("");
|
||||||
|
popover.style.top = "".concat(e.pageY, "px");
|
||||||
|
popover.style.left = "".concat(e.pageX, "px");
|
||||||
|
popover.childNodes.forEach(function (node, index) {
|
||||||
|
var _visibleItems$index = visibleItems[index],
|
||||||
|
click = _visibleItems$index.click,
|
||||||
|
_render = _visibleItems$index.render;
|
||||||
|
node.addEventListener('click', function (e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
if (isFunction(click)) click(e, component, hidePopover);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (isFunction(_render)) {
|
||||||
|
var ins = external_commonjs_vue_commonjs2_vue_root_Vue_default.a.extend({
|
||||||
|
render: function render(h) {
|
||||||
|
return _render(h, component, hidePopover);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var renderComponent = new ins().$mount();
|
||||||
|
node.querySelector('span').innerHTML = renderComponent.$el.outerHTML;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
showPopover();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
inserted: function inserted(el, binding, vnode) {}
|
||||||
|
});
|
||||||
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/popover.vue?vue&type=script&lang=js&
|
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/popover.vue?vue&type=script&lang=js&
|
||||||
|
|
||||||
|
|
||||||
@@ -5661,12 +5791,6 @@ var es6_string_includes = __webpack_require__("2fdb");
|
|||||||
|
|
||||||
var popoverCloseQueue = [];
|
var popoverCloseQueue = [];
|
||||||
|
|
||||||
var popoverCloseAll = function popoverCloseAll() {
|
|
||||||
return popoverCloseQueue.forEach(function (callback) {
|
|
||||||
return callback();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
var triggerEvents = {
|
var triggerEvents = {
|
||||||
hover: function hover(el) {},
|
hover: function hover(el) {},
|
||||||
focus: function focus(el) {
|
focus: function focus(el) {
|
||||||
@@ -5684,6 +5808,7 @@ var triggerEvents = {
|
|||||||
|
|
||||||
el.addEventListener("click", function (e) {
|
el.addEventListener("click", function (e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
contextmenu.hide();
|
||||||
|
|
||||||
_this2.changeVisible();
|
_this2.changeVisible();
|
||||||
});
|
});
|
||||||
@@ -5740,8 +5865,6 @@ var triggerEvents = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [h("div", {
|
}, [h("div", {
|
||||||
"class": "lemon-popover__title"
|
|
||||||
}), h("div", {
|
|
||||||
"class": "lemon-popover__content"
|
"class": "lemon-popover__content"
|
||||||
}, [this.$slots.content]), h("div", {
|
}, [this.$slots.content]), h("div", {
|
||||||
"class": "lemon-popover__arrow"
|
"class": "lemon-popover__arrow"
|
||||||
@@ -5801,9 +5924,14 @@ var triggerEvents = {
|
|||||||
this.visible ? this.close() : this.open();
|
this.visible ? this.close() : this.open();
|
||||||
},
|
},
|
||||||
open: function open() {
|
open: function open() {
|
||||||
popoverCloseAll();
|
this.closeAll();
|
||||||
this.visible = true;
|
this.visible = true;
|
||||||
},
|
},
|
||||||
|
closeAll: function closeAll() {
|
||||||
|
popoverCloseQueue.forEach(function (callback) {
|
||||||
|
return callback();
|
||||||
|
});
|
||||||
|
},
|
||||||
close: function close() {
|
close: function close() {
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
}
|
}
|
||||||
@@ -5834,17 +5962,21 @@ var popover_component = normalizeComponent(
|
|||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
/* harmony default export */ var popover = (popover_component.exports);
|
/* harmony default export */ var components_popover = (popover_component.exports);
|
||||||
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/button.vue?vue&type=script&lang=js&
|
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/button.vue?vue&type=script&lang=js&
|
||||||
/* harmony default export */ var buttonvue_type_script_lang_js_ = ({
|
/* harmony default export */ var buttonvue_type_script_lang_js_ = ({
|
||||||
name: "LemonButton",
|
name: "LemonButton",
|
||||||
props: {
|
props: {
|
||||||
|
color: {
|
||||||
|
type: String,
|
||||||
|
default: 'default'
|
||||||
|
},
|
||||||
disabled: Boolean
|
disabled: Boolean
|
||||||
},
|
},
|
||||||
render: function render() {
|
render: function render() {
|
||||||
var h = arguments[0];
|
var h = arguments[0];
|
||||||
return h("button", {
|
return h("button", {
|
||||||
"class": "lemon-button",
|
"class": ['lemon-button', "lemon-button--color-".concat(this.color)],
|
||||||
"attrs": {
|
"attrs": {
|
||||||
"disabled": this.disabled,
|
"disabled": this.disabled,
|
||||||
"type": "button"
|
"type": "button"
|
||||||
@@ -5949,12 +6081,19 @@ var badge_component = normalizeComponent(
|
|||||||
|
|
||||||
/* harmony default export */ var avatarvue_type_script_lang_js_ = ({
|
/* harmony default export */ var avatarvue_type_script_lang_js_ = ({
|
||||||
name: "LemonAvatar",
|
name: "LemonAvatar",
|
||||||
|
inject: ['IMUI'],
|
||||||
props: {
|
props: {
|
||||||
src: String,
|
src: String,
|
||||||
icon: {
|
icon: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "lemon-icon-people"
|
default: "lemon-icon-people"
|
||||||
},
|
},
|
||||||
|
circle: {
|
||||||
|
type: Boolean,
|
||||||
|
default: function _default() {
|
||||||
|
return this.IMUI ? this.IMUI.avatarCricle : false;
|
||||||
|
}
|
||||||
|
},
|
||||||
size: {
|
size: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 32
|
default: 32
|
||||||
@@ -5971,7 +6110,9 @@ var badge_component = normalizeComponent(
|
|||||||
var h = arguments[0];
|
var h = arguments[0];
|
||||||
return h("span", {
|
return h("span", {
|
||||||
"style": this.style,
|
"style": this.style,
|
||||||
"class": "lemon-avatar",
|
"class": ['lemon-avatar', {
|
||||||
|
'lemon-avatar--circle': this.circle
|
||||||
|
}],
|
||||||
"on": {
|
"on": {
|
||||||
"click": function click(e) {
|
"click": function click(e) {
|
||||||
return _this.$emit("click", e);
|
return _this.$emit("click", e);
|
||||||
@@ -6035,54 +6176,6 @@ var avatar_component = normalizeComponent(
|
|||||||
var helper = __webpack_require__("2638");
|
var helper = __webpack_require__("2638");
|
||||||
var helper_default = /*#__PURE__*/__webpack_require__.n(helper);
|
var helper_default = /*#__PURE__*/__webpack_require__.n(helper);
|
||||||
|
|
||||||
// EXTERNAL MODULE: ./node_modules/core-js/modules/es6.regexp.constructor.js
|
|
||||||
var es6_regexp_constructor = __webpack_require__("3b2b");
|
|
||||||
|
|
||||||
// EXTERNAL MODULE: ./node_modules/core-js/modules/es7.object.values.js
|
|
||||||
var es7_object_values = __webpack_require__("8615");
|
|
||||||
|
|
||||||
// EXTERNAL MODULE: ./node_modules/core-js/modules/es6.regexp.to-string.js
|
|
||||||
var es6_regexp_to_string = __webpack_require__("6b54");
|
|
||||||
|
|
||||||
// CONCATENATED MODULE: ./packages/utils/validate.js
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function isPlainObject(obj) {
|
|
||||||
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
||||||
}
|
|
||||||
function isString(str) {
|
|
||||||
return typeof str == "string";
|
|
||||||
}
|
|
||||||
function isToday(time) {
|
|
||||||
return new Date().getTime() - time < 86400000;
|
|
||||||
}
|
|
||||||
function isEmpty(obj) {
|
|
||||||
if (!obj) return true;
|
|
||||||
if (Array.isArray(obj) && obj.length == 0) return true;
|
|
||||||
if (isPlainObject(obj) && Object.values(obj).length == 0) return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
function isUrl(str) {
|
|
||||||
var reg = "^((https|http|ftp|rtsp|mms)?://)" + "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" + //ftp的user@
|
|
||||||
"(([0-9]{1,3}.){3}[0-9]{1,3}" + // IP形式的URL- 199.194.52.184
|
|
||||||
"|" + // 允许IP和DOMAIN(域名)
|
|
||||||
"([0-9a-z_!~*'()-]+.)*" + // 域名- www.
|
|
||||||
"([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]." + // 二级域名
|
|
||||||
"[a-z]{2,6})" + // first level domain- .com or .museum
|
|
||||||
"(:[0-9]{1,4})?" + // 端口- :80
|
|
||||||
"((/?)|" + // 如果没有文件名,则不需要斜杠
|
|
||||||
"(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$";
|
|
||||||
return new RegExp(reg).test(str) ? true : false;
|
|
||||||
}
|
|
||||||
function isFunction(val) {
|
|
||||||
return val && typeof val === "function";
|
|
||||||
}
|
|
||||||
function isEng(val) {
|
|
||||||
return /^[A-Za-z]+$/.test(val);
|
|
||||||
}
|
|
||||||
// EXTERNAL MODULE: ./node_modules/core-js/modules/es7.object.get-own-property-descriptors.js
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es7.object.get-own-property-descriptors.js
|
||||||
var es7_object_get_own_property_descriptors = __webpack_require__("8e6e");
|
var es7_object_get_own_property_descriptors = __webpack_require__("8e6e");
|
||||||
|
|
||||||
@@ -6232,9 +6325,6 @@ function mergeDeep(o1, o2) {
|
|||||||
|
|
||||||
return o1;
|
return o1;
|
||||||
}
|
}
|
||||||
function toEmojiName(str) {
|
|
||||||
return str.replace(/<img emoji-name=\"([^\"]*?)\" [^>]*>/gi, "[!$1]");
|
|
||||||
}
|
|
||||||
function formatByte(value) {
|
function formatByte(value) {
|
||||||
if (null == value || value == "") {
|
if (null == value || value == "") {
|
||||||
return "0 Bytes";
|
return "0 Bytes";
|
||||||
@@ -6435,13 +6525,18 @@ var isInitTool = false;
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
data: function data() {
|
data: function data() {
|
||||||
|
this.clipboardBlob = null;
|
||||||
return {
|
return {
|
||||||
|
//剪切板图片URL
|
||||||
|
clipboardUrl: '',
|
||||||
submitDisabled: true,
|
submitDisabled: true,
|
||||||
proxyTools: [],
|
proxyTools: [],
|
||||||
accept: ""
|
accept: ""
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created: function created() {
|
created: function created() {
|
||||||
|
var _this = this;
|
||||||
|
|
||||||
if (this.tools && this.tools.length > 0) {
|
if (this.tools && this.tools.length > 0) {
|
||||||
this.initTools(this.tools);
|
this.initTools(this.tools);
|
||||||
} else {
|
} else {
|
||||||
@@ -6453,9 +6548,13 @@ var isInitTool = false;
|
|||||||
name: 'uploadImage'
|
name: 'uploadImage'
|
||||||
}]);
|
}]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.IMUI.$on('change-contact', function () {
|
||||||
|
_this.closeClipboardImage();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
render: function render() {
|
render: function render() {
|
||||||
var _this = this;
|
var _this2 = this;
|
||||||
|
|
||||||
var h = arguments[0];
|
var h = arguments[0];
|
||||||
var toolLeft = [];
|
var toolLeft = [];
|
||||||
@@ -6477,7 +6576,7 @@ var isInitTool = false;
|
|||||||
"class": "lemon-editor__emoji"
|
"class": "lemon-editor__emoji"
|
||||||
}, [h("template", {
|
}, [h("template", {
|
||||||
"slot": "content"
|
"slot": "content"
|
||||||
}, [_this._renderEmojiTabs()]), h("div", {
|
}, [_this2._renderEmojiTabs()]), h("div", {
|
||||||
"class": classes,
|
"class": classes,
|
||||||
"attrs": {
|
"attrs": {
|
||||||
"title": title
|
"title": title
|
||||||
@@ -6503,7 +6602,27 @@ var isInitTool = false;
|
|||||||
});
|
});
|
||||||
return h("div", {
|
return h("div", {
|
||||||
"class": "lemon-editor"
|
"class": "lemon-editor"
|
||||||
}, [h("input", {
|
}, [this.clipboardUrl && h("div", {
|
||||||
|
"class": "lemon-editor__clipboard-image"
|
||||||
|
}, [h("img", {
|
||||||
|
"attrs": {
|
||||||
|
"src": this.clipboardUrl
|
||||||
|
}
|
||||||
|
}), h("div", [h("lemon-button", {
|
||||||
|
"style": {
|
||||||
|
marginRight: '10px'
|
||||||
|
},
|
||||||
|
"on": {
|
||||||
|
"click": this.closeClipboardImage
|
||||||
|
},
|
||||||
|
"attrs": {
|
||||||
|
"color": "grey"
|
||||||
|
}
|
||||||
|
}, ["\u53D6\u6D88"]), h("lemon-button", {
|
||||||
|
"on": {
|
||||||
|
"click": this.sendClipboardImage
|
||||||
|
}
|
||||||
|
}, ["\u53D1\u9001\u56FE\u7247"])])]), h("input", {
|
||||||
"style": "display:none",
|
"style": "display:none",
|
||||||
"attrs": {
|
"attrs": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
@@ -6551,11 +6670,21 @@ var isInitTool = false;
|
|||||||
}, [this.sendText])])])]);
|
}, [this.sendText])])])]);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
closeClipboardImage: function closeClipboardImage() {
|
||||||
|
this.clipboardUrl = '';
|
||||||
|
this.clipboardBlob = null;
|
||||||
|
},
|
||||||
|
sendClipboardImage: function sendClipboardImage() {
|
||||||
|
if (!this.clipboardBlob) return;
|
||||||
|
this.$emit("upload", this.clipboardBlob);
|
||||||
|
this.closeClipboardImage();
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化工具栏
|
* 初始化工具栏
|
||||||
*/
|
*/
|
||||||
initTools: function initTools(data) {
|
initTools: function initTools(data) {
|
||||||
var _this2 = this;
|
var _this3 = this;
|
||||||
|
|
||||||
var h = this.$createElement;
|
var h = this.$createElement;
|
||||||
if (!data) return;
|
if (!data) return;
|
||||||
@@ -6572,7 +6701,7 @@ var isInitTool = false;
|
|||||||
name: 'uploadFile',
|
name: 'uploadFile',
|
||||||
title: "文件上传",
|
title: "文件上传",
|
||||||
click: function click() {
|
click: function click() {
|
||||||
return _this2.selectFile("*");
|
return _this3.selectFile("*");
|
||||||
},
|
},
|
||||||
render: function render(menu) {
|
render: function render(menu) {
|
||||||
return h("i", {
|
return h("i", {
|
||||||
@@ -6583,7 +6712,7 @@ var isInitTool = false;
|
|||||||
name: 'uploadImage',
|
name: 'uploadImage',
|
||||||
title: "图片上传",
|
title: "图片上传",
|
||||||
click: function click() {
|
click: function click() {
|
||||||
return _this2.selectFile("image/*");
|
return _this3.selectFile("image/*");
|
||||||
},
|
},
|
||||||
render: function render(menu) {
|
render: function render(menu) {
|
||||||
return h("i", {
|
return h("i", {
|
||||||
@@ -6628,7 +6757,7 @@ var isInitTool = false;
|
|||||||
this._saveLastRange();
|
this._saveLastRange();
|
||||||
},
|
},
|
||||||
_renderEmojiTabs: function _renderEmojiTabs() {
|
_renderEmojiTabs: function _renderEmojiTabs() {
|
||||||
var _this3 = this;
|
var _this4 = this;
|
||||||
|
|
||||||
var h = this.$createElement;
|
var h = this.$createElement;
|
||||||
|
|
||||||
@@ -6642,7 +6771,7 @@ var isInitTool = false;
|
|||||||
"class": "lemon-editor__emoji-item",
|
"class": "lemon-editor__emoji-item",
|
||||||
"on": {
|
"on": {
|
||||||
"click": function click() {
|
"click": function click() {
|
||||||
return _this3._handleSelectEmoji(item);
|
return _this4._handleSelectEmoji(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -6712,12 +6841,36 @@ var isInitTool = false;
|
|||||||
var clipboardData = e.clipboardData || window.clipboardData;
|
var clipboardData = e.clipboardData || window.clipboardData;
|
||||||
var text = clipboardData.getData("Text");
|
var text = clipboardData.getData("Text");
|
||||||
|
|
||||||
if (window.clipboardData) {
|
if (text) {
|
||||||
this.$refs.textarea.innerHTML = text;
|
if (window.clipboardData) {
|
||||||
|
this.$refs.textarea.innerHTML = text;
|
||||||
|
} else {
|
||||||
|
exec(text, "insertText");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
exec(text, "insertText");
|
var _this$_getClipboardBl = this._getClipboardBlob(clipboardData),
|
||||||
|
blob = _this$_getClipboardBl.blob,
|
||||||
|
blobUrl = _this$_getClipboardBl.blobUrl;
|
||||||
|
|
||||||
|
this.clipboardBlob = blob;
|
||||||
|
this.clipboardUrl = blobUrl;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
_getClipboardBlob: function _getClipboardBlob(clipboard) {
|
||||||
|
var blob, blobUrl;
|
||||||
|
|
||||||
|
for (var i = 0; i < clipboard.items.length; ++i) {
|
||||||
|
if (clipboard.items[i].kind == 'file' && clipboard.items[i].type.indexOf('image/') !== -1) {
|
||||||
|
blob = clipboard.items[i].getAsFile();
|
||||||
|
blobUrl = (window.URL || window.webkitURL).createObjectURL(blob);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
blob: blob,
|
||||||
|
blobUrl: blobUrl
|
||||||
|
};
|
||||||
|
},
|
||||||
_handleKeyup: function _handleKeyup(e) {
|
_handleKeyup: function _handleKeyup(e) {
|
||||||
this._saveLastRange();
|
this._saveLastRange();
|
||||||
|
|
||||||
@@ -6735,7 +6888,7 @@ var isInitTool = false;
|
|||||||
// .replace(/<div>|<p>/g, "\r\n")
|
// .replace(/<div>|<p>/g, "\r\n")
|
||||||
// .replace(/<\/div>|<\/p>/g, "")
|
// .replace(/<\/div>|<\/p>/g, "")
|
||||||
// );
|
// );
|
||||||
return toEmojiName(this.$refs.textarea.innerHTML);
|
return this.IMUI.emojiImageToName(this.$refs.textarea.innerHTML);
|
||||||
},
|
},
|
||||||
_checkSubmitDisabled: function _checkSubmitDisabled() {
|
_checkSubmitDisabled: function _checkSubmitDisabled() {
|
||||||
this.submitDisabled = !clearHtmlExcludeImg(this.$refs.textarea.innerHTML.trim());
|
this.submitDisabled = !clearHtmlExcludeImg(this.$refs.textarea.innerHTML.trim());
|
||||||
@@ -6748,11 +6901,11 @@ var isInitTool = false;
|
|||||||
this._checkSubmitDisabled();
|
this._checkSubmitDisabled();
|
||||||
},
|
},
|
||||||
_handleChangeFile: function _handleChangeFile(e) {
|
_handleChangeFile: function _handleChangeFile(e) {
|
||||||
var _this4 = this;
|
var _this5 = this;
|
||||||
|
|
||||||
var fileInput = this.$refs.fileInput;
|
var fileInput = this.$refs.fileInput;
|
||||||
Array.from(fileInput.files).forEach(function (file) {
|
Array.from(fileInput.files).forEach(function (file) {
|
||||||
_this4.$emit("upload", file);
|
_this5.$emit("upload", file);
|
||||||
});
|
});
|
||||||
fileInput.value = "";
|
fileInput.value = "";
|
||||||
},
|
},
|
||||||
@@ -6764,7 +6917,7 @@ var isInitTool = false;
|
|||||||
this.$forceUpdate();
|
this.$forceUpdate();
|
||||||
},
|
},
|
||||||
setValue: function setValue(val) {
|
setValue: function setValue(val) {
|
||||||
this.$refs.textarea.innerHTML = val;
|
this.$refs.textarea.innerHTML = this.IMUI.emojiNameToImage(val);
|
||||||
|
|
||||||
this._checkSubmitDisabled();
|
this._checkSubmitDisabled();
|
||||||
}
|
}
|
||||||
@@ -6796,86 +6949,6 @@ var editor_component = normalizeComponent(
|
|||||||
)
|
)
|
||||||
|
|
||||||
/* harmony default export */ var editor = (editor_component.exports);
|
/* harmony default export */ var editor = (editor_component.exports);
|
||||||
// EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
|
|
||||||
var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__("8bbf");
|
|
||||||
var external_commonjs_vue_commonjs2_vue_root_Vue_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_vue_commonjs2_vue_root_Vue_);
|
|
||||||
|
|
||||||
// CONCATENATED MODULE: ./packages/directives/dropdown.js
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var dropdown_popover;
|
|
||||||
|
|
||||||
var hidePopover = function hidePopover() {
|
|
||||||
if (dropdown_popover) dropdown_popover.style.display = 'none';
|
|
||||||
};
|
|
||||||
|
|
||||||
var showPopover = function showPopover() {
|
|
||||||
if (dropdown_popover) dropdown_popover.style.display = 'block';
|
|
||||||
};
|
|
||||||
|
|
||||||
document.addEventListener('click', function (e) {
|
|
||||||
hidePopover();
|
|
||||||
});
|
|
||||||
/* harmony default export */ var dropdown = ({
|
|
||||||
hide: hidePopover,
|
|
||||||
bind: function bind(el, binding, vnode) {
|
|
||||||
el.addEventListener('contextmenu', function (e) {
|
|
||||||
if (isEmpty(binding.value) || !Array.isArray(binding.value)) return;
|
|
||||||
e.preventDefault();
|
|
||||||
var component;
|
|
||||||
var visibleItems = [];
|
|
||||||
if (binding.modifiers.message) component = vnode.context;else if (binding.modifiers.contact) component = vnode.child;
|
|
||||||
|
|
||||||
if (!dropdown_popover) {
|
|
||||||
dropdown_popover = document.createElement('div');
|
|
||||||
dropdown_popover.className = 'lemon-dropdown';
|
|
||||||
document.body.appendChild(dropdown_popover);
|
|
||||||
}
|
|
||||||
|
|
||||||
dropdown_popover.innerHTML = binding.value.map(function (item) {
|
|
||||||
var visible;
|
|
||||||
|
|
||||||
if (isFunction(item.visible)) {
|
|
||||||
visible = item.visible(component);
|
|
||||||
} else {
|
|
||||||
visible = item.visible === undefined ? true : item.visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (visible) {
|
|
||||||
visibleItems.push(item);
|
|
||||||
var icon = item.icon ? "<i class=\"lemon-dropdown__icon ".concat(item.icon, "\"></i>") : '';
|
|
||||||
return "<div style=\"color:".concat(item.color, "\" title=\"").concat(item.text, "\" class=\"lemon-dropdown__item\">").concat(icon, "<span>").concat(item.text, "</span></div>");
|
|
||||||
}
|
|
||||||
|
|
||||||
return '';
|
|
||||||
}).join("");
|
|
||||||
dropdown_popover.style.top = "".concat(e.pageY, "px");
|
|
||||||
dropdown_popover.style.left = "".concat(e.pageX, "px");
|
|
||||||
dropdown_popover.childNodes.forEach(function (node, index) {
|
|
||||||
var _visibleItems$index = visibleItems[index],
|
|
||||||
click = _visibleItems$index.click,
|
|
||||||
_render = _visibleItems$index.render;
|
|
||||||
node.addEventListener('click', function (e) {
|
|
||||||
e.stopPropagation();
|
|
||||||
if (isFunction(click)) click(e, component, hidePopover);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (isFunction(_render)) {
|
|
||||||
var ins = external_commonjs_vue_commonjs2_vue_root_Vue_default.a.extend({
|
|
||||||
render: function render(h) {
|
|
||||||
return _render(h, component, hidePopover);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
var renderComponent = new ins().$mount();
|
|
||||||
node.querySelector('span').innerHTML = renderComponent.$el.outerHTML;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
showPopover();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
inserted: function inserted(el, binding, vnode) {}
|
|
||||||
});
|
|
||||||
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/messages.vue?vue&type=script&lang=js&
|
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/messages.vue?vue&type=script&lang=js&
|
||||||
|
|
||||||
|
|
||||||
@@ -7007,7 +7080,7 @@ document.addEventListener('click', function (e) {
|
|||||||
switch (_context2.prev = _context2.next) {
|
switch (_context2.prev = _context2.next) {
|
||||||
case 0:
|
case 0:
|
||||||
target = e.target;
|
target = e.target;
|
||||||
dropdown.hide();
|
contextmenu.hide();
|
||||||
|
|
||||||
if (!(target.scrollTop == 0 && this._loading == false && this._loadend == false)) {
|
if (!(target.scrollTop == 0 && this._loading == false && this._loadend == false)) {
|
||||||
_context2.next = 8;
|
_context2.next = 8;
|
||||||
@@ -7208,7 +7281,7 @@ var messages_component = normalizeComponent(
|
|||||||
"class": "lemon-message__content-flex"
|
"class": "lemon-message__content-flex"
|
||||||
}, [h("div", {
|
}, [h("div", {
|
||||||
"directives": [{
|
"directives": [{
|
||||||
name: "dropdown",
|
name: "lemon-contextmenu",
|
||||||
value: this.IMUI.contextmenu,
|
value: this.IMUI.contextmenu,
|
||||||
modifiers: {
|
modifiers: {
|
||||||
"message": true
|
"message": true
|
||||||
@@ -7286,6 +7359,7 @@ var basic_component = normalizeComponent(
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function textvue_type_script_lang_js_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
function textvue_type_script_lang_js_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||||
|
|
||||||
function textvue_type_script_lang_js_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { textvue_type_script_lang_js_ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { textvue_type_script_lang_js_ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
function textvue_type_script_lang_js_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { textvue_type_script_lang_js_ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { textvue_type_script_lang_js_ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||||
@@ -7305,7 +7379,7 @@ function textvue_type_script_lang_js_objectSpread(target) { for (var i = 1; i <
|
|||||||
}, {
|
}, {
|
||||||
"scopedSlots": {
|
"scopedSlots": {
|
||||||
content: function content(props) {
|
content: function content(props) {
|
||||||
var content = _this.IMUI.replaceEmojiName(props.content);
|
var content = _this.IMUI.emojiNameToImage(props.content);
|
||||||
|
|
||||||
return h("span", helper_default()([{}, {
|
return h("span", helper_default()([{}, {
|
||||||
"domProps": {
|
"domProps": {
|
||||||
@@ -7604,7 +7678,7 @@ var CONTACT_TYPE = ["many", "single"];
|
|||||||
return "[图片]";
|
return "[图片]";
|
||||||
},
|
},
|
||||||
text: function text(message) {
|
text: function text(message) {
|
||||||
return this.replaceEmojiName(clearHtml(message.content));
|
return this.emojiNameToImage(clearHtml(message.content));
|
||||||
},
|
},
|
||||||
event: function event(message) {
|
event: function event(message) {
|
||||||
return '[通知]';
|
return '[通知]';
|
||||||
@@ -7701,6 +7775,7 @@ function () {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function componentsvue_type_script_lang_js_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
function componentsvue_type_script_lang_js_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||||
|
|
||||||
function componentsvue_type_script_lang_js_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { componentsvue_type_script_lang_js_ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { componentsvue_type_script_lang_js_ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
function componentsvue_type_script_lang_js_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { componentsvue_type_script_lang_js_ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { componentsvue_type_script_lang_js_ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||||
@@ -7778,6 +7853,7 @@ var renderDrawerContent = function renderDrawerContent() {};
|
|||||||
sendText: String,
|
sendText: String,
|
||||||
contextmenu: Array,
|
contextmenu: Array,
|
||||||
contactContextmenu: Array,
|
contactContextmenu: Array,
|
||||||
|
avatarCricle: Boolean,
|
||||||
user: {
|
user: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: function _default() {
|
default: function _default() {
|
||||||
@@ -7789,6 +7865,7 @@ var renderDrawerContent = function renderDrawerContent() {};
|
|||||||
this.CacheContactContainer = new memory_MemoryCache();
|
this.CacheContactContainer = new memory_MemoryCache();
|
||||||
this.CacheMenuContainer = new memory_MemoryCache();
|
this.CacheMenuContainer = new memory_MemoryCache();
|
||||||
this.CacheMessageLoaded = new memory_MemoryCache();
|
this.CacheMessageLoaded = new memory_MemoryCache();
|
||||||
|
this.CacheDraft = new memory_MemoryCache();
|
||||||
return {
|
return {
|
||||||
drawerVisible: !this.hideDrawer,
|
drawerVisible: !this.hideDrawer,
|
||||||
currentContactId: null,
|
currentContactId: null,
|
||||||
@@ -7905,6 +7982,8 @@ var renderDrawerContent = function renderDrawerContent() {};
|
|||||||
if (scrollToBottom == true) {
|
if (scrollToBottom == true) {
|
||||||
this.messageViewToBottom();
|
this.messageViewToBottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.CacheDraft.remove(message.toContactId);
|
||||||
} else {
|
} else {
|
||||||
updateContact.unread = '+1';
|
updateContact.unread = '+1';
|
||||||
}
|
}
|
||||||
@@ -7939,6 +8018,8 @@ var renderDrawerContent = function renderDrawerContent() {};
|
|||||||
lastContent: _this4.lastContentRender(message),
|
lastContent: _this4.lastContentRender(message),
|
||||||
lastSendTime: message.sendTime
|
lastSendTime: message.sendTime
|
||||||
});
|
});
|
||||||
|
|
||||||
|
_this4.CacheDraft.remove(message.toContactId);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
_handleUpload: function _handleUpload(file) {
|
_handleUpload: function _handleUpload(file) {
|
||||||
@@ -8083,14 +8164,14 @@ var renderDrawerContent = function renderDrawerContent() {};
|
|||||||
_renderSidebarMessage: function _renderSidebarMessage() {
|
_renderSidebarMessage: function _renderSidebarMessage() {
|
||||||
var _this9 = this;
|
var _this9 = this;
|
||||||
|
|
||||||
return this._renderSidebar([useScopedSlot(this.$scopedSlots["sidebar-message-top"]), this.lastMessages.map(function (contact) {
|
return this._renderSidebar([useScopedSlot(this.$scopedSlots["sidebar-message-top"], null, this), this.lastMessages.map(function (contact) {
|
||||||
return _this9._renderContact({
|
return _this9._renderContact({
|
||||||
contact: contact,
|
contact: contact,
|
||||||
timeFormat: _this9.contactTimeFormat
|
timeFormat: _this9.contactTimeFormat
|
||||||
}, function () {
|
}, function () {
|
||||||
return _this9.changeContact(contact.id);
|
return _this9.changeContact(contact.id);
|
||||||
}, _this9.$scopedSlots["sidebar-message"]);
|
}, _this9.$scopedSlots["sidebar-message"]);
|
||||||
})], DEFAULT_MENU_LASTMESSAGES);
|
})], DEFAULT_MENU_LASTMESSAGES, useScopedSlot(this.$scopedSlots["sidebar-message-fixedtop"], null, this));
|
||||||
},
|
},
|
||||||
_renderContact: function _renderContact(props, onClick, slot) {
|
_renderContact: function _renderContact(props, onClick, slot) {
|
||||||
var _this10 = this;
|
var _this10 = this;
|
||||||
@@ -8114,7 +8195,7 @@ var renderDrawerContent = function renderDrawerContent() {};
|
|||||||
"lemon-contact--active": this.currentContactId == props.contact.id
|
"lemon-contact--active": this.currentContactId == props.contact.id
|
||||||
},
|
},
|
||||||
"directives": [{
|
"directives": [{
|
||||||
name: "dropdown",
|
name: "lemon-contextmenu",
|
||||||
value: this.contactContextmenu,
|
value: this.contactContextmenu,
|
||||||
modifiers: {
|
modifiers: {
|
||||||
"contact": true
|
"contact": true
|
||||||
@@ -8136,7 +8217,7 @@ var renderDrawerContent = function renderDrawerContent() {};
|
|||||||
|
|
||||||
var h = this.$createElement;
|
var h = this.$createElement;
|
||||||
var prevIndex;
|
var prevIndex;
|
||||||
return this._renderSidebar([useScopedSlot(this.$scopedSlots["sidebar-contact-top"]), this.contacts.map(function (contact) {
|
return this._renderSidebar([useScopedSlot(this.$scopedSlots["sidebar-contact-top"], null, this), this.contacts.map(function (contact) {
|
||||||
if (!contact.index) return;
|
if (!contact.index) return;
|
||||||
contact.index = contact.index.replace(/\[[0-9]*\]/, "");
|
contact.index = contact.index.replace(/\[[0-9]*\]/, "");
|
||||||
var node = [contact.index !== prevIndex && h("p", {
|
var node = [contact.index !== prevIndex && h("p", {
|
||||||
@@ -8149,9 +8230,9 @@ var renderDrawerContent = function renderDrawerContent() {};
|
|||||||
}, _this11.$scopedSlots["sidebar-contact"])];
|
}, _this11.$scopedSlots["sidebar-contact"])];
|
||||||
prevIndex = contact.index;
|
prevIndex = contact.index;
|
||||||
return node;
|
return node;
|
||||||
})], DEFAULT_MENU_CONTACTS);
|
})], DEFAULT_MENU_CONTACTS, useScopedSlot(this.$scopedSlots["sidebar-contact-fixedtop"], null, this));
|
||||||
},
|
},
|
||||||
_renderSidebar: function _renderSidebar(children, name) {
|
_renderSidebar: function _renderSidebar(children, name, fixedtop) {
|
||||||
var h = this.$createElement;
|
var h = this.$createElement;
|
||||||
return h("div", {
|
return h("div", {
|
||||||
"class": "lemon-sidebar",
|
"class": "lemon-sidebar",
|
||||||
@@ -8162,7 +8243,11 @@ var renderDrawerContent = function renderDrawerContent() {};
|
|||||||
"on": {
|
"on": {
|
||||||
"scroll": this._handleSidebarScroll
|
"scroll": this._handleSidebarScroll
|
||||||
}
|
}
|
||||||
}, [children]);
|
}, [h("div", {
|
||||||
|
"class": "lemon-sidebar__fixed-top"
|
||||||
|
}, [fixedtop]), h("div", {
|
||||||
|
"class": "lemon-sidebar__scroll"
|
||||||
|
}, [children])]);
|
||||||
},
|
},
|
||||||
_renderDrawer: function _renderDrawer() {
|
_renderDrawer: function _renderDrawer() {
|
||||||
var h = this.$createElement;
|
var h = this.$createElement;
|
||||||
@@ -8275,14 +8360,13 @@ var renderDrawerContent = function renderDrawerContent() {};
|
|||||||
return nodes;
|
return nodes;
|
||||||
},
|
},
|
||||||
_handleSidebarScroll: function _handleSidebarScroll() {
|
_handleSidebarScroll: function _handleSidebarScroll() {
|
||||||
dropdown.hide();
|
contextmenu.hide();
|
||||||
},
|
},
|
||||||
_addContact: function _addContact(data, t) {
|
_addContact: function _addContact(data, t) {
|
||||||
var type = {
|
var type = {
|
||||||
0: "unshift",
|
0: "unshift",
|
||||||
1: "push"
|
1: "push"
|
||||||
}[t]; //this.contacts[type](cloneDeep(data));
|
}[t];
|
||||||
|
|
||||||
this.contacts[type](data);
|
this.contacts[type](data);
|
||||||
},
|
},
|
||||||
_addMessage: function _addMessage(data, contactId, t) {
|
_addMessage: function _addMessage(data, contactId, t) {
|
||||||
@@ -8321,12 +8405,15 @@ var renderDrawerContent = function renderDrawerContent() {};
|
|||||||
* @param {String} str 被替换的字符串
|
* @param {String} str 被替换的字符串
|
||||||
* @return {String} 替换后的字符串
|
* @return {String} 替换后的字符串
|
||||||
*/
|
*/
|
||||||
replaceEmojiName: function replaceEmojiName(str) {
|
emojiNameToImage: function emojiNameToImage(str) {
|
||||||
return str.replace(/\[!(\w+)\]/gi, function (str, match) {
|
return str.replace(/\[!(\w+)\]/gi, function (str, match) {
|
||||||
var file = match;
|
var file = match;
|
||||||
return emojiMap[file] ? "<img src=\"".concat(emojiMap[file], "\" />") : "[!".concat(match, "]");
|
return emojiMap[file] ? "<img emoji-name=\"".concat(match, "\" src=\"").concat(emojiMap[file], "\" />") : "[!".concat(match, "]");
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
emojiImageToName: function emojiImageToName(str) {
|
||||||
|
return str.replace(/<img emoji-name=\"([^\"]*?)\" [^>]*>/gi, "[!$1]");
|
||||||
|
},
|
||||||
updateCurrentMessages: function updateCurrentMessages() {
|
updateCurrentMessages: function updateCurrentMessages() {
|
||||||
if (!allMessages[this.currentContactId]) allMessages[this.currentContactId] = [];
|
if (!allMessages[this.currentContactId]) allMessages[this.currentContactId] = [];
|
||||||
this.currentMessages = allMessages[this.currentContactId];
|
this.currentMessages = allMessages[this.currentContactId];
|
||||||
@@ -8349,48 +8436,79 @@ var renderDrawerContent = function renderDrawerContent() {};
|
|||||||
regeneratorRuntime.mark(function _callee2(contactId, menuName) {
|
regeneratorRuntime.mark(function _callee2(contactId, menuName) {
|
||||||
var _this13 = this;
|
var _this13 = this;
|
||||||
|
|
||||||
|
var h, prevCurrentContactId, editorValue, draft;
|
||||||
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
||||||
while (1) {
|
while (1) {
|
||||||
switch (_context2.prev = _context2.next) {
|
switch (_context2.prev = _context2.next) {
|
||||||
case 0:
|
case 0:
|
||||||
|
h = this.$createElement;
|
||||||
|
|
||||||
if (!menuName) {
|
if (!menuName) {
|
||||||
_context2.next = 4;
|
_context2.next = 5;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.changeMenu(menuName);
|
this.changeMenu(menuName);
|
||||||
_context2.next = 6;
|
_context2.next = 7;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 5:
|
||||||
if (!(this._changeContactLock || this.currentContactId == contactId)) {
|
if (!(this._changeContactLock || this.currentContactId == contactId)) {
|
||||||
_context2.next = 6;
|
_context2.next = 7;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _context2.abrupt("return", false);
|
return _context2.abrupt("return", false);
|
||||||
|
|
||||||
case 6:
|
case 7:
|
||||||
|
prevCurrentContactId = this.currentContactId; //保存上个聊天目标的草稿
|
||||||
|
|
||||||
|
if (prevCurrentContactId) {
|
||||||
|
editorValue = this.getEditorValue();
|
||||||
|
|
||||||
|
if (editorValue) {
|
||||||
|
this.CacheDraft.set(prevCurrentContactId, editorValue);
|
||||||
|
this.updateContact({
|
||||||
|
id: prevCurrentContactId,
|
||||||
|
lastContent: [h("span", {
|
||||||
|
"style": "color:red;"
|
||||||
|
}, ["[\u8349\u7A3F]"]), h("span", helper_default()([{}, {
|
||||||
|
"domProps": {
|
||||||
|
innerHTML: this.lastContentRender({
|
||||||
|
type: 'text',
|
||||||
|
content: editorValue
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}]))]
|
||||||
|
});
|
||||||
|
this.setEditorValue('');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.currentContactId = contactId;
|
this.currentContactId = contactId;
|
||||||
|
|
||||||
if (this.currentContactId) {
|
if (this.currentContactId) {
|
||||||
_context2.next = 9;
|
_context2.next = 12;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _context2.abrupt("return", false);
|
return _context2.abrupt("return", false);
|
||||||
|
|
||||||
case 9:
|
case 12:
|
||||||
this.$emit("change-contact", this.currentContact, this);
|
this.$emit("change-contact", this.currentContact, this);
|
||||||
|
|
||||||
if (!isFunction(this.currentContact.renderContainer)) {
|
if (!isFunction(this.currentContact.renderContainer)) {
|
||||||
_context2.next = 12;
|
_context2.next = 15;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _context2.abrupt("return");
|
return _context2.abrupt("return");
|
||||||
|
|
||||||
case 12:
|
case 15:
|
||||||
|
//填充草稿内容
|
||||||
|
draft = this.CacheDraft.get(contactId) || "";
|
||||||
|
if (draft) this.setEditorValue(draft);
|
||||||
|
|
||||||
if (this.CacheMessageLoaded.has(contactId)) {
|
if (this.CacheMessageLoaded.has(contactId)) {
|
||||||
this.$refs.messages.loaded();
|
this.$refs.messages.loaded();
|
||||||
} else {
|
} else {
|
||||||
@@ -8411,7 +8529,7 @@ var renderDrawerContent = function renderDrawerContent() {};
|
|||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
case 14:
|
case 19:
|
||||||
case "end":
|
case "end":
|
||||||
return _context2.stop();
|
return _context2.stop();
|
||||||
}
|
}
|
||||||
@@ -8620,6 +8738,8 @@ var renderDrawerContent = function renderDrawerContent() {};
|
|||||||
var index = this.findContactIndexById(id);
|
var index = this.findContactIndexById(id);
|
||||||
if (index === -1) return false;
|
if (index === -1) return false;
|
||||||
this.contacts.splice(index, 1);
|
this.contacts.splice(index, 1);
|
||||||
|
this.CacheDraft.remove(id);
|
||||||
|
this.CacheMessageLoaded.remove(id);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -8695,7 +8815,7 @@ var renderDrawerContent = function renderDrawerContent() {};
|
|||||||
return this.currentMessages;
|
return this.currentMessages;
|
||||||
},
|
},
|
||||||
setEditorValue: function setEditorValue(val) {
|
setEditorValue: function setEditorValue(val) {
|
||||||
this.$refs.editor.setValue(this.replaceEmojiName(val));
|
this.$refs.editor.setValue(this.emojiNameToImage(val));
|
||||||
},
|
},
|
||||||
getEditorValue: function getEditorValue() {
|
getEditorValue: function getEditorValue() {
|
||||||
return this.$refs.editor.getFormatValue();
|
return this.$refs.editor.getFormatValue();
|
||||||
@@ -8753,7 +8873,7 @@ var common = __webpack_require__("6a2b");
|
|||||||
// CONCATENATED MODULE: ./packages/directives/index.js
|
// CONCATENATED MODULE: ./packages/directives/index.js
|
||||||
|
|
||||||
|
|
||||||
external_commonjs_vue_commonjs2_vue_root_Vue_default.a.directive('dropdown', dropdown);
|
external_commonjs_vue_commonjs2_vue_root_Vue_default.a.directive('LemonContextmenu', contextmenu);
|
||||||
// CONCATENATED MODULE: ./packages/index.js
|
// CONCATENATED MODULE: ./packages/index.js
|
||||||
|
|
||||||
|
|
||||||
@@ -8774,7 +8894,7 @@ external_commonjs_vue_commonjs2_vue_root_Vue_default.a.directive('dropdown', dro
|
|||||||
|
|
||||||
|
|
||||||
var version = "1.4.2";
|
var version = "1.4.2";
|
||||||
var packages_components = [components, components_contact, messages, editor, avatar, badge, components_button, popover, tabs, basic, message_text, message_image, file, message_event];
|
var packages_components = [components, components_contact, messages, editor, avatar, badge, components_button, components_popover, tabs, basic, message_text, message_image, file, message_event];
|
||||||
|
|
||||||
var install = function install(Vue) {
|
var install = function install(Vue) {
|
||||||
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+39
-11
@@ -11,7 +11,7 @@
|
|||||||
<a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=xzUa9CPYQ5KCNQ86h7ep4Z3TtkqJxRZE&jump_from=webapi">QQ交流群:1081773406</a>
|
<a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=xzUa9CPYQ5KCNQ86h7ep4Z3TtkqJxRZE&jump_from=webapi">QQ交流群:1081773406</a>
|
||||||
</div>
|
</div>
|
||||||
<br/>
|
<br/>
|
||||||
<div><a style="font-size:14px;" href="#help1">1.如何创建自定义消息?</a></div>
|
<div><a style="font-size:14px;" href="#help1">1.如何创建消息?</a></div>
|
||||||
<div><a style="font-size:14px;" href="#help2">2.如何对接后端接口?</a></div>
|
<div><a style="font-size:14px;" href="#help2">2.如何对接后端接口?</a></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="imui-center">
|
<div class="imui-center">
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
<lemon-button @click="appendEventMessage">发送 event 消息</lemon-button>
|
<lemon-button @click="appendEventMessage">发送 event 消息</lemon-button>
|
||||||
<lemon-button @click="removeMessage">删除最近一条消息</lemon-button>
|
<lemon-button @click="removeMessage">删除最近一条消息</lemon-button>
|
||||||
<lemon-button @click="updateMessage">修改消息</lemon-button>
|
<lemon-button @click="updateMessage">修改消息</lemon-button>
|
||||||
<lemon-button @click="appendCustomMessage">发送自定义消息</lemon-button>
|
<lemon-button @click="appendCustomMessage">发送消息</lemon-button>
|
||||||
<br/>
|
<br/>
|
||||||
<lemon-button @click="updateContact">修改联系人信息</lemon-button>
|
<lemon-button @click="updateContact">修改联系人信息</lemon-button>
|
||||||
<lemon-button @click="changeMenuVisible">切换导航显示</lemon-button>
|
<lemon-button @click="changeMenuVisible">切换导航显示</lemon-button>
|
||||||
@@ -96,7 +96,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #contact-info="contact">
|
<template #contact-info="contact">
|
||||||
自定义联系人信息 {{ contact.displayName }}
|
自定义通讯录信息 {{ contact.displayName }}
|
||||||
</template>
|
</template>
|
||||||
<template #sidebar-message="contact">
|
<template #sidebar-message="contact">
|
||||||
<lemon-badge :count="contact.unread" style="width:100%">
|
<lemon-badge :count="contact.unread" style="width:100%">
|
||||||
@@ -110,10 +110,16 @@
|
|||||||
<span>{{ contact.displayName }}</span>
|
<span>{{ contact.displayName }}</span>
|
||||||
</template>
|
</template>
|
||||||
<template #sidebar-message-top>
|
<template #sidebar-message-top>
|
||||||
<div class="bar">自定义消息顶部</div>
|
<div class="bar">最新消息顶部</div>
|
||||||
</template>
|
</template>
|
||||||
<template #sidebar-contact-top>
|
<template #sidebar-contact-top>
|
||||||
<div class="bar">自定义联系人顶部</div>
|
<div class="bar">联系人顶部</div>
|
||||||
|
</template>
|
||||||
|
<template #sidebar-message-fixedtop>
|
||||||
|
<div class="bar">最新消息顶部 Fixed</div>
|
||||||
|
</template>
|
||||||
|
<template #sidebar-contact-fixedtop>
|
||||||
|
<div class="bar">联系人顶部 Fixed</div>
|
||||||
</template>
|
</template>
|
||||||
</lemon-imui>
|
</lemon-imui>
|
||||||
</div>
|
</div>
|
||||||
@@ -128,6 +134,7 @@
|
|||||||
:user="user"
|
:user="user"
|
||||||
ref="SimpleIMUI"
|
ref="SimpleIMUI"
|
||||||
width="340px"
|
width="340px"
|
||||||
|
:avatar-cricle="true"
|
||||||
simple
|
simple
|
||||||
@pull-messages="handlePullMessages"
|
@pull-messages="handlePullMessages"
|
||||||
@message-click="handleMessageClick"
|
@message-click="handleMessageClick"
|
||||||
@@ -363,6 +370,13 @@
|
|||||||
<td width="100">default</td>
|
<td width="100">default</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td width="150">avatarCricle</td>
|
||||||
|
<td width="350">使用圆形头像</td>
|
||||||
|
<td width="150">Boolean</td>
|
||||||
|
<td width="100">false</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="150">sendText</td>
|
<td width="150">sendText</td>
|
||||||
<td width="350">发送消息按钮的文字</td>
|
<td width="350">发送消息按钮的文字</td>
|
||||||
@@ -722,13 +736,23 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="150">sidebar-message-top</td>
|
<td width="150">sidebar-message-top</td>
|
||||||
<td width="350">左侧最新消息列表的顶部</td>
|
<td width="350">左侧最新消息列表的顶部,会随列表滚动</td>
|
||||||
<td width="150">-</td>
|
<td width="150">instance</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="150">sidebar-contact-top</td>
|
<td width="150">sidebar-contact-top</td>
|
||||||
<td width="350">左侧联系人列表的顶部</td>
|
<td width="350">左侧联系人列表的顶部,会随列表滚动</td>
|
||||||
<td width="150">-</td>
|
<td width="150">instance</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td width="150">sidebar-message-fixedtop</td>
|
||||||
|
<td width="350">固定在左侧最新消息列表的顶部</td>
|
||||||
|
<td width="150">instance</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td width="150">sidebar-contact-fixedtop</td>
|
||||||
|
<td width="350">固定在左侧联系人列表的顶部</td>
|
||||||
|
<td width="150">instance</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="150">contact-info</td>
|
<td width="150">contact-info</td>
|
||||||
@@ -776,9 +800,9 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div class="title" id="help1">如何创建自定义消息?</div>
|
<div class="title" id="help1">如何创建消息?</div>
|
||||||
<div>
|
<div>
|
||||||
<p>Lemon-IMUI 目前内置了file、image、text、event四种消息类型,在实际应用当中肯定是不够的哦,咋办?没事的,我们继续往下see。<br/>要创建自定义消息首先要确定新消息的 Message 结构。</p>
|
<p>Lemon-IMUI 目前内置了file、image、text、event四种消息类型,在实际应用当中肯定是不够的哦,咋办?没事的,我们继续往下see。<br/>要创建消息首先要确定新消息的 Message 结构。</p>
|
||||||
<pre>
|
<pre>
|
||||||
{
|
{
|
||||||
//值为 voice,用于解析的组件 name 必须为 lemonMessageVoice
|
//值为 voice,用于解析的组件 name 必须为 lemonMessageVoice
|
||||||
@@ -1092,6 +1116,10 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const contactData1 = {
|
const contactData1 = {
|
||||||
id: "contact-1",
|
id: "contact-1",
|
||||||
displayName: "工作协作群",
|
displayName: "工作协作群",
|
||||||
|
|||||||
Vendored
+1
File diff suppressed because one or more lines are too long
Vendored
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><link rel=icon href=favicon.ico><title>Lemon IMUI</title><link href=css/index.fed1a091.css rel=preload as=style><link href=js/chunk-vendors.e4810482.js rel=preload as=script><link href=js/index.4318ecd4.js rel=preload as=script><link href=css/index.fed1a091.css rel=stylesheet></head><body><noscript><strong>We're sorry but flat-im doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=js/chunk-vendors.e4810482.js></script><script src=js/index.4318ecd4.js></script></body></html>
|
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><link rel=icon href=favicon.ico><title>Lemon IMUI</title><link href=css/index.da20b752.css rel=preload as=style><link href=js/chunk-vendors.e4810482.js rel=preload as=script><link href=js/index.f43bda32.js rel=preload as=script><link href=css/index.da20b752.css rel=stylesheet></head><body><noscript><strong>We're sorry but flat-im doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=js/chunk-vendors.e4810482.js></script><script src=js/index.f43bda32.js></script></body></html>
|
||||||
Vendored
-1
File diff suppressed because one or more lines are too long
Vendored
+1
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "lemon-imui",
|
"name": "lemon-imui",
|
||||||
"version": "1.5.0",
|
"version": "1.6.0",
|
||||||
"main": "dist/index.umd.min.js",
|
"main": "dist/index.umd.min.js",
|
||||||
"description": "基于 VUE2.0 的 IM 聊天组件",
|
"description": "基于 VUE2.0 的 IM 聊天组件",
|
||||||
"homepage": "https://github.com/fanjyy/lemon-imui",
|
"homepage": "https://github.com/fanjyy/lemon-imui",
|
||||||
|
|||||||
@@ -1,12 +1,19 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: "LemonAvatar",
|
name: "LemonAvatar",
|
||||||
|
inject:['IMUI'],
|
||||||
props: {
|
props: {
|
||||||
src: String,
|
src: String,
|
||||||
icon: {
|
icon: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "lemon-icon-people"
|
default: "lemon-icon-people"
|
||||||
},
|
},
|
||||||
|
circle:{
|
||||||
|
type:Boolean,
|
||||||
|
default(){
|
||||||
|
return this.IMUI ? this.IMUI.avatarCricle : false;
|
||||||
|
},
|
||||||
|
},
|
||||||
size: {
|
size: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 32
|
default: 32
|
||||||
@@ -21,7 +28,7 @@ export default {
|
|||||||
return (
|
return (
|
||||||
<span
|
<span
|
||||||
style={this.style}
|
style={this.style}
|
||||||
class="lemon-avatar"
|
class={['lemon-avatar',{'lemon-avatar--circle':this.circle}]}
|
||||||
on-click={e => this.$emit("click", e)}
|
on-click={e => this.$emit("click", e)}
|
||||||
>
|
>
|
||||||
{this.imageFinishLoad && <i class={this.icon} />}
|
{this.imageFinishLoad && <i class={this.icon} />}
|
||||||
@@ -65,6 +72,8 @@ export default {
|
|||||||
overflow hidden
|
overflow hidden
|
||||||
vertical-align middle
|
vertical-align middle
|
||||||
border-radius 4px
|
border-radius 4px
|
||||||
|
+m(circle)
|
||||||
|
border-radius 50%
|
||||||
img
|
img
|
||||||
width 100%
|
width 100%
|
||||||
height 100%
|
height 100%
|
||||||
|
|||||||
@@ -2,12 +2,16 @@
|
|||||||
export default {
|
export default {
|
||||||
name: "LemonButton",
|
name: "LemonButton",
|
||||||
props: {
|
props: {
|
||||||
|
color:{
|
||||||
|
type:String,
|
||||||
|
default:'default'
|
||||||
|
},
|
||||||
disabled: Boolean
|
disabled: Boolean
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
class="lemon-button"
|
class={['lemon-button',`lemon-button--color-${this.color}`]}
|
||||||
disabled={this.disabled}
|
disabled={this.disabled}
|
||||||
type="button"
|
type="button"
|
||||||
on-click={this._handleClick}
|
on-click={this._handleClick}
|
||||||
@@ -47,13 +51,20 @@ export default {
|
|||||||
background-color #fff
|
background-color #fff
|
||||||
box-shadow 0 2px 0 rgba(0, 0, 0, 0.015)
|
box-shadow 0 2px 0 rgba(0, 0, 0, 0.015)
|
||||||
text-shadow 0 -1px 0 rgba(0, 0, 0, 0.12)
|
text-shadow 0 -1px 0 rgba(0, 0, 0, 0.12)
|
||||||
&:hover:not([disabled])
|
+m(color-default)
|
||||||
border-color #666
|
&:hover:not([disabled])
|
||||||
color #333
|
border-color #666
|
||||||
&:active
|
color #333
|
||||||
background-color #ddd
|
&:active
|
||||||
&[disabled]
|
background-color #ddd
|
||||||
cursor not-allowed
|
&[disabled]
|
||||||
color #aaa
|
cursor not-allowed
|
||||||
background #eee
|
color #aaa
|
||||||
|
background #eee
|
||||||
|
+m(color-grey)
|
||||||
|
background #e1e1e1
|
||||||
|
border-color #e1e1e1
|
||||||
|
color #666
|
||||||
|
&:hover:not([disabled])
|
||||||
|
border-color #bbb
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -126,15 +126,17 @@ export default {
|
|||||||
+e(content)
|
+e(content)
|
||||||
font-size 12px
|
font-size 12px
|
||||||
color #999
|
color #999
|
||||||
padding-top 3px
|
height 18px
|
||||||
height 14px
|
line-height 18px
|
||||||
line-height 14px
|
margin-top 1px !important
|
||||||
ellipsis()
|
ellipsis()
|
||||||
img
|
img
|
||||||
height 14px
|
height 14px
|
||||||
display inline-block
|
display inline-block
|
||||||
vertical-align top
|
vertical-align middle
|
||||||
margin 0 1px
|
margin 0 1px
|
||||||
|
position relative
|
||||||
|
top -1px
|
||||||
+m(name-center)
|
+m(name-center)
|
||||||
+e(label)
|
+e(label)
|
||||||
padding-bottom 0
|
padding-bottom 0
|
||||||
|
|||||||
@@ -35,7 +35,10 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
this.clipboardBlob = null;
|
||||||
return {
|
return {
|
||||||
|
//剪切板图片URL
|
||||||
|
clipboardUrl:'',
|
||||||
submitDisabled: true,
|
submitDisabled: true,
|
||||||
proxyTools:[],
|
proxyTools:[],
|
||||||
accept: ""
|
accept: ""
|
||||||
@@ -47,6 +50,9 @@ export default {
|
|||||||
}else{
|
}else{
|
||||||
this.initTools([{name:'emoji'},{name:'uploadFile'},{name:'uploadImage'}]);
|
this.initTools([{name:'emoji'},{name:'uploadFile'},{name:'uploadImage'}]);
|
||||||
}
|
}
|
||||||
|
this.IMUI.$on('change-contact',()=>{
|
||||||
|
this.closeClipboardImage();
|
||||||
|
})
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
const toolLeft = [];
|
const toolLeft = [];
|
||||||
@@ -74,6 +80,15 @@ export default {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div class="lemon-editor">
|
<div class="lemon-editor">
|
||||||
|
{this.clipboardUrl && <div class="lemon-editor__clipboard-image">
|
||||||
|
<img src={this.clipboardUrl} />
|
||||||
|
<div>
|
||||||
|
<lemon-button style={{marginRight:'10px'}} on-click={this.closeClipboardImage} color="grey">
|
||||||
|
取消
|
||||||
|
</lemon-button>
|
||||||
|
<lemon-button on-click={this.sendClipboardImage}>发送图片</lemon-button>
|
||||||
|
</div>
|
||||||
|
</div>}
|
||||||
<input
|
<input
|
||||||
style="display:none"
|
style="display:none"
|
||||||
type="file"
|
type="file"
|
||||||
@@ -115,6 +130,15 @@ export default {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
closeClipboardImage(){
|
||||||
|
this.clipboardUrl = '';
|
||||||
|
this.clipboardBlob = null;
|
||||||
|
},
|
||||||
|
sendClipboardImage(){
|
||||||
|
if(!this.clipboardBlob) return;
|
||||||
|
this.$emit("upload", this.clipboardBlob);
|
||||||
|
this.closeClipboardImage();
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 初始化工具栏
|
* 初始化工具栏
|
||||||
*/
|
*/
|
||||||
@@ -224,12 +248,28 @@ export default {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const clipboardData = e.clipboardData || window.clipboardData;
|
const clipboardData = e.clipboardData || window.clipboardData;
|
||||||
const text = clipboardData.getData("Text");
|
const text = clipboardData.getData("Text");
|
||||||
if(window.clipboardData){
|
if(text){
|
||||||
this.$refs.textarea.innerHTML = text;
|
if(window.clipboardData){
|
||||||
|
this.$refs.textarea.innerHTML = text;
|
||||||
|
}else{
|
||||||
|
exec(text, "insertText");
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
exec(text, "insertText");
|
const {blob,blobUrl} = this._getClipboardBlob(clipboardData);
|
||||||
|
this.clipboardBlob = blob;
|
||||||
|
this.clipboardUrl = blobUrl;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
_getClipboardBlob(clipboard){
|
||||||
|
let blob,blobUrl;
|
||||||
|
for (var i = 0; i < clipboard.items.length; ++i) {
|
||||||
|
if ( clipboard.items[i].kind == 'file' && clipboard.items[i].type.indexOf('image/') !== -1 ) {
|
||||||
|
blob = clipboard.items[i].getAsFile();
|
||||||
|
blobUrl = (window.URL || window.webkitURL).createObjectURL(blob);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {blob,blobUrl};
|
||||||
|
},
|
||||||
_handleKeyup(e) {
|
_handleKeyup(e) {
|
||||||
this._saveLastRange();
|
this._saveLastRange();
|
||||||
this._checkSubmitDisabled();
|
this._checkSubmitDisabled();
|
||||||
@@ -246,7 +286,7 @@ export default {
|
|||||||
// .replace(/<div>|<p>/g, "\r\n")
|
// .replace(/<div>|<p>/g, "\r\n")
|
||||||
// .replace(/<\/div>|<\/p>/g, "")
|
// .replace(/<\/div>|<\/p>/g, "")
|
||||||
// );
|
// );
|
||||||
return toEmojiName(this.$refs.textarea.innerHTML);
|
return this.IMUI.emojiImageToName(this.$refs.textarea.innerHTML);
|
||||||
},
|
},
|
||||||
_checkSubmitDisabled() {
|
_checkSubmitDisabled() {
|
||||||
this.submitDisabled = !clearHtmlExcludeImg(this.$refs.textarea.innerHTML.trim());
|
this.submitDisabled = !clearHtmlExcludeImg(this.$refs.textarea.innerHTML.trim());
|
||||||
@@ -272,7 +312,7 @@ export default {
|
|||||||
this.$forceUpdate();
|
this.$forceUpdate();
|
||||||
},
|
},
|
||||||
setValue(val){
|
setValue(val){
|
||||||
this.$refs.textarea.innerHTML = val;
|
this.$refs.textarea.innerHTML = this.IMUI.emojiNameToImage(val);
|
||||||
this._checkSubmitDisabled();
|
this._checkSubmitDisabled();
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -283,6 +323,7 @@ export default {
|
|||||||
gap = 10px;
|
gap = 10px;
|
||||||
+b(lemon-editor)
|
+b(lemon-editor)
|
||||||
height 200px
|
height 200px
|
||||||
|
position relative
|
||||||
flex-column()
|
flex-column()
|
||||||
+e(tool)
|
+e(tool)
|
||||||
display flex
|
display flex
|
||||||
@@ -317,6 +358,31 @@ gap = 10px;
|
|||||||
overflow-x hidden
|
overflow-x hidden
|
||||||
overflow-y auto
|
overflow-y auto
|
||||||
scrollbar-light()
|
scrollbar-light()
|
||||||
|
+e(clipboard-image)
|
||||||
|
position absolute
|
||||||
|
top 0
|
||||||
|
left 0
|
||||||
|
width 100%
|
||||||
|
height 100%
|
||||||
|
flex-column()
|
||||||
|
justify-content center
|
||||||
|
align-items center
|
||||||
|
background #f4f4f4
|
||||||
|
z-index 1
|
||||||
|
img
|
||||||
|
max-height 66%
|
||||||
|
max-width 80%
|
||||||
|
background #e9e9e9
|
||||||
|
//box-shadow 0 0 20px rgba(0,0,0,0.15)
|
||||||
|
user-select none
|
||||||
|
cursor pointer
|
||||||
|
border-radius 4px
|
||||||
|
margin-bottom 10px
|
||||||
|
border 3px dashed #ddd !important
|
||||||
|
box-sizing border-box
|
||||||
|
.clipboard-popover-title
|
||||||
|
font-size 14px
|
||||||
|
color #333
|
||||||
+e(input)
|
+e(input)
|
||||||
height 100%
|
height 100%
|
||||||
box-sizing border-box
|
box-sizing border-box
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { useScopedSlot, funCall, generateUUID,cloneDeep } from "utils";
|
import { useScopedSlot, funCall, generateUUID,cloneDeep } from "utils";
|
||||||
import { isFunction, isString, isEmpty } from "utils/validate";
|
import { isFunction, isString, isEmpty } from "utils/validate";
|
||||||
import dropdown from "../directives/dropdown";
|
import contextmenu from "../directives/contextmenu";
|
||||||
import {
|
import {
|
||||||
DEFAULT_MENUS,
|
DEFAULT_MENUS,
|
||||||
DEFAULT_MENU_LASTMESSAGES,
|
DEFAULT_MENU_LASTMESSAGES,
|
||||||
@@ -71,6 +71,7 @@ export default {
|
|||||||
sendText:String,
|
sendText:String,
|
||||||
contextmenu:Array,
|
contextmenu:Array,
|
||||||
contactContextmenu:Array,
|
contactContextmenu:Array,
|
||||||
|
avatarCricle:Boolean,
|
||||||
user: {
|
user: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {
|
default: () => {
|
||||||
@@ -82,6 +83,7 @@ export default {
|
|||||||
this.CacheContactContainer = new MemoryCache();
|
this.CacheContactContainer = new MemoryCache();
|
||||||
this.CacheMenuContainer = new MemoryCache();
|
this.CacheMenuContainer = new MemoryCache();
|
||||||
this.CacheMessageLoaded = new MemoryCache();
|
this.CacheMessageLoaded = new MemoryCache();
|
||||||
|
this.CacheDraft = new MemoryCache();
|
||||||
return {
|
return {
|
||||||
drawerVisible: !this.hideDrawer,
|
drawerVisible: !this.hideDrawer,
|
||||||
currentContactId:null,
|
currentContactId:null,
|
||||||
@@ -173,6 +175,7 @@ export default {
|
|||||||
if(scrollToBottom == true){
|
if(scrollToBottom == true){
|
||||||
this.messageViewToBottom();
|
this.messageViewToBottom();
|
||||||
}
|
}
|
||||||
|
this.CacheDraft.remove(message.toContactId);
|
||||||
}else{
|
}else{
|
||||||
updateContact.unread = '+1';
|
updateContact.unread = '+1';
|
||||||
}
|
}
|
||||||
@@ -199,6 +202,7 @@ export default {
|
|||||||
lastContent: this.lastContentRender(message),
|
lastContent: this.lastContentRender(message),
|
||||||
lastSendTime: message.sendTime
|
lastSendTime: message.sendTime
|
||||||
});
|
});
|
||||||
|
this.CacheDraft.remove(message.toContactId);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
_handleUpload(file) {
|
_handleUpload(file) {
|
||||||
@@ -326,7 +330,7 @@ export default {
|
|||||||
_renderSidebarMessage() {
|
_renderSidebarMessage() {
|
||||||
return this._renderSidebar(
|
return this._renderSidebar(
|
||||||
[
|
[
|
||||||
useScopedSlot(this.$scopedSlots["sidebar-message-top"]),
|
useScopedSlot(this.$scopedSlots["sidebar-message-top"],null,this),
|
||||||
this.lastMessages.map(contact => {
|
this.lastMessages.map(contact => {
|
||||||
return this._renderContact(
|
return this._renderContact(
|
||||||
{
|
{
|
||||||
@@ -338,7 +342,8 @@ export default {
|
|||||||
);
|
);
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
DEFAULT_MENU_LASTMESSAGES
|
DEFAULT_MENU_LASTMESSAGES,
|
||||||
|
useScopedSlot(this.$scopedSlots["sidebar-message-fixedtop"],null,this)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_renderContact(props, onClick,slot) {
|
_renderContact(props, onClick,slot) {
|
||||||
@@ -363,7 +368,7 @@ export default {
|
|||||||
class={{
|
class={{
|
||||||
"lemon-contact--active": this.currentContactId == props.contact.id
|
"lemon-contact--active": this.currentContactId == props.contact.id
|
||||||
}}
|
}}
|
||||||
v-dropdown_contact={this.contactContextmenu}
|
v-lemon-contextmenu_contact={this.contactContextmenu}
|
||||||
props={props}
|
props={props}
|
||||||
on-click={click}
|
on-click={click}
|
||||||
scopedSlots={{default:slot}}
|
scopedSlots={{default:slot}}
|
||||||
@@ -374,7 +379,7 @@ export default {
|
|||||||
let prevIndex;
|
let prevIndex;
|
||||||
return this._renderSidebar(
|
return this._renderSidebar(
|
||||||
[
|
[
|
||||||
useScopedSlot(this.$scopedSlots["sidebar-contact-top"]),
|
useScopedSlot(this.$scopedSlots["sidebar-contact-top"],null,this),
|
||||||
this.contacts.map(contact => {
|
this.contacts.map(contact => {
|
||||||
if (!contact.index) return;
|
if (!contact.index) return;
|
||||||
contact.index = contact.index.replace(/\[[0-9]*\]/, "");
|
contact.index = contact.index.replace(/\[[0-9]*\]/, "");
|
||||||
@@ -397,13 +402,19 @@ export default {
|
|||||||
return node;
|
return node;
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
DEFAULT_MENU_CONTACTS
|
DEFAULT_MENU_CONTACTS,
|
||||||
|
useScopedSlot(this.$scopedSlots["sidebar-contact-fixedtop"],null,this)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_renderSidebar(children, name) {
|
_renderSidebar(children, name,fixedtop) {
|
||||||
return (
|
return (
|
||||||
<div class="lemon-sidebar" v-show={this.activeSidebar == name} on-scroll={this._handleSidebarScroll}>
|
<div class="lemon-sidebar" v-show={this.activeSidebar == name} on-scroll={this._handleSidebarScroll}>
|
||||||
{children}
|
<div class="lemon-sidebar__fixed-top">
|
||||||
|
{fixedtop}
|
||||||
|
</div>
|
||||||
|
<div class="lemon-sidebar__scroll">
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -514,14 +525,13 @@ export default {
|
|||||||
return nodes;
|
return nodes;
|
||||||
},
|
},
|
||||||
_handleSidebarScroll(){
|
_handleSidebarScroll(){
|
||||||
dropdown.hide();
|
contextmenu.hide();
|
||||||
},
|
},
|
||||||
_addContact(data, t) {
|
_addContact(data, t) {
|
||||||
const type = {
|
const type = {
|
||||||
0: "unshift",
|
0: "unshift",
|
||||||
1: "push"
|
1: "push"
|
||||||
}[t];
|
}[t];
|
||||||
//this.contacts[type](cloneDeep(data));
|
|
||||||
this.contacts[type](data);
|
this.contacts[type](data);
|
||||||
},
|
},
|
||||||
_addMessage(data, contactId, t) {
|
_addMessage(data, contactId, t) {
|
||||||
@@ -553,14 +563,17 @@ export default {
|
|||||||
* @param {String} str 被替换的字符串
|
* @param {String} str 被替换的字符串
|
||||||
* @return {String} 替换后的字符串
|
* @return {String} 替换后的字符串
|
||||||
*/
|
*/
|
||||||
replaceEmojiName(str) {
|
emojiNameToImage(str) {
|
||||||
return str.replace(/\[!(\w+)\]/gi, (str, match) => {
|
return str.replace(/\[!(\w+)\]/gi, (str, match) => {
|
||||||
const file = match;
|
const file = match;
|
||||||
return emojiMap[file]
|
return emojiMap[file]
|
||||||
? `<img src="${emojiMap[file]}" />`
|
? `<img emoji-name="${match}" src="${emojiMap[file]}" />`
|
||||||
: `[!${match}]`;
|
: `[!${match}]`;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
emojiImageToName(str){
|
||||||
|
return str.replace(/<img emoji-name=\"([^\"]*?)\" [^>]*>/gi, "[!$1]")
|
||||||
|
},
|
||||||
updateCurrentMessages(){
|
updateCurrentMessages(){
|
||||||
if(!allMessages[this.currentContactId]) allMessages[this.currentContactId] = []
|
if(!allMessages[this.currentContactId]) allMessages[this.currentContactId] = []
|
||||||
this.currentMessages = allMessages[this.currentContactId];
|
this.currentMessages = allMessages[this.currentContactId];
|
||||||
@@ -581,13 +594,36 @@ export default {
|
|||||||
}else{
|
}else{
|
||||||
if(this._changeContactLock || this.currentContactId == contactId) return false;
|
if(this._changeContactLock || this.currentContactId == contactId) return false;
|
||||||
}
|
}
|
||||||
|
const prevCurrentContactId = this.currentContactId;
|
||||||
|
//保存上个聊天目标的草稿
|
||||||
|
if(prevCurrentContactId){
|
||||||
|
const editorValue = this.getEditorValue();
|
||||||
|
if(editorValue){
|
||||||
|
this.CacheDraft.set(prevCurrentContactId,editorValue);
|
||||||
|
this.updateContact({
|
||||||
|
id:prevCurrentContactId,
|
||||||
|
lastContent:[
|
||||||
|
<span style="color:red;">[草稿]</span>,
|
||||||
|
<span domProps={{
|
||||||
|
innerHTML:this.lastContentRender({type:'text',content:editorValue})
|
||||||
|
}}></span>
|
||||||
|
],
|
||||||
|
});
|
||||||
|
this.setEditorValue('');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.currentContactId = contactId;
|
this.currentContactId = contactId;
|
||||||
if(!this.currentContactId) return false;
|
if(!this.currentContactId) return false;
|
||||||
|
|
||||||
this.$emit("change-contact", this.currentContact,this);
|
this.$emit("change-contact", this.currentContact,this);
|
||||||
if (isFunction(this.currentContact.renderContainer)) {
|
if (isFunction(this.currentContact.renderContainer)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//填充草稿内容
|
||||||
|
const draft = this.CacheDraft.get(contactId) || "";
|
||||||
|
if(draft) this.setEditorValue(draft);
|
||||||
|
|
||||||
|
|
||||||
if (this.CacheMessageLoaded.has(contactId)) {
|
if (this.CacheMessageLoaded.has(contactId)) {
|
||||||
this.$refs.messages.loaded();
|
this.$refs.messages.loaded();
|
||||||
@@ -785,6 +821,8 @@ export default {
|
|||||||
const index = this.findContactIndexById(id);
|
const index = this.findContactIndexById(id);
|
||||||
if(index === -1) return false;
|
if(index === -1) return false;
|
||||||
this.contacts.splice(index,1);
|
this.contacts.splice(index,1);
|
||||||
|
this.CacheDraft.remove(id);
|
||||||
|
this.CacheMessageLoaded.remove(id);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
@@ -850,7 +888,7 @@ export default {
|
|||||||
return this.currentMessages;
|
return this.currentMessages;
|
||||||
},
|
},
|
||||||
setEditorValue(val){
|
setEditorValue(val){
|
||||||
this.$refs.editor.setValue(this.replaceEmojiName(val));
|
this.$refs.editor.setValue(this.emojiNameToImage(val));
|
||||||
},
|
},
|
||||||
getEditorValue(){
|
getEditorValue(){
|
||||||
return this.$refs.editor.getFormatValue();
|
return this.$refs.editor.getFormatValue();
|
||||||
@@ -933,8 +971,12 @@ bezier = cubic-bezier(0.645, 0.045, 0.355, 1)
|
|||||||
+b(lemon-sidebar)
|
+b(lemon-sidebar)
|
||||||
width 250px
|
width 250px
|
||||||
background #efefef
|
background #efefef
|
||||||
overflow-y auto
|
display flex
|
||||||
scrollbar-light()
|
flex-direction column
|
||||||
|
+e(scroll){
|
||||||
|
overflow-y auto
|
||||||
|
scrollbar-light()
|
||||||
|
}
|
||||||
+e(label)
|
+e(label)
|
||||||
padding 6px 14px 6px 14px
|
padding 6px 14px 6px 14px
|
||||||
color #666
|
color #666
|
||||||
@@ -1014,7 +1056,11 @@ bezier = cubic-bezier(0.645, 0.045, 0.355, 1)
|
|||||||
.lemon-menu
|
.lemon-menu
|
||||||
.lemon-sidebar
|
.lemon-sidebar
|
||||||
display none
|
display none
|
||||||
+b(lemon-dropdown)
|
.lemon-wrapper--simple
|
||||||
|
.lemon-menu
|
||||||
|
.lemon-sidebar
|
||||||
|
display none
|
||||||
|
+b(lemon-contextmenu)
|
||||||
border-radius 4px
|
border-radius 4px
|
||||||
font-size 14px
|
font-size 14px
|
||||||
font-variant tabular-nums
|
font-variant tabular-nums
|
||||||
@@ -1022,21 +1068,22 @@ bezier = cubic-bezier(0.645, 0.045, 0.355, 1)
|
|||||||
color rgba(0, 0, 0, 0.65)
|
color rgba(0, 0, 0, 0.65)
|
||||||
z-index 10
|
z-index 10
|
||||||
background-color #fff
|
background-color #fff
|
||||||
border-radius 4px
|
border-radius 6px
|
||||||
box-shadow 0 2px 8px rgba(0, 0, 0, 0.06)
|
box-shadow 0 2px 8px rgba(0, 0, 0, 0.06)
|
||||||
position absolute
|
position absolute
|
||||||
transform-origin 50% 150%
|
transform-origin 50% 150%
|
||||||
box-sizing border-box
|
box-sizing border-box
|
||||||
user-select none
|
user-select none
|
||||||
overflow hidden
|
overflow hidden
|
||||||
|
min-width 120px
|
||||||
+e(item)
|
+e(item)
|
||||||
font-size 12px
|
font-size 14px
|
||||||
line-height 14px
|
line-height 16px
|
||||||
padding 8px 10px
|
padding 10px 15px
|
||||||
cursor pointer
|
cursor pointer
|
||||||
display flex
|
display flex
|
||||||
align-items center
|
align-items center
|
||||||
color #444
|
color #333
|
||||||
> span
|
> span
|
||||||
display inline-block
|
display inline-block
|
||||||
flex none
|
flex none
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ export default {
|
|||||||
</div>
|
</div>
|
||||||
<div class="lemon-message__content-flex">
|
<div class="lemon-message__content-flex">
|
||||||
<div
|
<div
|
||||||
v-dropdown_message={this.IMUI.contextmenu}
|
v-lemon-contextmenu_message={this.IMUI.contextmenu}
|
||||||
class="lemon-message__content"
|
class="lemon-message__content"
|
||||||
on-click={e => {
|
on-click={e => {
|
||||||
this._emitClick(e, "content");
|
this._emitClick(e, "content");
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export default {
|
|||||||
props={{ ...this.$attrs }}
|
props={{ ...this.$attrs }}
|
||||||
scopedSlots={{
|
scopedSlots={{
|
||||||
content: props => {
|
content: props => {
|
||||||
const content = this.IMUI.replaceEmojiName(props.content);
|
const content = this.IMUI.emojiNameToImage(props.content);
|
||||||
return <span domProps={{ innerHTML: content }} />;
|
return <span domProps={{ innerHTML: content }} />;
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import { hoursTimeFormat } from "utils";
|
import { hoursTimeFormat } from "utils";
|
||||||
import dropdown from "../directives/dropdown";
|
import contextmenu from "../directives/contextmenu";
|
||||||
export default {
|
export default {
|
||||||
name: "LemonMessages",
|
name: "LemonMessages",
|
||||||
components: {},
|
components: {},
|
||||||
@@ -111,7 +111,7 @@ export default {
|
|||||||
},
|
},
|
||||||
async _handleScroll(e) {
|
async _handleScroll(e) {
|
||||||
const { target } = e;
|
const { target } = e;
|
||||||
dropdown.hide();
|
contextmenu.hide();
|
||||||
if (
|
if (
|
||||||
target.scrollTop == 0 &&
|
target.scrollTop == 0 &&
|
||||||
this._loading == false &&
|
this._loading == false &&
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script>
|
<script>
|
||||||
const popoverCloseQueue = [];
|
const popoverCloseQueue = [];
|
||||||
const popoverCloseAll = () => popoverCloseQueue.forEach(callback => callback());
|
import contextmenu from "../directives/contextmenu";
|
||||||
const triggerEvents = {
|
const triggerEvents = {
|
||||||
hover(el) {},
|
hover(el) {},
|
||||||
focus(el) {
|
focus(el) {
|
||||||
@@ -14,6 +14,7 @@ const triggerEvents = {
|
|||||||
click(el) {
|
click(el) {
|
||||||
el.addEventListener("click", e => {
|
el.addEventListener("click", e => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
contextmenu.hide();
|
||||||
this.changeVisible();
|
this.changeVisible();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -59,7 +60,6 @@ export default {
|
|||||||
style={this.popoverStyle}
|
style={this.popoverStyle}
|
||||||
on-click={e => e.stopPropagation()}
|
on-click={e => e.stopPropagation()}
|
||||||
>
|
>
|
||||||
<div class="lemon-popover__title" />
|
|
||||||
<div class="lemon-popover__content">{this.$slots.content}</div>
|
<div class="lemon-popover__content">{this.$slots.content}</div>
|
||||||
<div class="lemon-popover__arrow" />
|
<div class="lemon-popover__arrow" />
|
||||||
</div>
|
</div>
|
||||||
@@ -96,9 +96,12 @@ export default {
|
|||||||
this.visible ? this.close() : this.open();
|
this.visible ? this.close() : this.open();
|
||||||
},
|
},
|
||||||
open() {
|
open() {
|
||||||
popoverCloseAll();
|
this.closeAll();
|
||||||
this.visible = true;
|
this.visible = true;
|
||||||
},
|
},
|
||||||
|
closeAll(){
|
||||||
|
popoverCloseQueue.forEach(callback => callback())
|
||||||
|
},
|
||||||
close() {
|
close() {
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import {isFunction,isEmpty} from 'utils/validate';
|
import {isFunction,isEmpty} from 'utils/validate';
|
||||||
|
import LemonPopover from '../components/popover.vue';
|
||||||
let popover;
|
let popover;
|
||||||
|
|
||||||
const hidePopover = ()=>{
|
const hidePopover = ()=>{
|
||||||
@@ -17,13 +18,14 @@ export default{
|
|||||||
el.addEventListener('contextmenu',(e)=>{
|
el.addEventListener('contextmenu',(e)=>{
|
||||||
if(isEmpty(binding.value) || !Array.isArray(binding.value)) return;
|
if(isEmpty(binding.value) || !Array.isArray(binding.value)) return;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
LemonPopover.methods.closeAll()
|
||||||
let component;
|
let component;
|
||||||
let visibleItems = []
|
let visibleItems = []
|
||||||
if(binding.modifiers.message) component = vnode.context;
|
if(binding.modifiers.message) component = vnode.context;
|
||||||
else if(binding.modifiers.contact) component = vnode.child;
|
else if(binding.modifiers.contact) component = vnode.child;
|
||||||
if(!popover){
|
if(!popover){
|
||||||
popover = document.createElement('div');
|
popover = document.createElement('div');
|
||||||
popover.className = 'lemon-dropdown';
|
popover.className = 'lemon-contextmenu';
|
||||||
document.body.appendChild(popover);
|
document.body.appendChild(popover);
|
||||||
}
|
}
|
||||||
popover.innerHTML = binding.value.map((item)=>{
|
popover.innerHTML = binding.value.map((item)=>{
|
||||||
@@ -36,8 +38,8 @@ export default{
|
|||||||
|
|
||||||
if(visible){
|
if(visible){
|
||||||
visibleItems.push(item);
|
visibleItems.push(item);
|
||||||
const icon = item.icon ? `<i class="lemon-dropdown__icon ${item.icon}"></i>` : '';
|
const icon = item.icon ? `<i class="lemon-contextmenu__icon ${item.icon}"></i>` : '';
|
||||||
return `<div style="color:${item.color}" title="${item.text}" class="lemon-dropdown__item">${icon}<span>${item.text}</span></div>`;
|
return `<div style="color:${item.color}" title="${item.text}" class="lemon-contextmenu__item">${icon}<span>${item.text}</span></div>`;
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}).join("");
|
}).join("");
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import Dropdown from './dropdown';
|
import Contextmenu from './contextmenu';
|
||||||
Vue.directive('dropdown',Dropdown);
|
Vue.directive('LemonContextmenu',Contextmenu);
|
||||||
@@ -7,7 +7,7 @@ export default {
|
|||||||
return "[图片]";
|
return "[图片]";
|
||||||
},
|
},
|
||||||
text(message) {
|
text(message) {
|
||||||
return this.replaceEmojiName(clearHtml(message.content));
|
return this.emojiNameToImage(clearHtml(message.content));
|
||||||
},
|
},
|
||||||
event(message){
|
event(message){
|
||||||
return '[通知]';
|
return '[通知]';
|
||||||
|
|||||||
@@ -103,9 +103,6 @@ export function mergeDeep(o1, o2) {
|
|||||||
return o1;
|
return o1;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function toEmojiName(str) {
|
|
||||||
return str.replace(/<img emoji-name=\"([^\"]*?)\" [^>]*>/gi, "[!$1]");
|
|
||||||
}
|
|
||||||
export function formatByte(value) {
|
export function formatByte(value) {
|
||||||
if (null == value || value == "") {
|
if (null == value || value == "") {
|
||||||
return "0 Bytes";
|
return "0 Bytes";
|
||||||
|
|||||||
Reference in New Issue
Block a user