mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Add setInputEnabled and don't handle textInput if it is disabled
This commit is contained in:
committed by
Antonio Scandurra
parent
acf996fc14
commit
8652222b22
@@ -1123,6 +1123,8 @@ class TextEditorComponent {
|
||||
}
|
||||
|
||||
didTextInput (event) {
|
||||
if (!this.isInputEnabled()) return
|
||||
|
||||
event.stopPropagation()
|
||||
|
||||
// WARNING: If we call preventDefault on the input of a space character,
|
||||
@@ -1131,9 +1133,6 @@ class TextEditorComponent {
|
||||
// to test.
|
||||
if (event.data !== ' ') event.preventDefault()
|
||||
|
||||
// TODO: Deal with disabled input
|
||||
// if (!this.isInputEnabled()) return
|
||||
|
||||
if (this.compositionCheckpoint) {
|
||||
this.props.model.revertToCheckpoint(this.compositionCheckpoint)
|
||||
this.compositionCheckpoint = null
|
||||
@@ -2063,6 +2062,14 @@ class TextEditorComponent {
|
||||
}
|
||||
return this.nextUpdatePromise
|
||||
}
|
||||
|
||||
setInputEnabled (inputEnabled) {
|
||||
this.props.inputEnabled = inputEnabled
|
||||
}
|
||||
|
||||
isInputEnabled (inputEnabled) {
|
||||
return this.props.inputEnabled != null ? this.props.inputEnabled : true
|
||||
}
|
||||
}
|
||||
|
||||
class DummyScrollbarComponent {
|
||||
|
||||
Reference in New Issue
Block a user