Commit 7ccd1479 authored by Matija Obreza's avatar Matija Obreza
Browse files

Merge branch '14-no-auto-detect-on-paste' into 'master'

Resolve "No auto-detect on paste"

Closes #14

See merge request genesys-pgr/validator!13
parents 53291234 62669fb0
...@@ -376,7 +376,7 @@ ...@@ -376,7 +376,7 @@
console.log('Not enough data for auto-detection len=', area.value.length); console.log('Not enough data for auto-detection len=', area.value.length);
return; return;
} }
var lines = area.value.replace(/\r\n/g, "\n").split("\n"); var lines = area.value.substr(0, 5000).replace(/\r\n/g, "\n").split("\n");
var separator = CSVAutodetector.detectSeparator(lines); var separator = CSVAutodetector.detectSeparator(lines);
var quote = CSVAutodetector.detectQuoteChar(lines, separator); var quote = CSVAutodetector.detectQuoteChar(lines, separator);
var escape = CSVAutodetector.detectEscapeChar(lines, separator, quote); var escape = CSVAutodetector.detectEscapeChar(lines, separator, quote);
...@@ -385,7 +385,8 @@ ...@@ -385,7 +385,8 @@
CSVAutodetector.autoSelectOptions(separator, quote, escape, decimalMark); CSVAutodetector.autoSelectOptions(separator, quote, escape, decimalMark);
}; };
document.getElementById("autodetectCsv").addEventListener("click", autodetectSettings); document.getElementById("autodetectCsv").addEventListener("click", autodetectSettings);
document.getElementById("csvText").addEventListener("paste", function(e) { setTimeout(autodetectSettings, 10); }); // Do NOT autodetect CSV on paste!
// document.getElementById("csvText").addEventListener("paste", function(e) { setTimeout(autodetectSettings, 10); });
}); });
</script> </script>
</body> </body>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment