Browse Source

pasteevent fallback to native if clipboard inaccessible fix #1061

Robin Herbots 9 years ago
parent
commit
82581cb27a
2 changed files with 2 additions and 4 deletions
  1. 1 0
      CHANGELOG.md
  2. 1 4
      js/inputmask.js

+ 1 - 0
CHANGELOG.md

@@ -21,6 +21,7 @@ All notable changes to this project will be documented in this file.
 	- use selective caching in getTests
 	- use selective caching in getTests
 
 
 ### Fixed
 ### Fixed
+- Pasting to masked input not working on Android #1061
 - Unable to get property 'forwardPosition' of undefined or null reference IE11 #1342
 - Unable to get property 'forwardPosition' of undefined or null reference IE11 #1342
 - Input event doesn't fire in IE #1287
 - Input event doesn't fire in IE #1287
 - Dynamically changing mask based on number of entered characters #1336
 - Dynamically changing mask based on number of entered characters #1336

+ 1 - 4
js/inputmask.js

@@ -2412,7 +2412,7 @@
 				inputValue = valueBeforeCaret + window.clipboardData.getData("Text") + valueAfterCaret;
 				inputValue = valueBeforeCaret + window.clipboardData.getData("Text") + valueAfterCaret;
 			} else if (ev.clipboardData && ev.clipboardData.getData) {
 			} else if (ev.clipboardData && ev.clipboardData.getData) {
 				inputValue = valueBeforeCaret + ev.clipboardData.getData("text/plain") + valueAfterCaret;
 				inputValue = valueBeforeCaret + ev.clipboardData.getData("text/plain") + valueAfterCaret;
-			}
+			} else return true; //allow native paste event as fallback ~ masking will continue by inputfallback
 
 
 			var pasteValue = inputValue;
 			var pasteValue = inputValue;
 			if ($.isFunction(opts.onBeforePaste)) {
 			if ($.isFunction(opts.onBeforePaste)) {
@@ -2423,9 +2423,6 @@
 				if (!pasteValue) {
 				if (!pasteValue) {
 					pasteValue = inputValue;
 					pasteValue = inputValue;
 				}
 				}
-				if (!pasteValue) {
-					return true;
-                }
 			}
 			}
 			checkVal(input, false, false, isRTL ? pasteValue.split("").reverse() : pasteValue.toString().split(""));
 			checkVal(input, false, false, isRTL ? pasteValue.split("").reverse() : pasteValue.toString().split(""));
 			writeBuffer(input, getBuffer(), seekNext(getLastValidPosition()), e, undoValue !== getBuffer().join(""));
 			writeBuffer(input, getBuffer(), seekNext(getLastValidPosition()), e, undoValue !== getBuffer().join(""));