Commit dff0b340 authored by Bady's avatar Bady
Browse files

Improve UX of knowledge editing

parent e7e8e5b2
......@@ -99,15 +99,22 @@
}
}
form {
margin: 20px auto 0;
#knowledge-form {
text-align: center;
}
form input[type="text"] {
#knowledge-input {
width: 420px;
}
#knowledge-input, #knowledge-submit, #knowledge-edit {
margin: 10px auto;
}
#knowledge-edit {
display: none;
}
#knowledge {
display: none;
position: absolute;
......@@ -459,8 +466,9 @@
</svg>
<form id="knowledge-form">
<input type="text" id="knowledge-input" maxlength="50">
<input type="submit" value="Submit" onclick="event.preventDefault(); addKnowledgeItem();">
<input id="knowledge-input" type="text" maxlength="50">
<input id="knowledge-submit" type="submit" value="Submit" onclick="event.preventDefault(); addKnowledgeItem();">
<input id="knowledge-edit" type="submit" value="Edit" onclick="event.preventDefault(); editKnowledgeItem();">
</form>
<div id="knowledge"></div>
......@@ -493,6 +501,15 @@
leaftext = document.getElementById('knowledge-input').value;
var leafdata = { "leaftext": leaftext }
socket.emit("leaf text", leafdata);
document.getElementById("knowledge-input").style.display = "none";
document.getElementById("knowledge-submit").style.display = "none";
document.getElementById("knowledge-edit").style.display = "block";
}
function editKnowledgeItem() {
document.getElementById("knowledge-input").style.display = "block";
document.getElementById("knowledge-submit").style.display = "block";
document.getElementById("knowledge-edit").style.display = "none";
}
socket.on('leaf data', (leafdata) => {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment