|
@@ -145,18 +145,7 @@ export default {
|
|
|
// e.preventDefault()
|
|
|
console.log(e)
|
|
|
setTimeout(() => {
|
|
|
- _this.resetImgSrc(_this.inputValue).then(res => {
|
|
|
- console.log(222, res)
|
|
|
- // _this.inputValue = val
|
|
|
- console.log(111, _this.inputValue)
|
|
|
- // 光标最后
|
|
|
- _this.$nextTick(() => {
|
|
|
- const ifra = document.getElementById(`tinymce_${_this.id}_ifr`)
|
|
|
- keepLastIndex(ifra.contentWindow.document.getElementById(`tinymce`), ifra.contentWindow)
|
|
|
- })
|
|
|
- }).catch(err => {
|
|
|
- console.log(err)
|
|
|
- })
|
|
|
+ _this.resetImgSrc(_this.inputValue)
|
|
|
}, 0)
|
|
|
}
|
|
|
}
|
|
@@ -164,8 +153,7 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
async resetImgSrc(str) {
|
|
|
- console.log(str)
|
|
|
- if (!str) return str
|
|
|
+ if (!str) return
|
|
|
let newStr = str
|
|
|
const imgReg = /<img.*?(?:>|\/>)/gi
|
|
|
const srcReg = /src=[\'\"]?([^\'\"]*)[\'\"]?/i
|
|
@@ -179,10 +167,14 @@ export default {
|
|
|
console.log(666, newImgUrl)
|
|
|
newStr = newStr.replace(src[1], newImgUrl)
|
|
|
console.log(777, newStr)
|
|
|
+ // 光标最后
|
|
|
+ _this.inputValue = newStr
|
|
|
+ _this.$nextTick(() => {
|
|
|
+ const ifra = document.getElementById(`tinymce_${_this.id}_ifr`)
|
|
|
+ keepLastIndex(ifra.contentWindow.document.getElementById(`tinymce`), ifra.contentWindow)
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
- console.log(333, newStr)
|
|
|
- return newStr
|
|
|
},
|
|
|
changeText(e) { // 富文本内容改变
|
|
|
this.inputValue = e
|