mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-13 18:37:07 +00:00
Only re-focus the reply link when reply is abandoned
Bug: T252903 Change-Id: Iabac3eb2258ecd48f61e027950446f59dca68df3
This commit is contained in:
parent
ba295c81dd
commit
09857e13f1
|
@ -241,7 +241,7 @@ CommentController.prototype.setupReplyWidget = function ( replyWidget, initialVa
|
||||||
this.replyWidget = replyWidget;
|
this.replyWidget = replyWidget;
|
||||||
};
|
};
|
||||||
|
|
||||||
CommentController.prototype.teardown = function () {
|
CommentController.prototype.teardown = function ( abandoned ) {
|
||||||
this.$replyLinkButtons.removeClass( 'dt-init-replylink-active' );
|
this.$replyLinkButtons.removeClass( 'dt-init-replylink-active' );
|
||||||
this.$pageContainer.removeClass( 'dt-init-replylink-open' );
|
this.$pageContainer.removeClass( 'dt-init-replylink-open' );
|
||||||
// eslint-disable-next-line no-jquery/no-global-selector
|
// eslint-disable-next-line no-jquery/no-global-selector
|
||||||
|
@ -255,7 +255,9 @@ CommentController.prototype.teardown = function () {
|
||||||
}
|
}
|
||||||
modifier.removeAddedListItem( this.newListItem );
|
modifier.removeAddedListItem( this.newListItem );
|
||||||
this.newListItem = null;
|
this.newListItem = null;
|
||||||
this.$replyLink.trigger( 'focus' );
|
if ( abandoned ) {
|
||||||
|
this.$replyLink.trigger( 'focus' );
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
CommentController.prototype.postReply = function ( parsoidData ) {
|
CommentController.prototype.postReply = function ( parsoidData ) {
|
||||||
|
|
|
@ -316,7 +316,7 @@ ReplyWidget.prototype.tryTeardown = function () {
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
promise.then( function () {
|
promise.then( function () {
|
||||||
widget.teardown();
|
widget.teardown( true );
|
||||||
} );
|
} );
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
@ -324,16 +324,17 @@ ReplyWidget.prototype.tryTeardown = function () {
|
||||||
/**
|
/**
|
||||||
* Teardown the widget
|
* Teardown the widget
|
||||||
*
|
*
|
||||||
|
* @param {boolean} [abandoned] Widget was torn down after a reply was abandoned
|
||||||
* @chainable
|
* @chainable
|
||||||
* @return {ReplyWidget}
|
* @return {ReplyWidget}
|
||||||
*/
|
*/
|
||||||
ReplyWidget.prototype.teardown = function () {
|
ReplyWidget.prototype.teardown = function ( abandoned ) {
|
||||||
this.unbindBeforeUnloadHandler();
|
this.unbindBeforeUnloadHandler();
|
||||||
this.clear();
|
this.clear();
|
||||||
this.storage.remove( this.storagePrefix + '/mode' );
|
this.storage.remove( this.storagePrefix + '/mode' );
|
||||||
this.storage.remove( this.storagePrefix + '/saveable' );
|
this.storage.remove( this.storagePrefix + '/saveable' );
|
||||||
this.$preview.empty();
|
this.$preview.empty();
|
||||||
this.emit( 'teardown' );
|
this.emit( 'teardown', abandoned );
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue