summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ws/munia.css5
-rw-r--r--src/ws/node.js11
-rw-r--r--src/ws/view.js30
3 files changed, 46 insertions, 0 deletions
diff --git a/src/ws/munia.css b/src/ws/munia.css
index 4afc374..c9d670c 100644
--- a/src/ws/munia.css
+++ b/src/ws/munia.css
@@ -117,6 +117,11 @@ body
border-radius: 3px;
}
+.node .edit input
+{
+ pointer-events: auto;
+}
+
.node .button
{
float: right;
diff --git a/src/ws/node.js b/src/ws/node.js
index 75fe1ec..5ecfdac 100644
--- a/src/ws/node.js
+++ b/src/ws/node.js
@@ -239,6 +239,17 @@ Node.prototype.create = function()
}
};
+//! Recursively set draggable property from node until root node.
+Node.prototype.setDraggable = function(value)
+{
+ var node = this.element;
+ node.draggable = value;
+ if(this.parent != null)
+ {
+ this.parent.setDraggable(value);
+ }
+};
+
function checkHTML(html)
{
var doc = document.createElement('p');
diff --git a/src/ws/view.js b/src/ws/view.js
index 7fc69bb..8e349d5 100644
--- a/src/ws/view.js
+++ b/src/ws/view.js
@@ -237,10 +237,12 @@ function onKeyUpHandlerDesc(e)
{ // enter
node.data_element.removeChild(lineedit);
update(updateid, "description", lineedit.value);
+ node.setDraggable(true);
}
if(e.which == 27)
{ // escape
node.data_element.removeChild(lineedit);
+ node.setDraggable(true);
}
}
@@ -255,6 +257,7 @@ function onLostFocusHandlerDesc(e)
var lineedit = e.target;
node.data_element.removeChild(lineedit);
+ node.setDraggable(true);
}
function editDescription(e)
@@ -275,6 +278,18 @@ function editDescription(e)
lineedit.placeholder = "Node Description (Ctrl+enter to save, esc to discard)";
lineedit.value = node.getDescription();
lineedit.id = idstr;
+ lineedit.onmouseenter =
+ function(ev)
+ {
+ var node = findNodeFromString(ev.target.id);
+ node.setDraggable(false);
+ };
+ lineedit.onmouseleave =
+ function(ev)
+ {
+ var node = findNodeFromString(ev.target.id);
+ node.setDraggable(true);
+ };
node.data_element.appendChild(lineedit);
lineedit.focus();
}
@@ -293,11 +308,13 @@ function onKeyUpHandler(e)
if(e.which == 13)
{ // enter
node.data_element.removeChild(lineedit);
+ node.setDraggable(true);
update(updateid, "title", lineedit.value);
}
if(e.which == 27)
{ // escape
node.data_element.removeChild(lineedit);
+ node.setDraggable(true);
}
}
@@ -312,6 +329,7 @@ function onLostFocusHandler(e)
var lineedit = e.target;
node.data_element.removeChild(lineedit);
+ node.setDraggable(true);
}
function editTitle(e)
@@ -331,6 +349,18 @@ function editTitle(e)
lineedit.placeholder = "Node Title (Enter to save, esc to discard)";
lineedit.value = node.getTitle();
lineedit.id = idstr;
+ lineedit.onmouseenter =
+ function(ev)
+ {
+ var node = findNodeFromString(ev.target.id);
+ node.setDraggable(false);
+ };
+ lineedit.onmouseleave =
+ function(ev)
+ {
+ var node = findNodeFromString(ev.target.id);
+ node.setDraggable(true);
+ };
node.data_element.insertBefore(lineedit, node.description_element);
lineedit.focus();
}