Skip to content

Commit

Permalink
7.7.2 stable version
Browse files Browse the repository at this point in the history
  • Loading branch information
mcagigas-at-wiris authored Oct 22, 2018
1 parent 118fd1c commit 2137cdd
Show file tree
Hide file tree
Showing 10 changed files with 243 additions and 111 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.7.1.1395
7.7.2.1396
78 changes: 39 additions & 39 deletions core/package-lock.json

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

2 changes: 1 addition & 1 deletion thirdpartylibs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<library>
<location>core</location>
<name>MathType JavaScript engine</name>
<version>7.7.1.1395</version>
<version>7.7.2.1396</version>
<license>GPL</license>
<licenseversion>3.0+</licenseversion>
</library>
Expand Down
6 changes: 3 additions & 3 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@

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

$plugin->version = 2018101800;
$plugin->release = '7.7.1.1395';
$plugin->version = 2018102200;
$plugin->release = '7.7.2.1396';
$plugin->requires = 2014050800;
$plugin->component = 'atto_wiris';
$plugin->dependencies = array ('filter_wiris' => 2018101800);
$plugin->dependencies = array ('filter_wiris' => 2018102200);
$plugin->maturity = MATURITY_STABLE;
4 changes: 2 additions & 2 deletions wirisplugin-generic.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
window.wrs_int_init = function(target,toolbar) {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = getPath() + '/core/core.js?v=' + '7.7.1.1395';
script.src = getPath() + '/core/core.js?v=' + '7.7.2.1396';
document.getElementsByTagName('head')[0].appendChild(script);
script.onload = function() {
createIntegrationModel(target, toolbar);
Expand Down Expand Up @@ -54,7 +54,7 @@
var integrationModelProperties = {};
integrationModelProperties.target = target;
integrationModelProperties.configurationService = '' + M.cfg.wwwroot + '/filter/wiris/integration/configurationjs.php';
integrationModelProperties.version = '7.7.1.1395';
integrationModelProperties.version = '7.7.2.1396';
integrationModelProperties.scriptName = "wirisplugin-generic.js";
integrationModelProperties.environment = {};
integrationModelProperties.environment.editor = "GenericHTML";
Expand Down
2 changes: 1 addition & 1 deletion wirisplugin-generic.src.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ window.wrs_int_init = function(target,toolbar) {
var genericIntegrationProperties = {};
genericIntegrationProperties.target = target;
genericIntegrationProperties.configurationService = '' + M.cfg.wwwroot + '/filter/wiris/integration/configurationjs.php';
genericIntegrationProperties.version = '7.7.1.1395';
genericIntegrationProperties.version = '7.7.2.1396';
genericIntegrationProperties.scriptName = "wirisplugin-generic.js";
genericIntegrationProperties.environment = {};
genericIntegrationProperties.environment.editor = "GenericHTML";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ Y.namespace('M.atto_wiris').Button = Y.Base.create('button', Y.M.editor_atto.Edi
*/
AttoIntegration.prototype.updateFormula = function(mathml) {
WirisPlugin.IntegrationModel.prototype.updateFormula.call(this, mathml);
var host = this.editorObject.get('host');
var html = host.textarea.get('value');
var value = this.convertSafeMathml(WirisPlugin.Parser.endParse(html, null, this.config.lang, true));
host.textarea.set('value', value);
this.editorObject.markUpdated();
};

Expand Down Expand Up @@ -225,43 +229,83 @@ Y.namespace('M.atto_wiris').Button = Y.Base.create('button', Y.M.editor_atto.Edi

// Global events to host.
var host = this.get('host');
var wirisplugin = this;

/**
* On host change callback method. The content of the host should updated in every
* change in order to maintain the associated textarea updated.
*/
_onHostChange = function() {
if (typeof WirisPlugin !== 'undefined' && ('currentInstance' in WirisPlugin)) {
WirisPlugin.currentInstance.editorObject = wirisplugin;
WirisPlugin.currentInstance.setTarget(wirisplugin.get('host').editor.getDOMNode());
WirisPlugin.currentInstance.unParseContent();
} else {
Y.later(50, this, this._onHostChange);
}
};

host.on('change', function() {
_onHostChange();
}.bind(this));

// It's needed to parse the content on selectionchanged event in order to recover properly
// the content of the editor in drafts.
// For more information view PLUGINS-1009
host.on('atto:selectionchanged', function(e) {
// This condition is satisfied when event is thrown by draft
if (typeof e.event == 'undefined') {
WirisPlugin.currentInstance.parseContent();
var html = host.editor.get('innerHTML');
html = WirisPlugin.Parser.initParse(html, WirisPlugin.currentInstance.config.lang);
host.editor.set('innerHTML', html);
}
});

// Override updateFromTextArea to update the content editable element.
host._wirisUpdateFromTextArea = host.updateFromTextArea;
host.updateFromTextArea = function() {
host._wirisUpdateFromTextArea();
WirisPlugin.currentInstance.parseContent();
var html = host.editor.get('innerHTML');
html = WirisPlugin.Parser.initParse(html, WirisPlugin.currentInstance.config.lang);
host.editor.set('innerHTML', html);
};
// Override updateOriginal to update the content of the text area element.
host._wirisupdateOriginal = host.updateOriginal;
host.updateOriginal = function() {
host._wirisupdateOriginal();
var html = host.textarea.get('value');
var value = WirisPlugin.Parser.endParse(html);
value = _convertSafeMathML(value);
host.textarea.set('value', value);
}

/**
* Converts all the occurrences of a safeMathml
* with standard MathML.
* @type {string} - content content to be filtered.
* @returns {string} the original content with MathML instead of safeMathML.
*/
_convertSafeMathML = function(content) {
var output = '';
var mathTagBegin = '«math';
var mathTagEnd = '«/math»';
var start = content.indexOf(mathTagBegin);
var end = 0;

while (start != -1) {
output += content.substring(end, start);
// Avoid WIRIS images to be parsed.
imageMathmlAttribute = content.indexOf(WirisPlugin.Configuration.get('imageMathmlAttribute'));
end = content.indexOf(mathTagEnd, start);

if (end == -1) {
end = content.length - 1;
} else if (imageMathmlAttribute != -1) {
// First close tag of img attribute
// If a mathmlAttribute exists should be inside a img tag.
end += content.indexOf("/>", start);
}
else {
end += mathTagEnd.length;
}

if (!WirisPlugin.MathML.isMathmlInAttribute(content, start) && imageMathmlAttribute == -1) {
var mathml = content.substring(start, end);
output += WirisPlugin.MathML.safeXmlDecode(mathml);
}
else {
output += content.substring(start, end);
}

start = content.indexOf(mathTagBegin, end);
}

output += content.substring(end, content.length);
return output;
}
},

/**
* Add MathType and ChemType buttons to toolbar.
* @param {object} config - backend configuration object.
Expand Down
Loading

0 comments on commit 2137cdd

Please sign in to comment.