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