summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ws/munia.css12
-rw-r--r--src/ws/view.js23
2 files changed, 11 insertions, 24 deletions
diff --git a/src/ws/munia.css b/src/ws/munia.css
index db030d6..4afc374 100644
--- a/src/ws/munia.css
+++ b/src/ws/munia.css
@@ -110,15 +110,11 @@ body
.node .edit
{
- border-color: red;
+ border: solid 1px red;
pointer-events: all;
- width: 90%
-/*
- border: inherit;
- padding: inherit;
- margin: inherit;
- background: inherit;
-*/
+ width: calc(100% - 0.5em);
+ margin: auto;
+ border-radius: 3px;
}
.node .button
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();
}