Skip to content

Commit

Permalink
added option to allow_reselect
Browse files Browse the repository at this point in the history
  • Loading branch information
vakata committed Sep 19, 2023
1 parent 8c1bcc8 commit 17eaa64
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/jstree.js
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,12 @@
e.preventDefault();
this.edit(e.currentTarget);
}
}
},
/**
* Should reselecting an already selected node trigger the select and changed callbacks
* @name $.jstree.defaults.core.allow_reselect
*/
allow_reselect : false
};
$.jstree.core.prototype = {
/**
Expand Down Expand Up @@ -3172,7 +3177,7 @@
this.deselect_node(obj, false, e);
}
else {
if (!this.is_selected(obj) || this._data.core.selected.length !== 1) {
if (this.settings.core.allow_reselect || !this.is_selected(obj) || this._data.core.selected.length !== 1) {
this.deselect_all(true);
this.select_node(obj, false, false, e);
}
Expand Down

0 comments on commit 17eaa64

Please sign in to comment.