Skip to content

Commit

Permalink
Merge pull request #32 from dmmat/patch-1
Browse files Browse the repository at this point in the history
add disabled property
  • Loading branch information
ajimix authored Mar 22, 2018
2 parents ee9b637 + 8ad4d3d commit 1c2c447
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion input.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ class exports.Input extends Layer
options.submit ?= false
options.tabIndex ?= 0
options.textarea ?= false
options.disabled ?= false

super options

Expand Down Expand Up @@ -134,6 +135,8 @@ class exports.Input extends Layer
@input.setAttribute "autocorrect", options.autoCorrect
@input.setAttribute "autocomplete", options.autoComplete
@input.setAttribute "autocapitalize", options.autoCapitalize
if options.disabled == true
@input.setAttribute "disabled", true
if options.autofocus == true
@input.setAttribute "autofocus", true
@input.setAttribute "spellcheck", options.spellCheck
Expand Down Expand Up @@ -183,4 +186,11 @@ class exports.Input extends Layer
@input.addEventListener "blur", ->
cb.apply(@)

onUnfocus: this.onBlur
onUnfocus: this.onBlur

disable: () ->
@input.setAttribute "disabled", true

enable: () =>
@input.removeAttribute "disabled", true

0 comments on commit 1c2c447

Please sign in to comment.