loleaflet: Check parent relationship before linking next comment

Change-Id: Ib22e1e1adca0544a70fa224abc9c98060ad83e5f
This commit is contained in:
Pranav Kant 2017-04-24 15:44:53 +05:30
parent 8b3a2ed9d7
commit 3175a3a042
2 changed files with 5 additions and 1 deletions

View file

@ -458,7 +458,7 @@ L.AnnotationManager = L.Class.extend({
newId = this._items[parentIdx]._data.id;
}
var currentIdx = this.getIndexOf(comment._data.id);
if (this._items[currentIdx + 1]) {
if (this._items[currentIdx + 1] && this._items[currentIdx].parentOf(this._items[currentIdx + 1])) {
this._items[currentIdx + 1]._data.parent = newId;
}
},

View file

@ -113,6 +113,10 @@ L.Annotation = L.Layer.extend({
this._nodeReplyText.focus();
},
parentOf: function(comment) {
return this._data.id === comment._data.parent;
},
_createButton: function(container, value, handler) {
var button = L.DomUtil.create('input', 'loleaflet-controls', container);
button.type = 'button';