Use undo grouping in editor command listeners

This commit is contained in:
Max Brunsfeld
2014-11-05 11:18:20 -08:00
parent b7aa421e4e
commit 5437236304
3 changed files with 117 additions and 99 deletions

View File

@@ -21,6 +21,7 @@ TextEditorComponent = React.createClass
statics:
performSyncUpdates: false
groupingInterval: 500
visible: false
autoHeight: false
@@ -457,7 +458,9 @@ TextEditorComponent = React.createClass
selectedLength = inputNode.selectionEnd - inputNode.selectionStart
editor.selectLeft() if selectedLength is 1
inputNode.value = event.data if editor.insertText(event.data)
insertedRange = editor.withGroupingInterval @constructor.groupingInterval, ->
editor.insertText(event.data)
inputNode.value = event.data if insertedRange
onVerticalScroll: (scrollTop) ->
{editor} = @props