summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2020-07-27 16:34:43 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2020-07-27 16:34:43 +0200
commite69ffe367cf588a726ca15599b115514d9918649 (patch)
treef94ca0ce1473d2fe2829223cbc23b9fd145ef387 /src
parentf1f84c1c3873a89ad39cd6602023c2706d549ccf (diff)
Show ellipsis when node has description.
Diffstat (limited to 'src')
-rw-r--r--src/ws/node.js38
1 files changed, 20 insertions, 18 deletions
diff --git a/src/ws/node.js b/src/ws/node.js
index 67d9372..424aa99 100644
--- a/src/ws/node.js
+++ b/src/ws/node.js
@@ -121,14 +121,7 @@ Node.prototype.addChild = function(node, insertBeforeId)
this.children_element.appendChild(node.element);
}
- if(this.childNodes.length > 0)
- {
- this.children_indicator_element.style.display = "inherit";
- }
- else
- {
- this.children_indicator_element.style.display = "none";
- }
+ this.updateAnnotations();
};
Node.prototype.removeChild = function(node)
@@ -140,14 +133,7 @@ Node.prototype.removeChild = function(node)
node.parent = null;
this.children_element.removeChild(node.element);
- if(this.childNodes.length > 0)
- {
- this.children_indicator_element.style.display = "inherit";
- }
- else
- {
- this.children_indicator_element.style.display = "none";
- }
+ this.updateAnnotations();
};
Node.prototype.create = function()
@@ -177,8 +163,6 @@ Node.prototype.create = function()
this.children_indicator_element = document.createElement("div");
this.children_indicator_element.className = "children_indicator";
- this.children_indicator_element.innerHTML = "&#10551;";
- this.children_indicator_element.style.display = "none";
annotation.appendChild(this.children_indicator_element);
this.data_element.appendChild(annotation);
@@ -249,6 +233,23 @@ Node.prototype.create = function()
}
};
+Node.prototype.updateAnnotations = function()
+{
+ var ann = "";
+
+ if(this.childNodes.length > 0)
+ {
+ ann += "&#10551;";
+ }
+
+ if(this.description_element.innerHTML != "")
+ {
+ ann += "&#8230;";
+ }
+
+ this.children_indicator_element.innerHTML = ann;
+};
+
//! Recursively set draggable property from node until root node.
Node.prototype.setDraggable = function(value)
{
@@ -340,6 +341,7 @@ Node.prototype.setAttribute = function(name, value)
this.description_element.innerHTML = marked(value);
makeClickthrough(this.description_element);
+ this.updateAnnotations();
}
if(name == "dragged")