![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/gositeme.com/hdinvoice3/includes/ve/plugins/mathml/ |
/* ===========================================================
* trumbowyg.mathMl.js v1.0
* MathML plugin for Trumbowyg
* https://github.com/loclamor/Trumbowyg/tree/mathml-plugin/plugins/mathml
* ===========================================================
* Author : loclamor
*/
/* globals MathJax */
(function($) {
'use strict';
$.extend(true, $.trumbowyg, {
langs: {
en: {
mathml: 'Insert Formulas',
formulas: 'Formulas',
inline: 'Inline'
},
fr: {
mathml: 'Inserer une formule',
formulas: 'Formule',
inline: 'En ligne'
},
tr: {
mathml: 'Formül Ekle',
formulas: 'Formüller',
inline: 'Satır içi'
}
},
plugins: {
mathml: {
init: function(trumbowyg) {
var btnDef = {
fn: function() {
trumbowyg.saveRange();
var mathMLoptions = {
formulas: {
label: trumbowyg.lang.formulas,
required: true,
value: ''
},
inline: {
label: trumbowyg.lang.inline,
attributes: {
checked: true
},
type: 'checkbox',
required: false,
}
};
var mathmlCallback = function(v) {
var delimitor = v.inline ? '$' : '$$';
if (trumbowyg.currentMathNode) {
$(trumbowyg.currentMathNode).html(delimitor + ' ' + v.formulas + ' ' + delimitor).attr('formulas', v.formulas).attr('inline', (v.inline ? 'true' : 'false'));
} else {
var html = '<span class="mathMlContainer" contenteditable="false" formulas="' + v.formulas + '" inline="' + (v.inline ? 'true' : 'false') + '" >' + delimitor + ' ' + v.formulas + ' ' + delimitor + '</span>';
var node = $(html)[0];
node.onclick = function(e) {
trumbowyg.currentMathNode = this;
mathMLoptions.formulas.value = $(this).attr('formulas');
if ($(this).attr('inline') === "true") {
mathMLoptions.inline.attributes.checked = true;
} else {
delete mathMLoptions.inline.attributes.checked;
}
trumbowyg.openModalInsert(trumbowyg.lang.mathml, mathMLoptions, mathmlCallback);
};
trumbowyg.range.deleteContents();
trumbowyg.range.insertNode(node);
}
trumbowyg.currentMathNode = false;
MathJax.Hub.Queue(['Typeset', MathJax.Hub]);
return true;
};
mathMLoptions.formulas.value = trumbowyg.getRangeText();
mathMLoptions.inline.attributes.checked = true;
trumbowyg.openModalInsert(trumbowyg.lang.mathml, mathMLoptions, mathmlCallback);
}
};
trumbowyg.addBtnDef('mathml', btnDef);
}
}
}
});
})(jQuery);