Monday, June 29, 2020

Error when pasting text in IE

The code for the event handler that is called when pasting some text into the input control throws an error because 'e.originalEvent.clipboardData' or  "Invalid argument" is undefined in Internet Explorer.


This code applies the fix and works fine

_searchInput.on('paste', function (e) {
var data;
if (window.clipboardData && window.clipboardData.getData) { // IE
data = window.clipboardData.getData('Text');
}
else if (e.originalEvent.clipboardData && e.originalEvent.clipboardData.getData) { // other browsers
data = e.originalEvent.clipboardData.getData('text/plain');
}

Change default Port on Next.js app

 If any other app or process is running on port 3000 , you will get this error in your terminal Port 3000 is already in use. error Command f...