vue-highlightable-input
vue-highlightable-input copied to clipboard
Add input method editors support
// add new event handlers mounted () { if (this.fireOnEnabled) this.$el.addEventListener(this.fireOn, this.handleChange)
+this.$el.addEventListener("compositionstart", this.IMEStart)
+this.$el.addEventListener("compositionend", this.IMEEnd)
+this.$el.addEventListener("compositionudpate", this.IMEUpdate)
this.internalValue = this.value
this.processHighlights()
},
// value changed value() { +if(this.composing) + return if (this.internalValue != this.value){ this.internalValue = this.value this.processHighlights() } },
//new event handlers for composition events IMEStart(event) { this.composing = true; },
IMEEnd(event) {
this.composing = false;
},
IMEUdpate(event) {
this.composing = true;
},
// Change handle event handleChange() { this.debouncedHandler = debounce(function(){ +if(this.composing) + return if (this.internalValue !== this.$el.textContent){ this.internalValue = this.$el.textContent this.processHighlights(); } }, this.highlightDelay) this.debouncedHandler(); },