From 0626dcafa50cecae67de9f0690e5e08d8f732d4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hosmel=20Quintana=20=F0=9F=98=B4?= Date: Thu, 13 Oct 2016 02:20:03 -0600 Subject: [PATCH] add raw value to target --- src/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/index.js b/src/index.js index 23b2b72..099aa7b 100644 --- a/src/index.js +++ b/src/index.js @@ -102,6 +102,7 @@ var MaskedInput = React.createClass({ } var value = this._getDisplayValue() e.target.value = value + e.target.rawValue = this.mask.getRawValue() if (value) { this._updateInputSelection() } @@ -118,6 +119,7 @@ var MaskedInput = React.createClass({ e.preventDefault() if (this.mask.undo()) { e.target.value = this._getDisplayValue() + e.target.rawValue = this.mask.getRawValue() this._updateInputSelection() if (this.props.onChange) { this.props.onChange(e) @@ -129,6 +131,7 @@ var MaskedInput = React.createClass({ e.preventDefault() if (this.mask.redo()) { e.target.value = this._getDisplayValue() + e.target.rawValue = this.mask.getRawValue() this._updateInputSelection() if (this.props.onChange) { this.props.onChange(e) @@ -143,6 +146,7 @@ var MaskedInput = React.createClass({ if (this.mask.backspace()) { var value = this._getDisplayValue() e.target.value = value + e.target.rawValue = this.mask.getRawValue() if (value) { this._updateInputSelection() } @@ -164,6 +168,7 @@ var MaskedInput = React.createClass({ this._updateMaskSelection() if (this.mask.input((e.key || e.data))) { e.target.value = this.mask.getValue() + e.target.rawValue = this.mask.getRawValue() this._updateInputSelection() if (this.props.onChange) { this.props.onChange(e) @@ -179,6 +184,7 @@ var MaskedInput = React.createClass({ // getData value needed for IE also works in FF & Chrome if (this.mask.paste(e.clipboardData.getData('Text'))) { e.target.value = this.mask.getValue() + e.target.rawValue = this.mask.getRawValue() // Timeout needed for IE setTimeout(this._updateInputSelection, 0) if (this.props.onChange) {