Commit dfd6837a by 杨明

fixed

1 parent 67da8cc3
...@@ -151,8 +151,8 @@ export default { ...@@ -151,8 +151,8 @@ export default {
// IE < 9 // IE < 9
document.selection.createRange().pasteHTML(html) document.selection.createRange().pasteHTML(html)
} }
this.currentText = document.querySelector('.w-textarea_input').innerHTML const htm = document.querySelector('.w-textarea_input').innerHTML
this.$emit('updateText', this.currentText) this.subText(htm)
}, },
addTag(text) { addTag(text) {
// 创建模版标签 // 创建模版标签
...@@ -246,6 +246,21 @@ export default { ...@@ -246,6 +246,21 @@ export default {
}, 100) }, 100)
} }
}, },
subText(htm) {
const list = emoji.flat(Infinity)
const cutImg = htm
.replace(/<img src="https:\/\/img01.glsx.com.cn\/weapp\/resource\/saas\/scrm\/emoji\//g, '')
.replace(/<wise.+?(?:<\/wise>)/g, '@昵称')
.replace(/<br>/g, '\n')
const replaceImg = cutImg.replace(/(\d){3}.png">/g, function (str) {
let s = list[parseInt(str.split('.')[0]) - 1]
return `[${s}]`
})
let Textnode = document.createElement('div')
Textnode.innerHTML = replaceImg
this.currentText = replaceImg.substring(0, 600)
this.$emit('updateText', this.currentText)
},
insertNodeFirst(node) { insertNodeFirst(node) {
this.savedRange.deleteContents() this.savedRange.deleteContents()
// 插入链接 // 插入链接
...@@ -263,20 +278,7 @@ export default { ...@@ -263,20 +278,7 @@ export default {
this.updateData(target.innerHTML) this.updateData(target.innerHTML)
} }
let htm = target.innerHTML let htm = target.innerHTML
const list = emoji.flat(Infinity) this.subText(htm)
const cutImg = htm
.replace(/<img src="https:\/\/img01.glsx.com.cn\/weapp\/resource\/saas\/scrm\/emoji\//g, '')
.replace(/<wise.+?(?:<\/wise>)/g, '@昵称')
.replace(/<br>/g, '\n')
const replaceImg = cutImg.replace(/(\d){3}.png">/g, function (str) {
let s = list[parseInt(str.split('.')[0]) - 1]
return `[${s}]`
})
let Textnode = document.createElement('div')
Textnode.innerHTML = replaceImg
this.currentText = replaceImg.substring(0, 600)
console.log(this.currentText)
this.$emit('updateText', this.currentText)
}, },
placeCaretAtEnd(el) { placeCaretAtEnd(el) {
//传入光标要去的jq节点对象 //传入光标要去的jq节点对象
...@@ -299,20 +301,7 @@ export default { ...@@ -299,20 +301,7 @@ export default {
// 即时更新数据 // 即时更新数据
this.updateData(target.innerHTML) this.updateData(target.innerHTML)
let htm = target.innerHTML let htm = target.innerHTML
console.log(htm) this.subText(htm)
const list = emoji.flat(Infinity)
const cutImg = htm
.replace(/<img src="https:\/\/img01.glsx.com.cn\/weapp\/resource\/saas\/scrm\/emoji\//g, '')
.replace(/<wise.+?(?:<\/wise>)/g, '@昵称')
.replace(/<br>/g, '\n')
const replaceImg = cutImg.replace(/(\d){3}.png">/g, function (str) {
let s = list[parseInt(str.split('.')[0]) - 1]
return `[${s}]`
})
let Textnode = document.createElement('div')
Textnode.innerHTML = replaceImg
this.currentText = Textnode.innerText.substring(0, 600)
this.$emit('updateText', this.currentText)
}, },
handleDelete(e) { handleDelete(e) {
// 监听“删除”事件 // 监听“删除”事件
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!