From c0e66df6cc5f0a9fdb0dbb44e3e0d7a52c428bc6 Mon Sep 17 00:00:00 2001 From: Harry Huang Date: Thu, 19 Dec 2024 14:28:54 +0800 Subject: [PATCH] fix(view): fix pjax support for mathjax --- source/js/pjax.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/source/js/pjax.js b/source/js/pjax.js index 19d752ee3..5e6e9a419 100644 --- a/source/js/pjax.js +++ b/source/js/pjax.js @@ -32,11 +32,18 @@ // // TODO pace start loading animation // }) - // // Listen for completion of Pjax - // document.addEventListener('pjax:complete', function() { - // return; - // // TODO pace stop loading animation - // }) + // Listen for completion of Pjax + document.addEventListener('pjax:complete', () => { + // MathJax reload logic + if (window.MathJax) { + try { + window.MathJax.typesetPromise && window.MathJax.typesetPromise(); + } catch (e) { + console.error('MathJax reload error:', e); + } + } + // TODO pace stop loading animation + }); document.addEventListener('DOMContentLoaded', () => initPjax()); }());