mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-23 15:38:55 +01:00
Fix input text behavior for null/empty value fields
This commit is contained in:
parent
e068968b35
commit
2490e72df5
1 changed files with 2 additions and 2 deletions
|
@ -88,7 +88,7 @@ function makeElementEditable(original, data, key) {
|
|||
var inputNewText = document.createElement("input");
|
||||
inputNewText.type = "text";
|
||||
inputNewText.className = "config-element-edit";
|
||||
inputNewText.value = original.textContent;
|
||||
inputNewText.value = (original.textContent == emptyValueDefault) ? "" : original.textContent;
|
||||
fixInputOnFocusOut(inputNewText, data, key);
|
||||
original.parentNode.replaceChild(inputNewText, original);
|
||||
inputNewText.focus();
|
||||
|
@ -118,7 +118,7 @@ function createValueNode(data, key) {
|
|||
*/
|
||||
function fixInputOnFocusOut(original, data, key) {
|
||||
original.addEventListener("blur", () => {
|
||||
data[key] = (!!data[key] && original.value != emptyValueDefault) ? original.value : "";
|
||||
data[key] = (original.value != emptyValueDefault) ? original.value : "";
|
||||
original.parentNode.replaceChild(createValueNode(data, key), original);
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue