修复样式布局问题,修复为空也能保存草稿的问题

This commit is contained in:
范君
2021-02-08 12:36:54 +08:00
parent ade377b467
commit 20442cb878
13 changed files with 6884 additions and 10698 deletions
+19 -19
View File
@@ -14,25 +14,25 @@ export default {
from: "IMUI",
default() {
return this;
}
}
},
},
},
components: {},
props: {
tools: {
type: Array,
default: () => []
default: () => [],
},
sendText: {
type: String,
default: "发 送"
default: "发 送",
},
sendKey: {
type: Function,
default(e) {
return e.keyCode == 13 && e.ctrlKey === true;
}
}
},
},
},
data() {
this.clipboardBlob = null;
@@ -41,7 +41,7 @@ export default {
clipboardUrl: "",
submitDisabled: true,
proxyTools: [],
accept: ""
accept: "",
};
},
created() {
@@ -51,7 +51,7 @@ export default {
this.initTools([
{ name: "emoji" },
{ name: "uploadFile" },
{ name: "uploadImage" }
{ name: "uploadImage" },
]);
}
this.IMUI.$on("change-contact", () => {
@@ -65,7 +65,7 @@ export default {
click = click || new Function();
const classes = [
"lemon-editor__tool-item",
{ "lemon-editor__tool-item--right": isRight }
{ "lemon-editor__tool-item--right": isRight },
];
let node;
if (name == "emoji") {
@@ -141,7 +141,7 @@ export default {
<div class="lemon-editor__tip">
{useScopedSlot(
this.IMUI.$scopedSlots["editor-footer"],
"使用 ctrl + enter 快捷发送消息"
"使用 ctrl + enter 快捷发送消息",
)}
</div>
<div class="lemon-editor__submit">
@@ -178,7 +178,7 @@ export default {
click: null,
render: menu => {
return <i class="lemon-icon-emoji" />;
}
},
},
{
name: "uploadFile",
@@ -186,7 +186,7 @@ export default {
click: () => this.selectFile("*"),
render: menu => {
return <i class="lemon-icon-folder" />;
}
},
},
{
name: "uploadImage",
@@ -194,22 +194,22 @@ export default {
click: () => this.selectFile("image/*"),
render: menu => {
return <i class="lemon-icon-image" />;
}
}
},
},
];
let tools = [];
if (Array.isArray(data)) {
const indexMap = {
emoji: 0,
uploadFile: 1,
uploadImage: 2
uploadImage: 2,
};
const indexKeys = Object.keys(indexMap);
tools = data.map(item => {
if (indexKeys.includes(item.name)) {
return {
...defaultTools[indexMap[item.name]],
...item
...item,
};
}
return item;
@@ -320,7 +320,7 @@ export default {
},
_checkSubmitDisabled() {
this.submitDisabled = !clearHtmlExcludeImg(
this.$refs.textarea.innerHTML.trim()
this.$refs.textarea.innerHTML.trim(),
);
},
_handleSend(e) {
@@ -346,8 +346,8 @@ export default {
setValue(val) {
this.$refs.textarea.innerHTML = this.IMUI.emojiNameToImage(val);
this._checkSubmitDisabled();
}
}
},
},
};
</script>
<style lang="stylus">
+10 -6
View File
@@ -1,5 +1,10 @@
<script>
import { useScopedSlot, funCall, generateUUID } from "utils";
import {
useScopedSlot,
funCall,
generateUUID,
clearHtmlExcludeImg,
} from "utils";
import { isFunction, isString, isEmpty } from "utils/validate";
import contextmenu from "../directives/contextmenu";
import {
@@ -577,9 +582,7 @@ export default {
lastContentRender(message) {
if (!isFunction(lastContentRender[message.type])) {
console.error(
`not found '${
message.type
}' of the latest message renderer,try to use setLastContentRender()`,
`not found '${message.type}' of the latest message renderer,try to use setLastContentRender()`,
);
return "";
}
@@ -657,8 +660,9 @@ export default {
//保存上个聊天目标的草稿
if (this.currentContactId) {
const editorValue = this.getEditorValue();
const editorValue = clearHtmlExcludeImg(this.getEditorValue()).trim();
if (editorValue) {
alert(editorValue);
this.setDraft(this.currentContactId, editorValue);
this.setEditorValue();
} else {
@@ -1095,11 +1099,11 @@ bezier = cubic-bezier(0.645, 0.045, 0.355, 1)
+b(lemon-vessel)
display flex
flex 1
min-height 100px
+e(left)
display flex
flex-direction column
flex 1
height 100%
+e(right)
flex none
+b(lemon-messages)