diff --git a/.travis.yml b/.travis.yml index 8551765f..19fc7e94 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,8 @@ php: - 7.0 env: + - MOODLE_BRANCH=MOODLE_33_STABLE DB=mysqli + - MOODLE_BRANCH=MOODLE_32_STABLE DB=mysqli - MOODLE_BRANCH=MOODLE_31_STABLE DB=mysqli - MOODLE_BRANCH=MOODLE_30_STABLE DB=pgsql - MOODLE_BRANCH=MOODLE_29_STABLE DB=mysqli @@ -35,6 +37,10 @@ matrix: env: MOODLE_BRANCH=MOODLE_28_STABLE DB=pgsql - php: 5.6 env: MOODLE_BRANCH=MOODLE_27_STABLE DB=mysqli + - php: 5.4 + env: MOODLE_BRANCH=MOODLE_33_STABLE DB=mysqli + - php: 5.4 + env: MOODLE_BRANCH=MOODLE_32_STABLE DB=mysqli include: - php: 5.4 env: MOODLE_BRANCH=MOODLE_31_STABLE DB=mysqli diff --git a/README.md b/README.md index f129fff6..78c428eb 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,11 @@ WIRIS plugin for Moodle ========== +### Master Build Status [![Build Status](https://travis-ci.org/wiris/moodle-atto_wiris.svg?branch=master)](https://travis-ci.org/wiris/moodle-atto_wiris) +### Development Build Status +[![Build Status](https://travis-ci.org/wiris/moodle-atto_wiris.svg?branch=development)](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). +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). [WIRIS EDITOR](http://www.wiris.com/editor) is a mathematical **visual (WYSIWYG) editor**. You can use a large collection of icons nicely organized in thematic tabs in order to create formulas or equations for any web content. You can create and edit your formulas in a visual environment, just click on the WIRIS editor icon for creation or double-click on the formula for edition. It is based on JavaScript and compatible with HTML 5. diff --git a/VERSION b/VERSION index a2914fef..47568998 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.3.1.1366 +4.4.0.1366 diff --git a/core/core.js b/core/core.js index 231ae6f1..829ace16 100644 --- a/core/core.js +++ b/core/core.js @@ -116,7 +116,7 @@ if (!(window._wrs_conf_CASClassName)) { if (typeof MutationObserver != 'undefined') { var wrs_observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { - if (mutation.oldValue == _wrs_conf_imageClassName && mutation.attributeName == 'class' && mutation.target.className.indexOf(_wrs_conf_imageClassName) == -1 ) { + if (mutation.oldValue == _wrs_conf_imageClassName && mutation.attributeName == 'class' && mutation.targetpassName.indexOf(_wrs_conf_imageClassName) == -1 ) { mutation.target.className = _wrs_conf_imageClassName; } }); @@ -894,7 +894,15 @@ function wrs_getLatexFromMathML(mathml) { 'mml': mathml }; - return wrs_getContent(_wrs_conf_servicePath, data); + var jsonResponse = JSON.parse(wrs_getContent(_wrs_conf_servicePath, data)); + + var latex; + + if (jsonResponse.status == "ok") { + latex = jsonResponse.result.text; + } + + return latex; } /** @@ -1019,10 +1027,19 @@ function wrs_getMathMLFromLatex(latex, includeLatexOnSemantics) { data['saveLatex'] = ''; } - var mathML = wrs_getContent(_wrs_conf_servicePath, data); - // Populate LatexCache. - wrs_populateLatexCache(latex, mathML); - return mathML.split("\r").join('').split("\n").join(' '); + var jsonResponse = JSON.parse(wrs_getContent(_wrs_conf_servicePath, data)); + + var output; + if (jsonResponse.status == "ok") { + var output = jsonResponse.result.text; + output = output.split("\r").join('').split("\n").join(' '); + // Populate LatexCache. + wrs_populateLatexCache(latex, output); + } else { + output = "$$" + latex + "$$"; + } + + return output; } /** @@ -1504,8 +1521,6 @@ function wrs_getElementsByNameFromString(code, name, autoClosed) { */ function wrs_insertElementOnSelection(element, focusElement, windowTarget) { try { - focusElement.focus(); - // Integration function // If wrs_int_insertElementOnSelection function exists on // integration script can call focus method from the editor instance. @@ -1515,6 +1530,9 @@ function wrs_insertElementOnSelection(element, focusElement, windowTarget) { if (typeof wrs_int_insertElementOnSelection != 'undefined') { wrs_int_insertElementOnSelection(); } + else { + focusElement.focus(); + } if (_wrs_isNewElement) { if (document.selection && document.getSelection == 0) { @@ -1827,7 +1845,10 @@ function wrs_mathmlToAccessible(mathml, language, data) { } else { data['service'] = 'mathml2accessible'; - var accessibleText = wrs_getContent(_wrs_conf_servicePath, data); + var accesibleJsonResponse = JSON.parse(wrs_getContent(_wrs_conf_servicePath, data)); + if (accesibleJsonResponse.status != 'error') { + accessibleText = accesibleJsonResponse.result.text; + } } return accessibleText; @@ -2206,7 +2227,6 @@ function wrs_openEditorWindow(language, target, isIframe) { document.getElementsByTagName("head")[0].appendChild(fileref); _wrs_css_loaded = true; } - _wrs_modalWindow.setTitle(title); _wrs_modalWindow.open(); } } @@ -2648,21 +2668,7 @@ function wrs_initSetSize() { function wrs_loadConfiguration() { if (typeof _wrs_conf_path == 'undefined') { - // Discover path. - var scriptName = "core/core.js"; - var col = document.getElementsByTagName("script"); - for (i = 0; i < col.length; i++) { - var d; - var src; - d = col[i]; - src = d.src; - var j = src.lastIndexOf(scriptName); - if (j >= 0) { - // That's my script! - baseURL = src.substr(0, j - 1); - } - } - _wrs_conf_path = baseURL; + _wrs_conf_path = wrs_getCorePath(); } var script = document.createElement('script'); @@ -2676,6 +2682,29 @@ function wrs_loadConfiguration() { document.getElementsByTagName('head')[0].appendChild(script); // Asynchronous load of configuration. } +function wrs_getCorePath() { + var scriptName = "core/core.js"; + var col = document.getElementsByTagName("script"); + for (i = 0; i < col.length; i++) { + var d; + var src; + d = col[i]; + src = d.src; + var j = src.lastIndexOf(scriptName); + if (j >= 0) { + // That's my script! + return src.substr(0, j - 1); + } + } +} + +function wrs_loadLangFile() { + var script = document.createElement('script'); + script.type = 'text/javascript'; + script.src = wrs_getCorePath() + "/lang/" + _wrs_int_langCode + "/strings.js"; + document.getElementsByTagName('head')[0].appendChild(script); +} + function wrs_concatenateUrl(path1, path2) { return (path1 + path2).replace(/([^:]\/)\/+/g, "$1"); } @@ -2688,7 +2717,7 @@ if (typeof _wrs_conf_configuration_loaded == 'undefined') { _wrs_conf_plugin_loaded = true; } - +wrs_loadLangFile() /** * Create modal window with embebbed iframe @@ -3381,6 +3410,17 @@ function wrs_addPluginListener(listener) { wrs_pluginListeners.push(listener); } +/** + * For now its not possible comunicate directly between editor.js and ModalWindow object. + * We need to use this method to call ModalWindow prototype from editor.js + * @param {object} editor WIRIS Editor + */ +function wrs_setModalWindowEditor(editor) { + if (_wrs_conf_modalWindow) { + _wrs_modalWindow.setEditor(editor); + } +} + // Production steps of ECMA-262, Edition 5, 15.4.4.18 // Reference: http://es5.github.io/#x15.4.4.18. if (!Array.prototype.forEach) { @@ -4054,19 +4094,19 @@ function ModalWindow(path, editorAttributes) { attributes = {}; attributes['class'] = 'wrs_modal_close_button'; - attributes['title'] = 'Close'; + attributes['title'] = strings['close']; var closeModalDiv = wrs_createElement('div', attributes); this.closeDiv = closeModalDiv; attributes = {}; attributes['class'] = 'wrs_modal_stack_button'; - attributes['title'] = 'Full-screen'; + attributes['title'] = strings['fullscreen']; var stackModalDiv = wrs_createElement('div', attributes); this.stackDiv = stackModalDiv; attributes = {}; attributes['class'] = 'wrs_modal_minimize_button'; - attributes['title'] = 'Minimise'; + attributes['title'] = strings['minimise']; var minimizeModalDiv = wrs_createElement('div', attributes); this.minimizeDiv = minimizeModalDiv; @@ -4088,8 +4128,7 @@ function ModalWindow(path, editorAttributes) { var iframeModalContainer = wrs_createElement('div', attributes); this.iframeContainer = iframeModalContainer; - this.editor = null; - + this.lastImageWasNew = true; } ModalWindow.prototype.create = function() { @@ -4143,30 +4182,47 @@ ModalWindow.prototype.open = function() { if (this.properties.open == true || this.properties.created) { - var editor = this.iframe.contentWindow._wrs_modalWindowProperties.editor; - var update_toolbar = function() { + var editor = this.editor; + var updateToolbar = function() { if (customEditor = wrs_int_getCustomEditorEnabled()) { - toolbar = customEditor.toolbar ? customEditor.toolbar : wrs_attributes['toolbar']; + var toolbar = customEditor.toolbar ? customEditor.toolbar : _wrs_int_wirisProperties['toolbar']; + _wrs_modalWindow.setTitle(customEditor.title); if (typeof editor.params.toolbar == 'undefined' || editor.params.toolbar != toolbar) { editor.setParams({'toolbar' : toolbar}); - _wrs_modalWindow.setTitle(customEditor.title); } - } else if (typeof editor.params.toolbar != 'undefined' && editor.params.toolbar != 'general') { - editor.setParams({'toolbar' : 'general'}); + } else { + var toolbar = (typeof _wrs_int_wirisProperties == 'undefined' || typeof _wrs_int_wirisProperties['toolbar'] == 'undefined') ? 'general' : _wrs_int_wirisProperties['toolbar']; _wrs_modalWindow.setTitle('WIRIS EDITOR math'); + if (typeof editor.params.toolbar == 'undefined' || editor.params.toolbar != toolbar) { + editor.setParams({'toolbar' : toolbar}); + wrs_int_disableCustomEditors(); + } + } + }; + + var self = this; + + // It controls cases where is needed to set an empty mathml or copy the current mathml value. + var updateMathMLContent = function () { + if (!self.lastImageWasNew) { + if (self.properties.deviceProperties.isAndroid || self.properties.deviceProperties.isIOS) { + editor.setMathML('[]"'); + } else { + editor.setMathML(''); + } } }; if (this.properties.open == true) { - var customEditorClass = _wrs_temporalImage.getAttribute('data-custom-editor'); - if (customEditorClass) { - wrs_int_enableCustomEditor(customEditorClass); + updateToolbar(); + if (_wrs_isNewElement) { + updateMathMLContent(); + self.lastImageWasNew = true; } else { - wrs_int_disableCustomEditors(); + editor.setMathML(wrs_mathmlDecode(_wrs_temporalImage.getAttribute('data-mathml'))); + this.lastImageWasNew = false; } - update_toolbar(); - this.iframe.contentWindow._wrs_modalWindowProperties.editor.setMathML(wrs_mathmlDecode(_wrs_temporalImage.getAttribute('data-mathml'))); } else { this.containerDiv.style.visibility = ''; @@ -4176,26 +4232,18 @@ ModalWindow.prototype.open = function() { this.properties.open = true; + updateToolbar(); + if (_wrs_isNewElement) { - if (this.properties.deviceProperties.isAndroid || this.properties.deviceProperties.isIOS) { - editor.setMathML('[]"'); - } else { - editor.setMathML(''); - } - update_toolbar(); + updateMathMLContent(); + self.lastImageWasNew = true; } else { - var customEditorClass = _wrs_temporalImage.getAttribute('data-custom-editor'); - if (customEditorClass) { - wrs_int_enableCustomEditor(customEditorClass); - } - else { - wrs_int_disableCustomEditors(); - } - update_toolbar(); editor.setMathML(wrs_mathmlDecode(_wrs_temporalImage.getAttribute('data-mathml'))); + this.lastImageWasNew = false; } editor.focus(); + if (!this.properties.deviceProperties.isAndroid && !this.properties.deviceProperties.isIOS) { this.stackModalWindow(); } @@ -4205,6 +4253,8 @@ ModalWindow.prototype.open = function() { this.maximizeModalWindow(); } } else { + var title = wrs_int_getCustomEditorEnabled() != null ? wrs_int_getCustomEditorEnabled().title : 'WIRIS EDITOR math'; + _wrs_modalWindow.setTitle(title); this.create(); } @@ -4215,13 +4265,14 @@ ModalWindow.prototype.open = function() { * @ignore */ ModalWindow.prototype.close = function() { + // Is mandatory make this BEFORE hide modalwindow. + this.editor.setMathML(''); this.overlayDiv.style.visibility = 'hidden'; this.containerDiv.style.visibility = 'hidden'; this.containerDiv.style.display = 'none'; this.overlayDiv.style.display = 'none'; this.properties.open = false; wrs_int_disableCustomEditors(); - document.getElementsByClassName('wrs_modal_iframe')[0].contentWindow._wrs_modalWindowProperties.editor.setMathML(''); // Properties to initial state. this.properties.state = ''; this.properties.previousState = ''; @@ -4468,9 +4519,6 @@ ModalWindow.prototype.startDrag = function(ev) { }; } - if (typeof dialogContainerDiv != 'undefined') { - this.addClass('wrs_drag'); - } } /** @@ -4508,7 +4556,6 @@ ModalWindow.prototype.stopDrag = function(ev) { 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; } @@ -4539,10 +4586,14 @@ ModalWindow.prototype.hideKeyboard = function() { }, 200); }; - // ...focus function changes scroll value, so we need to restore it. - if (typeof scrollY != 'undefined') { - var keepScroll = scrollY; - field.focus(); - window.scrollTo(0, keepScroll); - } + var keepScroll = window.pageYOffset; + field.focus(); + window.scrollTo(0, keepScroll); +} + +/** + * Set WIRIS Editor as variable + */ +ModalWindow.prototype.setEditor = function(editor) { + this.editor = editor; } diff --git a/core/editor.js b/core/editor.js index 01117979..3e6facad 100644 --- a/core/editor.js +++ b/core/editor.js @@ -220,10 +220,6 @@ var _wrs_isNewElement; // Unfortunately we need this variabels as global variabl wrs_attributes['toolbar'] = _wrs_conf_editorToolbar; } - if (customEditor = wrs_int_getCustomEditorEnabled()) { - wrs_attributes['toolbar'] = customEditor.toolbar ? customEditor.toolbar : wrs_attributes['toolbar']; - } - if (typeof(_wrs_int_wirisProperties) != 'undefined') { for (var key in _wrs_int_wirisProperties) { if (_wrs_int_wirisProperties.hasOwnProperty(key) && typeof(_wrs_int_wirisProperties[key]) != 'undefined') { @@ -232,12 +228,20 @@ var _wrs_isNewElement; // Unfortunately we need this variabels as global variabl } } + if (customEditor = wrs_int_getCustomEditorEnabled()) { + wrs_attributes['toolbar'] = customEditor.toolbar ? customEditor.toolbar : wrs_attributes['toolbar']; + } + if (com.wiris.jsEditor.defaultBasePath) { editor = com.wiris.jsEditor.JsEditor.newInstance(wrs_attributes); } else { editor = new com.wiris.jsEditor.JsEditor('editor', null); } + + // Set ModalWindow editor attribute. + getMethod(null, 'wrs_setModalWindowEditor', [editor], function(){ + }); _wrs_modalWindowProperties.editor = editor; var ua = navigator.userAgent.toLowerCase(); @@ -303,6 +307,7 @@ var _wrs_isNewElement; // Unfortunately we need this variabels as global variabl }); wrs_addEvent(submitButton, 'click', function () { + // In order to avoid n-formulas on n-clicks // submit button is disabled 1 second. submitButton.disabled = true; @@ -311,18 +316,33 @@ var _wrs_isNewElement; // Unfortunately we need this variabels as global variabl submitButton.disabled = false; }, 1000); - var mathml = ''; + // There are vars that are updated during the execution in core.js, we need to sync. + var varsToUpdate = ['_wrs_int_customEditors']; + getVars(varsToUpdate, function(object) { // Callback method to set variables. + for (var varName in object) { + window[varName] = object[varName]; // Variables set as global variables on window (core.js is on window can't change the scope). + } - if (!editor.isFormulaEmpty()) { - mathml += editor.getMathML(); // If isn't empty, get mathml code to mathml variable. - if (customEditor) { - mathml = wrs_mathmlAddEditorAttribute(mathml); + var mathml = ''; + + if (!editor.isFormulaEmpty()) { + mathml += editor.getMathML(); // If isn't empty, get mathml code to mathml variable. + if (wrs_int_getCustomEditorEnabled() != null) { + mathml = wrs_mathmlAddEditorAttribute(mathml); + } + else { + var startIndex = mathml.indexOf(' class="'); + if (startIndex != -1) { + var lastIndex = mathml.indexOf('"', startIndex + 8); + mathml = mathml.substring(0, startIndex) + mathml.substring(lastIndex + 1); + } + } + mathml = wrs_mathmlEntities(mathml); // Apply a parse. } - mathml = wrs_mathmlEntities(mathml); // Apply a parse. - } - getMethod(null, 'wrs_int_updateFormula', [mathml, null, queryParams['lang']], function(){ - _wrs_closeFunction(); + getMethod(null, 'wrs_int_updateFormula', [mathml, null, queryParams['lang']], function(){ + _wrs_closeFunction(); + }); }); }); diff --git a/lang/ar/strings.js b/lang/ar/strings.js index edb851ed..3455ca64 100644 --- a/lang/ar/strings.js +++ b/lang/ar/strings.js @@ -3,3 +3,6 @@ strings['cancel'] = 'إلغاء'; strings['accept'] = 'مواÙ?Ù‚'; strings['manual'] = 'الدليل'; strings['latex'] = 'LaTeX'; +strings['close'] = 'Close'; +strings['minimise'] = 'Minimise'; +strings['fullscreen'] = 'Full-screen'; diff --git a/lang/ca/strings.js b/lang/ca/strings.js index 148514d4..efb791ae 100644 --- a/lang/ca/strings.js +++ b/lang/ca/strings.js @@ -3,3 +3,6 @@ strings['cancel'] = 'Cancel·lar'; strings['accept'] = 'Acceptar'; strings['manual'] = 'Manual'; strings['latex'] = 'LaTeX'; +strings['close'] = 'Close'; +strings['minimise'] = 'Minimise'; +strings['fullscreen'] = 'Full-screen'; diff --git a/lang/cs/strings.js b/lang/cs/strings.js index d7f26e74..04fc7671 100644 --- a/lang/cs/strings.js +++ b/lang/cs/strings.js @@ -3,3 +3,6 @@ strings['cancel'] = 'Storno'; strings['accept'] = 'OK'; strings['manual'] = 'PříruÄ?ka'; strings['latex'] = 'LaTeX'; +strings['close'] = 'Close'; +strings['minimise'] = 'Minimise'; +strings['fullscreen'] = 'Full-screen'; diff --git a/lang/da/strings.js b/lang/da/strings.js index 0a9c68dd..e048ef7d 100644 --- a/lang/da/strings.js +++ b/lang/da/strings.js @@ -3,3 +3,6 @@ strings['cancel'] = 'Annuller'; strings['accept'] = 'OK'; strings['manual'] = 'Brugervejledning'; strings['latex'] = 'LaTeX'; +strings['close'] = 'Close'; +strings['minimise'] = 'Minimise'; +strings['fullscreen'] = 'Full-screen'; diff --git a/lang/de/strings.js b/lang/de/strings.js index 15d6baab..d046de34 100644 --- a/lang/de/strings.js +++ b/lang/de/strings.js @@ -3,3 +3,6 @@ strings['cancel'] = 'Abbrechen'; strings['accept'] = 'OK'; strings['manual'] = 'Handbuch'; strings['latex'] = 'LaTeX'; +strings['close'] = 'Close'; +strings['minimise'] = 'Minimise'; +strings['fullscreen'] = 'Full-screen'; diff --git a/lang/el/strings.js b/lang/el/strings.js index 7ec63cb0..c2426c10 100644 --- a/lang/el/strings.js +++ b/lang/el/strings.js @@ -3,3 +3,6 @@ strings['cancel'] = 'Άκυ strings['accept'] = 'ΟΚ'; strings['manual'] = 'ΧειÏ?οκίνητα'; strings['latex'] = 'LaTeX'; +strings['close'] = 'Close'; +strings['minimise'] = 'Minimise'; +strings['fullscreen'] = 'Full-screen'; diff --git a/lang/en/strings.js b/lang/en/strings.js index b23a577f..3a910eb5 100644 --- a/lang/en/strings.js +++ b/lang/en/strings.js @@ -3,3 +3,6 @@ strings['cancel'] = 'Cancel'; strings['accept'] = 'OK'; strings['manual'] = 'Manual'; strings['latex'] = 'LaTeX'; +strings['close'] = 'Close'; +strings['minimise'] = 'Minimise'; +strings['fullscreen'] = 'Full-screen'; diff --git a/lang/es/strings.js b/lang/es/strings.js index f890ebcd..1faba7e1 100644 --- a/lang/es/strings.js +++ b/lang/es/strings.js @@ -3,3 +3,6 @@ strings['cancel'] = 'Cancelar'; strings['accept'] = 'Aceptar'; strings['manual'] = 'Manual'; strings['latex'] = 'LaTeX'; +strings['close'] = 'Close'; +strings['minimise'] = 'Minimise'; +strings['fullscreen'] = 'Full-screen'; diff --git a/lang/et/strings.js b/lang/et/strings.js index ca42413f..22d8e3a4 100644 --- a/lang/et/strings.js +++ b/lang/et/strings.js @@ -3,3 +3,6 @@ strings['cancel'] = 'Loobu'; strings['accept'] = 'OK'; strings['manual'] = 'Käsiraamat'; strings['latex'] = 'LaTeX'; +strings['close'] = 'Close'; +strings['minimise'] = 'Minimise'; +strings['fullscreen'] = 'Full-screen'; diff --git a/lang/eu/strings.js b/lang/eu/strings.js index a38e784c..76f21b0f 100644 --- a/lang/eu/strings.js +++ b/lang/eu/strings.js @@ -3,3 +3,6 @@ strings['cancel'] = 'Ezeztatu'; strings['accept'] = 'Onartu'; strings['manual'] = 'Gida'; strings['latex'] = 'LaTeX'; +strings['close'] = 'Close'; +strings['minimise'] = 'Minimise'; +strings['fullscreen'] = 'Full-screen'; diff --git a/lang/fi/strings.js b/lang/fi/strings.js index e00d9069..4c479ce6 100644 --- a/lang/fi/strings.js +++ b/lang/fi/strings.js @@ -3,3 +3,6 @@ strings['cancel'] = 'Peruuta'; strings['accept'] = 'OK'; strings['manual'] = 'Manual'; strings['latex'] = 'LaTeX'; +strings['close'] = 'Close'; +strings['minimise'] = 'Minimise'; +strings['fullscreen'] = 'Full-screen'; diff --git a/lang/fr/strings.js b/lang/fr/strings.js index 832eb3f7..84d07a98 100644 --- a/lang/fr/strings.js +++ b/lang/fr/strings.js @@ -3,3 +3,6 @@ strings['cancel'] = 'Annuler'; strings['accept'] = 'OK'; strings['manual'] = 'Manuel'; strings['latex'] = 'LaTeX'; +strings['close'] = 'Close'; +strings['minimise'] = 'Minimise'; +strings['fullscreen'] = 'Full-screen'; diff --git a/lang/gl/strings.js b/lang/gl/strings.js index f890ebcd..1faba7e1 100644 --- a/lang/gl/strings.js +++ b/lang/gl/strings.js @@ -3,3 +3,6 @@ strings['cancel'] = 'Cancelar'; strings['accept'] = 'Aceptar'; strings['manual'] = 'Manual'; strings['latex'] = 'LaTeX'; +strings['close'] = 'Close'; +strings['minimise'] = 'Minimise'; +strings['fullscreen'] = 'Full-screen'; diff --git a/lang/he/strings.js b/lang/he/strings.js index 867cd9a4..e00bd68c 100644 --- a/lang/he/strings.js +++ b/lang/he/strings.js @@ -3,3 +3,6 @@ strings['cancel'] = 'ביטול'; strings['accept'] = '×?ישור'; strings['manual'] = 'מדריך'; strings['latex'] = 'LaTeX'; +strings['close'] = 'Close'; +strings['minimise'] = 'Minimise'; +strings['fullscreen'] = 'Full-screen'; diff --git a/lang/hr/strings.js b/lang/hr/strings.js index ef67db94..381ed3c3 100644 --- a/lang/hr/strings.js +++ b/lang/hr/strings.js @@ -3,3 +3,6 @@ strings['cancel'] = 'PoniÅ¡ti'; strings['accept'] = 'U redu'; strings['manual'] = 'PriruÄ?nik'; strings['latex'] = 'LaTeX'; +strings['close'] = 'Close'; +strings['minimise'] = 'Minimise'; +strings['fullscreen'] = 'Full-screen'; diff --git a/lang/hu/strings.js b/lang/hu/strings.js index 89f1311a..2ba267dc 100644 --- a/lang/hu/strings.js +++ b/lang/hu/strings.js @@ -3,3 +3,6 @@ strings['cancel'] = 'Mégsem'; strings['accept'] = 'OK'; strings['manual'] = 'Kézikönyv'; strings['latex'] = 'LaTeX'; +strings['close'] = 'Close'; +strings['minimise'] = 'Minimise'; +strings['fullscreen'] = 'Full-screen'; diff --git a/lang/it/strings.js b/lang/it/strings.js index fcffa66a..c2b539b5 100644 --- a/lang/it/strings.js +++ b/lang/it/strings.js @@ -3,3 +3,6 @@ strings['cancel'] = 'Annulla'; strings['accept'] = 'Accetta'; strings['manual'] = 'Manuale'; strings['latex'] = 'LaTeX'; +strings['close'] = 'Close'; +strings['minimise'] = 'Minimise'; +strings['fullscreen'] = 'Full-screen'; diff --git a/lang/ja/strings.js b/lang/ja/strings.js index 3833b536..c017287d 100644 --- a/lang/ja/strings.js +++ b/lang/ja/strings.js @@ -3,3 +3,6 @@ strings['cancel'] = 'キャンセル'; strings['accept'] = 'OK'; strings['manual'] = 'マニュアル'; strings['latex'] = 'LaTeX'; +strings['close'] = 'Close'; +strings['minimise'] = 'Minimise'; +strings['fullscreen'] = 'Full-screen'; diff --git a/lang/ko/strings.js b/lang/ko/strings.js index 8fd00063..c69cb229 100644 --- a/lang/ko/strings.js +++ b/lang/ko/strings.js @@ -3,3 +3,6 @@ strings['cancel'] = '취소'; strings['accept'] = '승ì?¸'; strings['manual'] = '설명서'; strings['latex'] = 'LaTeX'; +strings['close'] = 'Close'; +strings['minimise'] = 'Minimise'; +strings['fullscreen'] = 'Full-screen'; diff --git a/lang/nl/strings.js b/lang/nl/strings.js index 01603f68..f05331cf 100644 --- a/lang/nl/strings.js +++ b/lang/nl/strings.js @@ -3,3 +3,6 @@ strings['cancel'] = 'Annuleren'; strings['accept'] = 'OK'; strings['manual'] = 'Handleiding'; strings['latex'] = 'LaTeX'; +strings['close'] = 'Close'; +strings['minimise'] = 'Minimise'; +strings['fullscreen'] = 'Full-screen'; diff --git a/lang/no/strings.js b/lang/no/strings.js index c9f44b73..1acc9fba 100644 --- a/lang/no/strings.js +++ b/lang/no/strings.js @@ -3,3 +3,6 @@ strings['cancel'] = 'Avbryt'; strings['accept'] = 'OK'; strings['manual'] = 'HÃ¥ndbok'; strings['latex'] = 'LaTeX'; +strings['close'] = 'Close'; +strings['minimise'] = 'Minimise'; +strings['fullscreen'] = 'Full-screen'; diff --git a/lang/pl/strings.js b/lang/pl/strings.js index a8c521a6..c8a00f92 100644 --- a/lang/pl/strings.js +++ b/lang/pl/strings.js @@ -3,3 +3,6 @@ strings['cancel'] = 'Anuluj'; strings['accept'] = 'OK'; strings['manual'] = 'Instrukcja'; strings['latex'] = 'LaTeX'; +strings['close'] = 'Close'; +strings['minimise'] = 'Minimise'; +strings['fullscreen'] = 'Full-screen'; diff --git a/lang/pt/strings.js b/lang/pt/strings.js index b9d2fc85..b35e4eda 100644 --- a/lang/pt/strings.js +++ b/lang/pt/strings.js @@ -3,3 +3,6 @@ strings['cancel'] = 'Cancelar'; strings['accept'] = 'OK'; strings['manual'] = 'Manual'; strings['latex'] = 'LaTeX'; +strings['close'] = 'Close'; +strings['minimise'] = 'Minimise'; +strings['fullscreen'] = 'Full-screen'; diff --git a/lang/pt_br/strings.js b/lang/pt_br/strings.js index b9d2fc85..b35e4eda 100644 --- a/lang/pt_br/strings.js +++ b/lang/pt_br/strings.js @@ -3,3 +3,6 @@ strings['cancel'] = 'Cancelar'; strings['accept'] = 'OK'; strings['manual'] = 'Manual'; strings['latex'] = 'LaTeX'; +strings['close'] = 'Close'; +strings['minimise'] = 'Minimise'; +strings['fullscreen'] = 'Full-screen'; diff --git a/lang/ru/strings.js b/lang/ru/strings.js index 96257676..3b91d474 100644 --- a/lang/ru/strings.js +++ b/lang/ru/strings.js @@ -3,3 +3,6 @@ strings['cancel'] = 'отмена'; strings['accept'] = 'OK'; strings['manual'] = 'вручную'; strings['latex'] = 'LaTeX'; +strings['close'] = 'Close'; +strings['minimise'] = 'Minimise'; +strings['fullscreen'] = 'Full-screen'; diff --git a/lang/sv/strings.js b/lang/sv/strings.js index ab050efe..97317210 100644 --- a/lang/sv/strings.js +++ b/lang/sv/strings.js @@ -3,3 +3,6 @@ strings['cancel'] = 'Avbryt'; strings['accept'] = 'OK'; strings['manual'] = 'Bruksanvisning'; strings['latex'] = 'LaTeX'; +strings['close'] = 'Close'; +strings['minimise'] = 'Minimise'; +strings['fullscreen'] = 'Full-screen'; diff --git a/lang/tr/strings.js b/lang/tr/strings.js index 1db809c9..b12fdd48 100644 --- a/lang/tr/strings.js +++ b/lang/tr/strings.js @@ -3,3 +3,6 @@ strings['cancel'] = 'Vazgeç'; strings['accept'] = 'Tamam'; strings['manual'] = 'Kılavuz'; strings['latex'] = 'LaTeX'; +strings['close'] = 'Close'; +strings['minimise'] = 'Minimise'; +strings['fullscreen'] = 'Full-screen'; diff --git a/lang/zh/strings.js b/lang/zh/strings.js index fdcb0f53..8dd366cb 100644 --- a/lang/zh/strings.js +++ b/lang/zh/strings.js @@ -3,3 +3,6 @@ strings['cancel'] = ' strings['accept'] = '确定'; strings['manual'] = '手册'; strings['latex'] = 'LaTeX'; +strings['close'] = 'Close'; +strings['minimise'] = 'Minimise'; +strings['fullscreen'] = 'Full-screen'; diff --git a/version.php b/version.php index 3ec17d57..257131b6 100644 --- a/version.php +++ b/version.php @@ -25,9 +25,9 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2017050800; -$plugin->release = '4.3.1.1366'; -$plugin->requires = 2014050800; +$plugin->version = 2017061500; +$plugin->release = '4.4.0.1366'; +$plugin->requires = 2014050800; $plugin->component = 'atto_wiris'; -$plugin->dependencies = array ('filter_wiris' => 2017050800); +$plugin->dependencies = array ('filter_wiris' => 2017061500); $plugin->maturity = MATURITY_STABLE; diff --git a/wirisplugin-generic.js b/wirisplugin-generic.js index d8ed60f3..ded507ed 100644 --- a/wirisplugin-generic.js +++ b/wirisplugin-generic.js @@ -50,7 +50,7 @@ var _wrs_int_customEditors = {chemistry : {name: 'Chemistry', toolbar : 'chemist if (typeof _wrs_int_langCode == 'undefined') { if (navigator.userLanguage) { - _wrs_int_langCode = navigator.userLanguage; + _wrs_int_langCode = navigator.userLanguage.substring(0, 2); } else if (navigator.language) { _wrs_int_langCode = navigator.language.substring(0, 2); @@ -110,6 +110,7 @@ function wrs_int_init_handler(target,toolbar) { formulaButton.style.cursor = 'pointer'; wrs_addEvent(formulaButton, 'click', function () { + wrs_int_disableCustomEditors(); wrs_int_openNewFormulaEditor(target, _wrs_int_langCode); }); @@ -190,6 +191,7 @@ function wrs_int_openNewCAS(iframe, language) { */ function wrs_int_doubleClickHandler(iframe, element) { if (element.nodeName.toLowerCase() == 'img') { + wrs_int_disableCustomEditors(); if (customEditor = element.getAttribute('data-custom-editor')) { wrs_int_enableCustomEditor(customEditor); } diff --git a/yui/build/moodle-atto_wiris-button/moodle-atto_wiris-button-debug.js b/yui/build/moodle-atto_wiris-button/moodle-atto_wiris-button-debug.js index f682febb..b1ecedc0 100644 --- a/yui/build/moodle-atto_wiris-button/moodle-atto_wiris-button-debug.js +++ b/yui/build/moodle-atto_wiris-button/moodle-atto_wiris-button-debug.js @@ -37,7 +37,7 @@ YUI.add('moodle-atto_wiris-button', function (Y, NAME) { Y.namespace('M.atto_wiris').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], { /** - * The current language. + * The current language en by default. * **/ _lang: 'en', @@ -115,6 +115,7 @@ Y.namespace('M.atto_wiris').Button = Y.Base.create('button', Y.M.editor_atto.Edi var host = this.get('host'); var wirisplugin = this; window._wrs_int_currentPlugin = this; + window._wrs_int_editors_elements = typeof window._wrs_int_editors_elements == "undefined" ? {} : window._wrs_int_editors_elements; // Update textarea value on change. host.on('change', function() { wirisplugin._unparseContent(); @@ -259,9 +260,8 @@ Y.namespace('M.atto_wiris').Button = Y.Base.create('button', Y.M.editor_atto.Edi wrs_int_enableCustomEditor(customEditor); } } - // We need to call global variable (can't call this._editorButton()) - // out of context. - window._wrs_int_currentPlugin._editorButton(); + + window._wrs_int_editors_elements[target.id]._editorButton(); } }, /** @@ -279,6 +279,7 @@ Y.namespace('M.atto_wiris').Button = Y.Base.create('button', Y.M.editor_atto.Edi _updateEditorImgHandlers: function() { // Add doubleclick event to editable div. wrs_addElementEvents(this.get('host').editor.getDOMNode(),this._handleElementDoubleclick); + window._wrs_int_editors_elements[this.get("host").editor.getDOMNode().id] = this; }, /** * Reset event handlers for cas images. diff --git a/yui/build/moodle-atto_wiris-button/moodle-atto_wiris-button-min.js b/yui/build/moodle-atto_wiris-button/moodle-atto_wiris-button-min.js index 0c1f3f8b..2f7a9a40 100644 --- a/yui/build/moodle-atto_wiris-button/moodle-atto_wiris-button-min.js +++ b/yui/build/moodle-atto_wiris-button/moodle-atto_wiris-button-min.js @@ -1 +1 @@ -YUI.add("moodle-atto_wiris-button",function(e,t){e.namespace("M.atto_wiris").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{_lang:"en",initializer:function(t){this._lang=t.lang,window._wrs_int_langCode=t.lang,window.wrs_int_notifyWindowClosed=function(){window._wrs_int_popup=null,window._wrs_temporalImage=null,window._wrs_isNewElement=!0},window.wrs_int_updateFormula=function(e,t){var n=window._wrs_int_currentPlugin.get("host").editor.getDOMNode();wrs_updateFormula(n,window,e,null,t,_wrs_int_currentPlugin._lang),window._wrs_int_currentPlugin.markUpdated(),window._wrs_int_currentPlugin._updateEditorImgHandlers()},window.wrs_int_updateCAS=function(e,t,n,r){var i=window._wrs_int_currentPlugin.get("host").editor.getDOMNode();wrs_updateCAS(i,window,e,t,n,r),window._wrs_int_currentPlugin.markUpdated(),window._wrs_int_currentPlugin._updateCasImgHandlers()},window._wrs_int_conf_file=M.cfg.wwwroot+"/filter/wiris/integration/configurationjs.php",window._wrs_int_conf_path=M.cfg.wwwroot+"/lib/editor/atto/plugins/wiris",window._wrs_int_conf_async=!0,window._wrs_int_popup=window._wrs_int_popup||null,window._wrs_int_coreLoading=window._wrs_int_coreLoading||!1,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_isMoodle24=!0,window._wrs_int_customEditors={chemistry:{name:"Chemistry",toolbar:"chemistry",icon:"chem.gif",enabled:!1,confVariable:"_wrs_conf_chemEnabled",title:"WIRIS EDITOR chemistry"}},window._wrs_int_coreLoading||(window._wrs_int_coreLoading=!0,e.Get.js(window._wrs_int_conf_path+"/core/core.js",function(e){e}));var n=this.get("host"),r=this;window._wrs_int_currentPlugin=this,n.on("change",function(){r._unparseContent()}),n._wirisUpdateFromTextArea=n.updateFromTextArea,n.updateFromTextArea=function(){n._wirisUpdateFromTextArea(),r._parseContent()},this._parseContent(),this._addButtons()},_addButtons:function(){if(window._wrs_conf_plugin_loaded){window._wrs_conf_editorEnabled&&this.addButton({title:"wiris_editor_title",buttonName:"wiris_editor",icon:"formula",iconComponent:"atto_wiris",callback:this._editorButton}),window[_wrs_int_customEditors.chemistry.confVariable]&&this.addButton({title:"wiris_chem_editor_title",buttonName:"wiris_chem_editor",icon:"chem",iconComponent:"atto_wiris",callback:this._chemEditorButton}),window._wrs_conf_CASEnabled&&this.addButton({title:"wiris_cas_title",buttonName:"wiris_cas",icon:"cas",iconComponent:"atto_wiris",callback:this._casButton});var t=this.get("host");t.plugins.collapse&&t.plugins.collapse._setVisibility(t.plugins.collapse.buttons.collapse)}else e.later(50,this,this._addButtons)},_editorButton:function(){if(_wrs_int_popup)_wrs_int_popup.focus();else{var e=this.get("host");_wrs_int_currentPlugin=this,_wrs_int_popup=wrs_openEditorWindow(this._lang,e.editor.getDOMNode(),!1)}},_chemEditorButton:function(){if(_wrs_int_popup)_wrs_int_popup.focus();else{var e=this.get("host");_wrs_int_currentPlugin=this,wrs_int_enableCustomEditor("chemistry"),_wrs_int_popup=wrs_openEditorWindow(this._lang,e.editor.getDOMNode(),!1)}},_casButton:function(){if(_wrs_int_popup)_wrs_int_popup.focus();else{var e=this.get("host");_wrs_int_currentPlugin=this,_wrs_int_popup=wrs_openCASWindow(e.editor.getDOMNode(),!1,this._lang)}},_parseContent:function(){if(window._wrs_conf_plugin_loaded){var t=this.get("host"),n=t.editor.get("innerHTML");n=wrs_initParse(n,this._lang),t.editor.set("innerHTML",n),this.markUpdated(),this._updateCasImgHandlers(),this._updateEditorImgHandlers()}else e.later(50,this,this._parseContent)},_unparseContent:function(){if(window._wrs_conf_plugin_loaded){var t=this.get("host"),n=t.textarea.get("value");n=wrs_endParse(n,null,this._lang),t.textarea.set("value",n)}else e.later(50,this,this._unparseContent)},_handleElementDoubleclick:function(e,t,n){if(t.dataset.mathml){n.stopPropagation(),window._wrs_temporalImage=t,window._wrs_isNewElement=!1;var r=window._wrs_temporalImage.getAttribute("data-custom-editor");typeof r!="undefined"&&r&&window[_wrs_int_customEditors[r].confVariable]&&wrs_int_enableCustomEditor(r),window._wrs_int_currentPlugin._editorButton()}},_handleCasDoubleClick:function(e){window._wrs_temporalImage=e.currentTarget.getDOMNode(),window._wrs_isNewElement=!1,this._casButton(),e.stopPropagation()},_updateEditorImgHandlers:function(){wrs_addElementEvents(this.get("host").editor.getDOMNode(),this._handleElementDoubleclick)},_updateCasImgHandlers:function(){this.editor.all("img.Wiriscas").each(function(e){e.detachAll("dblclick"),e.on("dblclick",this._handleCasDoubleClick,this)},this)}})},"@VERSION@",{requires:["moodle-editor_atto-plugin","get"]}); +YUI.add("moodle-atto_wiris-button",function(e,t){e.namespace("M.atto_wiris").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{_lang:"en",initializer:function(t){this._lang=t.lang,window._wrs_int_langCode=t.lang,window.wrs_int_notifyWindowClosed=function(){window._wrs_int_popup=null,window._wrs_temporalImage=null,window._wrs_isNewElement=!0},window.wrs_int_updateFormula=function(e,t){var n=window._wrs_int_currentPlugin.get("host").editor.getDOMNode();wrs_updateFormula(n,window,e,null,t,_wrs_int_currentPlugin._lang),window._wrs_int_currentPlugin.markUpdated(),window._wrs_int_currentPlugin._updateEditorImgHandlers()},window.wrs_int_updateCAS=function(e,t,n,r){var i=window._wrs_int_currentPlugin.get("host").editor.getDOMNode();wrs_updateCAS(i,window,e,t,n,r),window._wrs_int_currentPlugin.markUpdated(),window._wrs_int_currentPlugin._updateCasImgHandlers()},window._wrs_int_conf_file=M.cfg.wwwroot+"/filter/wiris/integration/configurationjs.php",window._wrs_int_conf_path=M.cfg.wwwroot+"/lib/editor/atto/plugins/wiris",window._wrs_int_conf_async=!0,window._wrs_int_popup=window._wrs_int_popup||null,window._wrs_int_coreLoading=window._wrs_int_coreLoading||!1,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_isMoodle24=!0,window._wrs_int_customEditors={chemistry:{name:"Chemistry",toolbar:"chemistry",icon:"chem.gif",enabled:!1,confVariable:"_wrs_conf_chemEnabled",title:"WIRIS EDITOR chemistry"}},window._wrs_int_coreLoading||(window._wrs_int_coreLoading=!0,e.Get.js(window._wrs_int_conf_path+"/core/core.js",function(e){e}));var n=this.get("host"),r=this;window._wrs_int_currentPlugin=this,window._wrs_int_editors_elements=typeof window._wrs_int_editors_elements=="undefined"?{}:window._wrs_int_editors_elements,n.on("change",function(){r._unparseContent()}),n._wirisUpdateFromTextArea=n.updateFromTextArea,n.updateFromTextArea=function(){n._wirisUpdateFromTextArea(),r._parseContent()},this._parseContent(),this._addButtons()},_addButtons:function(){if(window._wrs_conf_plugin_loaded){window._wrs_conf_editorEnabled&&this.addButton({title:"wiris_editor_title",buttonName:"wiris_editor",icon:"formula",iconComponent:"atto_wiris",callback:this._editorButton}),window[_wrs_int_customEditors.chemistry.confVariable]&&this.addButton({title:"wiris_chem_editor_title",buttonName:"wiris_chem_editor",icon:"chem",iconComponent:"atto_wiris",callback:this._chemEditorButton}),window._wrs_conf_CASEnabled&&this.addButton({title:"wiris_cas_title",buttonName:"wiris_cas",icon:"cas",iconComponent:"atto_wiris",callback:this._casButton});var t=this.get("host");t.plugins.collapse&&t.plugins.collapse._setVisibility(t.plugins.collapse.buttons.collapse)}else e.later(50,this,this._addButtons)},_editorButton:function(){if(_wrs_int_popup)_wrs_int_popup.focus();else{var e=this.get("host");_wrs_int_currentPlugin=this,_wrs_int_popup=wrs_openEditorWindow(this._lang,e.editor.getDOMNode(),!1)}},_chemEditorButton:function(){if(_wrs_int_popup)_wrs_int_popup.focus();else{var e=this.get("host");_wrs_int_currentPlugin=this,wrs_int_enableCustomEditor("chemistry"),_wrs_int_popup=wrs_openEditorWindow(this._lang,e.editor.getDOMNode(),!1)}},_casButton:function(){if(_wrs_int_popup)_wrs_int_popup.focus();else{var e=this.get("host");_wrs_int_currentPlugin=this,_wrs_int_popup=wrs_openCASWindow(e.editor.getDOMNode(),!1,this._lang)}},_parseContent:function(){if(window._wrs_conf_plugin_loaded){var t=this.get("host"),n=t.editor.get("innerHTML");n=wrs_initParse(n,this._lang),t.editor.set("innerHTML",n),this.markUpdated(),this._updateCasImgHandlers(),this._updateEditorImgHandlers()}else e.later(50,this,this._parseContent)},_unparseContent:function(){if(window._wrs_conf_plugin_loaded){var t=this.get("host"),n=t.textarea.get("value");n=wrs_endParse(n,null,this._lang),t.textarea.set("value",n)}else e.later(50,this,this._unparseContent)},_handleElementDoubleclick:function(e,t,n){if(t.dataset.mathml){n.stopPropagation(),window._wrs_temporalImage=t,window._wrs_isNewElement=!1;var r=window._wrs_temporalImage.getAttribute("data-custom-editor");typeof r!="undefined"&&r&&window[_wrs_int_customEditors[r].confVariable]&&wrs_int_enableCustomEditor(r),window._wrs_int_editors_elements[e.id]._editorButton()}},_handleCasDoubleClick:function(e){window._wrs_temporalImage=e.currentTarget.getDOMNode(),window._wrs_isNewElement=!1,this._casButton(),e.stopPropagation()},_updateEditorImgHandlers:function(){wrs_addElementEvents(this.get("host").editor.getDOMNode(),this._handleElementDoubleclick),window._wrs_int_editors_elements[this.get("host").editor.getDOMNode().id]=this},_updateCasImgHandlers:function(){this.editor.all("img.Wiriscas").each(function(e){e.detachAll("dblclick"),e.on("dblclick",this._handleCasDoubleClick,this)},this)}})},"@VERSION@",{requires:["moodle-editor_atto-plugin","get"]}); diff --git a/yui/build/moodle-atto_wiris-button/moodle-atto_wiris-button.js b/yui/build/moodle-atto_wiris-button/moodle-atto_wiris-button.js index 5e0563c1..e28b556a 100644 --- a/yui/build/moodle-atto_wiris-button/moodle-atto_wiris-button.js +++ b/yui/build/moodle-atto_wiris-button/moodle-atto_wiris-button.js @@ -37,7 +37,7 @@ YUI.add('moodle-atto_wiris-button', function (Y, NAME) { Y.namespace('M.atto_wiris').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], { /** - * The current language. + * The current language en by default. * **/ _lang: 'en', @@ -114,6 +114,7 @@ Y.namespace('M.atto_wiris').Button = Y.Base.create('button', Y.M.editor_atto.Edi var host = this.get('host'); var wirisplugin = this; window._wrs_int_currentPlugin = this; + window._wrs_int_editors_elements = typeof window._wrs_int_editors_elements == "undefined" ? {} : window._wrs_int_editors_elements; // Update textarea value on change. host.on('change', function() { wirisplugin._unparseContent(); @@ -258,9 +259,8 @@ Y.namespace('M.atto_wiris').Button = Y.Base.create('button', Y.M.editor_atto.Edi wrs_int_enableCustomEditor(customEditor); } } - // We need to call global variable (can't call this._editorButton()) - // out of context. - window._wrs_int_currentPlugin._editorButton(); + + window._wrs_int_editors_elements[target.id]._editorButton(); } }, /** @@ -278,6 +278,7 @@ Y.namespace('M.atto_wiris').Button = Y.Base.create('button', Y.M.editor_atto.Edi _updateEditorImgHandlers: function() { // Add doubleclick event to editable div. wrs_addElementEvents(this.get('host').editor.getDOMNode(),this._handleElementDoubleclick); + window._wrs_int_editors_elements[this.get("host").editor.getDOMNode().id] = this; }, /** * Reset event handlers for cas images. diff --git a/yui/src/button/js/button.js b/yui/src/button/js/button.js index 212ae6b1..f95b5484 100644 --- a/yui/src/button/js/button.js +++ b/yui/src/button/js/button.js @@ -35,7 +35,7 @@ Y.namespace('M.atto_wiris').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], { /** - * The current language. + * The current language en by default. * **/ _lang: 'en',