TheDJ has uploaded a new change for review.

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

Change subject: LivePreview: Use setTimeout to delay rendering of MathJax
......................................................................

LivePreview: Use setTimeout to delay rendering of MathJax

wikipage.content hook is fired before the new content is attached, but
MathJax cannot deal with that. Use setTimeout to delay execution until
next execution run.

Bug: T90808
Change-Id: I02178bfd61d34dff49435f3a17a0ce385b37d14d
---
M modules/ext.math.mathjax.enabler.js
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math 
refs/changes/70/193270/1

diff --git a/modules/ext.math.mathjax.enabler.js 
b/modules/ext.math.mathjax.enabler.js
index 47cdf8a..5e3b1d6 100644
--- a/modules/ext.math.mathjax.enabler.js
+++ b/modules/ext.math.mathjax.enabler.js
@@ -225,7 +225,8 @@
                }
 
                if ( MathJax.isReady ) {
-                       render();
+                       // Call render asynchronous because live preview fires 
the hook with detached $content.
+                       setTimeout( render );
                } else {
                        mw.loader.using( 'ext.math.mathjax.mathjax', function 
() {
                                MathJax.Hub.Startup.signal.MessageHook( 'End', 
render );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I02178bfd61d34dff49435f3a17a0ce385b37d14d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Math
Gerrit-Branch: master
Gerrit-Owner: TheDJ <hartman.w...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to