allow JSON or TSV parsing
This commit is contained in:
parent
92f78aa56a
commit
53867caae8
1 changed files with 10 additions and 1 deletions
|
@ -37,7 +37,16 @@ Metamaps.Import = {
|
||||||
$('body').bind('paste', function(e) {
|
$('body').bind('paste', function(e) {
|
||||||
var text = e.originalEvent.clipboardData.getData('text/plain');
|
var text = e.originalEvent.clipboardData.getData('text/plain');
|
||||||
|
|
||||||
var results = self.parseTabbedString(text);
|
var results;
|
||||||
|
if (text[0] === '{') {
|
||||||
|
try {
|
||||||
|
results = JSON.parse(text);
|
||||||
|
} catch (Error e) {
|
||||||
|
results = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
results = self.parseTabbedString(text);
|
||||||
|
}
|
||||||
if (results === false) return;
|
if (results === false) return;
|
||||||
|
|
||||||
var topics = results.topics;
|
var topics = results.topics;
|
||||||
|
|
Loading…
Reference in a new issue