Skip to content

Commit

Permalink
should lock during composition in all cases
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jan 22, 2014
1 parent 9a45f63 commit 61e4dd1
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions src/directives/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,15 @@ module.exports = {
? 'value'
: 'innerHTML'

if (self.filters) {
var compositionLock = false
this.cLock = function () {
compositionLock = true
}
this.cUnlock = function () {
compositionLock = false
}
el.addEventListener('compositionstart', this.cLock)
el.addEventListener('compositionend', this.cUnlock)
var compositionLock = false
this.cLock = function () {
compositionLock = true
}
this.cUnlock = function () {
compositionLock = false
}
el.addEventListener('compositionstart', this.cLock)
el.addEventListener('compositionend', this.cUnlock)

// attach listener
self.set = self.filters
Expand All @@ -63,6 +61,7 @@ module.exports = {
})
}
: function () {
if (compositionLock) return
// no filters, don't let it trigger update()
self.lock = true
self.vm.$set(self.key, el[attr])
Expand Down Expand Up @@ -120,10 +119,8 @@ module.exports = {
unbind: function () {
var el = this.el
el.removeEventListener(this.event, this.set)
if (this.filters) {
el.removeEventListener('compositionstart', this.cLock)
el.removeEventListener('compositionend', this.cUnlock)
}
el.removeEventListener('compositionstart', this.cLock)
el.removeEventListener('compositionend', this.cUnlock)
if (isIE9) {
el.removeEventListener('cut', this.onCut)
el.removeEventListener('keyup', this.onDel)
Expand Down

0 comments on commit 61e4dd1

Please sign in to comment.