Krinkle has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/74314


Change subject: mediawiki.action.edit.preview: Fire "wikipage.content" mw.hook
......................................................................

mediawiki.action.edit.preview: Fire "wikipage.content" mw.hook

The mw.hook framework was added in 2e97025 and it also added
an example event ("wikipage.content") but this was never
actually fired anywhere other than for the initial load.

This will finally make things like jquery.tablesorter and
jquery.makeCollapsible work in live preview.

Also:

* Deprecate non-standard jQuery events triggered on jQuery
  wrapper around the "mw" object.

Bug: 33399
Change-Id: Ic516b3a01b4c1510cbe5f2de2998ad8275ecc607
---
M RELEASE-NOTES-1.22
M resources/mediawiki.action/mediawiki.action.edit.preview.js
2 files changed, 11 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/14/74314/1

diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22
index bcead8a..8d372c9 100644
--- a/RELEASE-NOTES-1.22
+++ b/RELEASE-NOTES-1.22
@@ -203,6 +203,8 @@
 * Special:Listfiles can no longer be sorted by image name when filtering
   by user in miser mode.
 * (bug 49074) CSSJanus: Handle values of border-radius correctly.
+* (bug 33399) LivePreview: Re-run wikipage content handlers
+  (jquery.makeCollapsible, jquery.tablesorter) after preview content is loaded.
 
 === API changes in 1.22 ===
 * (bug 25553) The JSON output formatter now leaves forward slashes unescaped
@@ -330,6 +332,8 @@
 * (bug 50785) A "null edit", that is, a save action in which no changes to the
   page text are made and no revision recorded, will no longer send refreshLinks
   jobs to the job table to update pages which use the edited page as a 
template.
+* The LivePreviewPrepare and LivePreviewDone events triggered on "jQuery( mw )"
+  have been deprecated in favour of using mw.hook.
 
 == Compatibility ==
 
diff --git a/resources/mediawiki.action/mediawiki.action.edit.preview.js 
b/resources/mediawiki.action/mediawiki.action.edit.preview.js
index 602aadb..bf0d99b 100644
--- a/resources/mediawiki.action/mediawiki.action.edit.preview.js
+++ b/resources/mediawiki.action/mediawiki.action.edit.preview.js
@@ -12,6 +12,7 @@
 
                e.preventDefault();
 
+               // Deprecated: Use mw.hook instead
                $( mw ).trigger( 'LivePreviewPrepare' );
 
                $wikiPreview = $( '#wikiPreview' );
@@ -78,7 +79,7 @@
 
                // Load new preview data.
                // TODO: This should use the action=parse API instead of 
loading the entire page
-               // Though that requires figuring out how to conver that raw 
data into proper HTML.
+               // Though that requires figuring out how to convert that raw 
data into proper HTML.
                $previewDataHolder.load( targetUrl + ' ' + copySelectors.join( 
',' ), postData, function () {
                        var i, $from;
                        // Copy the contents of the specified elements from the 
loaded page to the real page.
@@ -92,12 +93,15 @@
                                        .attr( 'class', $from.attr( 'class' ) );
                        }
 
+                       // Deprecated: Use mw.hook instead
+                       $( mw ).trigger( 'LivePreviewDone', [copySelectors] );
+
+                       mw.hook( 'wikipage.content' ).fire( $wikiPreview );
+
                        $spinner.remove();
                        $copyElements.animate( {
                                opacity: 1
                        }, 'fast' );
-
-                       $( mw ).trigger( 'LivePreviewDone', [copySelectors] );
                } );
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/74314
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic516b3a01b4c1510cbe5f2de2998ad8275ecc607
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to