diff --git a/static/js/jsmind.js b/static/js/jsmind.js
index b4a3eb9..221e2ae 100644
--- a/static/js/jsmind.js
+++ b/static/js/jsmind.js
@@ -1373,7 +1373,7 @@
return this.mind.get_node(nodeid);
},
- add_node: function (parent_node, nodeid, topic, data, stop_invoke_event) {
+ add_node: function (parent_node, nodeid, topic, data, stop_invoke_event /** by cy*/) {
if (this.get_editable()) {
var node = this.mind.add_node(parent_node, nodeid, topic, data);
if (!!node) {
@@ -1382,7 +1382,7 @@
this.view.show(false);
this.view.reset_node_custom_style(node);
this.expand_node(parent_node);
- if (!stop_invoke_event) {
+ if (!stop_invoke_event) { /** by cy*/
this.invoke_event_handle(jm.event_type.edit, {
evt: 'add_node',
data: [node.parent.id, nodeid, topic, data],
@@ -1397,7 +1397,7 @@
}
},
- insert_node_before: function (node_before, nodeid, topic, data, stop_invoke_event) {
+ insert_node_before: function (node_before, nodeid, topic, data, stop_invoke_event /** by cy*/) {
if (this.get_editable()) {
var beforeid = jm.util.is_node(node_before) ? node_before.id : node_before;
var node = this.mind.insert_node_before(node_before, nodeid, topic, data);
@@ -1405,7 +1405,7 @@
this.view.add_node(node);
this.layout.layout();
this.view.show(false);
- if (!stop_invoke_event) {
+ if (!stop_invoke_event) { /** by cy*/
this.invoke_event_handle(jm.event_type.edit, {
evt: 'insert_node_before',
data: [beforeid, nodeid, topic, data],
@@ -1420,7 +1420,7 @@
}
},
- insert_node_after: function (node_after, nodeid, topic, data, stop_invoke_event) {
+ insert_node_after: function (node_after, nodeid, topic, data, stop_invoke_event/** by cy*/) {
if (this.get_editable()) {
var afterid = jm.util.is_node(node_after) ? node_after.id : node_after;
var node = this.mind.insert_node_after(node_after, nodeid, topic, data);
@@ -1428,7 +1428,7 @@
this.view.add_node(node);
this.layout.layout();
this.view.show(false);
- if (!stop_invoke_event) {
+ if (!stop_invoke_event) { /** by cy*/
this.invoke_event_handle(jm.event_type.edit, {
evt: 'insert_node_after',
data: [afterid, nodeid, topic, data],
@@ -1443,7 +1443,7 @@
}
},
- remove_node: function (node, stop_invoke_event) {
+ remove_node: function (node, stop_invoke_event/** by cy*/) {
if (!jm.util.is_node(node)) {
var the_node = this.get_node(node);
if (!the_node) {
@@ -1467,7 +1467,7 @@
this.layout.layout();
this.view.show(false);
this.view.restore_location(parent_node);
- if (!stop_invoke_event) {
+ if (!stop_invoke_event) { /** by cy*/
this.invoke_event_handle(jm.event_type.edit, {evt: 'remove_node', data: [nodeid], node: parentid});
}
return true;
@@ -1477,7 +1477,7 @@
}
},
- update_node: function (nodeid, topic, stop_invoke_event) {
+ update_node: function (nodeid, topic, stop_invoke_event/** by cy*/) {
if (this.get_editable()) {
if (jm.util.text.is_empty(topic)) {
logger.warn('fail, topic can not be empty');
@@ -1492,6 +1492,7 @@
}
node.topic = topic;
+ // by cy
this.auto_height_node_before_update(node)
this.view.update_node(node);
@@ -1500,7 +1501,7 @@
this.view.show(false);
- if (!stop_invoke_event) {
+ if (!stop_invoke_event) { /** by cy*/
this.invoke_event_handle(jm.event_type.edit, {
evt: 'update_node',
data: [nodeid, topic],
@@ -1520,12 +1521,12 @@
const lines = topic.includes('
') ? topic.split('
').length : topic.split('\n').length
const view_data = node._data.view
const element = view_data.element
- const height = (lines * 12 + 14)
+ const height = (lines * 12 + 10)
element.style.height = `${height}px`
}
},
- move_node: function (nodeid, beforeid, parentid, direction, stop_invoke_event) {
+ move_node: function (nodeid, beforeid, parentid, direction, stop_invoke_event/** by cy*/) {
if (this.get_editable()) {
var node = this.mind.move_node(nodeid, beforeid, parentid, direction);
if (!!node) {
@@ -2418,7 +2419,7 @@
}
this.e_panel = $c('div');
this.e_nodes = $c('jmnodes');
- this.e_editor = $c('textarea');
+ this.e_editor = $c('textarea'); // by cy
this.graph = this.opts.engine.toLowerCase() === 'svg' ? new jm.graph_svg(this) : new jm.graph_canvas(this);
@@ -2428,7 +2429,7 @@
this.e_panel.appendChild(this.e_nodes);
this.e_editor.className = 'jsmind-editor';
- this.e_editor.style.fontSize = '11px';
+ this.e_editor.style.fontSize = '11px'; // by cy
// this.e_editor.type = 'text';
this.actualZoom = 1;
@@ -2437,6 +2438,7 @@
this.maxZoom = 2;
var v = this;
+ // by cy
/*jm.util.dom.add_event(this.e_editor, 'keydown', function (e) {
var evt = e || event;
if (evt.keyCode == 13) {
@@ -2658,7 +2660,7 @@
var ncs = getComputedStyle(element);
this.e_editor.value = topic;
this.e_editor.style.width = (element.clientWidth - parseInt(ncs.getPropertyValue('padding-left')) - parseInt(ncs.getPropertyValue('padding-right'))) + 'px';
- this.e_editor.style.height = (element.clientHeight - parseInt(ncs.getPropertyValue('padding-top')) - parseInt(ncs.getPropertyValue('padding-bottom'))) + 'px';
+ this.e_editor.style.height = (element.clientHeight - parseInt(ncs.getPropertyValue('padding-top')) - parseInt(ncs.getPropertyValue('padding-bottom'))) + 'px'; // by cy
element.innerHTML = '';
element.appendChild(this.e_editor);
element.style.zIndex = 5;