增加sendText、sendKey参数,增加editor-footer插槽
This commit is contained in:
Vendored
+90
-11
@@ -2826,6 +2826,52 @@ module.exports = function (TO_STRING) {
|
||||
};
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "7333":
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// 19.1.2.1 Object.assign(target, source, ...)
|
||||
var DESCRIPTORS = __webpack_require__("9e1e");
|
||||
var getKeys = __webpack_require__("0d58");
|
||||
var gOPS = __webpack_require__("2621");
|
||||
var pIE = __webpack_require__("52a7");
|
||||
var toObject = __webpack_require__("4bf8");
|
||||
var IObject = __webpack_require__("626a");
|
||||
var $assign = Object.assign;
|
||||
|
||||
// should work with symbols and should have deterministic property order (V8 bug)
|
||||
module.exports = !$assign || __webpack_require__("79e5")(function () {
|
||||
var A = {};
|
||||
var B = {};
|
||||
// eslint-disable-next-line no-undef
|
||||
var S = Symbol();
|
||||
var K = 'abcdefghijklmnopqrst';
|
||||
A[S] = 7;
|
||||
K.split('').forEach(function (k) { B[k] = k; });
|
||||
return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
|
||||
}) ? function assign(target, source) { // eslint-disable-line no-unused-vars
|
||||
var T = toObject(target);
|
||||
var aLen = arguments.length;
|
||||
var index = 1;
|
||||
var getSymbols = gOPS.f;
|
||||
var isEnum = pIE.f;
|
||||
while (aLen > index) {
|
||||
var S = IObject(arguments[index++]);
|
||||
var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);
|
||||
var length = keys.length;
|
||||
var j = 0;
|
||||
var key;
|
||||
while (length > j) {
|
||||
key = keys[j++];
|
||||
if (!DESCRIPTORS || isEnum.call(S, key)) T[key] = S[key];
|
||||
}
|
||||
} return T;
|
||||
} : $assign;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "7514":
|
||||
@@ -5286,6 +5332,17 @@ $export($export.P + $export.F * __webpack_require__("5147")(STARTS_WITH), 'Strin
|
||||
})(document);
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "f751":
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
// 19.1.3.1 Object.assign(target, source)
|
||||
var $export = __webpack_require__("5ca1");
|
||||
|
||||
$export($export.S + $export.F, 'Object', { assign: __webpack_require__("7333") });
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "f772":
|
||||
@@ -6316,6 +6373,7 @@ var es6_array_from = __webpack_require__("1c4c");
|
||||
|
||||
|
||||
|
||||
|
||||
function editorvue_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 editorvue_type_script_lang_js_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { editorvue_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 { editorvue_type_script_lang_js_ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
@@ -6333,6 +6391,14 @@ var emojiData = [];
|
||||
var isInitTool = false;
|
||||
/* harmony default export */ var editorvue_type_script_lang_js_ = ({
|
||||
name: "LemonEditor",
|
||||
inject: {
|
||||
IMUI: {
|
||||
from: 'IMUI',
|
||||
default: function _default() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
},
|
||||
components: {},
|
||||
props: {
|
||||
tools: {
|
||||
@@ -6340,6 +6406,16 @@ var isInitTool = false;
|
||||
default: function _default() {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
sendText: {
|
||||
type: String,
|
||||
default: '发 送'
|
||||
},
|
||||
sendKey: {
|
||||
type: Function,
|
||||
default: function _default(e) {
|
||||
return e.keyCode == 13 && e.ctrlKey === true;
|
||||
}
|
||||
}
|
||||
},
|
||||
data: function data() {
|
||||
@@ -6448,7 +6524,7 @@ var isInitTool = false;
|
||||
"class": "lemon-editor__footer"
|
||||
}, [h("div", {
|
||||
"class": "lemon-editor__tip"
|
||||
}, ["\u4F7F\u7528 ctrl + enter \u5FEB\u6377\u53D1\u9001\u6D88\u606F"]), h("div", {
|
||||
}, [useScopedSlot(this.IMUI.$scopedSlots['editor-footer'], "使用 ctrl + enter 快捷发送消息")]), h("div", {
|
||||
"class": "lemon-editor__submit"
|
||||
}, [h("lemon-button", {
|
||||
"attrs": {
|
||||
@@ -6457,7 +6533,7 @@ var isInitTool = false;
|
||||
"on": {
|
||||
"click": this._handleSend
|
||||
}
|
||||
}, ["\u53D1 \u9001"])])])]);
|
||||
}, [this.sendText])])])]);
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
@@ -6631,10 +6707,7 @@ var isInitTool = false;
|
||||
|
||||
},
|
||||
_handleKeydown: function _handleKeydown(e) {
|
||||
var keyCode = e.keyCode,
|
||||
ctrlKey = e.ctrlKey;
|
||||
|
||||
if (keyCode == 13 && ctrlKey === true && this.submitDisabled == false) {
|
||||
if (this.submitDisabled == false && this.sendKey(e)) {
|
||||
this._handleSend();
|
||||
}
|
||||
},
|
||||
@@ -7394,6 +7467,9 @@ function _toConsumableArray(arr) {
|
||||
// EXTERNAL MODULE: ./node_modules/core-js/modules/es6.string.starts-with.js
|
||||
var es6_string_starts_with = __webpack_require__("f559");
|
||||
|
||||
// EXTERNAL MODULE: ./node_modules/core-js/modules/es6.object.assign.js
|
||||
var es6_object_assign = __webpack_require__("f751");
|
||||
|
||||
// EXTERNAL MODULE: ./node_modules/core-js/modules/es6.array.sort.js
|
||||
var es6_array_sort = __webpack_require__("55dd");
|
||||
|
||||
@@ -7521,6 +7597,8 @@ 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_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; }
|
||||
@@ -7593,6 +7671,8 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
* 是否隐藏消息列表内的发送时间
|
||||
*/
|
||||
hideMessageTime: Boolean,
|
||||
sendKey: Function,
|
||||
sendText: String,
|
||||
user: {
|
||||
type: Object,
|
||||
default: function _default() {
|
||||
@@ -8030,7 +8110,9 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
}), h("lemon-editor", {
|
||||
"ref": "editor",
|
||||
"attrs": {
|
||||
"tools": this.editorTools
|
||||
"tools": this.editorTools,
|
||||
"sendText": this.sendText,
|
||||
"sendKey": this.sendKey
|
||||
},
|
||||
"on": {
|
||||
"send": this._handleSend,
|
||||
@@ -8360,10 +8442,7 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
* @param {Array<Contact>} data 联系人列表
|
||||
*/
|
||||
initContacts: function initContacts(data) {
|
||||
var _this$contacts;
|
||||
|
||||
(_this$contacts = this.contacts).push.apply(_this$contacts, _toConsumableArray(data));
|
||||
|
||||
this.contacts = data;
|
||||
this.sortContacts();
|
||||
},
|
||||
|
||||
|
||||
Vendored
+90
-11
@@ -2835,6 +2835,52 @@ module.exports = function (TO_STRING) {
|
||||
};
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "7333":
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// 19.1.2.1 Object.assign(target, source, ...)
|
||||
var DESCRIPTORS = __webpack_require__("9e1e");
|
||||
var getKeys = __webpack_require__("0d58");
|
||||
var gOPS = __webpack_require__("2621");
|
||||
var pIE = __webpack_require__("52a7");
|
||||
var toObject = __webpack_require__("4bf8");
|
||||
var IObject = __webpack_require__("626a");
|
||||
var $assign = Object.assign;
|
||||
|
||||
// should work with symbols and should have deterministic property order (V8 bug)
|
||||
module.exports = !$assign || __webpack_require__("79e5")(function () {
|
||||
var A = {};
|
||||
var B = {};
|
||||
// eslint-disable-next-line no-undef
|
||||
var S = Symbol();
|
||||
var K = 'abcdefghijklmnopqrst';
|
||||
A[S] = 7;
|
||||
K.split('').forEach(function (k) { B[k] = k; });
|
||||
return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
|
||||
}) ? function assign(target, source) { // eslint-disable-line no-unused-vars
|
||||
var T = toObject(target);
|
||||
var aLen = arguments.length;
|
||||
var index = 1;
|
||||
var getSymbols = gOPS.f;
|
||||
var isEnum = pIE.f;
|
||||
while (aLen > index) {
|
||||
var S = IObject(arguments[index++]);
|
||||
var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);
|
||||
var length = keys.length;
|
||||
var j = 0;
|
||||
var key;
|
||||
while (length > j) {
|
||||
key = keys[j++];
|
||||
if (!DESCRIPTORS || isEnum.call(S, key)) T[key] = S[key];
|
||||
}
|
||||
} return T;
|
||||
} : $assign;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "7514":
|
||||
@@ -5295,6 +5341,17 @@ $export($export.P + $export.F * __webpack_require__("5147")(STARTS_WITH), 'Strin
|
||||
})(document);
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "f751":
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
// 19.1.3.1 Object.assign(target, source)
|
||||
var $export = __webpack_require__("5ca1");
|
||||
|
||||
$export($export.S + $export.F, 'Object', { assign: __webpack_require__("7333") });
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "f772":
|
||||
@@ -6325,6 +6382,7 @@ var es6_array_from = __webpack_require__("1c4c");
|
||||
|
||||
|
||||
|
||||
|
||||
function editorvue_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 editorvue_type_script_lang_js_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { editorvue_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 { editorvue_type_script_lang_js_ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
@@ -6342,6 +6400,14 @@ var emojiData = [];
|
||||
var isInitTool = false;
|
||||
/* harmony default export */ var editorvue_type_script_lang_js_ = ({
|
||||
name: "LemonEditor",
|
||||
inject: {
|
||||
IMUI: {
|
||||
from: 'IMUI',
|
||||
default: function _default() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
},
|
||||
components: {},
|
||||
props: {
|
||||
tools: {
|
||||
@@ -6349,6 +6415,16 @@ var isInitTool = false;
|
||||
default: function _default() {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
sendText: {
|
||||
type: String,
|
||||
default: '发 送'
|
||||
},
|
||||
sendKey: {
|
||||
type: Function,
|
||||
default: function _default(e) {
|
||||
return e.keyCode == 13 && e.ctrlKey === true;
|
||||
}
|
||||
}
|
||||
},
|
||||
data: function data() {
|
||||
@@ -6457,7 +6533,7 @@ var isInitTool = false;
|
||||
"class": "lemon-editor__footer"
|
||||
}, [h("div", {
|
||||
"class": "lemon-editor__tip"
|
||||
}, ["\u4F7F\u7528 ctrl + enter \u5FEB\u6377\u53D1\u9001\u6D88\u606F"]), h("div", {
|
||||
}, [useScopedSlot(this.IMUI.$scopedSlots['editor-footer'], "使用 ctrl + enter 快捷发送消息")]), h("div", {
|
||||
"class": "lemon-editor__submit"
|
||||
}, [h("lemon-button", {
|
||||
"attrs": {
|
||||
@@ -6466,7 +6542,7 @@ var isInitTool = false;
|
||||
"on": {
|
||||
"click": this._handleSend
|
||||
}
|
||||
}, ["\u53D1 \u9001"])])])]);
|
||||
}, [this.sendText])])])]);
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
@@ -6640,10 +6716,7 @@ var isInitTool = false;
|
||||
|
||||
},
|
||||
_handleKeydown: function _handleKeydown(e) {
|
||||
var keyCode = e.keyCode,
|
||||
ctrlKey = e.ctrlKey;
|
||||
|
||||
if (keyCode == 13 && ctrlKey === true && this.submitDisabled == false) {
|
||||
if (this.submitDisabled == false && this.sendKey(e)) {
|
||||
this._handleSend();
|
||||
}
|
||||
},
|
||||
@@ -7403,6 +7476,9 @@ function _toConsumableArray(arr) {
|
||||
// EXTERNAL MODULE: ./node_modules/core-js/modules/es6.string.starts-with.js
|
||||
var es6_string_starts_with = __webpack_require__("f559");
|
||||
|
||||
// EXTERNAL MODULE: ./node_modules/core-js/modules/es6.object.assign.js
|
||||
var es6_object_assign = __webpack_require__("f751");
|
||||
|
||||
// EXTERNAL MODULE: ./node_modules/core-js/modules/es6.array.sort.js
|
||||
var es6_array_sort = __webpack_require__("55dd");
|
||||
|
||||
@@ -7530,6 +7606,8 @@ 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_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; }
|
||||
@@ -7602,6 +7680,8 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
* 是否隐藏消息列表内的发送时间
|
||||
*/
|
||||
hideMessageTime: Boolean,
|
||||
sendKey: Function,
|
||||
sendText: String,
|
||||
user: {
|
||||
type: Object,
|
||||
default: function _default() {
|
||||
@@ -8039,7 +8119,9 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
}), h("lemon-editor", {
|
||||
"ref": "editor",
|
||||
"attrs": {
|
||||
"tools": this.editorTools
|
||||
"tools": this.editorTools,
|
||||
"sendText": this.sendText,
|
||||
"sendKey": this.sendKey
|
||||
},
|
||||
"on": {
|
||||
"send": this._handleSend,
|
||||
@@ -8369,10 +8451,7 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
* @param {Array<Contact>} data 联系人列表
|
||||
*/
|
||||
initContacts: function initContacts(data) {
|
||||
var _this$contacts;
|
||||
|
||||
(_this$contacts = this.contacts).push.apply(_this$contacts, _toConsumableArray(data));
|
||||
|
||||
this.contacts = data;
|
||||
this.sortContacts();
|
||||
},
|
||||
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+26
-2
@@ -65,7 +65,12 @@
|
||||
@message-click="handleMessageClick"
|
||||
@change-contact="handleChangeContact"
|
||||
@send="handleSend"
|
||||
send-text="发送消息"
|
||||
:send-key="(e)=>e.ctrlKey == true"
|
||||
>
|
||||
<template #editor-footer>
|
||||
按 ctrl 键发送消息
|
||||
</template>
|
||||
<template #cover>
|
||||
<div class="cover">
|
||||
<i class="lemon-icon-message"></i>
|
||||
@@ -176,7 +181,7 @@
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>lastSendTime</td>
|
||||
<td>lastContent</td>
|
||||
<td>最近一条消息的内容</td>
|
||||
<td>String | Vnode</td>
|
||||
<td></td>
|
||||
@@ -294,7 +299,21 @@
|
||||
<td width="350">主题</td>
|
||||
<td width="150">default | blue</td>
|
||||
<td width="100">default</td>
|
||||
<td>主题颜色</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="150">sendText</td>
|
||||
<td width="350">发送消息按钮的文字</td>
|
||||
<td width="150">String</td>
|
||||
<td width="100">发送消息</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="150">sendKey</td>
|
||||
<td width="350">快捷发送键检查函数</td>
|
||||
<td width="150">Function(event)=>Boolean</td>
|
||||
<td width="100"></td>
|
||||
<td>(e)=>e.keyCode == 13 && e.ctrlKey</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="150">simple</td>
|
||||
@@ -585,6 +604,11 @@
|
||||
<td width="350">初始化时的封面</td>
|
||||
<td width="150">-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="150">editor-footer</td>
|
||||
<td width="350">消息输入框底部</td>
|
||||
<td width="150">-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="150">message-title</td>
|
||||
<td width="350">消息列表的标题</td>
|
||||
|
||||
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.9ef31261.css rel=preload as=style><link href=js/chunk-vendors.e4810482.js rel=preload as=script><link href=js/index.9a55b7ef.js rel=preload as=script><link href=css/index.9ef31261.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.9a55b7ef.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.9ef31261.css rel=preload as=style><link href=js/chunk-vendors.e4810482.js rel=preload as=script><link href=js/index.b9ac8f2d.js rel=preload as=script><link href=css/index.9ef31261.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.b9ac8f2d.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,7 +1,6 @@
|
||||
import Vue from "vue";
|
||||
import App from "./App.vue";
|
||||
import LemonIMUI from "../packages";
|
||||
//import LemonIMUI from "../dist/index.umd.min";
|
||||
Vue.use(LemonIMUI);
|
||||
|
||||
Vue.config.productionTip = false;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lemon-imui",
|
||||
"version": "1.3.3",
|
||||
"version": "1.4.0",
|
||||
"main": "dist/index.umd.min.js",
|
||||
"description": "基于 VUE2.0 的 IM 聊天组件",
|
||||
"homepage": "https://github.com/fanjyy/lemon-imui",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script>
|
||||
import { toEmojiName } from "utils";
|
||||
import { toEmojiName,useScopedSlot } from "utils";
|
||||
const exec = (val, command = "insertHTML") => {
|
||||
document.execCommand(command, false, val);
|
||||
};
|
||||
@@ -9,12 +9,30 @@ let emojiData = [];
|
||||
let isInitTool = false;
|
||||
export default {
|
||||
name: "LemonEditor",
|
||||
inject: {
|
||||
IMUI: {
|
||||
from:'IMUI',
|
||||
default (){
|
||||
return this;
|
||||
}
|
||||
}
|
||||
},
|
||||
components: {},
|
||||
props: {
|
||||
tools:{
|
||||
type:Array,
|
||||
default:()=>[],
|
||||
}
|
||||
},
|
||||
sendText:{
|
||||
type:String,
|
||||
default:'发 送'
|
||||
},
|
||||
sendKey:{
|
||||
type:Function,
|
||||
default(e){
|
||||
return e.keyCode == 13 && e.ctrlKey === true;
|
||||
}
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -82,13 +100,15 @@ export default {
|
||||
/>
|
||||
</div>
|
||||
<div class="lemon-editor__footer">
|
||||
<div class="lemon-editor__tip">使用 ctrl + enter 快捷发送消息</div>
|
||||
<div class="lemon-editor__tip">
|
||||
{useScopedSlot(this.IMUI.$scopedSlots['editor-footer'],"使用 ctrl + enter 快捷发送消息")}
|
||||
</div>
|
||||
<div class="lemon-editor__submit">
|
||||
<lemon-button
|
||||
disabled={this.submitDisabled}
|
||||
on-click={this._handleSend}
|
||||
>
|
||||
发 送
|
||||
{this.sendText}
|
||||
</lemon-button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -218,8 +238,7 @@ export default {
|
||||
//this._checkSubmitDisabled();
|
||||
},
|
||||
_handleKeydown(e) {
|
||||
const { keyCode,ctrlKey } = e;
|
||||
if (keyCode == 13 && ctrlKey === true && this.submitDisabled == false) {
|
||||
if(this.submitDisabled == false && this.sendKey(e)){
|
||||
this._handleSend();
|
||||
}
|
||||
},
|
||||
|
||||
@@ -66,6 +66,8 @@ export default {
|
||||
* 是否隐藏消息列表内的发送时间
|
||||
*/
|
||||
hideMessageTime:Boolean,
|
||||
sendKey:Function,
|
||||
sendText:String,
|
||||
user: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
@@ -461,6 +463,8 @@ export default {
|
||||
<lemon-editor
|
||||
ref="editor"
|
||||
tools={this.editorTools}
|
||||
sendText={this.sendText}
|
||||
sendKey={this.sendKey}
|
||||
onSend={this._handleSend}
|
||||
onUpload={this._handleUpload}
|
||||
/>
|
||||
@@ -723,7 +727,7 @@ export default {
|
||||
* @param {Array<Contact>} data 联系人列表
|
||||
*/
|
||||
initContacts(data) {
|
||||
this.contacts.push(...data);
|
||||
this.contacts = data;
|
||||
this.sortContacts();
|
||||
},
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user