mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-12 10:55:03 +00:00
perf: 优化表情输入
This commit is contained in:
parent
660851e81c
commit
0c2ff1a000
@ -7,7 +7,7 @@
|
|||||||
</Input>
|
</Input>
|
||||||
</div>
|
</div>
|
||||||
<ul class="scrollbar-overlay" :class="[type, 'no-dark-content']">
|
<ul class="scrollbar-overlay" :class="[type, 'no-dark-content']">
|
||||||
<li v-for="item in list" @click="onSelect(item)">
|
<li v-for="item in list" @click="onSelect($event, item)">
|
||||||
<img v-if="item.type === 'emoticon'" :src="item.src" :title="item.name" :alt="item.name"/>
|
<img v-if="item.type === 'emoticon'" :src="item.src" :title="item.name" :alt="item.name"/>
|
||||||
<span v-else v-html="item.html" :title="item.name"></span>
|
<span v-else v-html="item.html" :title="item.name"></span>
|
||||||
</li>
|
</li>
|
||||||
@ -158,8 +158,15 @@ export default {
|
|||||||
this.emoticonPath = path;
|
this.emoticonPath = path;
|
||||||
},
|
},
|
||||||
|
|
||||||
onSelect(item) {
|
onSelect(event, item) {
|
||||||
this.$emit('on-select', item)
|
if (item.type === 'emoji') {
|
||||||
|
this.$emit('on-select', {
|
||||||
|
type: 'emoji',
|
||||||
|
text: event.target.innerText
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$emit('on-select', item)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -452,6 +452,8 @@ export default {
|
|||||||
const range = this.quill.selection.savedRange;
|
const range = this.quill.selection.savedRange;
|
||||||
this.rangeIndex = range ? range.index : 0
|
this.rangeIndex = range ? range.index : 0
|
||||||
}
|
}
|
||||||
|
} else if (this.rangeIndex > 0) {
|
||||||
|
this.quill.setSelection(this.rangeIndex)
|
||||||
}
|
}
|
||||||
if (!val && this.$refs.emojiTip) {
|
if (!val && this.$refs.emojiTip) {
|
||||||
this.$refs.emojiTip.updatePopper()
|
this.$refs.emojiTip.updatePopper()
|
||||||
@ -948,14 +950,10 @@ export default {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (item.type === 'emoji') {
|
if (item.type === 'emoji') {
|
||||||
let element = document.createElement('span');
|
this.quill.insertText(this.rangeIndex, item.text);
|
||||||
element.innerHTML = item.html;
|
this.rangeIndex += item.text.length
|
||||||
this.quill.insertText(this.rangeIndex, element.innerHTML);
|
|
||||||
this.rangeIndex += element.innerHTML.length
|
|
||||||
element = null;
|
|
||||||
if (this.windowLarge) {
|
if (this.windowLarge) {
|
||||||
this.showEmoji = false;
|
this.showEmoji = false;
|
||||||
this.quill.setSelection(this.rangeIndex)
|
|
||||||
}
|
}
|
||||||
} else if (item.type === 'emoticon') {
|
} else if (item.type === 'emoticon') {
|
||||||
this.$emit('on-send', `<img class="emoticon" data-asset="${item.asset}" data-name="${item.name}" src="${item.src}"/>`)
|
this.$emit('on-send', `<img class="emoticon" data-asset="${item.asset}" data-name="${item.name}" src="${item.src}"/>`)
|
||||||
|
|||||||
@ -390,6 +390,10 @@
|
|||||||
-webkit-touch-callout: none;
|
-webkit-touch-callout: none;
|
||||||
transition: transform 0.3s;
|
transition: transform 0.3s;
|
||||||
}
|
}
|
||||||
|
&:active {
|
||||||
|
background-color: #eeeeee;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
&:hover {
|
&:hover {
|
||||||
> img {
|
> img {
|
||||||
transform: scale(1.4);
|
transform: scale(1.4);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user