From 89ceede3bf3bfeee0a9db7870a33d63c57771cdb Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Fri, 20 Oct 2017 11:49:43 +0800 Subject: [PATCH] MDL-60458 Mathjax: Restore the accessible config Undo the changes to the accessible config that were introduced by the previous library upgrade. --- filter/mathjaxloader/db/upgrade.php | 28 ++++++++++++++++++++++++++ filter/mathjaxloader/readme_moodle.txt | 6 ------ filter/mathjaxloader/settings.php | 2 +- filter/mathjaxloader/version.php | 2 +- 4 files changed, 30 insertions(+), 8 deletions(-) diff --git a/filter/mathjaxloader/db/upgrade.php b/filter/mathjaxloader/db/upgrade.php index ef222ea505c..4dd40b1a26b 100644 --- a/filter/mathjaxloader/db/upgrade.php +++ b/filter/mathjaxloader/db/upgrade.php @@ -169,5 +169,33 @@ MathJax.Hub.Config({ upgrade_plugin_savepoint(true, 2017101200, 'filter', 'mathjaxloader'); } + if ($oldversion < 2017102000) { + // Re-add Accessible.js (we should not have removed it). + $previousdefault = ' +MathJax.Hub.Config({ + config: ["default.js", "MMLorHTML.js", "Safe.js"], + errorSettings: { message: ["!"] }, + skipStartupTypeset: true, + messageStyle: "none" +}); +'; + $newdefault = ' +MathJax.Hub.Config({ + config: ["Accessible.js", "Safe.js"], + errorSettings: { message: ["!"] }, + skipStartupTypeset: true, + messageStyle: "none" +}); +'; + + $mathjaxconfig = get_config('filter_mathjaxloader', 'mathjaxconfig'); + + if (empty($mathjaxconfig) || filter_mathjaxloader_upgrade_mathjaxconfig_equal($mathjaxconfig, $previousdefault)) { + set_config('mathjaxconfig', $newdefault, 'filter_mathjaxloader'); + } + + upgrade_plugin_savepoint(true, 2017102000, 'filter', 'mathjaxloader'); + } + return true; } diff --git a/filter/mathjaxloader/readme_moodle.txt b/filter/mathjaxloader/readme_moodle.txt index e7e666f1095..055a986e8b6 100644 --- a/filter/mathjaxloader/readme_moodle.txt +++ b/filter/mathjaxloader/readme_moodle.txt @@ -18,9 +18,3 @@ Upgrading the default MathJax version 3. Check and eventually update the list of language mappings in filter.php. Also see the unit test for the language mappings. -Changes -------- - -* The MathJax 2.7.2 seems to have a bug causing the accessibility extensions - fail in web apps using RequireJS (such as Moodle). We had to stop using the - Accessible.js config for that reason. See MDL-60209 for details. diff --git a/filter/mathjaxloader/settings.php b/filter/mathjaxloader/settings.php index 783282b997a..a911788d89b 100644 --- a/filter/mathjaxloader/settings.php +++ b/filter/mathjaxloader/settings.php @@ -45,7 +45,7 @@ if ($ADMIN->fulltree) { $default = ' MathJax.Hub.Config({ - config: ["default.js", "MMLorHTML.js", "Safe.js"], + config: ["Accessible.js", "Safe.js"], errorSettings: { message: ["!"] }, skipStartupTypeset: true, messageStyle: "none" diff --git a/filter/mathjaxloader/version.php b/filter/mathjaxloader/version.php index d8213c89599..23907d72810 100644 --- a/filter/mathjaxloader/version.php +++ b/filter/mathjaxloader/version.php @@ -24,6 +24,6 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2017101200; +$plugin->version = 2017102000; $plugin->requires = 2017050500; // Requires this Moodle version. $plugin->component= 'filter_mathjaxloader';