Handle expanding maxVisibleChilds if needed with undo/redo
This commit is contained in:
parent
8dff972dce
commit
53a49107d0
|
@ -873,7 +873,17 @@ Node.prototype.search = function(text) {
|
|||
* @param {function(boolean)} [callback]
|
||||
*/
|
||||
Node.prototype.scrollTo = function(callback) {
|
||||
// if the node is not visible, expand its parents
|
||||
this.expandPathToNode();
|
||||
|
||||
if (this.dom.tr && this.dom.tr.parentNode) {
|
||||
this.editor.scrollTo(this.dom.tr.offsetTop, callback);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* if the node is not visible, expand its parents
|
||||
*/
|
||||
Node.prototype.expandPathToNode = function () {
|
||||
var node = this;
|
||||
var recurse = false;
|
||||
while (node && node.parent) {
|
||||
|
@ -889,10 +899,6 @@ Node.prototype.scrollTo = function(callback) {
|
|||
node.parent.expand(recurse);
|
||||
node = node.parent;
|
||||
}
|
||||
|
||||
if (this.dom.tr && this.dom.tr.parentNode) {
|
||||
this.editor.scrollTo(this.dom.tr.offsetTop, callback);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1130,6 +1130,7 @@ treemode.select = function (nodes) {
|
|||
|
||||
var first = nodes[0];
|
||||
nodes.forEach(function (node) {
|
||||
node.expandPathToNode();
|
||||
node.setSelected(true, node === first);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue