summaryrefslogtreecommitdiff
path: root/src/ws/view.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/ws/view.js')
-rw-r--r--src/ws/view.js23
1 files changed, 7 insertions, 16 deletions
diff --git a/src/ws/view.js b/src/ws/view.js
index 4be20aa..8ed5184 100644
--- a/src/ws/view.js
+++ b/src/ws/view.js
@@ -253,13 +253,6 @@ function node_submit_KeyUpHandler(target, e)
}
}
-//
-// Butt ugly.. but hey! it works...
-//
-var updateid;
-var lineedit;
-var lineeditparent;
-
function onKeyUpHandlerDesc(e)
{
var node = findNodeFromString(e.target.id);
@@ -271,7 +264,7 @@ function onKeyUpHandlerDesc(e)
var lineedit = e.target;
var updateid = idFromStr(lineedit.id);
- if(e.which == 13)
+ if(e.which == 13 && e.ctrlKey)
{ // enter
node.data_element.removeChild(lineedit);
update(updateid, "description", lineedit.value);
@@ -305,15 +298,15 @@ function editDescription(e)
return; // no node
}
- var lineedit = document.createElement("input");
- lineedit.setAttribute("class", "edit");
+ var lineedit = document.createElement("textarea");
+ lineedit.className = "edit";
+ lineedit.rows = 16;
lineedit.setAttribute("onkeyup", "onKeyUpHandlerDesc(event)");
lineedit.setAttribute("onblur", "onLostFocusHandlerDesc(event)");
- lineedit.placeholder = "Node Description";
+ lineedit.placeholder = "Node Description (Ctrl+enter to save, esc to discard)";
lineedit.value = node.getDescription();
lineedit.id = idstr;
node.data_element.appendChild(lineedit);
- //lineeditparent = e.target;
lineedit.focus();
}
@@ -354,7 +347,6 @@ function onLostFocusHandler(e)
function editTitle(e)
{
- console.log("!");
e.stopPropagation();
const idstr = e.target.parentElement.parentElement.id;
var node = findNodeFromString(idstr);
@@ -367,11 +359,10 @@ function editTitle(e)
lineedit.setAttribute("class", "edit");
lineedit.setAttribute("onkeyup", "onKeyUpHandler(event)");
lineedit.setAttribute("onblur", "onLostFocusHandler(event)");
- lineedit.placeholder = "Node Title";
+ lineedit.placeholder = "Node Title (Enter to save, esc to discard)";
lineedit.value = node.getTitle();
lineedit.id = idstr;
- node.data_element.appendChild(lineedit);
- //lineeditparent = e.target;
+ node.data_element.insertBefore(lineedit, node.description_element);
lineedit.focus();
}