diff --git a/src/Plugin/CKEditorPlugin/MathJaxPlugin.php b/src/Plugin/CKEditorPlugin/MathJaxPlugin.php new file mode 100644 index 0000000000000000000000000000000000000000..bdfd952bf2a7a0e20513a9713e9386db62b1d140 --- /dev/null +++ b/src/Plugin/CKEditorPlugin/MathJaxPlugin.php @@ -0,0 +1,65 @@ +<?php + +namespace Drupal\uw_cfg_common\Plugin\CKEditorPlugin; + +use Drupal\ckeditor\CKEditorPluginBase; +use Drupal\editor\Entity\Editor; + +/** + * Defines the "mathjax" plugin. + * + * @CKEditorPlugin( + * id = "mathjax", + * label = @Translation("Mathjax") + * ) + */ +class MathJaxPlugin extends CKEditorPluginBase { + + /** + * {@inheritdoc} + */ + public function getDependencies(Editor $editor) { + return [ + 'clipboard', + 'dialog', + 'lineutils', + 'widget', + ]; + } + + /** + * {@inheritdoc} + */ + public function getLibraries(Editor $editor) { + return []; + } + + /** + * {@inheritdoc} + */ + public function getConfig(Editor $editor) { + return [ + 'mathJaxLib' => '//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-AMS_HTML', + ]; + } + + /** + * {@inheritdoc} + */ + public function getButtons() { + return [ + 'Mathjax' => [ + 'label' => $this->t('Math'), + 'image' => drupal_get_path('profile', 'uw_base_profile') . '/libraries/ckeditor-mathjax/icons/mathjax.png', + ], + ]; + } + + /** + * {@inheritdoc} + */ + public function getFile() { + return drupal_get_path('profile', 'uw_base_profile') . '/libraries/ckeditor-mathjax/plugin.js'; + } + +}