generated from SSShooter/mind-elixir-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
487 additions
and
316 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
/* eslint-disable import/no-webpack-loader-syntax */ | ||
import js from 'mind-elixir/dist/MindElixirLite.js?raw' | ||
|
||
export default data => `<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge" /> | ||
<title>${data.nodeData.topic}</title> | ||
<style> | ||
html, body { | ||
margin: 0; | ||
padding: 0; | ||
height: 100%; | ||
width: 100%; | ||
} | ||
#map { | ||
height: 100%; | ||
width: 100%; | ||
overflow: auto; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id="map"></div> | ||
<script>${js}</script> | ||
<script> | ||
let mind = new MindElixirLite({el: '#map'}) | ||
mind.init(${JSON.stringify(data)}) | ||
</script> | ||
</body> | ||
</html>` | ||
/* eslint-disable import/no-webpack-loader-syntax */ | ||
import js from 'mind-elixir/lite?raw' | ||
|
||
export default data => `<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge" /> | ||
<title>${data.nodeData.topic}</title> | ||
<style> | ||
html, body { | ||
margin: 0; | ||
padding: 0; | ||
height: 100%; | ||
width: 100%; | ||
} | ||
#map { | ||
height: 100%; | ||
width: 100%; | ||
overflow: auto; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id="map"></div> | ||
<script>${js}</script> | ||
<script> | ||
let mind = new MindElixirLite({el: '#map'}) | ||
mind.init(${JSON.stringify(data)}) | ||
</script> | ||
</body> | ||
</html>` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,89 +1,89 @@ | ||
import MindElixir, { E } from 'mind-elixir' | ||
import example from 'mind-elixir/dist/example1' | ||
|
||
import exportHtml from './index' | ||
// import exportHtml from '@mind-elixir/export-html' | ||
|
||
const app = document.querySelector('#app') | ||
app.style.marginTop = '50px' | ||
app.style.height = '800px' | ||
app.style.width = '100%' | ||
|
||
const options = { | ||
el: app, | ||
newTopicName: '子节点', | ||
direction: MindElixir.SIDE, | ||
// direction: MindElixir.RIGHT, | ||
locale: 'en', | ||
draggable: true, | ||
editable: true, | ||
contextMenu: true, | ||
contextMenuOption: { | ||
focus: true, | ||
link: true, | ||
extend: [ | ||
{ | ||
name: 'Node edit', | ||
onclick: () => { | ||
alert('extend menu') | ||
}, | ||
}, | ||
], | ||
}, | ||
toolBar: true, | ||
nodeMenu: true, | ||
keypress: true, | ||
allowUndo: false, | ||
before: { | ||
moveDownNode() { | ||
return false | ||
}, | ||
insertSibling(el, obj) { | ||
console.log('insertSibling', el, obj) | ||
return true | ||
}, | ||
async addChild(el, obj) { | ||
console.log('addChild', el, obj) | ||
// await sleep() | ||
return true | ||
}, | ||
}, | ||
primaryLinkStyle: 1, | ||
primaryNodeVerticalGap: 15, // 25 | ||
primaryNodeHorizontalGap: 15, // 65 | ||
} | ||
|
||
const mind = new MindElixir(options) | ||
mind.install(exportHtml) | ||
const data = MindElixir.new('new topic') | ||
mind.init(example) // or try `example` | ||
function sleep() { | ||
return new Promise((res, rej) => { | ||
setTimeout(() => res(), 1000) | ||
}) | ||
} | ||
console.log('test E function', E('bd4313fbac40284b')) | ||
window.currentOperation = null | ||
mind.bus.addListener('operation', (operation) => { | ||
console.log(operation) | ||
if (operation.name !== 'finishEdit') window.currentOperation = operation | ||
// return { | ||
// name: action name, | ||
// obj: target object | ||
// } | ||
|
||
// name: [insertSibling|addChild|removeNode|beginEdit|finishEdit] | ||
// obj: target | ||
|
||
// name: moveNode | ||
// obj: {from:target1,to:target2} | ||
}) | ||
mind.bus.addListener('selectNode', (node) => { | ||
console.log(node) | ||
}) | ||
mind.bus.addListener('expandNode', (node) => { | ||
console.log('expandNode: ', node) | ||
}) | ||
window.m = mind | ||
window.M = MindElixir | ||
window.E = MindElixir.E | ||
import MindElixir from 'mind-elixir' | ||
import example from 'mind-elixir/example' | ||
|
||
import exportHtml from './index' | ||
// import exportHtml from '@mind-elixir/export-html' | ||
const E = MindElixir.E | ||
const app = document.querySelector('#app') | ||
app.style.marginTop = '50px' | ||
app.style.height = '800px' | ||
app.style.width = '100%' | ||
|
||
const options = { | ||
el: app, | ||
newTopicName: '子节点', | ||
direction: MindElixir.SIDE, | ||
// direction: MindElixir.RIGHT, | ||
locale: 'en', | ||
draggable: true, | ||
editable: true, | ||
contextMenu: true, | ||
contextMenuOption: { | ||
focus: true, | ||
link: true, | ||
extend: [ | ||
{ | ||
name: 'Node edit', | ||
onclick: () => { | ||
alert('extend menu') | ||
}, | ||
}, | ||
], | ||
}, | ||
toolBar: true, | ||
nodeMenu: true, | ||
keypress: true, | ||
allowUndo: false, | ||
before: { | ||
moveDownNode() { | ||
return false | ||
}, | ||
insertSibling(el, obj) { | ||
console.log('insertSibling', el, obj) | ||
return true | ||
}, | ||
async addChild(el, obj) { | ||
console.log('addChild', el, obj) | ||
// await sleep() | ||
return true | ||
}, | ||
}, | ||
primaryLinkStyle: 1, | ||
primaryNodeVerticalGap: 15, // 25 | ||
primaryNodeHorizontalGap: 15, // 65 | ||
} | ||
|
||
const mind = new MindElixir(options) | ||
mind.install(exportHtml) | ||
const data = MindElixir.new('new topic') | ||
mind.init(example) // or try `example` | ||
function sleep() { | ||
return new Promise((res, rej) => { | ||
setTimeout(() => res(), 1000) | ||
}) | ||
} | ||
console.log('test E function', E('bd4313fbac40284b')) | ||
window.currentOperation = null | ||
mind.bus.addListener('operation', (operation) => { | ||
console.log(operation) | ||
if (operation.name !== 'finishEdit') window.currentOperation = operation | ||
// return { | ||
// name: action name, | ||
// obj: target object | ||
// } | ||
|
||
// name: [insertSibling|addChild|removeNode|beginEdit|finishEdit] | ||
// obj: target | ||
|
||
// name: moveNode | ||
// obj: {from:target1,to:target2} | ||
}) | ||
mind.bus.addListener('selectNode', (node) => { | ||
console.log(node) | ||
}) | ||
mind.bus.addListener('expandNode', (node) => { | ||
console.log('expandNode: ', node) | ||
}) | ||
window.m = mind | ||
window.M = MindElixir | ||
window.E = MindElixir.E |
Oops, something went wrong.