|
@@ -30,9 +30,7 @@ export default {
|
|
|
...mapState({})
|
|
...mapState({})
|
|
|
},
|
|
},
|
|
|
mounted() {},
|
|
mounted() {},
|
|
|
- updated() {
|
|
|
|
|
- console.log('updated', this.range)
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ updated() {},
|
|
|
methods: {
|
|
methods: {
|
|
|
handleCompositionStart() {
|
|
handleCompositionStart() {
|
|
|
this.isCompositionStarted = true
|
|
this.isCompositionStarted = true
|
|
@@ -42,11 +40,6 @@ export default {
|
|
|
this.handleInputValue(e)
|
|
this.handleInputValue(e)
|
|
|
},
|
|
},
|
|
|
handleKeyDown(e) {
|
|
handleKeyDown(e) {
|
|
|
- if (!this.range) {
|
|
|
|
|
- this.range = window.getSelection().getRangeAt(0)
|
|
|
|
|
- }
|
|
|
|
|
- console.log('keydown', this.range)
|
|
|
|
|
-
|
|
|
|
|
switch (e.key) {
|
|
switch (e.key) {
|
|
|
case 'Enter':
|
|
case 'Enter':
|
|
|
e.preventDefault()
|
|
e.preventDefault()
|
|
@@ -84,13 +77,11 @@ export default {
|
|
|
itemId: this.item.id,
|
|
itemId: this.item.id,
|
|
|
diff
|
|
diff
|
|
|
})
|
|
})
|
|
|
|
|
+ this.range = window.getSelection().getRangeAt(0)
|
|
|
|
|
+ const offset = this.range.startOffset
|
|
|
|
|
|
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
|
- console.log(this.range.startOffset)
|
|
|
|
|
- this.range.setStart(
|
|
|
|
|
- this.range.startContainer,
|
|
|
|
|
- this.range.startOffset + 1
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ this.range.setStart(this.range.startContainer.firstChild, offset)
|
|
|
|
|
|
|
|
this.range.collapse()
|
|
this.range.collapse()
|
|
|
window.getSelection().removeAllRanges()
|
|
window.getSelection().removeAllRanges()
|