From 3603d0c03bf4e76d83b648d09d17637f8f2be23f Mon Sep 17 00:00:00 2001
From: fan <504498960@qq.com>
Date: Sat, 30 Jan 2021 21:03:15 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=B3=E9=94=AE=E8=8F=9C?=
=?UTF-8?q?=E5=8D=95=E9=85=8D=E7=BD=AE=20=E5=A2=9E=E5=8A=A0setEditorValue?=
=?UTF-8?q?=E3=80=81getEditorValue=E6=96=B9=E6=B3=95=20=E4=BF=AE=E6=94=B9u?=
=?UTF-8?q?pdateContact=E4=BC=A0=E5=8F=82=20=E4=BF=AE=E5=A4=8D=E5=8F=AA?=
=?UTF-8?q?=E9=80=89=E6=8B=A9=E8=A1=A8=E6=83=85=E5=8F=91=E9=80=81=E6=8C=89?=
=?UTF-8?q?=E9=92=AE=E6=98=AF=E7=81=B0=E8=89=B2=E7=9A=84=E9=97=AE=E9=A2=98?=
=?UTF-8?q?=20=E4=BF=AE=E5=A4=8Dsend=E4=B9=8B=E5=90=8EtoContactId=E4=B8=A2?=
=?UTF-8?q?=E5=A4=B1=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
dist/index.common.js | 252 +++++++++++++++++++------
dist/index.css | 2 +-
dist/index.umd.js | 260 ++++++++++++++++++++------
dist/index.umd.min.js | 2 +-
examples/App.vue | 241 +++++++++++++++++++++++-
examples/dist/css/index.8db04478.css | 1 -
examples/dist/css/index.fed1a091.css | 1 +
examples/dist/index.html | 2 +-
examples/dist/js/index.4318ecd4.js | 1 +
examples/dist/js/index.dfad42c7.js | 1 -
package.json | 2 +-
packages/components/contact.vue | 18 +-
packages/components/editor.vue | 11 +-
packages/components/index.vue | 85 ++++++++-
packages/components/message/basic.vue | 20 +-
packages/components/messages.vue | 2 +
packages/components/popover.vue | 10 +-
packages/directives/dropdown.js | 70 +++++++
packages/directives/index.js | 3 +
packages/index.js | 3 +-
packages/styles/common/icons.styl | 17 +-
packages/styles/fonts/icon.woff | Bin 0 -> 2344 bytes
packages/utils/index.js | 5 +-
23 files changed, 825 insertions(+), 184 deletions(-)
delete mode 100644 examples/dist/css/index.8db04478.css
create mode 100644 examples/dist/css/index.fed1a091.css
create mode 100644 examples/dist/js/index.4318ecd4.js
delete mode 100644 examples/dist/js/index.dfad42c7.js
create mode 100644 packages/directives/dropdown.js
create mode 100644 packages/directives/index.js
create mode 100644 packages/styles/fonts/icon.woff
diff --git a/dist/index.common.js b/dist/index.common.js
index 1dd8b6b..804ed3c 100644
--- a/dist/index.common.js
+++ b/dist/index.common.js
@@ -3187,6 +3187,13 @@ module.exports = {
};
+/***/ }),
+
+/***/ "8bbf":
+/***/ (function(module, exports) {
+
+module.exports = require("vue");
+
/***/ }),
/***/ "8e60":
@@ -5566,7 +5573,7 @@ var tabs_render, staticRenderFns
/* normalize component */
-var component = normalizeComponent(
+var tabs_component = normalizeComponent(
components_tabsvue_type_script_lang_js_,
tabs_render,
staticRenderFns,
@@ -5577,7 +5584,7 @@ var component = normalizeComponent(
)
-/* harmony default export */ var tabs = (component.exports);
+/* harmony default export */ var tabs = (tabs_component.exports);
// EXTERNAL MODULE: ./node_modules/regenerator-runtime/runtime.js
var runtime = __webpack_require__("96cf");
@@ -5712,7 +5719,7 @@ var triggerEvents = {
"style": "position:relative"
}, [h("transition", {
"attrs": {
- "name": "slide-top"
+ "name": "lemon-slide-top"
}
}, [this.visible && h("div", {
"class": "lemon-popover",
@@ -6184,6 +6191,10 @@ function arrayIntersect(a, b) {
function clearHtml(str) {
return str.replace(/<.*?>/ig, "");
+} //清除字符串内的所有HTML标签,除了IMG
+
+function clearHtmlExcludeImg(str) {
+ return str.replace(/<(?!img).*?>/ig, "");
}
function error(text) {
throw new Error(text);
@@ -6249,6 +6260,14 @@ function generateUUID() {
/* harmony default export */ var contactvue_type_script_lang_js_ = ({
name: "LemonContact",
components: {},
+ inject: {
+ IMUI: {
+ from: 'IMUI',
+ default: function _default() {
+ return this;
+ }
+ }
+ },
data: function data() {
return {};
},
@@ -6283,24 +6302,16 @@ function generateUUID() {
watch: {},
methods: {
_renderInner: function _renderInner() {
- var _this2 = this;
-
var h = this.$createElement;
var contact = this.contact;
return [h("lemon-badge", {
"attrs": {
- "count": !this.simple ? contact.unread : 0,
- "native-on-click": function nativeOnClick(e) {
- return _this2._handleBubbleClick(e, contact);
- }
+ "count": !this.simple ? contact.unread : 0
},
"class": "lemon-contact__avatar"
}, [h("lemon-avatar", {
"attrs": {
"size": 40,
- "native-on-click": function nativeOnClick(e) {
- return _this2._handleAvatarClick(e, contact);
- },
"src": contact.avatar
}
})]), h("div", {
@@ -6321,14 +6332,6 @@ function generateUUID() {
},
_handleClick: function _handleClick(e, data) {
this.$emit("click", data);
- },
- _handleAvatarClick: function _handleAvatarClick(e, data) {
- e.stopPropagation();
- this.$emit("avatar-click", data);
- },
- _handleBubbleClick: function _handleBubbleClick(e, data) {
- e.stopPropagation();
- this.$emit("bubble-click", data);
}
}
});
@@ -6662,6 +6665,8 @@ var isInitTool = false;
exec(""));
+ this._checkSubmitDisabled();
+
this._saveLastRange();
},
selectFile: function () {
@@ -6724,7 +6729,7 @@ var isInitTool = false;
return toEmojiName(this.$refs.textarea.innerHTML);
},
_checkSubmitDisabled: function _checkSubmitDisabled() {
- this.submitDisabled = !this.$refs.textarea.innerText.trim();
+ this.submitDisabled = !clearHtmlExcludeImg(this.$refs.textarea.innerHTML.trim());
},
_handleSend: function _handleSend(e) {
var text = this.getFormatValue();
@@ -6748,6 +6753,11 @@ var isInitTool = false;
initEmoji: function initEmoji(data) {
emojiData = data;
this.$forceUpdate();
+ },
+ setValue: function setValue(val) {
+ this.$refs.textarea.innerHTML = val;
+
+ this._checkSubmitDisabled();
}
}
});
@@ -6777,6 +6787,86 @@ var editor_component = normalizeComponent(
)
/* 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 ? "") : '';
+ return "
自定义封面 Lemon IMUI
+| 名称 | +说明 | +类型 | +示例 | +|
|---|---|---|---|---|
| text | +显示文字 | +String | +- | ++ |
| color | +颜色 | +String | +- | ++ |
| icon | +图标 class | +String | +- | ++ |
| click | +点击事件,调用hide方法隐藏右键菜单。 | +Function(e,instance,hide) | +- | ++ |
| visible | +是否显示的判断函数 | +Function(instance) | +- | ++ |
| render | +负责样式的渲染函数,使用render的时候text属性会失去作用,调用hide方法隐藏右键菜单。 | +Function(e,instance,hide) | +- | ++ |
| false | ||||
| contextmenu | +聊天消息右键菜单配置 | +[ContextmenuItem] | +- | ++ |
| contactContextmenu | +联系人右键菜单配置 | +[ContextmenuItem] | +- | ++ |