Skip to content
Snippets Groups Projects
Commit 89436422 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Use the Ext.LoadMask when processing MathJax.

parent 6d471115
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,9 @@ Ext.define('App.grid.plugin.MathJax', {
extend: 'Ext.AbstractPlugin',
alias: 'plugin.pGridMathJax',
// Private attributes for internationalization
textMask: 'Processing symbols',
/**
* Initialize the plugin
*
......@@ -47,30 +50,19 @@ Ext.define('App.grid.plugin.MathJax', {
"use strict";
var grid = this.getCmp(),
domEl = Ext.getDom(grid.getView().getEl());
/**
* Call at the end of the MathJax processing.
* Remove the mask on the grid and hide the progress bar
*
* @param {App.grid.Panel} wdg
*/
function endOfTask (wdg) {
wdg.unmask();
Ext.Msg.hide();
}
// mask the grid during MathJax processing and show a progress bar
grid.mask();
Ext.Msg.show({
wait: true,
waitConfig: {
text: 'processing symbols'}
domEl = Ext.getDom(grid.getView().getEl()),
loadMask;
// mask the grid during MathJax processing
loadMask = Ext.create('Ext.LoadMask', {
target: grid,
msg: this.textMask
});
// push in the MatJax queue the processing
// followed by the unmasking
loadMask.show();
// push in the MatJax queue the processing followed by the unmasking
MathJax.Hub.Queue(["Typeset", MathJax.Hub, domEl]);
MathJax.Hub.Queue([endOfTask, grid]);
MathJax.Hub.Queue([function (mask) {mask.hide();}, loadMask]);
}
});
\ No newline at end of file
......@@ -168,11 +168,23 @@ Ext.define('App.panel.WithUrlSelector', {
onLoad: function (loader, response, options) {
"use strict";
var domEl,
loadMask;
// process symbols
if (MathJax && this.isMathJax) {
MathJax.Hub.PreProcess();
MathJax.Hub.Process();
domEl = Ext.getDom(this.mainPanel.getEl());
loadMask = Ext.create('Ext.LoadMask', {
target: this.mainPanel,
msg: 'Processing symbols'
});
loadMask.show();
MathJax.Hub.Queue(["Typeset", MathJax.Hub, domEl]);
MathJax.Hub.Queue([function (mask) {mask.hide();}, loadMask]);
}
// enable the selector
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment