提交 ccb98c2c 编写于 作者: R Rob Lourens

Fix TOC items expanding on second settings editor open

上级 95e33c7a
......@@ -126,15 +126,23 @@ class TOCTreeDelegate implements IListVirtualDelegate<SettingsTreeElement> {
}
}
export function createTOCIterator(model: TOCTreeModel | SettingsTreeGroupElement): Iterator<ITreeElement<SettingsTreeGroupElement>> {
export function createTOCIterator(model: TOCTreeModel | SettingsTreeGroupElement, tree: TOCTree): Iterator<ITreeElement<SettingsTreeGroupElement>> {
const groupChildren = <SettingsTreeGroupElement[]>model.children.filter(c => c instanceof SettingsTreeGroupElement);
const groupsIt = Iterator.fromArray(groupChildren);
return Iterator.map(groupsIt, g => {
let nodeExists = true;
try { tree.getNode(g); } catch (e) { nodeExists = false; }
const hasGroupChildren = g.children.some(c => c instanceof SettingsTreeGroupElement);
return {
element: g,
collapsed: nodeExists ? undefined : true,
collapsible: hasGroupChildren,
children: g instanceof SettingsTreeGroupElement ?
createTOCIterator(g) :
createTOCIterator(g, tree) :
undefined
};
});
......
......@@ -967,7 +967,7 @@ export class SettingsEditor2 extends BaseEditor {
}
private refreshTOCTree(): void {
this.tocTree.setChildren(null, createTOCIterator(this.tocTreeModel));
this.tocTree.setChildren(null, createTOCIterator(this.tocTreeModel, this.tocTree));
}
private updateModifiedLabelForKey(key: string): void {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册