jsmind 0.4.6 → 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 -31
- package/docs/en/1.usage.md +11 -11
- package/docs/en/2.options.md +213 -1
- package/docs/en/3.operation.md +137 -1
- package/docs/en/4.contribution.md +35 -0
- package/docs/en/5.development.md +18 -0
- package/docs/en/index.md +23 -12
- package/docs/zh/1.usage.md +22 -20
- package/docs/zh/2.options.md +54 -8
- package/docs/zh/3.operation.md +35 -21
- package/docs/zh/4.contribution.md +41 -0
- package/docs/zh/5.development.md +78 -0
- package/docs/zh/index.md +2 -1
- 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} +128 -122
- package/js/jsmind.js +1211 -1064
- package/js/jsmind.screenshot.js +139 -137
- package/package.json +51 -31
- package/style/jsmind.css +357 -114
- package/example/1_basic.html +0 -62
- package/example/2_features.html +0 -526
- 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/features/jsmind.shell.js
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Released under BSD License
|
|
3
|
-
* Copyright (c) 2014-2015 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
|