mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-27 17:51:09 +00:00
Fix re-initialization after page is updated
I did this wrong in a6147ffac8
, the
'dt-init-done' class was never cleared. Put it on another element.
Bug: T241861
Change-Id: I136bd9c12bcc80cff01f5d26a8a53524f0c533c6
This commit is contained in:
parent
d7aded339c
commit
25eb55000f
|
@ -10,11 +10,13 @@ if ( new mw.Uri().query.dtdebug ) {
|
|||
mw.loader.load( 'ext.discussionTools.debug' );
|
||||
} else {
|
||||
mw.hook( 'wikipage.content' ).add( function ( $container ) {
|
||||
// Don't re-run if we already handled this element
|
||||
if ( $container.closest( '.dt-init-done' ).length === 0 ) {
|
||||
$container.find( '#mw-content-text' ).addBack( '#mw-content-text' ).each( function () {
|
||||
controller.init( $( this ) );
|
||||
} );
|
||||
}
|
||||
$container.find( '.mw-parser-output' ).each( function () {
|
||||
var $node = $( this );
|
||||
// Don't re-run if we already handled this element
|
||||
// eslint-disable-next-line no-jquery/no-class-state
|
||||
if ( !$node.hasClass( 'dt-init-done' ) ) {
|
||||
controller.init( $node );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
}
|
||||
|
|
|
@ -243,7 +243,7 @@ ReplyWidget.prototype.onReplyClick = function () {
|
|||
// (see ve.init.mw.DesktopArticleTarget.prototype.replacePageContent)
|
||||
|
||||
// Re-initialize
|
||||
controller.init( $container, {
|
||||
controller.init( $container.find( '.mw-parser-output' ), {
|
||||
repliedTo: repliedTo
|
||||
} );
|
||||
mw.hook( 'wikipage.content' ).fire( $container );
|
||||
|
|
Loading…
Reference in a new issue