mirror of
https://github.com/atom/atom.git
synced 2026-02-17 10:01:25 -05:00
Clear hidden input compositionstart on Chrome 56
We use the value of the hidden input to display a preview of the composition, but it might already contain spaces from previous keystrokes, since we don't call preventDefault when spaces are inserted.
This commit is contained in:
@@ -1644,6 +1644,10 @@ class TextEditorComponent {
|
||||
// 4. compositionend fired
|
||||
// 5. textInput fired; event.data == the completion string
|
||||
didCompositionStart () {
|
||||
if (parseInt(process.versions.chrome) === 56) {
|
||||
this.getHiddenInput().value = ''
|
||||
}
|
||||
|
||||
this.compositionCheckpoint = this.props.model.createCheckpoint()
|
||||
if (this.accentedCharacterMenuIsOpen) {
|
||||
this.props.model.selectLeft()
|
||||
@@ -1653,7 +1657,7 @@ class TextEditorComponent {
|
||||
didCompositionUpdate (event) {
|
||||
if (parseInt(process.versions.chrome) === 56) {
|
||||
process.nextTick(() => {
|
||||
const previewText = this.refs.cursorsAndInput.refs.hiddenInput.value
|
||||
const previewText = this.getHiddenInput().value
|
||||
this.props.model.insertText(previewText, {select: true})
|
||||
})
|
||||
} else {
|
||||
@@ -2815,6 +2819,10 @@ class TextEditorComponent {
|
||||
return this.props.inputEnabled != null ? this.props.inputEnabled : true
|
||||
}
|
||||
|
||||
getHiddenInput () {
|
||||
return this.refs.cursorsAndInput.refs.hiddenInput
|
||||
}
|
||||
|
||||
getPlatform () {
|
||||
return this.props.platform || process.platform
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user