render metacodeOptions in right click menu with react
This commit is contained in:
parent
704a22bf0e
commit
80a5e8335f
1 changed files with 20 additions and 5 deletions
|
@ -2,9 +2,14 @@
|
||||||
|
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
import outdent from 'outdent'
|
import outdent from 'outdent'
|
||||||
|
import clipboard from 'clipboard-js'
|
||||||
|
import React from 'react'
|
||||||
|
import ReactDOM from 'react-dom'
|
||||||
|
|
||||||
import $jit from '../patched/JIT'
|
import $jit from '../patched/JIT'
|
||||||
|
|
||||||
|
import MetacodeSelect from '../components/MetacodeSelect'
|
||||||
|
|
||||||
import Active from './Active'
|
import Active from './Active'
|
||||||
import Control from './Control'
|
import Control from './Control'
|
||||||
import Create from './Create'
|
import Create from './Create'
|
||||||
|
@ -21,7 +26,6 @@ import Topic from './Topic'
|
||||||
import TopicCard from './Views/TopicCard'
|
import TopicCard from './Views/TopicCard'
|
||||||
import Util from './Util'
|
import Util from './Util'
|
||||||
import Visualize from './Visualize'
|
import Visualize from './Visualize'
|
||||||
import clipboard from 'clipboard-js'
|
|
||||||
|
|
||||||
let panningInt
|
let panningInt
|
||||||
|
|
||||||
|
@ -1418,9 +1422,7 @@ const JIT = {
|
||||||
<div class="expandLi"></div>
|
<div class="expandLi"></div>
|
||||||
</li>`
|
</li>`
|
||||||
|
|
||||||
const metacodeOptions = $('#metacodeOptions').html()
|
menustring += '<li class="rc-metacode"><div class="rc-icon"></div>Change metacode<span id="metacodeOptionsWrapper"></span><div class="expandLi"></div></li>'
|
||||||
|
|
||||||
menustring += '<li class="rc-metacode"><div class="rc-icon"></div>Change metacode' + metacodeOptions + '<div class="expandLi"></div></li>'
|
|
||||||
}
|
}
|
||||||
if (Active.Topic) {
|
if (Active.Topic) {
|
||||||
if (!Active.Mapper) {
|
if (!Active.Mapper) {
|
||||||
|
@ -1475,6 +1477,20 @@ const JIT = {
|
||||||
// add the menu to the page
|
// add the menu to the page
|
||||||
$('#wrapper').append(rightclickmenu)
|
$('#wrapper').append(rightclickmenu)
|
||||||
|
|
||||||
|
ReactDOM.render(
|
||||||
|
React.createElement(MetacodeSelect, {
|
||||||
|
onMetacodeSelect: metacodeId => {
|
||||||
|
const topic = Topic.get(node.id)
|
||||||
|
debugger
|
||||||
|
topic.save({
|
||||||
|
metacode_id: metacodeId
|
||||||
|
})
|
||||||
|
},
|
||||||
|
metacodeSets: TopicCard.metacodeSets
|
||||||
|
}),
|
||||||
|
document.getElementById('metacodeOptionsWrapper')
|
||||||
|
)
|
||||||
|
|
||||||
// attach events to clicks on the list items
|
// attach events to clicks on the list items
|
||||||
|
|
||||||
// delete the selected things from the database
|
// delete the selected things from the database
|
||||||
|
@ -1524,7 +1540,6 @@ const JIT = {
|
||||||
// change the metacode of all the selected nodes that you have edit permission for
|
// change the metacode of all the selected nodes that you have edit permission for
|
||||||
$('.rc-metacode li li').click(function() {
|
$('.rc-metacode li li').click(function() {
|
||||||
$('.rightclickmenu').remove()
|
$('.rightclickmenu').remove()
|
||||||
//
|
|
||||||
Control.updateSelectedMetacodes($(this).attr('data-id'))
|
Control.updateSelectedMetacodes($(this).attr('data-id'))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue