Skip to content

Commit 61e4dd1

Browse files
committed
should lock during composition in all cases
1 parent 9a45f63 commit 61e4dd1

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

src/directives/model.js

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,15 @@ module.exports = {
2727
? 'value'
2828
: 'innerHTML'
2929

30-
if (self.filters) {
31-
var compositionLock = false
32-
this.cLock = function () {
33-
compositionLock = true
34-
}
35-
this.cUnlock = function () {
36-
compositionLock = false
37-
}
38-
el.addEventListener('compositionstart', this.cLock)
39-
el.addEventListener('compositionend', this.cUnlock)
30+
var compositionLock = false
31+
this.cLock = function () {
32+
compositionLock = true
33+
}
34+
this.cUnlock = function () {
35+
compositionLock = false
4036
}
37+
el.addEventListener('compositionstart', this.cLock)
38+
el.addEventListener('compositionend', this.cUnlock)
4139

4240
// attach listener
4341
self.set = self.filters
@@ -63,6 +61,7 @@ module.exports = {
6361
})
6462
}
6563
: function () {
64+
if (compositionLock) return
6665
// no filters, don't let it trigger update()
6766
self.lock = true
6867
self.vm.$set(self.key, el[attr])
@@ -120,10 +119,8 @@ module.exports = {
120119
unbind: function () {
121120
var el = this.el
122121
el.removeEventListener(this.event, this.set)
123-
if (this.filters) {
124-
el.removeEventListener('compositionstart', this.cLock)
125-
el.removeEventListener('compositionend', this.cUnlock)
126-
}
122+
el.removeEventListener('compositionstart', this.cLock)
123+
el.removeEventListener('compositionend', this.cUnlock)
127124
if (isIE9) {
128125
el.removeEventListener('cut', this.onCut)
129126
el.removeEventListener('keyup', this.onDel)

0 commit comments

Comments
 (0)