mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Allow successive accented characters to be inserted in React editor
Refs #2732 Because we're only checking the length of the input element's selection in the React editor on textinput events and not also its content, we were mistaking some IME compositions as accented character menu insertions. Clearing the content of the input on 'compositionend' prevents this issue.
This commit is contained in:
@@ -356,12 +356,13 @@ EditorComponent = React.createClass
|
||||
# 5. textInput fired; event.data == the completion string
|
||||
|
||||
selectedText = null
|
||||
node.addEventListener 'compositionstart', =>
|
||||
node.addEventListener 'compositionstart', ->
|
||||
selectedText = editor.getSelectedText()
|
||||
node.addEventListener 'compositionupdate', (event) =>
|
||||
node.addEventListener 'compositionupdate', (event) ->
|
||||
editor.insertText(event.data, select: true, undo: 'skip')
|
||||
node.addEventListener 'compositionend', =>
|
||||
node.addEventListener 'compositionend', (event) ->
|
||||
editor.insertText(selectedText, select: true, undo: 'skip')
|
||||
event.target.value = ''
|
||||
|
||||
listenForCommands: ->
|
||||
{parentView, editor, mini} = @props
|
||||
|
||||
Reference in New Issue
Block a user