Skip to content

Commit

Permalink
4.3.0.1365
Browse files Browse the repository at this point in the history
 Stable version
  • Loading branch information
mcagigas-at-wiris committed May 8, 2017
1 parent 1012a70 commit 1879269
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 37 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.2.0.1364
4.3.0.1365
1 change: 1 addition & 0 deletions configuration.ini.dist
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#wiriseditorwindowattributes = width=570, height=450, scroll=no, resizable=yes
#wiriseditorsetsize = false
#wiriseditormodalwindow = false
#wiriseditormodalwindowfullscreen = true
#wirischemeditorenabled = true
#wirisimageformat = png

Expand Down
99 changes: 69 additions & 30 deletions core/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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('<math><semantics><annotation encoding="application/json">[]</annotation></semantics></math>"');
this.properties.open = true;

if (_wrs_isNewElement) {
if (this.properties.deviceProperties.isAndroid || this.properties.deviceProperties.isIOS) {
editor.setMathML('<math><semantics><annotation encoding="application/json">[]</annotation></semantics></math>"');
} else {
editor.setMathML('<math/>');
}
update_toolbar();
} else {
editor.setMathML('<math/>');
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();
}

}

/**
Expand Down Expand Up @@ -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);
}
6 changes: 3 additions & 3 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@

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

$plugin->version = 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;
7 changes: 4 additions & 3 deletions yui/src/button/js/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
}
},
/**
Expand All @@ -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.
Expand Down

0 comments on commit 1879269

Please sign in to comment.