diff --git a/VERSION b/VERSION
index bd195547..cf715db4 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-4.2.0.1364
+4.3.0.1365
diff --git a/configuration.ini.dist b/configuration.ini.dist
index e2203ebe..59e5d6a4 100644
--- a/configuration.ini.dist
+++ b/configuration.ini.dist
@@ -48,6 +48,7 @@
#wiriseditorwindowattributes = width=570, height=450, scroll=no, resizable=yes
#wiriseditorsetsize = false
#wiriseditormodalwindow = false
+#wiriseditormodalwindowfullscreen = true
#wirischemeditorenabled = true
#wirisimageformat = png
diff --git a/core/core.js b/core/core.js
index 3430ceb1..b739b8a5 100644
--- a/core/core.js
+++ b/core/core.js
@@ -2184,7 +2184,7 @@ function wrs_openEditorWindow(language, target, isIframe) {
}
var title = wrs_int_getCustomEditorEnabled() != null ? wrs_int_getCustomEditorEnabled().title : 'WIRIS EDITOR math';
- if (!_wrs_conf_modalWindow) {
+ if (_wrs_conf_modalWindow != 'undefined' && _wrs_conf_modalWindow === false) {
_wrs_popupWindow = window.open(path, title, _wrs_conf_editorAttributes);
return _wrs_popupWindow;
}
@@ -2196,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", wrs_concatenateUrl(window.parent._wrs_conf_path, '/core/modal.css'));
+ fileref.setAttribute("href", wrs_concatenateUrl(_wrs_conf_path, '/core/modal.css'));
document.getElementsByTagName("head")[0].appendChild(fileref);
_wrs_css_loaded = true;
}
@@ -2700,7 +2700,7 @@ function wrs_createModalWindow() {
var fileref = document.createElement("link");
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
- fileref.setAttribute("href", wrs_concatenateUrl(window.parent._wrs_conf_path, '/core/modal.css'));
+ fileref.setAttribute("href", wrs_concatenateUrl(_wrs_conf_path, '/core/modal.css'));
document.getElementsByTagName("head")[0].appendChild(fileref);
_wrs_css_loaded = true;
}
@@ -3223,15 +3223,17 @@ function getMetricsFromSvgString(svgString) {
*/
function wrs_int_getCustomEditorEnabled() {
var customEditorEnabled = null;
- Object.keys(_wrs_int_customEditors).forEach(function(key) {
+ for (var key in _wrs_int_customEditors) {
if (_wrs_int_customEditors[key].enabled) {
- customEditorEnabled = _wrs_int_customEditors[key]
+ customEditorEnabled = _wrs_int_customEditors[key];
+ break;
}
- });
+ }
return customEditorEnabled;
}
+
/**
* Disable all custom editors
* @ignore
@@ -4122,50 +4124,84 @@ ModalWindow.prototype.create = function() {
_wrs_popupWindow = this.iframe.contentWindow;
this.properties.open = true;
this.properties.created = true;
+
+ if (typeof _wrs_conf_modalWindow != "undefined" && _wrs_conf_modalWindow && _wrs_conf_modalWindowFullScreen) {
+ this.maximizeModalWindow();
+ }
+
}
ModalWindow.prototype.open = function() {
this.hideKeyboard();
- if (this.properties.open == true) {
- this.iframe.contentWindow._wrs_modalWindowProperties.editor.setMathML(wrs_mathmlDecode(_wrs_temporalImage.getAttribute('data-mathml')));
- } else if (this.properties.created) {
-
- this.containerDiv.style.visibility = '';
- this.overlayDiv.style.visibility = '';
- this.containerDiv.style.display = '';
- this.overlayDiv.style.display = '';
+ if (this.properties.open == true || this.properties.created) {
var editor = this.iframe.contentWindow._wrs_modalWindowProperties.editor;
+ var update_toolbar = function() {
+ if (customEditor = wrs_int_getCustomEditorEnabled()) {
+ toolbar = customEditor.toolbar ? customEditor.toolbar : wrs_attributes['toolbar'];
+ 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'});
+ _wrs_modalWindow.setTitle('WIRIS EDITOR math');
+ }
+ };
- this.properties.open = true;
- if (customEditor = wrs_int_getCustomEditorEnabled()) {
- toolbar = customEditor.toolbar ? customEditor.toolbar : wrs_attributes['toolbar'];
- if (typeof editor.params.toolbar == 'undefined' || editor.params.toolbar != toolbar) {
- editor.setParams({'toolbar' : toolbar});
+ if (this.properties.open == true) {
+ var customEditorClass = _wrs_temporalImage.getAttribute('data-custom-editor');
+ if (customEditorClass) {
+ wrs_int_enableCustomEditor(customEditorClass);
+ }
+ else {
+ wrs_int_disableCustomEditors();
}
- } else if (typeof editor.params.toolbar != 'undefined' && editor.params.toolbar != 'general') {
- editor.setParams({'toolbar' : 'general'});
+ update_toolbar();
+ this.iframe.contentWindow._wrs_modalWindowProperties.editor.setMathML(wrs_mathmlDecode(_wrs_temporalImage.getAttribute('data-mathml')));
}
+ else {
+ this.containerDiv.style.visibility = '';
+ this.overlayDiv.style.visibility = '';
+ this.containerDiv.style.display = '';
+ this.overlayDiv.style.display = '';
- if (_wrs_isNewElement) {
- if (this.properties.deviceProperties.isAndroid || this.properties.deviceProperties.isIOS) {
- editor.setMathML('"');
+ this.properties.open = true;
+
+ if (_wrs_isNewElement) {
+ if (this.properties.deviceProperties.isAndroid || this.properties.deviceProperties.isIOS) {
+ editor.setMathML('"');
+ } else {
+ editor.setMathML('');
+ }
+ update_toolbar();
} else {
- editor.setMathML('');
+ 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')));
+ }
+
+ editor.focus();
+ if (!this.properties.deviceProperties.isAndroid && !this.properties.deviceProperties.isIOS) {
+ this.stackModalWindow();
}
- } else {
- editor.setMathML(wrs_mathmlDecode(_wrs_temporalImage.getAttribute('data-mathml')));
}
- editor.focus();
- if (!this.properties.deviceProperties.isAndroid && !this.properties.deviceProperties.isIOS) {
- this.stackModalWindow();
+ if (typeof _wrs_conf_modalWindow != "undefined" && _wrs_conf_modalWindow && _wrs_conf_modalWindowFullScreen) {
+ this.maximizeModalWindow();
}
} else {
this.create();
}
+
}
/**
@@ -4497,5 +4533,8 @@ ModalWindow.prototype.hideKeyboard = function() {
}, 200);
};
+ // ...focus function changes scroll value, so we need to restore it.
+ var keepScroll = scrollY;
field.focus();
+ window.scrollTo(0, keepScroll);
}
diff --git a/version.php b/version.php
index 88f25d49..8598b230 100644
--- a/version.php
+++ b/version.php
@@ -25,9 +25,9 @@
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2017040600;
-$plugin->release = '4.2.0.1364';
+$plugin->version = 2017050800;
+$plugin->release = '4.3.0.1365';
$plugin->requires = 2014050800;
$plugin->component = 'atto_wiris';
-$plugin->dependencies = array ('filter_wiris' => 2017040600);
+$plugin->dependencies = array ('filter_wiris' => 2017050800);
$plugin->maturity = MATURITY_STABLE;
diff --git a/yui/src/button/js/button.js b/yui/src/button/js/button.js
index a5721f2b..212ae6b1 100644
--- a/yui/src/button/js/button.js
+++ b/yui/src/button/js/button.js
@@ -113,6 +113,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();
@@ -257,9 +258,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();
}
},
/**
@@ -277,6 +277,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.