Commit 9b3dd8ac by 杨明

modified: src/packages/Editor/src/index.vue

1 parent fd7a537b
...@@ -421,7 +421,7 @@ export default { ...@@ -421,7 +421,7 @@ export default {
let videoObj = document.createElement('video') let videoObj = document.createElement('video')
videoObj.src = videoUrl videoObj.src = videoUrl
videoObj.load() videoObj.load()
videoObj.onloadedmetadata = function (evt) { videoObj.onloadedmetadata = function(evt) {
URL.revokeObjectURL(videoUrl) URL.revokeObjectURL(videoUrl)
const { limitWidth, limitHeight, limitTime } = _this.videoList const { limitWidth, limitHeight, limitTime } = _this.videoList
if (limitWidth && limitHeight && (videoObj.videoWidth > limitWidth || videoObj.videoHeight > limitHeight)) { if (limitWidth && limitHeight && (videoObj.videoWidth > limitWidth || videoObj.videoHeight > limitHeight)) {
...@@ -457,7 +457,7 @@ export default { ...@@ -457,7 +457,7 @@ export default {
}, },
textInput(val) { textInput(val) {
val = val.replace(/ /g, '') val = val.replace(/ /g, '')
this.textNum = val.replace(/(\[.*?\]|\n|\s)/g, '').length this.textNum = val.replace(/(\n|\s)/g, '').length
if (this.textNum > this.maxNum) { if (this.textNum > this.maxNum) {
this.textNum = this.maxNum this.textNum = this.maxNum
this.updateList(this.previewList, 1) this.updateList(this.previewList, 1)
...@@ -532,7 +532,10 @@ export default { ...@@ -532,7 +532,10 @@ export default {
if (!this.previewList[idx].attContent) { if (!this.previewList[idx].attContent) {
html = html.replace('\n', '').replace(/<br\/>/g, '') html = html.replace('\n', '').replace(/<br\/>/g, '')
} }
html = html.replace(/&amp;/g, '&').replace(/&lt;/g, '<').replace(/&gt;/g, '>') html = html
.replace(/&amp;/g, '&')
.replace(/&lt;/g, '<')
.replace(/&gt;/g, '>')
let textLen = this.previewList[idx].attContent + html let textLen = this.previewList[idx].attContent + html
if (textLen.replace(/(\n|\s)/g, '').length > this.maxNum) { if (textLen.replace(/(\n|\s)/g, '').length > this.maxNum) {
textLen = this.previewList[idx].attContent textLen = this.previewList[idx].attContent
...@@ -568,7 +571,7 @@ export default { ...@@ -568,7 +571,7 @@ export default {
this.updateText(content) this.updateText(content)
this.textValue = content this.textValue = content
}, },
changeInput: utils.debounce(function () { changeInput: utils.debounce(function() {
var allNodes = document.getElementById('editor').childNodes var allNodes = document.getElementById('editor').childNodes
var str = '' var str = ''
allNodes.forEach(item => { allNodes.forEach(item => {
...@@ -594,7 +597,7 @@ export default { ...@@ -594,7 +597,7 @@ export default {
.replace(/\[[\u4E00-\u9FA56]{1,4}]/g, '').length .replace(/\[[\u4E00-\u9FA56]{1,4}]/g, '').length
attContent = obj.attContent.replace(/\[(@昵称|#兑换码)\]/g, '<wise id="1" contenteditable="false">$1</wise>') attContent = obj.attContent.replace(/\[(@昵称|#兑换码)\]/g, '<wise id="1" contenteditable="false">$1</wise>')
} }
let htm = attContent.replace(/\[[\u4E00-\u9FA56]{1,4}]/gi, function (res) { let htm = attContent.replace(/\[[\u4E00-\u9FA56]{1,4}]/gi, function(res) {
let word = res.replace(/\[|\]/gi, '') let word = res.replace(/\[|\]/gi, '')
const list = emoji.flat(Infinity) const list = emoji.flat(Infinity)
let index = parseInt(list.indexOf(word)) + 1 let index = parseInt(list.indexOf(word)) + 1
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!