Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Preventing paste in disabled state
  • Loading branch information
Alexey Fedorov1 authored and Alexey Fedorov1 committed Feb 8, 2018
commit 321f6f2bcf59302f87bd395d5478135086d15530
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
/umd
npm-debug.log*
package-lock.json
/.vscode
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 4.0.2 / 2018-02-08

* Prevent paste in disabled state

## 4.0.1 / 2018-01-26 🇦🇺

* Fix auto-fill scenarios by using data from `onChange` events [[#112](https://github.com/insin/react-maskedinput/pull/112)]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-maskedinput",
"version": "4.0.1",
"version": "4.0.2",
"description": "Masked <input/> React component",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,12 @@ class MaskedInput extends React.Component {

_onPaste = (e) => {
// console.log('onPaste', JSON.stringify(getSelection(this.input)), e.clipboardData.getData('Text'), e.target.value)
const {disabled} = this.props

e.preventDefault()
this._updateMaskSelection()
// getData value needed for IE also works in FF & Chrome
if (this.mask.paste(e.clipboardData.getData('Text'))) {
if (!disabled && this.mask.paste(e.clipboardData.getData('Text'))) {
e.target.value = this.mask.getValue()
// Timeout needed for IE
setTimeout(() => this._updateInputSelection(), 0)
Expand Down