Add options for zoom and accessibility (#6)
* Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload
This commit is contained in:
parent
892971c3cc
commit
611840a32d
|
@ -2,18 +2,27 @@ import { withPluginApi } from 'discourse/lib/plugin-api';
|
|||
import loadScript from 'discourse/lib/load-script';
|
||||
|
||||
let initializedMathJax = false;
|
||||
let zoom_on_hover, enable_accessibility;
|
||||
|
||||
function initMathJax() {
|
||||
if (initializedMathJax) { return; }
|
||||
|
||||
window.MathJax = {
|
||||
var extensions = ["toMathML.js", "Safe.js"];
|
||||
if(enable_accessibility) {
|
||||
extensions.push("[a11y]/accessibility-menu.js")
|
||||
}
|
||||
var settings = {
|
||||
jax: ['input/TeX', 'input/AsciiMath', 'input/MathML', 'output/CommonHTML'],
|
||||
TeX: {extensions: ["AMSmath.js", "AMSsymbols.js", "autoload-all.js"]},
|
||||
extensions: ["toMathML.js"],
|
||||
extensions: extensions,
|
||||
showProcessingMessages: false,
|
||||
root: '/plugins/discourse-math/mathjax'
|
||||
};
|
||||
|
||||
}
|
||||
if(zoom_on_hover) {
|
||||
settings.menuSettings = {zoom: "Hover"};
|
||||
settings.MathEvents = {hover: 750};
|
||||
}
|
||||
window.MathJax = settings;
|
||||
initializedMathJax = true;
|
||||
}
|
||||
|
||||
|
@ -72,6 +81,8 @@ export default {
|
|||
name: "apply-math",
|
||||
initialize(container) {
|
||||
const siteSettings = container.lookup('site-settings:main');
|
||||
zoom_on_hover = siteSettings.discourse_math_zoom_on_hover;
|
||||
enable_accessibility = siteSettings.discourse_math_enable_accessibility;
|
||||
if (siteSettings.discourse_math_enabled) {
|
||||
withPluginApi('0.5', initializeMath);
|
||||
}
|
||||
|
|
|
@ -4,3 +4,5 @@
|
|||
en:
|
||||
site_settings:
|
||||
discourse_math_enabled: 'Enable Discourse Math plugin (will add special processing to $ and $$ blocks)'
|
||||
discourse_math_zoom_on_hover: 'Zoom 200% on hover'
|
||||
discourse_math_enable_accessibility: 'Enable accessibility features'
|
||||
|
|
|
@ -4,3 +4,5 @@
|
|||
es:
|
||||
site_settings:
|
||||
discourse_math_enabled: 'Habilitar plugin Discourse Math (agregará procesamiento especial para los bloques con $ y $$)'
|
||||
discourse_math_zoom_on_hover: 'Zoom 200% en hover'
|
||||
discourse_math_enable_accessibility: 'Habilitar las funciones de accesibilidad'
|
||||
|
|
|
@ -4,3 +4,5 @@
|
|||
fi:
|
||||
site_settings:
|
||||
discourse_math_enabled: 'Ota käyttöön Discoursen matematiikkalisäosa ($ ja $$ blokit käsitellään erityisellä tavalla)'
|
||||
discourse_math_zoom_on_click: 'Zoomaa 200% hoverissa'
|
||||
discourse_math_enable_accessibility: 'Ota käyttöön esteettömyysominaisuudet'
|
||||
|
|
|
@ -2,3 +2,9 @@ plugins:
|
|||
discourse_math_enabled:
|
||||
default: false
|
||||
client: true
|
||||
discourse_math_zoom_on_hover:
|
||||
default: false
|
||||
client: true
|
||||
discourse_math_enable_accessibility:
|
||||
default: false
|
||||
client: true
|
||||
|
|
Loading…
Reference in New Issue