xref: /webtrees/resources/views/modules/ckeditor/ckeditor-js.phtml (revision ad7270802ba57a28d195fc58fcc55f26458a779a)
1<?php use Fisharebest\Webtrees\Module\CkeditorModule; ?>
2<?php use Fisharebest\Webtrees\Services\ModuleService; ?>
3<?php use Fisharebest\Webtrees\View; ?>
4
5<?php if (app()->make(ModuleService::class)->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