mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-17 03:03:41 +00:00
perf: 优化表情关键词匹配
This commit is contained in:
parent
2b3d5ff223
commit
31b03beb2c
@ -871,18 +871,29 @@ export default {
|
|||||||
}
|
}
|
||||||
this.emojiTimer && clearTimeout(this.emojiTimer)
|
this.emojiTimer && clearTimeout(this.emojiTimer)
|
||||||
this.emojiTimer = setTimeout(_ => {
|
this.emojiTimer = setTimeout(_ => {
|
||||||
text = text.replace(/ /g," ")
|
if (/<img/i.test(text)) {
|
||||||
text = text.replace(/<[^>]+>/g, "")
|
this.emojiQuickShow = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
text = text
|
||||||
|
.replace(/ /g," ")
|
||||||
|
.replace(/<[^>]+>/g, "")
|
||||||
if (text
|
if (text
|
||||||
&& text.indexOf(" ") === -1
|
&& text.indexOf(" ") === -1
|
||||||
&& text.length >= 1
|
&& text.length >= 1
|
||||||
&& text.length <= 4
|
&& text.length <= 8
|
||||||
&& $A.isArray(window.emoticonData)) {
|
&& $A.isArray(window.emoticonData)) {
|
||||||
// 显示快捷选择表情窗口
|
// 显示快捷选择表情窗口
|
||||||
this.emojiQuickItems = [];
|
this.emojiQuickItems = [];
|
||||||
let baseUrl = $A.apiUrl("../images/emoticon")
|
const baseUrl = $A.apiUrl("../images/emoticon")
|
||||||
window.emoticonData.some(data => {
|
window.emoticonData.some(data => {
|
||||||
let item = data.list.find(d => $A.strExists(d.name + (d.key ? ` ${d.key}` : ''), text))
|
const item = data.list.find(d => {
|
||||||
|
const ks = [d.name]
|
||||||
|
if (d.key) {
|
||||||
|
ks.push(...(`${d.key}`).split(" "))
|
||||||
|
}
|
||||||
|
return ks.includes(text)
|
||||||
|
})
|
||||||
if (item) {
|
if (item) {
|
||||||
this.emojiQuickItems.push(Object.assign(item, {
|
this.emojiQuickItems.push(Object.assign(item, {
|
||||||
type: `emoticon`,
|
type: `emoticon`,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user