2 Commits

Author SHA1 Message Date
b0a3890db4 Merge branch 'two-way-binding' into new 2022-07-09 20:11:16 +03:00
2bbd11a7ed Fixed two way binding 2022-07-09 19:49:29 +03:00
7 changed files with 37 additions and 25 deletions

View File

@@ -1751,16 +1751,21 @@ function src_autoLink (text, options) {
},
data () {
return {
focused: false,
body: ''
focused: false
}
},
computed: {
valueModel: {
get () { return this.value },
set (value) {
this.$emit('input', value)
}
},
showPlaceholder () {
return !this.body.replace(/^\s*\n/gm, '').length
return !this.valueModel.replace(/^\s*\n/gm, '').length
},
computedBody () {
return highlight(this.body, {
return highlight(this.valueModel, {
extractUrlsWithoutProtocol: this.extractUrlsWithoutProtocol,
mentionsWithDots: this.mentionsWithDots
})
@@ -1789,7 +1794,7 @@ function src_autoLink (text, options) {
},
clear () {
this.$refs.mbody.innerText = ''
this.body = ''
this.valueModel = ''
},
onKeyUp (e) {
const keysToIgnore = ['Shift', 'Meta', 'Control', 'Alt', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight']
@@ -1799,8 +1804,7 @@ function src_autoLink (text, options) {
if (e.key === 'Enter') {
caretPosition++
}
this.body = e.target.innerText
this.$emit('input', this.body)
this.valueModel = e.target.innerText
this.$nextTick(() => {
this.setCaretPos(caretPosition)
})

File diff suppressed because one or more lines are too long

View File

@@ -1760,16 +1760,21 @@ function src_autoLink (text, options) {
},
data () {
return {
focused: false,
body: ''
focused: false
}
},
computed: {
valueModel: {
get () { return this.value },
set (value) {
this.$emit('input', value)
}
},
showPlaceholder () {
return !this.body.replace(/^\s*\n/gm, '').length
return !this.valueModel.replace(/^\s*\n/gm, '').length
},
computedBody () {
return highlight(this.body, {
return highlight(this.valueModel, {
extractUrlsWithoutProtocol: this.extractUrlsWithoutProtocol,
mentionsWithDots: this.mentionsWithDots
})
@@ -1798,7 +1803,7 @@ function src_autoLink (text, options) {
},
clear () {
this.$refs.mbody.innerText = ''
this.body = ''
this.valueModel = ''
},
onKeyUp (e) {
const keysToIgnore = ['Shift', 'Meta', 'Control', 'Alt', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight']
@@ -1808,8 +1813,7 @@ function src_autoLink (text, options) {
if (e.key === 'Enter') {
caretPosition++
}
this.body = e.target.innerText
this.$emit('input', this.body)
this.valueModel = e.target.innerText
this.$nextTick(() => {
this.setCaretPos(caretPosition)
})

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -31,16 +31,21 @@ export default {
},
data () {
return {
focused: false,
body: ''
focused: false
}
},
computed: {
valueModel: {
get () { return this.value },
set (value) {
this.$emit('input', value)
}
},
showPlaceholder () {
return !this.body.replace(/^\s*\n/gm, '').length
return !this.valueModel.replace(/^\s*\n/gm, '').length
},
computedBody () {
return highlight(this.body, {
return highlight(this.valueModel, {
extractUrlsWithoutProtocol: this.extractUrlsWithoutProtocol,
mentionsWithDots: this.mentionsWithDots
})
@@ -69,7 +74,7 @@ export default {
},
clear () {
this.$refs.mbody.innerText = ''
this.body = ''
this.valueModel = ''
},
onKeyUp (e) {
const keysToIgnore = ['Shift', 'Meta', 'Control', 'Alt', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight']
@@ -79,8 +84,7 @@ export default {
if (e.key === 'Enter') {
caretPosition++
}
this.body = e.target.innerText
this.$emit('input', this.body)
this.valueModel = e.target.innerText
this.$nextTick(() => {
this.setCaretPos(caretPosition)
})