修复输入内容换行引起的一些问题、修复IE浏览器下报错的问题
This commit is contained in:
Vendored
+41
-35
@@ -6103,6 +6103,7 @@ var es6_regexp_replace = __webpack_require__("a481");
|
||||
|
||||
|
||||
|
||||
|
||||
function 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 _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
@@ -6179,6 +6180,10 @@ function arrayIntersect(a, b) {
|
||||
return a.filter(function (x) {
|
||||
return b.includes(x);
|
||||
});
|
||||
} //清除字符串内的所有HTML标签
|
||||
|
||||
function clearHtml(str) {
|
||||
return str.replace(/<.*?>/ig, "");
|
||||
}
|
||||
function error(text) {
|
||||
throw new Error(text);
|
||||
@@ -6373,7 +6378,6 @@ 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; }
|
||||
@@ -6517,8 +6521,7 @@ var isInitTool = false;
|
||||
"keyup": this._handleKeyup,
|
||||
"keydown": this._handleKeydown,
|
||||
"paste": this._handlePaste,
|
||||
"click": this._handleClick,
|
||||
"input": this._handleInput
|
||||
"click": this._handleClick
|
||||
}
|
||||
})]), h("div", {
|
||||
"class": "lemon-editor__footer"
|
||||
@@ -6612,9 +6615,6 @@ var isInitTool = false;
|
||||
_handleClick: function _handleClick() {
|
||||
this._saveLastRange();
|
||||
},
|
||||
_handleInput: function _handleInput() {
|
||||
this._checkSubmitDisabled();
|
||||
},
|
||||
_renderEmojiTabs: function _renderEmojiTabs() {
|
||||
var _this3 = this;
|
||||
|
||||
@@ -6695,16 +6695,19 @@ var isInitTool = false;
|
||||
}(),
|
||||
_handlePaste: function _handlePaste(e) {
|
||||
e.preventDefault();
|
||||
var clipboardData = e.clipboardData;
|
||||
var text = clipboardData.getData("text");
|
||||
exec(text, "insertText"); // Array.from(clipboardData.items).forEach(item => {
|
||||
// console.log(item.type);
|
||||
// });
|
||||
//e.target.innerText = text;
|
||||
var clipboardData = e.clipboardData || window.clipboardData;
|
||||
var text = clipboardData.getData("Text");
|
||||
|
||||
if (window.clipboardData) {
|
||||
this.$refs.textarea.innerHTML = text;
|
||||
} else {
|
||||
exec(text, "insertText");
|
||||
}
|
||||
},
|
||||
_handleKeyup: function _handleKeyup(e) {
|
||||
this._saveLastRange(); //this._checkSubmitDisabled();
|
||||
this._saveLastRange();
|
||||
|
||||
this._checkSubmitDisabled();
|
||||
},
|
||||
_handleKeydown: function _handleKeydown(e) {
|
||||
if (this.submitDisabled == false && this.sendKey(e)) {
|
||||
@@ -6712,10 +6715,16 @@ var isInitTool = false;
|
||||
}
|
||||
},
|
||||
getFormatValue: function getFormatValue() {
|
||||
return toEmojiName(this.$refs.textarea.innerHTML.replace(/<br>|<\/br>/, "").replace(/<div>|<p>/g, "\r\n").replace(/<\/div>|<\/p>/g, ""));
|
||||
// return toEmojiName(
|
||||
// this.$refs.textarea.innerHTML
|
||||
// .replace(/<br>|<\/br>/, "")
|
||||
// .replace(/<div>|<p>/g, "\r\n")
|
||||
// .replace(/<\/div>|<\/p>/g, "")
|
||||
// );
|
||||
return toEmojiName(this.$refs.textarea.innerHTML);
|
||||
},
|
||||
_checkSubmitDisabled: function _checkSubmitDisabled() {
|
||||
this.submitDisabled = !this.$refs.textarea.innerHTML.trim();
|
||||
this.submitDisabled = !this.$refs.textarea.innerText.trim();
|
||||
},
|
||||
_handleSend: function _handleSend(e) {
|
||||
var text = this.getFormatValue();
|
||||
@@ -7493,6 +7502,7 @@ var MESSAGE_TYPE = ["voice", "file", "video", "image", "text"];
|
||||
var MESSAGE_STATUS = ["going", "succeed", "failed"];
|
||||
var CONTACT_TYPE = ["many", "single"];
|
||||
// CONCATENATED MODULE: ./packages/lastContentRender.js
|
||||
|
||||
/* harmony default export */ var packages_lastContentRender = ({
|
||||
file: function file(message) {
|
||||
return "[文件]";
|
||||
@@ -7501,7 +7511,7 @@ var CONTACT_TYPE = ["many", "single"];
|
||||
return "[图片]";
|
||||
},
|
||||
text: function text(message) {
|
||||
return this.replaceEmojiName(message.content);
|
||||
return this.replaceEmojiName(clearHtml(message.content));
|
||||
},
|
||||
event: function event(message) {
|
||||
return '[通知]';
|
||||
@@ -7598,7 +7608,6 @@ 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; }
|
||||
@@ -8359,15 +8368,20 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
* EmojiItem = {name: wx,title: 微笑,src: url} 无分组
|
||||
*/
|
||||
initEmoji: function initEmoji(data) {
|
||||
var flatData = [];
|
||||
this.$refs.editor.initEmoji(data);
|
||||
|
||||
if (data[0].label) {
|
||||
data = data.flatMap(function (item) {
|
||||
return item.children;
|
||||
data.forEach(function (item) {
|
||||
var _flatData;
|
||||
|
||||
(_flatData = flatData).push.apply(_flatData, _toConsumableArray(item.children));
|
||||
});
|
||||
} else {
|
||||
flatData = data;
|
||||
}
|
||||
|
||||
data.forEach(function (_ref2) {
|
||||
flatData.forEach(function (_ref2) {
|
||||
var name = _ref2.name,
|
||||
src = _ref2.src;
|
||||
return emojiMap[name] = src;
|
||||
@@ -8521,22 +8535,14 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
return this.findContactIndexById(contactId) !== -1;
|
||||
},
|
||||
findMessage: function findMessage(messageId) {
|
||||
return Object.values(allMessages).flat().find(function (_ref3) {
|
||||
var id = _ref3.id;
|
||||
return id == messageId;
|
||||
});
|
||||
for (var key in allMessages) {
|
||||
var message = allMessages[key].find(function (_ref3) {
|
||||
var id = _ref3.id;
|
||||
return id == messageId;
|
||||
});
|
||||
if (message) return message;
|
||||
}
|
||||
},
|
||||
// findMessageIndexById(messageId, contactId) {
|
||||
// const msg = messages[contactId];
|
||||
// if (isEmpty(msg)) {
|
||||
// return -1;
|
||||
// }
|
||||
// return msg.findIndex(item => item.id == messageId);
|
||||
// },
|
||||
// findMessageById(messageId, contactId) {
|
||||
// const index = this.findMessageIndexById(messageId, contactId);
|
||||
// if (index !== -1) return messages[contactId][index];
|
||||
// },
|
||||
|
||||
/**
|
||||
* 返回所有联系人
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+41
-35
@@ -6112,6 +6112,7 @@ var es6_regexp_replace = __webpack_require__("a481");
|
||||
|
||||
|
||||
|
||||
|
||||
function 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 _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
@@ -6188,6 +6189,10 @@ function arrayIntersect(a, b) {
|
||||
return a.filter(function (x) {
|
||||
return b.includes(x);
|
||||
});
|
||||
} //清除字符串内的所有HTML标签
|
||||
|
||||
function clearHtml(str) {
|
||||
return str.replace(/<.*?>/ig, "");
|
||||
}
|
||||
function error(text) {
|
||||
throw new Error(text);
|
||||
@@ -6382,7 +6387,6 @@ 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; }
|
||||
@@ -6526,8 +6530,7 @@ var isInitTool = false;
|
||||
"keyup": this._handleKeyup,
|
||||
"keydown": this._handleKeydown,
|
||||
"paste": this._handlePaste,
|
||||
"click": this._handleClick,
|
||||
"input": this._handleInput
|
||||
"click": this._handleClick
|
||||
}
|
||||
})]), h("div", {
|
||||
"class": "lemon-editor__footer"
|
||||
@@ -6621,9 +6624,6 @@ var isInitTool = false;
|
||||
_handleClick: function _handleClick() {
|
||||
this._saveLastRange();
|
||||
},
|
||||
_handleInput: function _handleInput() {
|
||||
this._checkSubmitDisabled();
|
||||
},
|
||||
_renderEmojiTabs: function _renderEmojiTabs() {
|
||||
var _this3 = this;
|
||||
|
||||
@@ -6704,16 +6704,19 @@ var isInitTool = false;
|
||||
}(),
|
||||
_handlePaste: function _handlePaste(e) {
|
||||
e.preventDefault();
|
||||
var clipboardData = e.clipboardData;
|
||||
var text = clipboardData.getData("text");
|
||||
exec(text, "insertText"); // Array.from(clipboardData.items).forEach(item => {
|
||||
// console.log(item.type);
|
||||
// });
|
||||
//e.target.innerText = text;
|
||||
var clipboardData = e.clipboardData || window.clipboardData;
|
||||
var text = clipboardData.getData("Text");
|
||||
|
||||
if (window.clipboardData) {
|
||||
this.$refs.textarea.innerHTML = text;
|
||||
} else {
|
||||
exec(text, "insertText");
|
||||
}
|
||||
},
|
||||
_handleKeyup: function _handleKeyup(e) {
|
||||
this._saveLastRange(); //this._checkSubmitDisabled();
|
||||
this._saveLastRange();
|
||||
|
||||
this._checkSubmitDisabled();
|
||||
},
|
||||
_handleKeydown: function _handleKeydown(e) {
|
||||
if (this.submitDisabled == false && this.sendKey(e)) {
|
||||
@@ -6721,10 +6724,16 @@ var isInitTool = false;
|
||||
}
|
||||
},
|
||||
getFormatValue: function getFormatValue() {
|
||||
return toEmojiName(this.$refs.textarea.innerHTML.replace(/<br>|<\/br>/, "").replace(/<div>|<p>/g, "\r\n").replace(/<\/div>|<\/p>/g, ""));
|
||||
// return toEmojiName(
|
||||
// this.$refs.textarea.innerHTML
|
||||
// .replace(/<br>|<\/br>/, "")
|
||||
// .replace(/<div>|<p>/g, "\r\n")
|
||||
// .replace(/<\/div>|<\/p>/g, "")
|
||||
// );
|
||||
return toEmojiName(this.$refs.textarea.innerHTML);
|
||||
},
|
||||
_checkSubmitDisabled: function _checkSubmitDisabled() {
|
||||
this.submitDisabled = !this.$refs.textarea.innerHTML.trim();
|
||||
this.submitDisabled = !this.$refs.textarea.innerText.trim();
|
||||
},
|
||||
_handleSend: function _handleSend(e) {
|
||||
var text = this.getFormatValue();
|
||||
@@ -7502,6 +7511,7 @@ var MESSAGE_TYPE = ["voice", "file", "video", "image", "text"];
|
||||
var MESSAGE_STATUS = ["going", "succeed", "failed"];
|
||||
var CONTACT_TYPE = ["many", "single"];
|
||||
// CONCATENATED MODULE: ./packages/lastContentRender.js
|
||||
|
||||
/* harmony default export */ var packages_lastContentRender = ({
|
||||
file: function file(message) {
|
||||
return "[文件]";
|
||||
@@ -7510,7 +7520,7 @@ var CONTACT_TYPE = ["many", "single"];
|
||||
return "[图片]";
|
||||
},
|
||||
text: function text(message) {
|
||||
return this.replaceEmojiName(message.content);
|
||||
return this.replaceEmojiName(clearHtml(message.content));
|
||||
},
|
||||
event: function event(message) {
|
||||
return '[通知]';
|
||||
@@ -7607,7 +7617,6 @@ 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; }
|
||||
@@ -8368,15 +8377,20 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
* EmojiItem = {name: wx,title: 微笑,src: url} 无分组
|
||||
*/
|
||||
initEmoji: function initEmoji(data) {
|
||||
var flatData = [];
|
||||
this.$refs.editor.initEmoji(data);
|
||||
|
||||
if (data[0].label) {
|
||||
data = data.flatMap(function (item) {
|
||||
return item.children;
|
||||
data.forEach(function (item) {
|
||||
var _flatData;
|
||||
|
||||
(_flatData = flatData).push.apply(_flatData, _toConsumableArray(item.children));
|
||||
});
|
||||
} else {
|
||||
flatData = data;
|
||||
}
|
||||
|
||||
data.forEach(function (_ref2) {
|
||||
flatData.forEach(function (_ref2) {
|
||||
var name = _ref2.name,
|
||||
src = _ref2.src;
|
||||
return emojiMap[name] = src;
|
||||
@@ -8530,22 +8544,14 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
return this.findContactIndexById(contactId) !== -1;
|
||||
},
|
||||
findMessage: function findMessage(messageId) {
|
||||
return Object.values(allMessages).flat().find(function (_ref3) {
|
||||
var id = _ref3.id;
|
||||
return id == messageId;
|
||||
});
|
||||
for (var key in allMessages) {
|
||||
var message = allMessages[key].find(function (_ref3) {
|
||||
var id = _ref3.id;
|
||||
return id == messageId;
|
||||
});
|
||||
if (message) return message;
|
||||
}
|
||||
},
|
||||
// findMessageIndexById(messageId, contactId) {
|
||||
// const msg = messages[contactId];
|
||||
// if (isEmpty(msg)) {
|
||||
// return -1;
|
||||
// }
|
||||
// return msg.findIndex(item => item.id == messageId);
|
||||
// },
|
||||
// findMessageById(messageId, contactId) {
|
||||
// const index = this.findMessageIndexById(messageId, contactId);
|
||||
// if (index !== -1) return messages[contactId][index];
|
||||
// },
|
||||
|
||||
/**
|
||||
* 返回所有联系人
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -1557,6 +1557,7 @@ export default {
|
||||
<style lang="stylus">
|
||||
::selection{background:#000;color:#fff;}
|
||||
body
|
||||
font-family "Microsoft YaHei"
|
||||
background #f6f6f6 !important
|
||||
#app
|
||||
width 90%
|
||||
|
||||
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.9ef31261.css rel=preload as=style><link href=js/chunk-vendors.e4810482.js rel=preload as=script><link href=js/index.e68554e2.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.e68554e2.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.8db04478.css rel=preload as=style><link href=js/chunk-vendors.e4810482.js rel=preload as=script><link href=js/index.e5d6dd7c.js rel=preload as=script><link href=css/index.8db04478.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.e5d6dd7c.js></script></body></html>
|
||||
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lemon-imui",
|
||||
"version": "1.4.0",
|
||||
"version": "1.4.1",
|
||||
"main": "dist/index.umd.min.js",
|
||||
"description": "基于 VUE2.0 的 IM 聊天组件",
|
||||
"homepage": "https://github.com/fanjyy/lemon-imui",
|
||||
|
||||
@@ -128,11 +128,14 @@ export default {
|
||||
+e(content)
|
||||
font-size 12px
|
||||
color #999
|
||||
padding-top 3px
|
||||
height 14px
|
||||
line-height 14px
|
||||
ellipsis()
|
||||
img
|
||||
height 14px
|
||||
display inline-block
|
||||
vertical-align middle
|
||||
vertical-align top
|
||||
margin 0 1px
|
||||
+m(name-center)
|
||||
+e(label)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script>
|
||||
import { toEmojiName,useScopedSlot } from "utils";
|
||||
import { toEmojiName,useScopedSlot,clearHtml } from "utils";
|
||||
const exec = (val, command = "insertHTML") => {
|
||||
document.execCommand(command, false, val);
|
||||
};
|
||||
@@ -95,7 +95,6 @@ export default {
|
||||
on-keydown={this._handleKeydown}
|
||||
on-paste={this._handlePaste}
|
||||
on-click={this._handleClick}
|
||||
on-input={this._handleInput}
|
||||
spellcheck="false"
|
||||
/>
|
||||
</div>
|
||||
@@ -182,9 +181,6 @@ export default {
|
||||
_handleClick() {
|
||||
this._saveLastRange();
|
||||
},
|
||||
_handleInput() {
|
||||
this._checkSubmitDisabled();
|
||||
},
|
||||
_renderEmojiTabs() {
|
||||
const renderImageGrid = items => {
|
||||
return items.map(item => (
|
||||
@@ -225,17 +221,17 @@ export default {
|
||||
},
|
||||
_handlePaste(e) {
|
||||
e.preventDefault();
|
||||
const { clipboardData } = e;
|
||||
const text = clipboardData.getData("text");
|
||||
exec(text, "insertText");
|
||||
// Array.from(clipboardData.items).forEach(item => {
|
||||
// console.log(item.type);
|
||||
// });
|
||||
//e.target.innerText = text;
|
||||
const clipboardData = e.clipboardData || window.clipboardData;
|
||||
const text = clipboardData.getData("Text");
|
||||
if(window.clipboardData){
|
||||
this.$refs.textarea.innerHTML = text;
|
||||
}else{
|
||||
exec(text, "insertText");
|
||||
}
|
||||
},
|
||||
_handleKeyup(e) {
|
||||
this._saveLastRange();
|
||||
//this._checkSubmitDisabled();
|
||||
this._checkSubmitDisabled();
|
||||
},
|
||||
_handleKeydown(e) {
|
||||
if(this.submitDisabled == false && this.sendKey(e)){
|
||||
@@ -243,15 +239,16 @@ export default {
|
||||
}
|
||||
},
|
||||
getFormatValue() {
|
||||
return toEmojiName(
|
||||
this.$refs.textarea.innerHTML
|
||||
.replace(/<br>|<\/br>/, "")
|
||||
.replace(/<div>|<p>/g, "\r\n")
|
||||
.replace(/<\/div>|<\/p>/g, "")
|
||||
);
|
||||
// return toEmojiName(
|
||||
// this.$refs.textarea.innerHTML
|
||||
// .replace(/<br>|<\/br>/, "")
|
||||
// .replace(/<div>|<p>/g, "\r\n")
|
||||
// .replace(/<\/div>|<\/p>/g, "")
|
||||
// );
|
||||
return toEmojiName(this.$refs.textarea.innerHTML);
|
||||
},
|
||||
_checkSubmitDisabled() {
|
||||
this.submitDisabled = !this.$refs.textarea.innerHTML.trim();
|
||||
this.submitDisabled = !this.$refs.textarea.innerText.trim();
|
||||
},
|
||||
_handleSend(e) {
|
||||
const text = this.getFormatValue();
|
||||
|
||||
@@ -653,11 +653,16 @@ export default {
|
||||
* EmojiItem = {name: wx,title: 微笑,src: url} 无分组
|
||||
*/
|
||||
initEmoji(data) {
|
||||
let flatData = [];
|
||||
this.$refs.editor.initEmoji(data);
|
||||
if (data[0].label) {
|
||||
data = data.flatMap(item => item.children);
|
||||
data.forEach(item=>{
|
||||
flatData.push(...item.children);
|
||||
})
|
||||
}else{
|
||||
flatData = data;
|
||||
}
|
||||
data.forEach(({ name, src }) => (emojiMap[name] = src));
|
||||
flatData.forEach(({ name, src }) => (emojiMap[name] = src));
|
||||
},
|
||||
initEditorTools(data){
|
||||
this.editorTools = data;
|
||||
@@ -802,19 +807,11 @@ export default {
|
||||
return this.findContactIndexById(contactId) !== -1;
|
||||
},
|
||||
findMessage(messageId){
|
||||
return Object.values(allMessages).flat().find(({id})=>id == messageId);
|
||||
for(const key in allMessages){
|
||||
const message = allMessages[key].find(({id})=>id == messageId)
|
||||
if(message) return message;
|
||||
}
|
||||
},
|
||||
// findMessageIndexById(messageId, contactId) {
|
||||
// const msg = messages[contactId];
|
||||
// if (isEmpty(msg)) {
|
||||
// return -1;
|
||||
// }
|
||||
// return msg.findIndex(item => item.id == messageId);
|
||||
// },
|
||||
// findMessageById(messageId, contactId) {
|
||||
// const index = this.findMessageIndexById(messageId, contactId);
|
||||
// if (index !== -1) return messages[contactId][index];
|
||||
// },
|
||||
/**
|
||||
* 返回所有联系人
|
||||
* @return {Array<Contact>}
|
||||
@@ -858,6 +855,7 @@ bezier = cubic-bezier(0.645, 0.045, 0.355, 1)
|
||||
+b(lemon-wrapper)
|
||||
display flex
|
||||
font-size 14px
|
||||
font-family "Microsoft YaHei"
|
||||
//mask-image radial-gradient(circle, white 100%, black 100%)
|
||||
background #efefef
|
||||
transition all .4s bezier
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import {clearHtml } from 'utils';
|
||||
export default {
|
||||
file(message) {
|
||||
return "[文件]";
|
||||
@@ -6,7 +7,7 @@ export default {
|
||||
return "[图片]";
|
||||
},
|
||||
text(message) {
|
||||
return this.replaceEmojiName(message.content);
|
||||
return this.replaceEmojiName(clearHtml(message.content));
|
||||
},
|
||||
event(message){
|
||||
return '[通知]';
|
||||
|
||||
@@ -70,6 +70,10 @@ export function funCall(event, callback) {
|
||||
export function arrayIntersect(a, b) {
|
||||
return a.filter(x => b.includes(x));
|
||||
}
|
||||
//清除字符串内的所有HTML标签
|
||||
export function clearHtml(str){
|
||||
return str.replace(/<.*?>/ig,"");
|
||||
}
|
||||
|
||||
export function error(text) {
|
||||
throw new Error(text);
|
||||
|
||||
Reference in New Issue
Block a user