Collapse advanced drawer when clearing

Bug: T263061
Change-Id: Ibcd95ce1c86548962b9b7ff7b62bd0d127f53b76
This commit is contained in:
Ed Sanders 2020-09-21 20:52:47 +01:00
parent e91f466115
commit e6b91ced43
2 changed files with 13 additions and 2 deletions

View file

@ -243,11 +243,19 @@ ReplyWidget.prototype.isEmpty = null;
ReplyWidget.prototype.getMode = null;
/**
* Restore the widget to its original state
*
* Clear any widget values, reset UI states, and clear
* any auto-save values.
*/
ReplyWidget.prototype.clear = function () {
if ( this.errorMessage ) {
this.errorMessage.$element.remove();
}
this.$preview.empty();
this.toggleAdvanced( false );
this.storage.remove( this.storagePrefix + '/mode' );
this.storage.remove( this.storagePrefix + '/saveable' );
this.storage.remove( this.storagePrefix + '/summary' );

View file

@ -126,8 +126,11 @@ ReplyWidgetVisual.prototype.teardown = function () {
ReplyWidgetVisual.prototype.focus = function () {
var targetWidget = this.replyBodyWidget;
setTimeout( function () {
targetWidget.getSurface().getModel().selectLastContentOffset();
targetWidget.focus();
// Check surface still exists after timeout
if ( targetWidget.getSurface() ) {
targetWidget.getSurface().getModel().selectLastContentOffset();
targetWidget.focus();
}
} );
return this;