xref: /webtrees/resources/views/modules/ckeditor/ckeditor-js.phtml (revision 63276d8f3b702807b282100a6302f3d6329b2617)
1<?php use Fisharebest\Webtrees\Module; ?>
2<?php use Fisharebest\Webtrees\Module\CkeditorModule; ?>
3<?php use Fisharebest\Webtrees\View; ?>
4
5<?php if (Module::findByClass(CkeditorModule::class)): ?>
6    <?php View::push('javascript') ?>
7    <script src="<?= e(CkeditorModule::CKEDITOR_PATH) ?>ckeditor.js"></script>
8    <script src="<?= e(CkeditorModule::CKEDITOR_PATH) ?>adapters/jquery.js"></script>
9
10    <script>
11    var CKEDITOR_BASEPATH = <?= json_encode(CkeditorModule::CKEDITOR_PATH) ?>;
12
13    // Enable for all browsers
14    CKEDITOR.env.isCompatible = true;
15
16    // Disable toolbars
17    CKEDITOR.config.removePlugins = "forms,newpage,preview,print,save,templates";
18    CKEDITOR.config.extraAllowedContent = "area[shape,coords,href,target,alt,title];map[name];img[usemap];*[class,style]";
19
20    // Activate the editor
21    $("textarea.html-edit").ckeditor(function(config){config.removePlugins = "forms";}, {
22      language: "<?= strtolower(WT_LOCALE) ?>"
23    });
24    </script>
25    <?php View::endpush() ?>
26<?php endif ?>
27