Handle expanding maxVisibleChilds if needed with undo/redo

This commit is contained in:
jos 2018-05-12 17:23:21 +02:00
parent 8dff972dce
commit 53a49107d0
2 changed files with 12 additions and 5 deletions

View File

@ -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);
}
};

View File

@ -1130,6 +1130,7 @@ treemode.select = function (nodes) {
var first = nodes[0];
nodes.forEach(function (node) {
node.expandPathToNode();
node.setSelected(true, node === first);
});