jsmind 0.4.8 → 0.4.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +2 -2
- package/README.md +45 -32
- package/docs/en/1.usage.md +4 -3
- package/docs/en/2.options.md +6 -1
- package/docs/en/3.operation.md +18 -17
- package/docs/en/4.contribution.md +6 -5
- package/docs/en/5.development.md +18 -0
- package/docs/en/index.md +1 -0
- package/docs/zh/1.usage.md +4 -3
- package/docs/zh/2.options.md +7 -1
- package/docs/zh/3.operation.md +23 -17
- package/docs/zh/4.contribution.md +13 -6
- package/docs/zh/5.development.md +78 -0
- package/docs/zh/index.md +1 -0
- package/es6/jsmind.draggable-node.js +9 -0
- package/es6/jsmind.draggable-node.js.map +1 -0
- package/es6/jsmind.js +9 -0
- package/es6/jsmind.js.map +1 -0
- package/es6/jsmind.screenshot.js +9 -0
- package/es6/jsmind.screenshot.js.map +1 -0
- package/js/{jsmind.draggable.js → jsmind.draggable-node.js} +5 -3
- package/js/jsmind.js +129 -148
- package/js/jsmind.screenshot.js +3 -3
- package/package.json +51 -31
- package/style/jsmind.css +357 -115
- package/example/1_basic.html +0 -62
- package/example/2_features.html +0 -528
- package/example/3_mathjax.html +0 -104
- package/example/ant.png +0 -0
- package/example/data_example.json +0 -48
- package/example/demo.html +0 -102
- package/features/jsmind.shell.js +0 -116
- package/screenshots/jsmind.png +0 -0
package/example/demo.html
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
6
|
-
<title>jsMind</title>
|
|
7
|
-
<link type="text/css" rel="stylesheet" href="../style/jsmind.css" />
|
|
8
|
-
<style type="text/css">
|
|
9
|
-
#jsmind_container{
|
|
10
|
-
width:800px;
|
|
11
|
-
height:500px;
|
|
12
|
-
border:solid 1px #ccc;
|
|
13
|
-
/*background:#f4f4f4;*/
|
|
14
|
-
background:#f4f4f4;
|
|
15
|
-
}
|
|
16
|
-
</style>
|
|
17
|
-
</head>
|
|
18
|
-
<body>
|
|
19
|
-
<input type="file" onchange="load_file(this);"/>
|
|
20
|
-
<button onclick="save_nodetree();">nodetree</button>
|
|
21
|
-
<button onclick="replay();">replay</button>
|
|
22
|
-
<div id="jsmind_container"></div>
|
|
23
|
-
<script type="text/javascript" src="../js/jsmind.js"></script>
|
|
24
|
-
<script type="text/javascript" src="../js/jsmind.draggable.js"></script>
|
|
25
|
-
<script type="text/javascript" src="../features/jsmind.shell.js"></script>
|
|
26
|
-
<script type="text/javascript">
|
|
27
|
-
var _jm = null;
|
|
28
|
-
function load_jsmind(){
|
|
29
|
-
var mind = {
|
|
30
|
-
meta:{
|
|
31
|
-
name:'demo',
|
|
32
|
-
author:'hizzgdev@163.com',
|
|
33
|
-
version:'0.2'
|
|
34
|
-
},
|
|
35
|
-
format:'node_array',
|
|
36
|
-
data:[
|
|
37
|
-
{"id":"root", "isroot":true, "topic":"jsMind"},
|
|
38
|
-
|
|
39
|
-
{"id":"sub1", "parentid":"root", "topic":"sub1"},
|
|
40
|
-
{"id":"sub11", "parentid":"sub1", "topic":"sub11"},
|
|
41
|
-
{"id":"sub12", "parentid":"sub1", "topic":"sub12"},
|
|
42
|
-
{"id":"sub13", "parentid":"sub1", "topic":"sub13"},
|
|
43
|
-
|
|
44
|
-
{"id":"sub2", "parentid":"root", "topic":"sub2"},
|
|
45
|
-
{"id":"sub21", "parentid":"sub2", "topic":"sub21"},
|
|
46
|
-
{"id":"sub22", "parentid":"sub2", "topic":"sub22"},
|
|
47
|
-
|
|
48
|
-
{"id":"sub3", "parentid":"root", "topic":"sub3"},
|
|
49
|
-
]
|
|
50
|
-
};
|
|
51
|
-
var options = {
|
|
52
|
-
container:'jsmind_container',
|
|
53
|
-
editable:true,
|
|
54
|
-
theme:'primary',
|
|
55
|
-
shortcut:{
|
|
56
|
-
handles:{
|
|
57
|
-
test:function(j,e){
|
|
58
|
-
console.log(j);
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
mapping:{
|
|
62
|
-
test:89
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
_jm = jsMind.show(options,mind);
|
|
67
|
-
// jm.set_readonly(true);
|
|
68
|
-
// var mind_data = jm.get_data();
|
|
69
|
-
// alert(mind_data);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function load_file(fi){
|
|
73
|
-
var files = fi.files;
|
|
74
|
-
if(files.length > 0){
|
|
75
|
-
var file_data = files[0];
|
|
76
|
-
jsMind.util.file.read(file_data, function(freemind_data, jsmind_name){
|
|
77
|
-
var mind = jsmind_data;
|
|
78
|
-
if(!!mind){
|
|
79
|
-
_jm.show(mind);
|
|
80
|
-
}else{
|
|
81
|
-
console.error('can not open this file as mindmap');
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function save_nodetree(){
|
|
88
|
-
var mind_data = _jm.get_data('node_tree');
|
|
89
|
-
console.log(mind_data);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function replay(){
|
|
93
|
-
var shell = _jm.shell;
|
|
94
|
-
if(!!shell){
|
|
95
|
-
shell.replay();
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
load_jsmind();
|
|
100
|
-
</script>
|
|
101
|
-
</body>
|
|
102
|
-
</html>
|
package/features/jsmind.shell.js
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Released under BSD License
|
|
3
|
-
* Copyright (c) 2014-2021 hizzgdev@163.com
|
|
4
|
-
*
|
|
5
|
-
* Project Home:
|
|
6
|
-
* https://github.com/hizzgdev/jsmind/
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
(function ($w) {
|
|
10
|
-
'use strict';
|
|
11
|
-
var $d = $w.document;
|
|
12
|
-
var __name__ = 'jsMind';
|
|
13
|
-
var jsMind = $w[__name__];
|
|
14
|
-
if (!jsMind) { return; }
|
|
15
|
-
if (typeof (jsMind.shell) != 'undefined') { return; }
|
|
16
|
-
|
|
17
|
-
var options = {
|
|
18
|
-
play_delay: 1000
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
jsMind.shell = function (jm) {
|
|
22
|
-
this.jm = jm;
|
|
23
|
-
this.step = 0;
|
|
24
|
-
this.commands = []; //version
|
|
25
|
-
this.delay_handle = 0;
|
|
26
|
-
this.playing = false;
|
|
27
|
-
this.jm_editable = this.jm.get_editable();
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
jsMind.shell.prototype = {
|
|
31
|
-
init: function () {
|
|
32
|
-
this.playing = false;
|
|
33
|
-
},
|
|
34
|
-
record: function (action, obj) {
|
|
35
|
-
if (!this.playing) {
|
|
36
|
-
var command = { action: action, data: obj.data, node: obj.node };
|
|
37
|
-
var prev_command = this.commands[this.step - 1];
|
|
38
|
-
if (command.action === 'update_node' && prev_command.action === 'add_node' && prev_command.data[2] === 'New Node') {
|
|
39
|
-
prev_command.data[2] = command.data[1];
|
|
40
|
-
this.commands[this.step - 1] = prev_command;
|
|
41
|
-
} else {
|
|
42
|
-
this.step = this.commands.push(command);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
execute: function (command) {
|
|
47
|
-
var func = this.jm[command.action];
|
|
48
|
-
var node = command.node;
|
|
49
|
-
this.jm.enable_edit();
|
|
50
|
-
func.apply(this.jm, command.data);
|
|
51
|
-
this.jm.disable_edit();
|
|
52
|
-
if (!!node) {
|
|
53
|
-
this.jm.select_node(node);
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
add_command: function (command) {
|
|
57
|
-
this.commands.push(command);
|
|
58
|
-
play();
|
|
59
|
-
},
|
|
60
|
-
replay: function () {
|
|
61
|
-
this.step = 0;
|
|
62
|
-
this.play();
|
|
63
|
-
},
|
|
64
|
-
play: function () {
|
|
65
|
-
this.jm.disable_edit();
|
|
66
|
-
this.playing = true;
|
|
67
|
-
this._play_stepbystep();
|
|
68
|
-
},
|
|
69
|
-
_play_stepbystep: function () {
|
|
70
|
-
if (this.delay_handle != 0) {
|
|
71
|
-
$w.clearTimeout(this.delay_handle);
|
|
72
|
-
this.delay_handle = 0;
|
|
73
|
-
}
|
|
74
|
-
if (this.step < this.commands.length) {
|
|
75
|
-
this.execute(this.commands[this.step]);
|
|
76
|
-
this.step++;
|
|
77
|
-
var js = this;
|
|
78
|
-
this.delay_handle = $w.setTimeout(function () {
|
|
79
|
-
js.play.call(js);
|
|
80
|
-
}, options.play_delay);
|
|
81
|
-
} else {
|
|
82
|
-
this._play_end();
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
_play_end: function () {
|
|
86
|
-
this.playing = false;
|
|
87
|
-
if (this.jm_editable) {
|
|
88
|
-
this.jm.enable_edit();
|
|
89
|
-
} else {
|
|
90
|
-
this.jm.disable_edit();
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
|
|
94
|
-
jm_event_handle: function (type, data) {
|
|
95
|
-
if (type === jsMind.event_type.show) {
|
|
96
|
-
this.record('show', data);
|
|
97
|
-
}
|
|
98
|
-
if (type === jsMind.event_type.edit) {
|
|
99
|
-
var action = data.evt;
|
|
100
|
-
delete data.evt;
|
|
101
|
-
this.record(action, data);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
var shell_plugin = new jsMind.plugin('shell', function (jm) {
|
|
107
|
-
var js = new jsMind.shell(jm);
|
|
108
|
-
jm.shell = js;
|
|
109
|
-
js.init();
|
|
110
|
-
jm.add_event_listener(function (type, data) {
|
|
111
|
-
js.jm_event_handle.call(js, type, data);
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
jsMind.register_plugin(shell_plugin);
|
|
116
|
-
})(window);
|
package/screenshots/jsmind.png
DELETED
|
Binary file
|