Commit 99b8e799 authored by Robert Lyon's avatar Robert Lyon

Making adjustments to the mathslate plugin for mahara (Bug #1472446)

1) Adding it to the tinymce if MathJax is enabled
2) Converting the uppercase Greek letters that have equivalents in standard alphabet
to those letters as MathJax doesn't adjust them

Change-Id: Ic7a524245f9602f0b2c78dc084a022a2fd3cb7c7
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 325cdfac
......@@ -209,6 +209,9 @@ function formError(form, data) {
scrollTo(0, 0);
}
function formSuccess(form, data) {
if (config.mathjax) {
MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
}
var yayMsg = DIV({'id': 'messages'}, makeMessage(data.message, 'ok'));
swapDOM('messages', yayMsg);
scrollTo(0, 0);
......
......@@ -6,5 +6,5 @@ Version: 1.1
Changes:
* None
* Adjusting the config.json options for uppercase Greek letters
......@@ -64,28 +64,28 @@
["mi",{"tex":["\\psi "],"am":[" psi "]},"ψ"],
["mi",{"tex":["\\omega "],"am":[" omega "]},"ω"],
["br",{}],
["mi",{"tex":["\\Alpha "],"am":[" Alpha "]},"\u0391"],
["mi",{"tex":["\\Beta "],"am":[" Beta "]},"\u0392"],
["mi",{"tex":["A"],"am":[" Alpha "]},"\u0391"],
["mi",{"tex":["B"],"am":[" Beta "]},"\u0392"],
["mi",{"tex":["\\Gamma "],"am":[" Gamma "]},"\u0393"],
["mi",{"tex":["\\Delta "],"am":[" Delta "]},"\u0394"],
["mi",{"tex":["\\Epsilon "],"am":[" Epsilon "]},"\u0395"],
["mi",{"tex":["\\Zeta "],"am":[" Zeta "]},"\u0396"],
["mi",{"tex":["\\Eta "],"am":[" Eta "]},"\u0397"],
["mi",{"tex":["E"],"am":[" Epsilon "]},"\u0395"],
["mi",{"tex":["Z"],"am":[" Zeta "]},"\u0396"],
["mi",{"tex":["H"],"am":[" Eta "]},"\u0397"],
["mi",{"tex":["\\Theta "],"am":[" Theta "]},"\u0398"],
["mi",{"tex":["\\Iota "],"am":[" Iota "]},"\u0399"],
["mi",{"tex":["\\Kappa "],"am":[" Kappa "]},"\u039A"],
["mi",{"tex":["I"],"am":[" Iota "]},"\u0399"],
["mi",{"tex":["K"],"am":[" Kappa "]},"\u039A"],
["mi",{"tex":["\\Lambda "],"am":[" Lambda "]},"\u039B"],
["mi",{"tex":["\\Mu "],"am":[" Mu "]},"\u039C"],
["mi",{"tex":["\\Nu "],"am":[" Nu "]},"\u039D"],
["mi",{"tex":["M"],"am":[" Mu "]},"\u039C"],
["mi",{"tex":["N"],"am":[" Nu "]},"\u039D"],
["mi",{"tex":["\\Xi "],"am":[" Xi "]},"\u039E"],
["mi",{"tex":["\\Omicron "],"am":[" Omicron "]},"\u039F"],
["mi",{"tex":["O"],"am":[" Omicron "]},"\u039F"],
["mi",{"tex":["\\Pi "],"am":[" Pi "]},"\u03A0"],
["mi",{"tex":["\\Rho "],"am":[" Rho "]},"\u03A1"],
["mi",{"tex":["P"],"am":[" Rho "]},"\u03A1"],
["mi",{"tex":["\\Sigma "],"am":[" Sigma "]},"\u03A3"],
["mi",{"tex":["\\Tau "],"am":[" Tau "]},"\u03A4"],
["mi",{"tex":["T"],"am":[" Tau "]},"\u03A4"],
["mi",{"tex":["\\Upsilon "],"am":[" Upsilon "]},"\u03A5"],
["mi",{"tex":["\\Phi "],"am":[" Phi "]},"\u03A6"],
["mi",{"tex":["\\Chi "],"am":[" Chi "]},"\u03A7"],
["mi",{"tex":["X"],"am":[" Chi "]},"\u03A7"],
["mi",{"tex":["\\Psi "],"am":[" Psi "]},"\u03A8"],
["mi",{"tex":["\\Omega "],"am":[" Omega "]},"\u03A9"],
["br",{}],
......
......@@ -250,11 +250,13 @@ function smarty($javascript = array(), $headers = array(), $pagestrings = array(
$spellchecker = $spellchecker_toolbar = '';
$spellchecker_config = 'gecko_spellcheck : true,';
}
$mathslate = (get_config('mathjax')) ? 'mathslate' : '';
$mathslateplugin = !empty($mathslate) ? ',' . $mathslate : '';
$toolbar = array(
null,
'"toolbar_toggle | formatselect | bold italic | bullist numlist | link unlink | imagebrowser | undo redo"',
'"underline strikethrough subscript superscript | alignleft aligncenter alignright alignjustify | outdent indent | forecolor backcolor | ltr rtl | fullscreen"',
'"fontselect | fontsizeselect | emoticons nonbreaking charmap ' . $spellchecker_toolbar . ' | table | removeformat pastetext | code"',
'"fontselect | fontsizeselect | emoticons nonbreaking charmap ' . $mathslate . ' ' . $spellchecker_toolbar . ' | table | removeformat pastetext | code"',
);
// For right-to-left langs, reverse button order & align controls right.
......@@ -268,7 +270,7 @@ function smarty($javascript = array(), $headers = array(), $pagestrings = array(
if ($check[$key] == 'tinymce') {
$tinymceconfig = <<<EOF
theme: "modern",
plugins: "tooltoggle,textcolor,visualblocks,wordcount,link,imagebrowser,table,emoticons{$spellchecker},paste,code,fullscreen,directionality,searchreplace,nonbreaking,charmap",
plugins: "tooltoggle,textcolor,visualblocks,wordcount,link,imagebrowser,table,emoticons{$spellchecker},paste,code,fullscreen,directionality,searchreplace,nonbreaking,charmap{$mathslateplugin}",
skin: 'light',
toolbar1: {$toolbar[1]},
toolbar2: {$toolbar[2]},
......
@javascript @core @core_administration
Feature: TinyMCE mathslate plugin
In order to view mathslate plugin
As an admin
I need to be able to access mathslate in Tinymce
Scenario: Making adjustments to the mathslate plugin for mahara (Bug 1472446)
Given I log in as "admin" with password "Kupuhipa1"
And I follow "Administration"
And I follow "Configure site"
And I follow "General settings"
And I wait "10" seconds
And I set the following fields to these values:
| Enable MathJax | 1 |
And I press "Update site options"
And I should see "Site options have been updated."
And I choose "Pages" in "Configure site"
And I press "Create page"
And I set the following fields to these values:
| Page title | test |
| Page description | testing |
And I press "Save"
And I should see "Page saved successfully"
And I wait "1" seconds
And I choose "Pages" in "Configure site"
And I follow "test"
# Tinymce field adding a math equation
And I fill in "\\[\\alpha A\\beta B\\]" in WYSIWYG editor "add_feedback_form_message_ifr"
And I press "Comment"
And I wait "1" seconds
And I should see "αAβB"
And I should see "Feedback submitted"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment