mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/WikiEditor
synced 2024-11-23 15:57:15 +00:00
Realtime Preview: also trigger on form.reset()
If the form is reset, make sure that the preview is re-run. There isn't actually any reset button in the normal edit form, but Edit Recovery uses reset() to remove any recovered data, and if RTP is open when that's done the preview needs to be updated. Bug: T351821 Depends-On: I1ec757d5ddd9f0db66496c6aaef70747d93a5c83 Change-Id: I30481edae4c071e8586ac1dc7d587bd550965967
This commit is contained in:
parent
3bf5db1857
commit
f1bcbe75c3
|
@ -158,6 +158,7 @@ RealtimePreview.prototype.saveUserPref = function () {
|
|||
RealtimePreview.prototype.toggle = function ( saveUserPref ) {
|
||||
var $uiText = this.context.$ui.find( '.wikiEditor-ui-text' );
|
||||
var $textarea = this.context.$textarea;
|
||||
var $form = $textarea.parents( 'form' );
|
||||
|
||||
// Save the current cursor selection and focused element.
|
||||
var cursorPos = $textarea.textSelection( 'getCaretPosition', { startAndEnd: true } );
|
||||
|
@ -174,6 +175,7 @@ RealtimePreview.prototype.toggle = function ( saveUserPref ) {
|
|||
|
||||
// Remove the keyup handler.
|
||||
$textarea.off( this.eventNames );
|
||||
$form.off( 'reset.realtimepreview' );
|
||||
|
||||
// Let other things happen after disabling.
|
||||
mw.hook( 'ext.WikiEditor.realtimepreview.disable' ).fire( this );
|
||||
|
@ -194,6 +196,8 @@ RealtimePreview.prototype.toggle = function ( saveUserPref ) {
|
|||
$textarea
|
||||
.off( this.eventNames )
|
||||
.on( this.eventNames, this.getEventHandler() );
|
||||
$form.off( 'reset.realtimepreview' )
|
||||
.on( 'reset.realtimepreview', this.getEventHandler() );
|
||||
|
||||
// Hide or show the manual-reload message bar.
|
||||
this.manualWidget.toggle( this.inManualMode );
|
||||
|
|
Loading…
Reference in a new issue