fix a bug with event/e and eslint
This commit is contained in:
parent
bb04117ce7
commit
6975b16c1c
2 changed files with 13 additions and 15 deletions
|
@ -6,7 +6,6 @@ import _ from 'lodash'
|
|||
import Active from './Active'
|
||||
import AutoLayout from './AutoLayout'
|
||||
import DataModel from './DataModel'
|
||||
import GlobalUI from './GlobalUI'
|
||||
import Map from './Map'
|
||||
import Synapse from './Synapse'
|
||||
import Topic from './Topic'
|
||||
|
@ -388,7 +387,7 @@ const Import = {
|
|||
}
|
||||
)
|
||||
},
|
||||
|
||||
|
||||
handleTEXT: function(text, opts = {}) {
|
||||
let coords = opts.coords
|
||||
if (!coords || coords.x === undefined || coords.y === undefined) {
|
||||
|
@ -396,11 +395,11 @@ const Import = {
|
|||
}
|
||||
|
||||
const name = text
|
||||
const url = ""
|
||||
const url = ''
|
||||
const metacode = opts.metacode || 'Wildcard'
|
||||
const importId = opts.importId || null // don't store a cidMapping
|
||||
const permission = opts.permission || null // use default
|
||||
const desc = opts.desc || ""
|
||||
const desc = opts.desc || ''
|
||||
|
||||
Import.createTopicWithParameters(
|
||||
name,
|
||||
|
|
|
@ -19,7 +19,7 @@ const PasteInput = {
|
|||
e = e || window.event
|
||||
|
||||
// prevent conflict with react-dropzone file uploader
|
||||
if (event.target.id !== 'infovis-canvas') return
|
||||
if (e.target.id !== 'infovis-canvas') return
|
||||
|
||||
e.preventDefault()
|
||||
var coords = Util.pixelsToCoords(Visualize.mGraph, { x: e.clientX, y: e.clientY })
|
||||
|
@ -29,7 +29,7 @@ const PasteInput = {
|
|||
// OMG import bookmarks 😍 (Or just text :P)
|
||||
if (e.dataTransfer.items && e.dataTransfer.items.length > 0) {
|
||||
e.dataTransfer.items[0].getAsString(function(text) {
|
||||
self.handle(text,coords)
|
||||
self.handle(text, coords)
|
||||
})
|
||||
}
|
||||
}, false)
|
||||
|
@ -68,17 +68,16 @@ const PasteInput = {
|
|||
} else if (text.match(/^[Tt]opics\t/) || text.match(/^[Ss]ynapses\t/)) {
|
||||
Import.handleTSV(text)
|
||||
} else {
|
||||
//Handle as plain text
|
||||
let textItems = text.split("\n")
|
||||
if (textItems.length === 1){
|
||||
if(textItems[0].trim() !== ""){
|
||||
Import.handleTEXT(textItems[0].trim(),coords)
|
||||
// Handle as plain text
|
||||
let textItems = text.split('\n')
|
||||
if (textItems.length === 1) {
|
||||
if (textItems[0].trim() !== '') {
|
||||
Import.handleTEXT(textItems[0].trim(), coords)
|
||||
}
|
||||
}
|
||||
else if (window.confirm('Are you sure you want to create ' + textItems.length + ' new topics?')) {
|
||||
} else if (window.confirm('Are you sure you want to create ' + textItems.length + ' new topics?')) {
|
||||
textItems.forEach(item => {
|
||||
if(item.trim() !== ""){
|
||||
self.handle(item.trim(),coords)
|
||||
if (item.trim() !== '') {
|
||||
self.handle(item.trim(), coords)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue