Rearrange done and cancel buttons and dispose dialogs correctly (#1420)

This commit is contained in:
Matt Irvine
2018-05-15 15:39:27 -07:00
committed by GitHub
parent 078f3a2b54
commit 1a9f72dfe0
3 changed files with 7 additions and 9 deletions

View File

@@ -66,12 +66,10 @@ export class DialogModal extends Modal {
});
}
this._cancelButton = this.addDialogButton(this._dialog.cancelButton, () => this.cancel(), false);
this.updateButtonElement(this._cancelButton, this._dialog.cancelButton);
this._dialog.cancelButton.registerClickEvent(this._onCancel.event);
this._doneButton = this.addDialogButton(this._dialog.okButton, () => this.done(), false);
this.updateButtonElement(this._doneButton, this._dialog.okButton);
this._dialog.okButton.registerClickEvent(this._onDone.event);
this._cancelButton = this.addDialogButton(this._dialog.cancelButton, () => this.cancel(), false);
this._dialog.cancelButton.registerClickEvent(this._onCancel.event);
}
private addDialogButton(button: DialogButton, onSelect: () => void = () => undefined, registerClickEvent: boolean = true): Button {
@@ -84,6 +82,7 @@ export class DialogModal extends Modal {
this.updateButtonElement(buttonElement, button);
});
attachButtonStyler(buttonElement, this._themeService);
this.updateButtonElement(buttonElement, button);
return buttonElement;
}