diff --git a/README.md b/README.md
index f0fa739..217a23d 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,6 @@
WIRIS plugin for Moodle
==========
+[![Build Status](https://travis-ci.org/wiris/moodle-tinymce_tiny_mce_wiris.svg?branch=master)](https://travis-ci.org/wiris/moodle-tinymce_tiny_mce_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).
diff --git a/VERSION b/VERSION
index 0f42559..bd19554 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-4.1.1.1361
+4.2.0.1364
diff --git a/tinymce/VERSION b/tinymce/VERSION
index 0f42559..bd19554 100644
--- a/tinymce/VERSION
+++ b/tinymce/VERSION
@@ -1 +1 @@
-4.1.1.1361
+4.2.0.1364
diff --git a/tinymce/core/core.js b/tinymce/core/core.js
index 72a30db..3430ceb 100644
--- a/tinymce/core/core.js
+++ b/tinymce/core/core.js
@@ -21,6 +21,32 @@ wrs_addEvent(window, 'message', function (e) {
}
});
+/**
+ * Fires an element event.
+ * @param {object} element element where event should be fired.
+ * @param {string} event event to fire.
+ * @ignore
+ */
+function wrs_fireEvent(element, event) {
+ if (document.createEvent){
+ var eventObject = document.createEvent('HTMLEvents');
+ eventObject.initEvent(event, true, true);
+ return !element.dispatchEvent(eventObject);
+ }
+
+ var eventObject = document.createEventObject();
+ return element.fireEvent('on' + event, eventObject)
+}
+
+wrs_addEvent(window, 'mouseup', function (e) {
+ if (typeof(_wrs_modalWindow) !== 'undefined' && _wrs_modalWindow != null) {
+ if (_wrs_modalWindow.properties.state != "maximized") {
+ _wrs_modalWindow.overlayDiv.style.display = 'none';
+ }
+ wrs_fireEvent(_wrs_modalWindow.iframe.contentDocument, 'mouseup');
+ }
+});
+
// Vars.
var _wrs_currentPath = window.location.toString().substr(0, window.location.toString().lastIndexOf('/') + 1);
var _wrs_editMode = typeof _wrs_editMode != 'undefined' ? _wrs_editMode : undefined;
@@ -32,7 +58,7 @@ var _wrs_range;
// LaTex client cache.
var _wrs_int_LatexCache = {};
-// Accessible client cache
+// Accessible client cache.
var _wrs_int_AccessibleCache = {};
var _wrs_xmlCharacters = {
@@ -259,7 +285,7 @@ function wrs_addClass(element, className) {
* @ignore
*/
function wrs_containsClass(element, className) {
- if (!('className' in element)) {
+ if (element == null || !('className' in element)) {
return false;
}
@@ -786,23 +812,6 @@ function wrs_endParseSaveMode(code) {
return code;
}
-/**
- * Fires an element event.
- * @param {object} element element where event should be fired.
- * @param {string} event event to fire.
- * @ignore
- */
-function wrs_fireEvent(element, event) {
- if (document.createEvent){
- var eventObject = document.createEvent('HTMLEvents');
- eventObject.initEvent(event, true, true);
- return !element.dispatchEvent(eventObject);
- }
-
- var eventObject = document.createEventObject();
- return element.fireEvent('on' + event, eventObject)
-}
-
/**
* Gets the formula mathml or CAS appletCode using its image hash code.
* @param {string} variableName Variable to send on POST query to the server.
@@ -1706,11 +1715,6 @@ 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 ="<" --> "<".
- // Transform =">" --> ">".
- // input = input.split("=" + _wrs_safeXmlCharacters.doubleQuote + _wrs_safeXmlCharacters.tagOpener + _wrs_safeXmlCharacters.doubleQuote).join("=" + _wrs_safeXmlCharacters.doubleQuote + "<" + _wrs_safeXmlCharacters.doubleQuote);
- // input = input.split("=" + _wrs_safeXmlCharacters.doubleQuote + _wrs_safeXmlCharacters.tagCloser + _wrs_safeXmlCharacters.doubleQuote).join("=" + _wrs_safeXmlCharacters.doubleQuote + ">" + _wrs_safeXmlCharacters.doubleQuote);
-
return input;
}
@@ -1935,6 +1939,7 @@ function wrs_mathmlToImgObject(creator, mathml, wirisProperties, language) {
}
data['mml'] = mathml;
+ data['lang'] = language;
if (_wrs_conf_setSize) {
// Request metrics of the generated image.
@@ -1963,7 +1968,7 @@ function wrs_mathmlToImgObject(creator, mathml, wirisProperties, language) {
imgObject.setAttribute('data-custom-editor', mathmlSubstring);
}
- // Performance enabled
+ // Performance enabled.
if (_wrs_conf_wirisPluginPerformance && (_wrs_conf_saveMode == 'xml' || _wrs_conf_saveMode == 'safeXml')) {
var result = JSON.parse(wrs_createShowImageSrc(mathml, data, language));
@@ -2120,7 +2125,12 @@ function wrs_openEditorWindow(language, target, isIframe) {
_wrs_temporalRange = null;
if (target) {
- var selectedItem = wrs_getSelectedItem(target, isIframe);
+ var selectedItem;
+ if (typeof wrs_int_getSelectedItem != 'undefined') {
+ selectedItem = wrs_int_getSelectedItem(target, isIframe);
+ } else {
+ selectedItem = wrs_getSelectedItem(target, isIframe);
+ }
if (selectedItem != null) {
if (selectedItem.caretPosition === undefined) {
@@ -2186,7 +2196,7 @@ function wrs_openEditorWindow(language, target, isIframe) {
var fileref = document.createElement("link");
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
- fileref.setAttribute("href", window.parent._wrs_conf_path + '/core/modal.css');
+ fileref.setAttribute("href", wrs_concatenateUrl(window.parent._wrs_conf_path, '/core/modal.css'));
document.getElementsByTagName("head")[0].appendChild(fileref);
_wrs_css_loaded = true;
}
@@ -2412,13 +2422,13 @@ wrs_PluginEvent.prototype.preventDefault = function () {
}
/**
- * Fires one WIRIS event
+ * Fires WIRIS plugin event listeners
* @param {String} eventName event name
* @param {Object} e event properties
* @return {bool} false if event has been prevented.
* @ignore
*/
-function wrs_fireEvent(eventName, e) {
+function wrs_fireEventListeners(eventName, e) {
for (var i = 0; i < wrs_pluginListeners.length && !e.cancelled; ++i) {
if (wrs_pluginListeners[i][eventName]) {
// Calling listener.
@@ -2447,6 +2457,8 @@ function wrs_updateFormula(focusElement, windowTarget, mathml, wirisProperties,
// - editMode (read only)
// - wirisProperties
// - language (read only).
+
+ editMode = editMode !== null ? editMode : _wrs_editMode;
var e = new wrs_PluginEvent();
e.mathml = mathml;
@@ -2463,7 +2475,7 @@ function wrs_updateFormula(focusElement, windowTarget, mathml, wirisProperties,
e.language = language;
e.editMode = editMode;
- if (wrs_fireEvent('onBeforeFormulaInsertion', e)) {
+ if (wrs_fireEventListeners('onBeforeFormulaInsertion', e)) {
return;
}
@@ -2494,7 +2506,7 @@ function wrs_updateFormula(focusElement, windowTarget, mathml, wirisProperties,
wrs_insertElementOnSelection(e.node, focusElement, windowTarget);
}
- if (wrs_fireEvent('onAfterFormulaInsertion', e)) {
+ if (wrs_fireEventListeners('onAfterFormulaInsertion', e)) {
return;
}
}
@@ -2609,11 +2621,11 @@ function wrs_fixAfterResize(img) {
if (_wrs_conf_setSize) {
if (img.src.indexOf("data:image") != -1) {
if (_wrs_conf_imageFormat == 'svg') {
- // data:image/svg+xml;charset=utf8, = 32
+ // ...data:image/svg+xml;charset=utf8, = 32.
var svg = wrs_urldecode(img.src.substring(32, img.src.length))
wrs_setImgSize(img, svg, true);
} else {
- // data:image/png;base64, == 22
+ // ...data:image/png;base64, == 22.
var base64 = img.src.substring(22,img.src.length);
wrs_setImgSize(img, base64, true);
}
@@ -2658,6 +2670,10 @@ function wrs_loadConfiguration() {
document.getElementsByTagName('head')[0].appendChild(script); // Asynchronous load of configuration.
}
+function wrs_concatenateUrl(path1, path2) {
+ return (path1 + path2).replace(/([^:]\/)\/+/g, "$1");
+}
+
var _wrs_conf_core_loaded = true;
if (typeof _wrs_conf_configuration_loaded == 'undefined') {
@@ -2684,7 +2700,7 @@ function wrs_createModalWindow() {
var fileref = document.createElement("link");
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
- fileref.setAttribute("href", window.parent._wrs_conf_path + '/core/modal.css');
+ fileref.setAttribute("href", wrs_concatenateUrl(window.parent._wrs_conf_path, '/core/modal.css'));
document.getElementsByTagName("head")[0].appendChild(fileref);
_wrs_css_loaded = true;
}
@@ -4032,21 +4048,18 @@ function ModalWindow(path, editorAttributes) {
attributes['class'] = 'wrs_modal_close_button';
attributes['title'] = 'Close';
var closeModalDiv = wrs_createElement('div', attributes);
- // closeModalDiv.innerHTML = '×';
this.closeDiv = closeModalDiv;
attributes = {};
attributes['class'] = 'wrs_modal_stack_button';
attributes['title'] = 'Full-screen';
var stackModalDiv = wrs_createElement('div', attributes);
- // stackModalDiv.innerHTML = '/';
this.stackDiv = stackModalDiv;
attributes = {};
attributes['class'] = 'wrs_modal_minimize_button';
attributes['title'] = 'Minimise';
var minimizeModalDiv = wrs_createElement('div', attributes);
- // minimizeModalDiv.innerHTML = "_";
this.minimizeDiv = minimizeModalDiv;
attributes = {};
@@ -4078,6 +4091,12 @@ ModalWindow.prototype.create = function() {
this.titleBardDiv.appendChild(this.titleDiv);
this.iframeContainer.appendChild(this.iframe);
+ wrs_addEvent(this.overlayDiv, 'mouseup', function (e) {
+ if (typeof(_wrs_modalWindow) !== 'undefined' && _wrs_modalWindow != null) {
+ wrs_fireEvent(_wrs_modalWindow.iframe.contentDocument, 'mouseup');
+ }
+ });
+
if (!this.deviceProperties['isMobile'] && !this.deviceProperties['isAndroid'] && !this.deviceProperties['isIOS']) {
this.containerDiv.appendChild(this.titleBardDiv);
}
@@ -4161,7 +4180,7 @@ ModalWindow.prototype.close = function() {
this.properties.open = false;
wrs_int_disableCustomEditors();
document.getElementsByClassName('wrs_modal_iframe')[0].contentWindow._wrs_modalWindowProperties.editor.setMathML('');
- // Properties to initial state
+ // Properties to initial state.
this.properties.state = '';
this.properties.previousState = '';
}
@@ -4241,6 +4260,8 @@ ModalWindow.prototype.stackModalWindow = function () {
this.containerDiv.style.left = null;
this.containerDiv.style.position = null;
+ this.overlayDiv.style.background = "rgba(0,0,0,0)";
+
this.stackDiv.title = "Full-screen";
var modalWidth = parseInt(this.properties.iframeAttributes['width']);
@@ -4251,6 +4272,7 @@ ModalWindow.prototype.stackModalWindow = function () {
this.iframe.style.height = (parseInt(300) + 3) + 'px';
this.iframe.style.margin = '6px';
this.removeClass('wrs_maximized');
+ this.minimizeDiv.title = "Minimise";
this.removeClass('wrs_minimized');
this.addClass('wrs_stack');
}
@@ -4271,6 +4293,8 @@ ModalWindow.prototype.minimizeModalWindow = function() {
this.containerDiv.style.left = null;
this.containerDiv.style.top = null;
this.containerDiv.style.position = null;
+ this.overlayDiv.style.background = "rgba(0,0,0,0)";
+ this.minimizeDiv.title = "Maximise";
if (wrs_containsClass(this.overlayDiv, 'wrs_stack')) {
this.removeClass('wrs_stack');
@@ -4301,6 +4325,7 @@ ModalWindow.prototype.maximizeModalWindow = function() {
this.iframe.style.margin = '6px';
this.removeClass('wrs_drag');
if (wrs_containsClass(this.overlayDiv, 'wrs_minimized')) {
+ this.minimizeDiv.title = "Minimise";
this.removeClass('wrs_minimized');
} else if (wrs_containsClass(this.overlayDiv, 'wrs_stack')) {
this.containerDiv.style.left = null;
@@ -4308,6 +4333,8 @@ ModalWindow.prototype.maximizeModalWindow = function() {
this.removeClass('wrs_stack');
}
this.stackDiv.title = "Exit full-screen";
+ this.overlayDiv.style.background = "rgba(0,0,0,0.8)";
+ this.overlayDiv.style.display = '';
this.addClass('wrs_maximized');
}
@@ -4324,6 +4351,7 @@ ModalWindow.prototype.addListeners = function() {
wrs_addEvent(window, 'mouseup', this.stopDrag.bind(this));
wrs_addEvent(document, 'mouseup', this.stopDrag.bind(this));
wrs_addEvent(this.iframe.contentWindow, 'mouseup', this.stopDrag.bind(this));
+ wrs_addEvent(this.iframe.contentWindow, 'mousedown', this.setOverlayDiv.bind(this));
wrs_addEvent(document.body, 'mousemove', this.drag.bind(this));
}
@@ -4351,7 +4379,7 @@ ModalWindow.prototype.removeListeners = function() {
* @ignore
*/
ModalWindow.prototype.eventClient = function(ev) {
- if (typeof(ev.clientX) == 'undefined') {
+ if (typeof(ev.clientX) == 'undefined' && ev.changedTouches) {
var client = {
X : ev.changedTouches[0].clientX,
Y : ev.changedTouches[0].clientY
@@ -4366,6 +4394,17 @@ ModalWindow.prototype.eventClient = function(ev) {
}
}
+
+/**
+ * Set the overlay div display
+ *
+ * @param {event} ev touchstart or mousedown event.
+ * @ignore
+ */
+ModalWindow.prototype.setOverlayDiv = function(ev) {
+ this.overlayDiv.style.display = '';
+}
+
/**
* Start drag function: set the object _wrs_dragDataObject with the draggable object offsets coordinates.
* when drag starts (on touchstart or mousedown events).
@@ -4402,8 +4441,8 @@ ModalWindow.prototype.drag = function(ev) {
if(this.dragDataObject) {
ev.preventDefault();
ev = ev || event;
- this.containerDiv.style.left = this.eventClient(ev).X - this.dragDataObject.x + "px";
- this.containerDiv.style.top = this.eventClient(ev).Y - this.dragDataObject.y + "px";
+ this.containerDiv.style.left = this.eventClient(ev).X - this.dragDataObject.x + window.pageXOffset + "px";
+ this.containerDiv.style.top = this.eventClient(ev).Y - this.dragDataObject.y + window.pageYOffset + "px";
this.containerDiv.style.position = 'absolute';
this.containerDiv.style.bottom = null;
wrs_removeClass(this.containerDiv, 'wrs_stack');
@@ -4417,6 +4456,16 @@ ModalWindow.prototype.drag = function(ev) {
* @ignore
*/
ModalWindow.prototype.stopDrag = function(ev) {
+ this.containerDiv.style.position = 'fixed';
+ // Due to we have multiple events that call this function, we need only to execute the next modifiers one time,
+ // when the user stops to drag and dragDataObject is not null (the object to drag is attached).
+ if (this.dragDataObject) {
+ // Fixed position makes the coords relative to the main window. So that, we need to transform
+ // the absolute coords to relative removing the scroll.
+ this.containerDiv.style.left = parseInt(this.containerDiv.style.left) - window.pageXOffset + "px";
+ this.containerDiv.style.top = parseInt(this.containerDiv.style.top) - window.pageYOffset + "px";
+ }
+ this.containerDiv.style.bottom = null;
wrs_addClass(this.containerDiv, 'wrs_drag');
this.dragDataObject = null;
}
diff --git a/tinymce/core/editor.css b/tinymce/core/editor.css
index aae3496..4582658 100644
--- a/tinymce/core/editor.css
+++ b/tinymce/core/editor.css
@@ -109,7 +109,7 @@ and (orientation : landscape) {
}
}
-/*iPhone 5*/
+/*iPhone5*/
@media only screen
and (min-device-width : 320px)
and (max-device-width : 568px)
diff --git a/tinymce/core/editor.js b/tinymce/core/editor.js
index 4163286..0111797 100644
--- a/tinymce/core/editor.js
+++ b/tinymce/core/editor.js
@@ -239,8 +239,6 @@ var _wrs_isNewElement; // Unfortunately we need this variabels as global variabl
editor = new com.wiris.jsEditor.JsEditor('editor', null);
}
_wrs_modalWindowProperties.editor = editor;
- // getMethod(null, 'wrs_editorLoaded', [editor], function(editorLoaded){
- // });
var ua = navigator.userAgent.toLowerCase();
var isAndroid = ua.indexOf("android") > -1;
@@ -277,7 +275,7 @@ var _wrs_isNewElement; // Unfortunately we need this variabels as global variabl
}
if (isIOS) {
- // Editor and controls container
+ // Editor and controls container.
var editorAndControlsContainer = document.getElementById('container');
editorAndControlsContainer.className += ' wrs_container wrs_modalIos';
}
@@ -323,7 +321,7 @@ var _wrs_isNewElement; // Unfortunately we need this variabels as global variabl
mathml = wrs_mathmlEntities(mathml); // Apply a parse.
}
- getMethod(null, 'wrs_int_updateFormula', [mathml, _wrs_editMode, queryParams['lang']], function(){
+ getMethod(null, 'wrs_int_updateFormula', [mathml, null, queryParams['lang']], function(){
_wrs_closeFunction();
});
diff --git a/tinymce/core/modal.css b/tinymce/core/modal.css
index 47c5e12..c3540c6 100644
--- a/tinymce/core/modal.css
+++ b/tinymce/core/modal.css
@@ -1,10 +1,4 @@
-/*body.wrs_modal_open {
- overflow: hidden;
- position: fixed;
-}
-*/
.wrs_modal_overlay {
- /*overflow: scroll;*/
position: fixed;
font-family: arial, sans-serif;
top: 0;
@@ -15,24 +9,18 @@
z-index: 99998;
opacity:0.65;
pointer-events: auto;
- /*-webkit-transition: opacity 400ms ease-in;
- -moz-transition: opacity 400ms ease-in;
- transition: opacity 400ms ease-in;*/
}
.wrs_modal_overlay.wrs_maximized{
}
.wrs_modal_overlay.wrs_minimized {
- display: none;
}
.wrs_modal_overlay.wrs_stack {
- display: none;
}
.wrs_modal_overlay.wrs_modal_ios {
- /*position: inherit;*/
}
.wrs_modal_overlay.wrs_modal_ios.moodle {
@@ -159,7 +147,6 @@
.wrs_modal_title_bar {
display : block;
background-color: #778e9a;
- /*cursor: pointer;*/
}
.wrs_modal_dialogContainer {
@@ -191,7 +178,6 @@
margin-right: 10px;
}
.wrs_modal_dialogContainer.wrs_modal_desktop.wrs_minimized.wrs_drag {
- /*bottom: auto;*/
}
.wrs_modal_dialogContainer.wrs_modal_desktop.wrs_stack {
diff --git a/tinymce/editor_plugin.js b/tinymce/editor_plugin.js
index 019d120..b53d306 100644
--- a/tinymce/editor_plugin.js
+++ b/tinymce/editor_plugin.js
@@ -34,7 +34,6 @@ var _wrs_conf_pluginBasePath = _wrs_conf_path;
/* Vars */
var _wrs_int_editorIcon;
-var _wrs_int_CASIcon;
var _wrs_int_temporalIframe;
var _wrs_int_temporalElementIsIframe;
var _wrs_int_window;
@@ -51,7 +50,7 @@ var _wrs_int_initParsed = false;
// Core added to queue.
var _wrs_addCoreQueue = typeof _wrs_addCoreQueue == 'undefined' ? false : _wrs_addCoreQueue;
-// Lang
+// Lang.
var _wrs_int_langCode = 'en';
/* Plugin integration */
@@ -73,10 +72,8 @@ var _wrs_int_langCode = 'en';
}
if (typeof _wrs_conf_hostPlatform != 'undefined' && _wrs_conf_hostPlatform == 'Moodle' && _wrs_conf_versionPlatform < 2013111800) {
_wrs_int_editorIcon = _wrs_conf_path + 'icons/tinymce3/formula.png';
- _wrs_int_CASIcon = _wrs_conf_path + 'icons/tinymce3/cas.png';
} else {
_wrs_int_editorIcon = _wrs_conf_path + 'icons/formula.png';
- _wrs_int_CASIcon = _wrs_conf_path + 'icons/cas.png';
}
var element;
@@ -143,15 +140,9 @@ var _wrs_int_langCode = 'en';
// Bug fix: In Moodle2.x when TinyMCE is set to full screen
// the content doesn't need to be filtered.
- if (!editor.getParam('fullscreen_is_enabled')){
-
- // When there is a blankspace, null or undefined state or the tag "
') {
- editor.setContent(wrs_initParse(content, language));
- }
+ if (!editor.getParam('fullscreen_is_enabled') && editor.getContent() !== ""){
+ editor.setContent(wrs_initParse(content, language));
// Init parsing OK. If a setContent method is called
// wrs_initParse is called again.
// Now if source code is edited the returned code is parsed.
@@ -273,30 +264,12 @@ var _wrs_int_langCode = 'en';
});
editor.addButton('tiny_mce_wiris_formulaEditor', {
- title: 'Math editor',
+ title: 'WIRIS EDITOR math',
cmd: 'tiny_mce_wiris_openFormulaEditor',
image: _wrs_int_editorIcon
});
}
- if (_wrs_int_conf_async || _wrs_conf_CASEnabled) {
- editor.addCommand('tiny_mce_wiris_openCAS', function () {
- var language = editor.settings.language;
-
- if (editor.settings['wirisformulaeditorlang']) {
- language = editor.settings['wirisformulaeditorlang'];
- }
-
- wrs_int_openNewCAS(element, language, editor.inline ? false : true);
- });
-
- editor.addButton('tiny_mce_wiris_CAS', {
- title: 'Calculator',
- cmd: 'tiny_mce_wiris_openCAS',
- image: _wrs_int_CASIcon
- });
- }
-
// Dynamic customEditors buttons.
for (var key in _wrs_int_customEditors) {
if (_wrs_int_customEditors.hasOwnProperty(key)) {
@@ -339,7 +312,7 @@ var _wrs_int_langCode = 'en';
}
editor.addButton('tiny_mce_wiris_formulaEditor' + _wrs_int_customEditors[key].name, {
- title: _wrs_int_customEditors[key].name + ' editor',
+ title: _wrs_int_customEditors[key].title,
cmd: cmd,
image: imagePath
});
@@ -391,25 +364,6 @@ function wrs_int_openNewFormulaEditor(element, language, isIframe) {
}
}
-/**
- * Opens CAS.
- * @param object element Target
- * @param string language
- * @param bool isIframe
- */
-function wrs_int_openNewCAS(element, language, isIframe) {
- if (_wrs_int_window_opened) {
- _wrs_int_window.focus();
- }
- else {
- _wrs_int_window_opened = true;
- _wrs_isNewElement = true;
- _wrs_int_temporalIframe = element;
- _wrs_int_temporalElementIsIframe = isIframe;
- _wrs_int_window = wrs_openCASWindow(element, isIframe, language);
- }
-}
-
/**
* Handles a double click on the target.
* @param object editor tinymce active editor
@@ -420,7 +374,7 @@ function wrs_int_openNewCAS(element, language, isIframe) {
function wrs_int_doubleClickHandler(editor, target, isIframe, element) {
// This loop allows the double clicking on the formulas represented with span's.
- while (!wrs_containsClass(element, 'Wirisformula') && !wrs_containsClass(element, 'Wiriscas') && element.parentNode) {
+ while (!wrs_containsClass(element, 'Wirisformula') && element.parentNode) {
element = element.parentNode;
}
@@ -464,21 +418,6 @@ function wrs_int_doubleClickHandler(editor, target, isIframe, element) {
_wrs_int_window.focus();
}
}
- else if (wrs_containsClass(element, 'Wiriscas')) {
- if (!_wrs_int_window_opened) {
- var language = editor.settings.language;
-
- if (editor.settings['wirisformulaeditorlang']) {
- language = editor.settings['wirisformulaeditorlang'];
- }
-
- _wrs_temporalImage = element;
- wrs_int_openExistingCAS(target, isIframe, language);
- }
- else {
- _wrs_int_window.focus();
- }
- }
}
}
@@ -495,20 +434,6 @@ function wrs_int_openExistingFormulaEditor(element, isIframe, language) {
_wrs_int_window = wrs_openEditorWindow(language, element, isIframe);
}
-/**
- * Opens CAS to edit an existing formula.
- * @param object element Target
- * @param bool isIframe
- * @param string language
- */
-function wrs_int_openExistingCAS(element, isIframe, language) {
- _wrs_int_window_opened = true;
- _wrs_isNewElement = false;
- _wrs_int_temporalIframe = element;
- _wrs_int_temporalElementIsIframe = isIframe;
- _wrs_int_window = wrs_openCASWindow(element, isIframe, language);
-}
-
/**
* Handles a mouse down event on the iframe.
* @param object iframe Target
@@ -516,7 +441,7 @@ function wrs_int_openExistingCAS(element, isIframe, language) {
*/
function wrs_int_mousedownHandler(iframe, element) {
if (element.nodeName.toLowerCase() == 'img') {
- if (wrs_containsClass(element, 'Wirisformula') || wrs_containsClass(element, 'Wiriscas')) {
+ if (wrs_containsClass(element, 'Wirisformula')) {
_wrs_int_temporalImageResizing = element;
}
}
@@ -552,21 +477,6 @@ function wrs_int_updateFormula(mathml, editMode, language) {
}
}
-/**
- * Calls wrs_updateCAS with well params.
- * @param string appletCode
- * @param string image
- * @param int width
- * @param int height
- */
-function wrs_int_updateCAS(appletCode, image, width, height) {
- if (_wrs_int_temporalElementIsIframe) {
- wrs_updateCAS(_wrs_int_temporalIframe.contentWindow, _wrs_int_temporalIframe.contentWindow, appletCode, image, width, height);
- } else {
- wrs_updateCAS(_wrs_int_temporalIframe, window, appletCode, image, width, height);
- }
-}
-
/**
* Handles window closing.
*/
diff --git a/tinymce/editor_plugin_src.js b/tinymce/editor_plugin_src.js
index 019d120..b53d306 100644
--- a/tinymce/editor_plugin_src.js
+++ b/tinymce/editor_plugin_src.js
@@ -34,7 +34,6 @@ var _wrs_conf_pluginBasePath = _wrs_conf_path;
/* Vars */
var _wrs_int_editorIcon;
-var _wrs_int_CASIcon;
var _wrs_int_temporalIframe;
var _wrs_int_temporalElementIsIframe;
var _wrs_int_window;
@@ -51,7 +50,7 @@ var _wrs_int_initParsed = false;
// Core added to queue.
var _wrs_addCoreQueue = typeof _wrs_addCoreQueue == 'undefined' ? false : _wrs_addCoreQueue;
-// Lang
+// Lang.
var _wrs_int_langCode = 'en';
/* Plugin integration */
@@ -73,10 +72,8 @@ var _wrs_int_langCode = 'en';
}
if (typeof _wrs_conf_hostPlatform != 'undefined' && _wrs_conf_hostPlatform == 'Moodle' && _wrs_conf_versionPlatform < 2013111800) {
_wrs_int_editorIcon = _wrs_conf_path + 'icons/tinymce3/formula.png';
- _wrs_int_CASIcon = _wrs_conf_path + 'icons/tinymce3/cas.png';
} else {
_wrs_int_editorIcon = _wrs_conf_path + 'icons/formula.png';
- _wrs_int_CASIcon = _wrs_conf_path + 'icons/cas.png';
}
var element;
@@ -143,15 +140,9 @@ var _wrs_int_langCode = 'en';
// Bug fix: In Moodle2.x when TinyMCE is set to full screen
// the content doesn't need to be filtered.
- if (!editor.getParam('fullscreen_is_enabled')){
-
- // When there is a blankspace, null or undefined state or the tag "
') {
- editor.setContent(wrs_initParse(content, language));
- }
+ if (!editor.getParam('fullscreen_is_enabled') && editor.getContent() !== ""){
+ editor.setContent(wrs_initParse(content, language));
// Init parsing OK. If a setContent method is called
// wrs_initParse is called again.
// Now if source code is edited the returned code is parsed.
@@ -273,30 +264,12 @@ var _wrs_int_langCode = 'en';
});
editor.addButton('tiny_mce_wiris_formulaEditor', {
- title: 'Math editor',
+ title: 'WIRIS EDITOR math',
cmd: 'tiny_mce_wiris_openFormulaEditor',
image: _wrs_int_editorIcon
});
}
- if (_wrs_int_conf_async || _wrs_conf_CASEnabled) {
- editor.addCommand('tiny_mce_wiris_openCAS', function () {
- var language = editor.settings.language;
-
- if (editor.settings['wirisformulaeditorlang']) {
- language = editor.settings['wirisformulaeditorlang'];
- }
-
- wrs_int_openNewCAS(element, language, editor.inline ? false : true);
- });
-
- editor.addButton('tiny_mce_wiris_CAS', {
- title: 'Calculator',
- cmd: 'tiny_mce_wiris_openCAS',
- image: _wrs_int_CASIcon
- });
- }
-
// Dynamic customEditors buttons.
for (var key in _wrs_int_customEditors) {
if (_wrs_int_customEditors.hasOwnProperty(key)) {
@@ -339,7 +312,7 @@ var _wrs_int_langCode = 'en';
}
editor.addButton('tiny_mce_wiris_formulaEditor' + _wrs_int_customEditors[key].name, {
- title: _wrs_int_customEditors[key].name + ' editor',
+ title: _wrs_int_customEditors[key].title,
cmd: cmd,
image: imagePath
});
@@ -391,25 +364,6 @@ function wrs_int_openNewFormulaEditor(element, language, isIframe) {
}
}
-/**
- * Opens CAS.
- * @param object element Target
- * @param string language
- * @param bool isIframe
- */
-function wrs_int_openNewCAS(element, language, isIframe) {
- if (_wrs_int_window_opened) {
- _wrs_int_window.focus();
- }
- else {
- _wrs_int_window_opened = true;
- _wrs_isNewElement = true;
- _wrs_int_temporalIframe = element;
- _wrs_int_temporalElementIsIframe = isIframe;
- _wrs_int_window = wrs_openCASWindow(element, isIframe, language);
- }
-}
-
/**
* Handles a double click on the target.
* @param object editor tinymce active editor
@@ -420,7 +374,7 @@ function wrs_int_openNewCAS(element, language, isIframe) {
function wrs_int_doubleClickHandler(editor, target, isIframe, element) {
// This loop allows the double clicking on the formulas represented with span's.
- while (!wrs_containsClass(element, 'Wirisformula') && !wrs_containsClass(element, 'Wiriscas') && element.parentNode) {
+ while (!wrs_containsClass(element, 'Wirisformula') && element.parentNode) {
element = element.parentNode;
}
@@ -464,21 +418,6 @@ function wrs_int_doubleClickHandler(editor, target, isIframe, element) {
_wrs_int_window.focus();
}
}
- else if (wrs_containsClass(element, 'Wiriscas')) {
- if (!_wrs_int_window_opened) {
- var language = editor.settings.language;
-
- if (editor.settings['wirisformulaeditorlang']) {
- language = editor.settings['wirisformulaeditorlang'];
- }
-
- _wrs_temporalImage = element;
- wrs_int_openExistingCAS(target, isIframe, language);
- }
- else {
- _wrs_int_window.focus();
- }
- }
}
}
@@ -495,20 +434,6 @@ function wrs_int_openExistingFormulaEditor(element, isIframe, language) {
_wrs_int_window = wrs_openEditorWindow(language, element, isIframe);
}
-/**
- * Opens CAS to edit an existing formula.
- * @param object element Target
- * @param bool isIframe
- * @param string language
- */
-function wrs_int_openExistingCAS(element, isIframe, language) {
- _wrs_int_window_opened = true;
- _wrs_isNewElement = false;
- _wrs_int_temporalIframe = element;
- _wrs_int_temporalElementIsIframe = isIframe;
- _wrs_int_window = wrs_openCASWindow(element, isIframe, language);
-}
-
/**
* Handles a mouse down event on the iframe.
* @param object iframe Target
@@ -516,7 +441,7 @@ function wrs_int_openExistingCAS(element, isIframe, language) {
*/
function wrs_int_mousedownHandler(iframe, element) {
if (element.nodeName.toLowerCase() == 'img') {
- if (wrs_containsClass(element, 'Wirisformula') || wrs_containsClass(element, 'Wiriscas')) {
+ if (wrs_containsClass(element, 'Wirisformula')) {
_wrs_int_temporalImageResizing = element;
}
}
@@ -552,21 +477,6 @@ function wrs_int_updateFormula(mathml, editMode, language) {
}
}
-/**
- * Calls wrs_updateCAS with well params.
- * @param string appletCode
- * @param string image
- * @param int width
- * @param int height
- */
-function wrs_int_updateCAS(appletCode, image, width, height) {
- if (_wrs_int_temporalElementIsIframe) {
- wrs_updateCAS(_wrs_int_temporalIframe.contentWindow, _wrs_int_temporalIframe.contentWindow, appletCode, image, width, height);
- } else {
- wrs_updateCAS(_wrs_int_temporalIframe, window, appletCode, image, width, height);
- }
-}
-
/**
* Handles window closing.
*/
diff --git a/tinymce/plugin.js b/tinymce/plugin.js
index 019d120..b53d306 100644
--- a/tinymce/plugin.js
+++ b/tinymce/plugin.js
@@ -34,7 +34,6 @@ var _wrs_conf_pluginBasePath = _wrs_conf_path;
/* Vars */
var _wrs_int_editorIcon;
-var _wrs_int_CASIcon;
var _wrs_int_temporalIframe;
var _wrs_int_temporalElementIsIframe;
var _wrs_int_window;
@@ -51,7 +50,7 @@ var _wrs_int_initParsed = false;
// Core added to queue.
var _wrs_addCoreQueue = typeof _wrs_addCoreQueue == 'undefined' ? false : _wrs_addCoreQueue;
-// Lang
+// Lang.
var _wrs_int_langCode = 'en';
/* Plugin integration */
@@ -73,10 +72,8 @@ var _wrs_int_langCode = 'en';
}
if (typeof _wrs_conf_hostPlatform != 'undefined' && _wrs_conf_hostPlatform == 'Moodle' && _wrs_conf_versionPlatform < 2013111800) {
_wrs_int_editorIcon = _wrs_conf_path + 'icons/tinymce3/formula.png';
- _wrs_int_CASIcon = _wrs_conf_path + 'icons/tinymce3/cas.png';
} else {
_wrs_int_editorIcon = _wrs_conf_path + 'icons/formula.png';
- _wrs_int_CASIcon = _wrs_conf_path + 'icons/cas.png';
}
var element;
@@ -143,15 +140,9 @@ var _wrs_int_langCode = 'en';
// Bug fix: In Moodle2.x when TinyMCE is set to full screen
// the content doesn't need to be filtered.
- if (!editor.getParam('fullscreen_is_enabled')){
-
- // When there is a blankspace, null or undefined state or the tag "
') {
- editor.setContent(wrs_initParse(content, language));
- }
+ if (!editor.getParam('fullscreen_is_enabled') && editor.getContent() !== ""){
+ editor.setContent(wrs_initParse(content, language));
// Init parsing OK. If a setContent method is called
// wrs_initParse is called again.
// Now if source code is edited the returned code is parsed.
@@ -273,30 +264,12 @@ var _wrs_int_langCode = 'en';
});
editor.addButton('tiny_mce_wiris_formulaEditor', {
- title: 'Math editor',
+ title: 'WIRIS EDITOR math',
cmd: 'tiny_mce_wiris_openFormulaEditor',
image: _wrs_int_editorIcon
});
}
- if (_wrs_int_conf_async || _wrs_conf_CASEnabled) {
- editor.addCommand('tiny_mce_wiris_openCAS', function () {
- var language = editor.settings.language;
-
- if (editor.settings['wirisformulaeditorlang']) {
- language = editor.settings['wirisformulaeditorlang'];
- }
-
- wrs_int_openNewCAS(element, language, editor.inline ? false : true);
- });
-
- editor.addButton('tiny_mce_wiris_CAS', {
- title: 'Calculator',
- cmd: 'tiny_mce_wiris_openCAS',
- image: _wrs_int_CASIcon
- });
- }
-
// Dynamic customEditors buttons.
for (var key in _wrs_int_customEditors) {
if (_wrs_int_customEditors.hasOwnProperty(key)) {
@@ -339,7 +312,7 @@ var _wrs_int_langCode = 'en';
}
editor.addButton('tiny_mce_wiris_formulaEditor' + _wrs_int_customEditors[key].name, {
- title: _wrs_int_customEditors[key].name + ' editor',
+ title: _wrs_int_customEditors[key].title,
cmd: cmd,
image: imagePath
});
@@ -391,25 +364,6 @@ function wrs_int_openNewFormulaEditor(element, language, isIframe) {
}
}
-/**
- * Opens CAS.
- * @param object element Target
- * @param string language
- * @param bool isIframe
- */
-function wrs_int_openNewCAS(element, language, isIframe) {
- if (_wrs_int_window_opened) {
- _wrs_int_window.focus();
- }
- else {
- _wrs_int_window_opened = true;
- _wrs_isNewElement = true;
- _wrs_int_temporalIframe = element;
- _wrs_int_temporalElementIsIframe = isIframe;
- _wrs_int_window = wrs_openCASWindow(element, isIframe, language);
- }
-}
-
/**
* Handles a double click on the target.
* @param object editor tinymce active editor
@@ -420,7 +374,7 @@ function wrs_int_openNewCAS(element, language, isIframe) {
function wrs_int_doubleClickHandler(editor, target, isIframe, element) {
// This loop allows the double clicking on the formulas represented with span's.
- while (!wrs_containsClass(element, 'Wirisformula') && !wrs_containsClass(element, 'Wiriscas') && element.parentNode) {
+ while (!wrs_containsClass(element, 'Wirisformula') && element.parentNode) {
element = element.parentNode;
}
@@ -464,21 +418,6 @@ function wrs_int_doubleClickHandler(editor, target, isIframe, element) {
_wrs_int_window.focus();
}
}
- else if (wrs_containsClass(element, 'Wiriscas')) {
- if (!_wrs_int_window_opened) {
- var language = editor.settings.language;
-
- if (editor.settings['wirisformulaeditorlang']) {
- language = editor.settings['wirisformulaeditorlang'];
- }
-
- _wrs_temporalImage = element;
- wrs_int_openExistingCAS(target, isIframe, language);
- }
- else {
- _wrs_int_window.focus();
- }
- }
}
}
@@ -495,20 +434,6 @@ function wrs_int_openExistingFormulaEditor(element, isIframe, language) {
_wrs_int_window = wrs_openEditorWindow(language, element, isIframe);
}
-/**
- * Opens CAS to edit an existing formula.
- * @param object element Target
- * @param bool isIframe
- * @param string language
- */
-function wrs_int_openExistingCAS(element, isIframe, language) {
- _wrs_int_window_opened = true;
- _wrs_isNewElement = false;
- _wrs_int_temporalIframe = element;
- _wrs_int_temporalElementIsIframe = isIframe;
- _wrs_int_window = wrs_openCASWindow(element, isIframe, language);
-}
-
/**
* Handles a mouse down event on the iframe.
* @param object iframe Target
@@ -516,7 +441,7 @@ function wrs_int_openExistingCAS(element, isIframe, language) {
*/
function wrs_int_mousedownHandler(iframe, element) {
if (element.nodeName.toLowerCase() == 'img') {
- if (wrs_containsClass(element, 'Wirisformula') || wrs_containsClass(element, 'Wiriscas')) {
+ if (wrs_containsClass(element, 'Wirisformula')) {
_wrs_int_temporalImageResizing = element;
}
}
@@ -552,21 +477,6 @@ function wrs_int_updateFormula(mathml, editMode, language) {
}
}
-/**
- * Calls wrs_updateCAS with well params.
- * @param string appletCode
- * @param string image
- * @param int width
- * @param int height
- */
-function wrs_int_updateCAS(appletCode, image, width, height) {
- if (_wrs_int_temporalElementIsIframe) {
- wrs_updateCAS(_wrs_int_temporalIframe.contentWindow, _wrs_int_temporalIframe.contentWindow, appletCode, image, width, height);
- } else {
- wrs_updateCAS(_wrs_int_temporalIframe, window, appletCode, image, width, height);
- }
-}
-
/**
* Handles window closing.
*/
diff --git a/tinymce/plugin.min.js b/tinymce/plugin.min.js
index 019d120..b53d306 100644
--- a/tinymce/plugin.min.js
+++ b/tinymce/plugin.min.js
@@ -34,7 +34,6 @@ var _wrs_conf_pluginBasePath = _wrs_conf_path;
/* Vars */
var _wrs_int_editorIcon;
-var _wrs_int_CASIcon;
var _wrs_int_temporalIframe;
var _wrs_int_temporalElementIsIframe;
var _wrs_int_window;
@@ -51,7 +50,7 @@ var _wrs_int_initParsed = false;
// Core added to queue.
var _wrs_addCoreQueue = typeof _wrs_addCoreQueue == 'undefined' ? false : _wrs_addCoreQueue;
-// Lang
+// Lang.
var _wrs_int_langCode = 'en';
/* Plugin integration */
@@ -73,10 +72,8 @@ var _wrs_int_langCode = 'en';
}
if (typeof _wrs_conf_hostPlatform != 'undefined' && _wrs_conf_hostPlatform == 'Moodle' && _wrs_conf_versionPlatform < 2013111800) {
_wrs_int_editorIcon = _wrs_conf_path + 'icons/tinymce3/formula.png';
- _wrs_int_CASIcon = _wrs_conf_path + 'icons/tinymce3/cas.png';
} else {
_wrs_int_editorIcon = _wrs_conf_path + 'icons/formula.png';
- _wrs_int_CASIcon = _wrs_conf_path + 'icons/cas.png';
}
var element;
@@ -143,15 +140,9 @@ var _wrs_int_langCode = 'en';
// Bug fix: In Moodle2.x when TinyMCE is set to full screen
// the content doesn't need to be filtered.
- if (!editor.getParam('fullscreen_is_enabled')){
-
- // When there is a blankspace, null or undefined state or the tag "
') {
- editor.setContent(wrs_initParse(content, language));
- }
+ if (!editor.getParam('fullscreen_is_enabled') && editor.getContent() !== ""){
+ editor.setContent(wrs_initParse(content, language));
// Init parsing OK. If a setContent method is called
// wrs_initParse is called again.
// Now if source code is edited the returned code is parsed.
@@ -273,30 +264,12 @@ var _wrs_int_langCode = 'en';
});
editor.addButton('tiny_mce_wiris_formulaEditor', {
- title: 'Math editor',
+ title: 'WIRIS EDITOR math',
cmd: 'tiny_mce_wiris_openFormulaEditor',
image: _wrs_int_editorIcon
});
}
- if (_wrs_int_conf_async || _wrs_conf_CASEnabled) {
- editor.addCommand('tiny_mce_wiris_openCAS', function () {
- var language = editor.settings.language;
-
- if (editor.settings['wirisformulaeditorlang']) {
- language = editor.settings['wirisformulaeditorlang'];
- }
-
- wrs_int_openNewCAS(element, language, editor.inline ? false : true);
- });
-
- editor.addButton('tiny_mce_wiris_CAS', {
- title: 'Calculator',
- cmd: 'tiny_mce_wiris_openCAS',
- image: _wrs_int_CASIcon
- });
- }
-
// Dynamic customEditors buttons.
for (var key in _wrs_int_customEditors) {
if (_wrs_int_customEditors.hasOwnProperty(key)) {
@@ -339,7 +312,7 @@ var _wrs_int_langCode = 'en';
}
editor.addButton('tiny_mce_wiris_formulaEditor' + _wrs_int_customEditors[key].name, {
- title: _wrs_int_customEditors[key].name + ' editor',
+ title: _wrs_int_customEditors[key].title,
cmd: cmd,
image: imagePath
});
@@ -391,25 +364,6 @@ function wrs_int_openNewFormulaEditor(element, language, isIframe) {
}
}
-/**
- * Opens CAS.
- * @param object element Target
- * @param string language
- * @param bool isIframe
- */
-function wrs_int_openNewCAS(element, language, isIframe) {
- if (_wrs_int_window_opened) {
- _wrs_int_window.focus();
- }
- else {
- _wrs_int_window_opened = true;
- _wrs_isNewElement = true;
- _wrs_int_temporalIframe = element;
- _wrs_int_temporalElementIsIframe = isIframe;
- _wrs_int_window = wrs_openCASWindow(element, isIframe, language);
- }
-}
-
/**
* Handles a double click on the target.
* @param object editor tinymce active editor
@@ -420,7 +374,7 @@ function wrs_int_openNewCAS(element, language, isIframe) {
function wrs_int_doubleClickHandler(editor, target, isIframe, element) {
// This loop allows the double clicking on the formulas represented with span's.
- while (!wrs_containsClass(element, 'Wirisformula') && !wrs_containsClass(element, 'Wiriscas') && element.parentNode) {
+ while (!wrs_containsClass(element, 'Wirisformula') && element.parentNode) {
element = element.parentNode;
}
@@ -464,21 +418,6 @@ function wrs_int_doubleClickHandler(editor, target, isIframe, element) {
_wrs_int_window.focus();
}
}
- else if (wrs_containsClass(element, 'Wiriscas')) {
- if (!_wrs_int_window_opened) {
- var language = editor.settings.language;
-
- if (editor.settings['wirisformulaeditorlang']) {
- language = editor.settings['wirisformulaeditorlang'];
- }
-
- _wrs_temporalImage = element;
- wrs_int_openExistingCAS(target, isIframe, language);
- }
- else {
- _wrs_int_window.focus();
- }
- }
}
}
@@ -495,20 +434,6 @@ function wrs_int_openExistingFormulaEditor(element, isIframe, language) {
_wrs_int_window = wrs_openEditorWindow(language, element, isIframe);
}
-/**
- * Opens CAS to edit an existing formula.
- * @param object element Target
- * @param bool isIframe
- * @param string language
- */
-function wrs_int_openExistingCAS(element, isIframe, language) {
- _wrs_int_window_opened = true;
- _wrs_isNewElement = false;
- _wrs_int_temporalIframe = element;
- _wrs_int_temporalElementIsIframe = isIframe;
- _wrs_int_window = wrs_openCASWindow(element, isIframe, language);
-}
-
/**
* Handles a mouse down event on the iframe.
* @param object iframe Target
@@ -516,7 +441,7 @@ function wrs_int_openExistingCAS(element, isIframe, language) {
*/
function wrs_int_mousedownHandler(iframe, element) {
if (element.nodeName.toLowerCase() == 'img') {
- if (wrs_containsClass(element, 'Wirisformula') || wrs_containsClass(element, 'Wiriscas')) {
+ if (wrs_containsClass(element, 'Wirisformula')) {
_wrs_int_temporalImageResizing = element;
}
}
@@ -552,21 +477,6 @@ function wrs_int_updateFormula(mathml, editMode, language) {
}
}
-/**
- * Calls wrs_updateCAS with well params.
- * @param string appletCode
- * @param string image
- * @param int width
- * @param int height
- */
-function wrs_int_updateCAS(appletCode, image, width, height) {
- if (_wrs_int_temporalElementIsIframe) {
- wrs_updateCAS(_wrs_int_temporalIframe.contentWindow, _wrs_int_temporalIframe.contentWindow, appletCode, image, width, height);
- } else {
- wrs_updateCAS(_wrs_int_temporalIframe, window, appletCode, image, width, height);
- }
-}
-
/**
* Handles window closing.
*/
diff --git a/tinymce/wirisplugin-generic.js b/tinymce/wirisplugin-generic.js
index a170074..df0a4ed 100644
--- a/tinymce/wirisplugin-generic.js
+++ b/tinymce/wirisplugin-generic.js
@@ -47,14 +47,17 @@ var _wrs_int_directionality = '';
// Custom Editors.
var _wrs_int_customEditors = {chemistry : {name: 'Chemistry', toolbar : 'chemistry', icon : 'chem.png', enabled : false, confVariable : '_wrs_conf_chemEnabled', title: 'WIRIS EDITOR chemistry'}}
-if (navigator.userLanguage) {
- _wrs_int_langCode = navigator.userLanguage;
-}
-else if (navigator.language) {
- _wrs_int_langCode = navigator.language.substring(0, 2);
-}
-else {
- _wrs_int_langCode = 'en';
+
+if (typeof _wrs_int_langCode == 'undefined') {
+ if (navigator.userLanguage) {
+ _wrs_int_langCode = navigator.userLanguage;
+ }
+ else if (navigator.language) {
+ _wrs_int_langCode = navigator.language.substring(0, 2);
+ }
+ else {
+ _wrs_int_langCode = 'en';
+ }
}
// Including core.js.
diff --git a/version.php b/version.php
index 9587695..71742c0 100644
--- a/version.php
+++ b/version.php
@@ -26,9 +26,9 @@
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2017030900;
-$plugin->release = '4.1.1.1361';
+$plugin->version = 2017040600;
+$plugin->release = '4.2.0.1364';
$plugin->requires = 2012120300;
$plugin->component = 'tinymce_tiny_mce_wiris';
-$plugin->dependencies = array ('filter_wiris' => 2017030900);
+$plugin->dependencies = array ('filter_wiris' => 2017040600);
$plugin->maturity = MATURITY_STABLE;