jsmind 0.4.6 → 0.4.8
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 +1 -0
- package/docs/en/1.usage.md +7 -8
- package/docs/en/2.options.md +208 -1
- package/docs/en/3.operation.md +136 -1
- package/docs/en/4.contribution.md +34 -0
- package/docs/en/index.md +22 -12
- package/docs/zh/1.usage.md +18 -17
- package/docs/zh/2.options.md +47 -7
- package/docs/zh/3.operation.md +13 -5
- package/docs/zh/4.contribution.md +34 -0
- package/docs/zh/index.md +1 -1
- package/example/2_features.html +6 -4
- package/example/3_mathjax.html +104 -0
- package/features/jsmind.shell.js +40 -40
- package/js/jsmind.draggable.js +124 -120
- package/js/jsmind.js +1153 -987
- package/js/jsmind.screenshot.js +137 -135
- package/package.json +1 -1
- package/style/jsmind.css +4 -3
package/js/jsmind.screenshot.js
CHANGED
|
@@ -1,106 +1,106 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Released under BSD License
|
|
3
|
-
* Copyright (c) 2014-
|
|
3
|
+
* Copyright (c) 2014-2021 hizzgdev@163.com
|
|
4
4
|
*
|
|
5
5
|
* Project Home:
|
|
6
6
|
* https://github.com/hizzgdev/jsmind/
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
(function($w){
|
|
9
|
+
(function ($w) {
|
|
10
10
|
'use strict';
|
|
11
11
|
|
|
12
12
|
var __name__ = 'jsMind';
|
|
13
13
|
var jsMind = $w[__name__];
|
|
14
|
-
if(!jsMind){return;}
|
|
15
|
-
if(typeof jsMind.screenshot != 'undefined'){return;}
|
|
14
|
+
if (!jsMind) { return; }
|
|
15
|
+
if (typeof jsMind.screenshot != 'undefined') { return; }
|
|
16
16
|
|
|
17
17
|
var $d = $w.document;
|
|
18
|
-
var $c = function(tag){return $d.createElement(tag);};
|
|
18
|
+
var $c = function (tag) { return $d.createElement(tag); };
|
|
19
19
|
|
|
20
|
-
var css = function(cstyle,property_name){
|
|
20
|
+
var css = function (cstyle, property_name) {
|
|
21
21
|
return cstyle.getPropertyValue(property_name);
|
|
22
22
|
};
|
|
23
|
-
var is_visible = function(cstyle){
|
|
24
|
-
var visibility = css(cstyle,'visibility');
|
|
25
|
-
var display
|
|
23
|
+
var is_visible = function (cstyle) {
|
|
24
|
+
var visibility = css(cstyle, 'visibility');
|
|
25
|
+
var display = css(cstyle, 'display');
|
|
26
26
|
return (visibility !== 'hidden' && display !== 'none');
|
|
27
27
|
};
|
|
28
|
-
var jcanvas =
|
|
29
|
-
jcanvas.rect = function (ctx,x,y,w,h,r) {
|
|
28
|
+
var jcanvas = {};
|
|
29
|
+
jcanvas.rect = function (ctx, x, y, w, h, r) {
|
|
30
30
|
if (w < 2 * r) r = w / 2;
|
|
31
31
|
if (h < 2 * r) r = h / 2;
|
|
32
|
-
ctx.moveTo(x+r, y);
|
|
33
|
-
ctx.arcTo(x+w, y,
|
|
34
|
-
ctx.arcTo(x+w, y+h, x,
|
|
35
|
-
ctx.arcTo(x,
|
|
36
|
-
ctx.arcTo(x,
|
|
32
|
+
ctx.moveTo(x + r, y);
|
|
33
|
+
ctx.arcTo(x + w, y, x + w, y + h, r);
|
|
34
|
+
ctx.arcTo(x + w, y + h, x, y + h, r);
|
|
35
|
+
ctx.arcTo(x, y + h, x, y, r);
|
|
36
|
+
ctx.arcTo(x, y, x + w, y, r);
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
jcanvas.text_multiline = function(ctx,text,x,y,w,h,lineheight){
|
|
39
|
+
jcanvas.text_multiline = function (ctx, text, x, y, w, h, lineheight) {
|
|
40
40
|
var line = '';
|
|
41
41
|
var text_len = text.length;
|
|
42
42
|
var chars = text.split('');
|
|
43
43
|
var test_line = null;
|
|
44
44
|
ctx.textAlign = 'left';
|
|
45
45
|
ctx.textBaseline = 'top';
|
|
46
|
-
for(var i=0;i<text_len;i++){
|
|
46
|
+
for (var i = 0; i < text_len; i++) {
|
|
47
47
|
test_line = line + chars[i];
|
|
48
|
-
if(ctx.measureText(test_line).width > w && i>0){
|
|
49
|
-
ctx.fillText(line,x,y);
|
|
48
|
+
if (ctx.measureText(test_line).width > w && i > 0) {
|
|
49
|
+
ctx.fillText(line, x, y);
|
|
50
50
|
line = chars[i];
|
|
51
51
|
y += lineheight;
|
|
52
|
-
}else{
|
|
52
|
+
} else {
|
|
53
53
|
line = test_line;
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
ctx.fillText(line,x,y);
|
|
56
|
+
ctx.fillText(line, x, y);
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
-
jcanvas.text_ellipsis = function(ctx,text,x,y,w,h){
|
|
60
|
-
var center_y = y+h/2;
|
|
61
|
-
var text = jcanvas.fittingString(ctx,text,w);
|
|
59
|
+
jcanvas.text_ellipsis = function (ctx, text, x, y, w, h) {
|
|
60
|
+
var center_y = y + h / 2;
|
|
61
|
+
var text = jcanvas.fittingString(ctx, text, w);
|
|
62
62
|
ctx.textAlign = 'left';
|
|
63
63
|
ctx.textBaseline = 'middle';
|
|
64
|
-
ctx.fillText(text,x,center_y,w);
|
|
64
|
+
ctx.fillText(text, x, center_y, w);
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
jcanvas.fittingString = function(ctx,text,max_width) {
|
|
67
|
+
jcanvas.fittingString = function (ctx, text, max_width) {
|
|
68
68
|
var width = ctx.measureText(text).width;
|
|
69
|
-
var ellipsis = '…'
|
|
69
|
+
var ellipsis = '…';
|
|
70
70
|
var ellipsis_width = ctx.measureText(ellipsis).width;
|
|
71
|
-
if (width<=max_width || width<=ellipsis_width) {
|
|
71
|
+
if (width <= max_width || width <= ellipsis_width) {
|
|
72
72
|
return text;
|
|
73
73
|
} else {
|
|
74
74
|
var len = text.length;
|
|
75
|
-
while (width>=max_width-ellipsis_width && len
|
|
75
|
+
while (width >= max_width - ellipsis_width && len-- > 0) {
|
|
76
76
|
text = text.substring(0, len);
|
|
77
77
|
width = ctx.measureText(text).width;
|
|
78
78
|
}
|
|
79
|
-
return text+ellipsis;
|
|
79
|
+
return text + ellipsis;
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
|
|
83
|
-
jcanvas.image = function(ctx,
|
|
83
|
+
jcanvas.image = function (ctx, url, x, y, w, h, r, rotation, callback) {
|
|
84
84
|
var img = new Image();
|
|
85
85
|
img.onload = function () {
|
|
86
86
|
ctx.save();
|
|
87
|
-
ctx.translate(x,y);
|
|
87
|
+
ctx.translate(x, y);
|
|
88
88
|
ctx.save();
|
|
89
89
|
ctx.beginPath();
|
|
90
|
-
jcanvas.rect(ctx,0,0,w,h,r);
|
|
90
|
+
jcanvas.rect(ctx, 0, 0, w, h, r);
|
|
91
91
|
ctx.closePath();
|
|
92
92
|
ctx.clip();
|
|
93
|
-
ctx.translate(w/2,h/2);
|
|
94
|
-
ctx.rotate(rotation*Math.PI/180);
|
|
95
|
-
ctx.drawImage(img
|
|
93
|
+
ctx.translate(w / 2, h / 2);
|
|
94
|
+
ctx.rotate(rotation * Math.PI / 180);
|
|
95
|
+
ctx.drawImage(img, -w / 2, -h / 2);
|
|
96
96
|
ctx.restore();
|
|
97
97
|
ctx.restore();
|
|
98
|
-
callback();
|
|
98
|
+
!!callback && callback();
|
|
99
99
|
}
|
|
100
|
-
img.src =
|
|
100
|
+
img.src = url;
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
-
jsMind.screenshot = function(jm){
|
|
103
|
+
jsMind.screenshot = function (jm) {
|
|
104
104
|
this.jm = jm;
|
|
105
105
|
this.canvas_elem = null;
|
|
106
106
|
this.canvas_ctx = null;
|
|
@@ -108,8 +108,8 @@
|
|
|
108
108
|
};
|
|
109
109
|
|
|
110
110
|
jsMind.screenshot.prototype = {
|
|
111
|
-
init:function(){
|
|
112
|
-
if(this._inited){return;}
|
|
111
|
+
init: function () {
|
|
112
|
+
if (this._inited) { return; }
|
|
113
113
|
console.log('init');
|
|
114
114
|
var c = $c('canvas');
|
|
115
115
|
var ctx = c.getContext('2d');
|
|
@@ -121,83 +121,81 @@
|
|
|
121
121
|
this.resize();
|
|
122
122
|
},
|
|
123
123
|
|
|
124
|
-
shoot:function(callback){
|
|
124
|
+
shoot: function (callback) {
|
|
125
125
|
this.init();
|
|
126
|
+
this._draw(function () {
|
|
127
|
+
!!callback && callback();
|
|
128
|
+
this.clean();
|
|
129
|
+
}.bind(this));
|
|
126
130
|
this._watermark();
|
|
127
|
-
var jms = this;
|
|
128
|
-
this._draw(function(){
|
|
129
|
-
if(!!callback){
|
|
130
|
-
callback(jms);
|
|
131
|
-
}
|
|
132
|
-
jms.clean();
|
|
133
|
-
});
|
|
134
131
|
},
|
|
135
132
|
|
|
136
|
-
shootDownload: function(){
|
|
137
|
-
this.shoot(function(
|
|
138
|
-
|
|
139
|
-
});
|
|
133
|
+
shootDownload: function () {
|
|
134
|
+
this.shoot(function () {
|
|
135
|
+
this._download();
|
|
136
|
+
}.bind(this));
|
|
140
137
|
},
|
|
141
138
|
|
|
142
|
-
shootAsDataURL: function(callback){
|
|
143
|
-
this.shoot(function(
|
|
144
|
-
callback(
|
|
145
|
-
});
|
|
139
|
+
shootAsDataURL: function (callback) {
|
|
140
|
+
this.shoot(function () {
|
|
141
|
+
!!callback && callback(this.canvas_elem.toDataURL());
|
|
142
|
+
}.bind(this));
|
|
146
143
|
},
|
|
147
144
|
|
|
148
|
-
resize:function(){
|
|
149
|
-
if(this._inited){
|
|
150
|
-
this.canvas_elem.width=this.jm.view.size.w;
|
|
151
|
-
this.canvas_elem.height=this.jm.view.size.h;
|
|
145
|
+
resize: function () {
|
|
146
|
+
if (this._inited) {
|
|
147
|
+
this.canvas_elem.width = this.jm.view.size.w;
|
|
148
|
+
this.canvas_elem.height = this.jm.view.size.h;
|
|
152
149
|
}
|
|
153
150
|
},
|
|
154
151
|
|
|
155
|
-
clean:function(){
|
|
152
|
+
clean: function () {
|
|
156
153
|
var c = this.canvas_elem;
|
|
157
|
-
this.canvas_ctx.clearRect(0,0,c.width,c.height);
|
|
154
|
+
this.canvas_ctx.clearRect(0, 0, c.width, c.height);
|
|
158
155
|
},
|
|
159
156
|
|
|
160
|
-
_draw:function(callback){
|
|
157
|
+
_draw: function (callback) {
|
|
161
158
|
var ctx = this.canvas_ctx;
|
|
162
159
|
ctx.textAlign = 'left';
|
|
163
160
|
ctx.textBaseline = 'top';
|
|
164
|
-
this._draw_lines()
|
|
165
|
-
|
|
161
|
+
this._draw_lines(function () {
|
|
162
|
+
this._draw_nodes(callback);
|
|
163
|
+
}.bind(this));
|
|
166
164
|
},
|
|
167
165
|
|
|
168
|
-
_watermark:function(){
|
|
166
|
+
_watermark: function () {
|
|
169
167
|
var c = this.canvas_elem;
|
|
170
168
|
var ctx = this.canvas_ctx;
|
|
171
|
-
ctx.textAlign='right';
|
|
172
|
-
ctx.textBaseline='bottom';
|
|
173
|
-
ctx.fillStyle='#000';
|
|
174
|
-
ctx.font='11px Verdana,Arial,Helvetica,sans-serif';
|
|
175
|
-
ctx.fillText('hizzgdev.github.io/jsmind',c.width-5.5,c.height-2.5);
|
|
176
|
-
ctx.textAlign='left';
|
|
177
|
-
ctx.fillText($w.location,5.5,c.height-2.5);
|
|
169
|
+
ctx.textAlign = 'right';
|
|
170
|
+
ctx.textBaseline = 'bottom';
|
|
171
|
+
ctx.fillStyle = '#000';
|
|
172
|
+
ctx.font = '11px Verdana,Arial,Helvetica,sans-serif';
|
|
173
|
+
ctx.fillText('hizzgdev.github.io/jsmind', c.width - 5.5, c.height - 2.5);
|
|
174
|
+
ctx.textAlign = 'left';
|
|
175
|
+
ctx.fillText($w.location, 5.5, c.height - 2.5);
|
|
178
176
|
},
|
|
179
177
|
|
|
180
|
-
_draw_lines:function(){
|
|
181
|
-
this.jm.view.
|
|
178
|
+
_draw_lines: function (callback) {
|
|
179
|
+
this.jm.view.graph.copy_to(this.canvas_ctx, callback);
|
|
182
180
|
},
|
|
183
181
|
|
|
184
|
-
_draw_nodes:function(callback){
|
|
182
|
+
_draw_nodes: function (callback) {
|
|
185
183
|
var nodes = this.jm.mind.nodes;
|
|
186
184
|
var node;
|
|
187
|
-
for(var nodeid in nodes){
|
|
185
|
+
for (var nodeid in nodes) {
|
|
188
186
|
node = nodes[nodeid];
|
|
189
187
|
this._draw_node(node);
|
|
190
188
|
}
|
|
191
189
|
|
|
192
190
|
function check_nodes_ready() {
|
|
193
|
-
console.log('check_node_ready'+new Date());
|
|
191
|
+
console.log('check_node_ready' + new Date());
|
|
194
192
|
var allOk = true;
|
|
195
|
-
for(var nodeid in nodes){
|
|
193
|
+
for (var nodeid in nodes) {
|
|
196
194
|
node = nodes[nodeid];
|
|
197
195
|
allOk = allOk & node.ready;
|
|
198
196
|
}
|
|
199
197
|
|
|
200
|
-
if(!allOk) {
|
|
198
|
+
if (!allOk) {
|
|
201
199
|
$w.setTimeout(check_nodes_ready, 200);
|
|
202
200
|
} else {
|
|
203
201
|
$w.setTimeout(callback, 200);
|
|
@@ -206,40 +204,44 @@
|
|
|
206
204
|
check_nodes_ready();
|
|
207
205
|
},
|
|
208
206
|
|
|
209
|
-
_draw_node:function(node){
|
|
207
|
+
_draw_node: function (node) {
|
|
210
208
|
var ctx = this.canvas_ctx;
|
|
211
209
|
var view_data = node._data.view;
|
|
212
210
|
var node_element = view_data.element;
|
|
213
211
|
var ncs = getComputedStyle(node_element);
|
|
214
|
-
if(!is_visible(ncs)){
|
|
212
|
+
if (!is_visible(ncs)) {
|
|
215
213
|
node.ready = true;
|
|
216
214
|
return;
|
|
217
215
|
}
|
|
218
216
|
|
|
219
|
-
var bgcolor = css(ncs,'background-color');
|
|
220
|
-
var round_radius = parseInt(css(ncs,'border-top-left-radius'));
|
|
221
|
-
var color = css(ncs,'color');
|
|
222
|
-
var padding_left = parseInt(css(ncs,'padding-left'));
|
|
223
|
-
var padding_right = parseInt(css(ncs,'padding-right'));
|
|
224
|
-
var padding_top = parseInt(css(ncs,'padding-top'));
|
|
225
|
-
var padding_bottom = parseInt(css(ncs,'padding-bottom'));
|
|
226
|
-
var text_overflow = css(ncs,'text-overflow');
|
|
227
|
-
var font = css(ncs,'font-style')+' '+
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
var rb = {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
217
|
+
var bgcolor = css(ncs, 'background-color');
|
|
218
|
+
var round_radius = parseInt(css(ncs, 'border-top-left-radius'));
|
|
219
|
+
var color = css(ncs, 'color');
|
|
220
|
+
var padding_left = parseInt(css(ncs, 'padding-left'));
|
|
221
|
+
var padding_right = parseInt(css(ncs, 'padding-right'));
|
|
222
|
+
var padding_top = parseInt(css(ncs, 'padding-top'));
|
|
223
|
+
var padding_bottom = parseInt(css(ncs, 'padding-bottom'));
|
|
224
|
+
var text_overflow = css(ncs, 'text-overflow');
|
|
225
|
+
var font = css(ncs, 'font-style') + ' ' +
|
|
226
|
+
css(ncs, 'font-variant') + ' ' +
|
|
227
|
+
css(ncs, 'font-weight') + ' ' +
|
|
228
|
+
css(ncs, 'font-size') + '/' + css(ncs, 'line-height') + ' ' +
|
|
229
|
+
css(ncs, 'font-family');
|
|
230
|
+
|
|
231
|
+
var rb = {
|
|
232
|
+
x: view_data.abs_x,
|
|
233
|
+
y: view_data.abs_y,
|
|
234
|
+
w: view_data.width + 1,
|
|
235
|
+
h: view_data.height + 1
|
|
236
|
+
};
|
|
237
|
+
var tb = {
|
|
238
|
+
x: rb.x + padding_left,
|
|
239
|
+
y: rb.y + padding_top,
|
|
240
|
+
w: rb.w - padding_left - padding_right,
|
|
241
|
+
h: rb.h - padding_top - padding_bottom
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
ctx.font = font;
|
|
243
245
|
ctx.fillStyle = bgcolor;
|
|
244
246
|
ctx.beginPath();
|
|
245
247
|
jcanvas.rect(ctx, rb.x, rb.y, rb.w, rb.h, round_radius);
|
|
@@ -248,26 +250,26 @@
|
|
|
248
250
|
|
|
249
251
|
ctx.fillStyle = color;
|
|
250
252
|
if ('background-image' in node.data) {
|
|
251
|
-
var backgroundUrl = css(ncs,'background-image').slice(5, -2);
|
|
253
|
+
var backgroundUrl = css(ncs, 'background-image').slice(5, -2);
|
|
252
254
|
node.ready = false;
|
|
253
255
|
var rotation = 0;
|
|
254
256
|
if ('background-rotation' in node.data) {
|
|
255
257
|
rotation = node.data['background-rotation'];
|
|
256
258
|
}
|
|
257
259
|
jcanvas.image(ctx, backgroundUrl, rb.x, rb.y, rb.w, rb.h, round_radius, rotation,
|
|
258
|
-
function() {
|
|
260
|
+
function () {
|
|
259
261
|
node.ready = true;
|
|
260
262
|
});
|
|
261
263
|
}
|
|
262
264
|
if (!!node.topic) {
|
|
263
|
-
if(text_overflow === 'ellipsis'){
|
|
265
|
+
if (text_overflow === 'ellipsis') {
|
|
264
266
|
jcanvas.text_ellipsis(ctx, node.topic, tb.x, tb.y, tb.w, tb.h);
|
|
265
|
-
}else{
|
|
266
|
-
var line_height = parseInt(css(ncs,'line-height'));
|
|
267
|
-
jcanvas.text_multiline(ctx, node.topic, tb.x, tb.y, tb.w, tb.h,line_height);
|
|
267
|
+
} else {
|
|
268
|
+
var line_height = parseInt(css(ncs, 'line-height'));
|
|
269
|
+
jcanvas.text_multiline(ctx, node.topic, tb.x, tb.y, tb.w, tb.h, line_height);
|
|
268
270
|
}
|
|
269
271
|
}
|
|
270
|
-
if(!!view_data.expander){
|
|
272
|
+
if (!!view_data.expander) {
|
|
271
273
|
this._draw_expander(view_data.expander);
|
|
272
274
|
}
|
|
273
275
|
if (!('background-image' in node.data)) {
|
|
@@ -275,14 +277,14 @@
|
|
|
275
277
|
}
|
|
276
278
|
},
|
|
277
279
|
|
|
278
|
-
_draw_expander:function(expander){
|
|
280
|
+
_draw_expander: function (expander) {
|
|
279
281
|
var ctx = this.canvas_ctx;
|
|
280
282
|
var ncs = getComputedStyle(expander);
|
|
281
|
-
if(!is_visible(ncs)){ return; }
|
|
283
|
+
if (!is_visible(ncs)) { return; }
|
|
282
284
|
|
|
283
|
-
var style_left = css(ncs,'left');
|
|
284
|
-
var style_top = css(ncs,'top');
|
|
285
|
-
var font = css(ncs,'font');
|
|
285
|
+
var style_left = css(ncs, 'left');
|
|
286
|
+
var style_top = css(ncs, 'top');
|
|
287
|
+
var font = css(ncs, 'font');
|
|
286
288
|
var left = parseInt(style_left);
|
|
287
289
|
var top = parseInt(style_top);
|
|
288
290
|
var is_plus = expander.innerHTML === '+';
|
|
@@ -290,24 +292,24 @@
|
|
|
290
292
|
ctx.lineWidth = 1;
|
|
291
293
|
|
|
292
294
|
ctx.beginPath();
|
|
293
|
-
ctx.arc(left+7,top+7,5,0,Math.PI*2,true);
|
|
294
|
-
ctx.moveTo(left+10,top+7);
|
|
295
|
-
ctx.lineTo(left+4,top+7);
|
|
296
|
-
if(is_plus){
|
|
297
|
-
ctx.moveTo(left+7,top+4);
|
|
298
|
-
ctx.lineTo(left+7,top+10);
|
|
295
|
+
ctx.arc(left + 7, top + 7, 5, 0, Math.PI * 2, true);
|
|
296
|
+
ctx.moveTo(left + 10, top + 7);
|
|
297
|
+
ctx.lineTo(left + 4, top + 7);
|
|
298
|
+
if (is_plus) {
|
|
299
|
+
ctx.moveTo(left + 7, top + 4);
|
|
300
|
+
ctx.lineTo(left + 7, top + 10);
|
|
299
301
|
}
|
|
300
302
|
ctx.closePath();
|
|
301
303
|
ctx.stroke();
|
|
302
304
|
},
|
|
303
305
|
|
|
304
|
-
_download:function(){
|
|
306
|
+
_download: function () {
|
|
305
307
|
var c = this.canvas_elem;
|
|
306
|
-
var name = this.jm.mind.name+'.png';
|
|
308
|
+
var name = this.jm.mind.name + '.png';
|
|
307
309
|
|
|
308
310
|
if (navigator.msSaveBlob && (!!c.msToBlob)) {
|
|
309
311
|
var blob = c.msToBlob();
|
|
310
|
-
navigator.msSaveBlob(blob,name);
|
|
312
|
+
navigator.msSaveBlob(blob, name);
|
|
311
313
|
} else {
|
|
312
314
|
var bloburl = this.canvas_elem.toDataURL();
|
|
313
315
|
var anchor = $c('a');
|
|
@@ -326,21 +328,21 @@
|
|
|
326
328
|
}
|
|
327
329
|
},
|
|
328
330
|
|
|
329
|
-
jm_event_handle:function(type,data){
|
|
330
|
-
if(type === jsMind.event_type.resize){
|
|
331
|
+
jm_event_handle: function (type, data) {
|
|
332
|
+
if (type === jsMind.event_type.resize) {
|
|
331
333
|
this.resize();
|
|
332
334
|
}
|
|
333
335
|
}
|
|
334
336
|
};
|
|
335
337
|
|
|
336
|
-
var screenshot_plugin = new jsMind.plugin('screenshot',function(jm){
|
|
338
|
+
var screenshot_plugin = new jsMind.plugin('screenshot', function (jm) {
|
|
337
339
|
var jss = new jsMind.screenshot(jm);
|
|
338
340
|
jm.screenshot = jss;
|
|
339
|
-
jm.shoot = function(){
|
|
341
|
+
jm.shoot = function () {
|
|
340
342
|
jss.shoot();
|
|
341
343
|
};
|
|
342
|
-
jm.add_event_listener(function(type,data){
|
|
343
|
-
jss.jm_event_handle.call(jss,type,data);
|
|
344
|
+
jm.add_event_listener(function (type, data) {
|
|
345
|
+
jss.jm_event_handle.call(jss, type, data);
|
|
344
346
|
});
|
|
345
347
|
});
|
|
346
348
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsmind",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.8",
|
|
4
4
|
"description": "jsMind is a pure javascript library for mindmap, it base on html5 canvas. jsMind was released under BSD li cense, you can embed it in any project, if only you observe the license.",
|
|
5
5
|
"main": "js/jsmind.js",
|
|
6
6
|
"directories": {
|
package/style/jsmind.css
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Released under BSD License
|
|
3
|
-
* Copyright (c) 2014-
|
|
3
|
+
* Copyright (c) 2014-2021 hizzgdev@163.com
|
|
4
4
|
*
|
|
5
5
|
* Project Home:
|
|
6
6
|
* https://github.com/hizzgdev/jsmind/
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
/* important section */
|
|
10
|
-
.jsmind-inner{position:relative;overflow:auto;width:100%;height:100%;}/*box-shadow:0 0 2px #000;*/
|
|
10
|
+
.jsmind-inner{position:relative;overflow:auto;width:100%;height:100%;outline:none;}/*box-shadow:0 0 2px #000;*/
|
|
11
11
|
.jsmind-inner{
|
|
12
12
|
moz-user-select:-moz-none;
|
|
13
13
|
-moz-user-select:none;
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/* z-index:1 */
|
|
22
|
-
|
|
22
|
+
svg.jsmind{position:absolute;z-index:1;}
|
|
23
|
+
canvas.jsmind{position:absolute;z-index:1;}
|
|
23
24
|
|
|
24
25
|
/* z-index:2 */
|
|
25
26
|
jmnodes{position:absolute;z-index:2;background-color:rgba(0,0,0,0);}/*background color is necessary*/
|