We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 45ada40 + 3bb87ed commit 81701d7Copy full SHA for 81701d7
js/topcodereditor.js
@@ -646,11 +646,13 @@
646
647
editor.codemirror.on('paste', function (cm, event) {
648
var clipboard = event.clipboardData;
649
- var data = clipboard.getData('text/plain').trim();
650
- var rows = data.split((/[\u0085\u2028\u2029]|\r\n?/g)).map(function(row) {
651
- row = row.replace('\n', ' ')
652
- return row.split("\t")
+ // trim the trailing newline character, if present.
+ var data = clipboard.getData('text/plain');
+ data = data.replace(/(?:[\n\u0085\u2028\u2029]|\r\n?)$/, '');
+ var rows = data.split((/[\n\u0085\u2028\u2029]|\r\n?/g)).map(function(row) {
653
+ return row.split("\t");
654
})
655
+
656
var isTableData = looksLikeTable(rows);
657
if(isTableData) {
658
event.preventDefault();
0 commit comments