code climate and enable Cmd+C copy
This commit is contained in:
parent
26189edb74
commit
99be53225c
3 changed files with 12 additions and 11 deletions
|
@ -12,6 +12,8 @@ import Selected from './Selected'
|
|||
const Export = {
|
||||
data: null,
|
||||
copySelection: function () {
|
||||
// clipboard.copy can't be called in a different callback - it has to be directly
|
||||
// inside an event listener. So to work around this, we require two Ctrl+C presses
|
||||
if (Export.data === null) {
|
||||
Export.loadCopyData()
|
||||
} else {
|
||||
|
@ -34,9 +36,9 @@ const Export = {
|
|||
// deselect synapses not joined to a selected topic
|
||||
Selected.Edges.slice(0).forEach(edge => {
|
||||
const synapse = edge.getData('synapses')[edge.getData('displayIndex')]
|
||||
const topic1_id = synapse.get('topic1_id')
|
||||
const topic2_id = synapse.get('topic2_id')
|
||||
if (topics.indexOf(topic1_id) === -1 || topics.indexOf(topic2_id) === -1) {
|
||||
const topic1Id = synapse.get('topic1_id')
|
||||
const topic2Id = synapse.get('topic2_id')
|
||||
if (topics.indexOf(topic1Id) === -1 || topics.indexOf(topic2Id) === -1) {
|
||||
Control.deselectEdge(edge)
|
||||
}
|
||||
})
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
/* global $ */
|
||||
|
||||
import clipboard from 'clipboard-js'
|
||||
|
||||
import Active from './Active'
|
||||
import Create from './Create'
|
||||
import Control from './Control'
|
||||
|
@ -94,7 +92,8 @@ const Listeners = {
|
|||
|
||||
break
|
||||
case 67: // if c or C is pressed
|
||||
if (e.ctrlKey && e.target.tagName === 'BODY') {
|
||||
// metaKey is OSX command key for Cmd+C
|
||||
if ((e.ctrlKey || e.metaKey) && e.target.tagName === 'BODY') {
|
||||
Export.copySelection()
|
||||
}
|
||||
break
|
||||
|
|
Loading…
Add table
Reference in a new issue