Skip to content

Commit

Permalink
3.63.1.1322
Browse files Browse the repository at this point in the history
 Stable version
  • Loading branch information
mcagigas-at-wiris committed Dec 16, 2016
1 parent 1737246 commit 87a8b18
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 27 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
WIRIS plugin for Moodle
==========
[![Build Status](https://travis-ci.org/wiris/moodle-atto_wiris.svg?branch=master)](https://travis-ci.org/wiris/moodle-atto_wiris)


Add a fully WYSIWYG editor for scientific expressions ([WIRIS EDITOR](http://www.wiris.com/editor)) and, optionally, an advanced calculator tool ([WIRIS CAS](http://www.wiris.com/cas)). Enabled editing to STEM related topics (Science, Technology, Engineering and Mathematics).

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.62.1.1322
3.63.1.1322
24 changes: 19 additions & 5 deletions core/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ var _wrs_temporalImage;
var _wrs_temporalFocusElement;
var _wrs_androidRange;
var _wrs_iosRange;
// We need to keep the main window height scroll value to restore it
// when we close a modalwindow.
var _wrs_mainwindow_scroll;
// We need a variable to send device properties to editor.js on modal mode.
var _wrs_deviceProperties = {}
// Dragable options.
Expand Down Expand Up @@ -593,8 +596,7 @@ function wrs_endParseEditMode(code, wirisProperties, language) {
if (latex.indexOf('<') == -1) {
latex = wrs_htmlentitiesDecode(latex);
var mathml = wrs_getMathMLFromLatex(latex, true);
var imgObject = wrs_mathmlToImgObject(document, mathml, wirisProperties, language);
output += wrs_createObjectCode(imgObject);
output += mathml;
endPosition += 2;
}
else {
Expand Down Expand Up @@ -978,6 +980,8 @@ function wrs_getMathMLFromLatex(latex, includeLatexOnSemantics) {
}

var mathML = wrs_getContent(_wrs_conf_servicePath, data);
// Populate LatexCache.
wrs_populateLatexCache(latex, mathML);
return mathML.split("\r").join('').split("\n").join(' ');
}

Expand Down Expand Up @@ -1160,7 +1164,7 @@ function wrs_getWIRISImageOutput(imgCode, convertToXml, convertToSafeXml) {
var imgObject = wrs_createObject(imgCode);

if (imgObject) {
if (imgObject.className == _wrs_conf_imageClassName) {
if (imgObject.className == _wrs_conf_imageClassName || imgObject.getAttribute(_wrs_conf_imageMathmlAttribute)) {
if (!convertToXml) {
return imgCode;
}
Expand Down Expand Up @@ -1671,6 +1675,11 @@ function wrs_mathmlEncode(input) {
input = input.split(_wrs_xmlCharacters.ampersand).join(_wrs_safeXmlCharacters.ampersand);
input = input.split(_wrs_xmlCharacters.quote).join(_wrs_safeXmlCharacters.quote);

// Transform "<" --> "&lt;".
// Transform ">" --> "&gt;".
input = input.split(_wrs_safeXmlCharacters.doubleQuote + _wrs_safeXmlCharacters.tagOpener + _wrs_safeXmlCharacters.doubleQuote).join(_wrs_safeXmlCharacters.doubleQuote + "&lt;" + _wrs_safeXmlCharacters.doubleQuote);
input = input.split(_wrs_safeXmlCharacters.doubleQuote + _wrs_safeXmlCharacters.tagCloser + _wrs_safeXmlCharacters.doubleQuote).join(_wrs_safeXmlCharacters.doubleQuote + "&gt;" + _wrs_safeXmlCharacters.doubleQuote);

return input;
}

Expand Down Expand Up @@ -2627,7 +2636,8 @@ if (typeof _wrs_conf_configuration_loaded == 'undefined') {
*/

function wrs_createModalWindow(title, iframeParams, deviceProperties, modalProperties) {

// Keep the scroll to restore when the modal window is closed.
_wrs_mainwindow_scroll = window.scrollY;
// Adding css stylesheet.
var fileref = document.createElement("link");
fileref.setAttribute("rel", "stylesheet");
Expand Down Expand Up @@ -2997,7 +3007,11 @@ function wrs_closeModalWindow() {
if (document.querySelector('meta[name=viewport]')) {
document.querySelector('meta[name=viewport]').content = "";
}
document.body.className = document.body.className != 'wrs_modal_open' ? document.body.className.replace(' wrs_modal_open', '') : document.body.className = ""

// Due to this line, the scroll is set to 0 on the main window, so that we need to restore it with the previous value.
document.body.className = document.body.className != 'wrs_modal_open' ? document.body.className.replace(' wrs_modal_open', '') : document.body.className = "";
window.scrollTo(0, _wrs_mainwindow_scroll);

var modalDiv = document.getElementsByClassName('wrs_modal_overlay')[0];
closeFunction = document.body.removeChild(modalDiv);
}
Expand Down
5 changes: 5 additions & 0 deletions core/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,11 @@ var _wrs_isNewElement; // Unfortunately we need this variabels as global variabl
else {
mathml = wrs_mathmlDecode(_wrs_temporalImageAttribute);
}
if (wrs_int_getCustomEditorEnabled() == null && mathml.indexOf('class="wrs_') != -1) {
var classIndexStart = mathml.indexOf('class="wrs_');
classIndexEnd = mathml.indexOf(" ", classIndexStart);
mathml = mathml.substring(0, classIndexStart) + mathml.substring(classIndexEnd, mathml.lenght);
}

editor.setMathML(mathml);
}
Expand Down
6 changes: 3 additions & 3 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2016111700;
$plugin->release = '3.62.1.1322';
$plugin->version = 2016121600;
$plugin->release = '3.63.1.1322';
$plugin->requires = 2014050800;
$plugin->component = 'atto_wiris';
$plugin->dependencies = array ('filter_wiris' => 2016111700);
$plugin->dependencies = array ('filter_wiris' => 2016121600);
$plugin->maturity = MATURITY_STABLE;
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Y.namespace('M.atto_wiris').Button = Y.Base.create('button', Y.M.editor_atto.Edi
* The current language.
* **/
_lang: 'en',

/**
* Initialization function.
*
Expand Down Expand Up @@ -84,13 +85,19 @@ Y.namespace('M.atto_wiris').Button = Y.Base.create('button', Y.M.editor_atto.Edi
window._wrs_int_path = window._wrs_int_conf_file.split("/");
window._wrs_int_path.pop();
window._wrs_int_path = window._wrs_int_path.join("/");
window._wrs_int_path = window._wrs_int_path.indexOf("/") == 0 || window._wrs_int_path.indexOf("http") == 0 ? window._wrs_int_path : window._wrs_int_conf_path + "/" + window._wrs_int_path;
window._wrs_int_path = window._wrs_int_path.indexOf("/") === 0 || window._wrs_int_path.indexOf("http") === 0 ? window._wrs_int_path : window._wrs_int_conf_path + "/" + window._wrs_int_path;

// Moodle.
window._wrs_isMoodle24 = true;

// Custom editors.
window._wrs_int_customEditors = {chemistry : {name: 'Chemistry', toolbar : 'chemistry', icon : 'chem.gif', enabled : false, confVariable : '_wrs_conf_chemEnabled'}}
window._wrs_int_customEditors = {
chemistry : {
name: 'Chemistry',
toolbar : 'chemistry',
icon : 'chem.gif',
enabled : false,
confVariable : '_wrs_conf_chemEnabled'}};

// Load WIRIS plugin core javascript file only once.
if (!window._wrs_int_coreLoading) {
Expand Down Expand Up @@ -137,7 +144,7 @@ Y.namespace('M.atto_wiris').Button = Y.Base.create('button', Y.M.editor_atto.Edi
callback: this._editorButton
});
}
if (window[_wrs_int_customEditors['chemistry'].confVariable]) {
if (window[_wrs_int_customEditors.chemistry.confVariable]) {
this.addButton({
title: 'wiris_chem_editor_title',
buttonName: 'wiris_chem_editor',
Expand Down Expand Up @@ -240,11 +247,12 @@ Y.namespace('M.atto_wiris').Button = Y.Base.create('button', Y.M.editor_atto.Edi
* Doubleclick event for Wiris images on editable div.
*/
_handleElementDoubleclick: function(target, element, event){
if (typeof _wrs_conf_imageClassName != 'undefined' && wrs_containsClass(element, _wrs_conf_imageClassName)) {
if (element.dataset.mathml) {
event.stopPropagation();
window._wrs_temporalImage = element;
window._wrs_isNewElement = false;
if (customEditor = window._wrs_temporalImage.getAttribute('data-custom-editor')) {
var customEditor = window._wrs_temporalImage.getAttribute('data-custom-editor');
if (typeof(customEditor) != 'undefined' && customEditor){
if (window[_wrs_int_customEditors[customEditor].confVariable]) {
wrs_int_enableCustomEditor(customEditor);
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 87a8b18

Please sign in to comment.