mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-12 09:27:36 +00:00
Re-add event listeners to images after a finished VE edit
Currently, if VisualEditor saved an edit, it replaces the current content with the new content, which removes all already added event listeners, e.g. on thumbs, added by MMV. Add a new hook handler to the postEdit JavaScript hook to re-add all event handlers to the thumb images to cover this case and enable MMV on a page after a finished VE edit. Bug: T97010 Change-Id: Ic1ee0b52265363978640358510cab89db4de2bb8
This commit is contained in:
parent
5541d11b88
commit
7b50d14a8e
|
@ -61,9 +61,13 @@
|
|||
|
||||
this.thumbsReadyDeferred = $.Deferred();
|
||||
this.thumbs = [];
|
||||
this.$thumbs = null; // will be set by processThumbs
|
||||
|
||||
this.$thumbs = $( '.gallery .image img, a.image img, #file a img' );
|
||||
// find and setup all thumbs on this page
|
||||
this.processThumbs();
|
||||
// repeat this, if the page has changed, e.g. because of a
|
||||
// finished VisualEditor edit.
|
||||
mw.hook( 'postEdit' ).add( $.proxy( this, 'processThumbs' ) );
|
||||
|
||||
this.browserHistory = window.history;
|
||||
}
|
||||
|
@ -145,6 +149,8 @@
|
|||
MMVB.processThumbs = function () {
|
||||
var bs = this;
|
||||
|
||||
this.$thumbs = $( '.gallery .image img, a.image img, #file a img' );
|
||||
|
||||
// if this breaks in IE8, see https://github.com/ebryn/backburner.js/pull/50
|
||||
// but it probably won't since there is a catch further up the chain
|
||||
try {
|
||||
|
|
Loading…
Reference in a new issue