提交 1fb84276 编写于 作者: B Benjamin Pasero

Revert "fixes #3294"

This reverts commit 16a8d1d1.
上级 0af2119b
......@@ -808,7 +808,7 @@ export class TreeModel extends Events.EventEmitter {
this.addEmitter2(this.registry),
this.registry.addListener2('item:dispose', (event: IItemDisposeEvent) => {
event.item.getAllTraits()
.forEach(trait => this.removeTraits(trait, [event.item]));
.forEach(trait => delete this.traitsToItems[trait][event.item.id]);
})
);
......@@ -1126,6 +1126,8 @@ export class TreeModel extends Events.EventEmitter {
public setFocus(element?: any, eventPayload?: any): void {
this.setTraits('focused', element ? [element] : []);
var eventData: _.IFocusEvent = { focus: this.getFocus(), payload: eventPayload };
this.emit('focus', eventData);
}
public isFocused(element: any): boolean {
......
......@@ -330,10 +330,6 @@ export class ViewItem implements IViewItem {
this.row = null;
}
hasDOMFocus(): boolean {
return this.row && this.row.element && DOM.isAncestor(document.activeElement, this.row.element);
}
public dispose(): void {
this.row = null;
this.model = null;
......@@ -728,6 +724,9 @@ export class TreeView extends HeightMap implements IScrollable {
case 'item:removeTrait':
this.onItemRemoveTrait(data);
break;
case 'focus':
this.onModelFocusChange();
break;
}
}
......@@ -1072,10 +1071,6 @@ export class TreeView extends HeightMap implements IScrollable {
}
}
}
if (e.trait === 'focused') {
setTimeout(() => this.onModelFocusChange());
}
}
private onItemRemoveTrait(e:Model.IItemTraitEvent): void {
......@@ -1094,10 +1089,6 @@ export class TreeView extends HeightMap implements IScrollable {
}
delete this.highlightedItemWasDraggable;
}
if (e.trait === 'focused') {
setTimeout(() => this.onModelFocusChange());
}
}
private onModelFocusChange(): void {
......@@ -1610,10 +1601,6 @@ export class TreeView extends HeightMap implements IScrollable {
}
private removeItemFromDOM(item: ViewItem): void {
if (item.hasDOMFocus()) {
this.focus();
}
item.removeFromDOM();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册