summaryrefslogtreecommitdiff
path: root/resources/views/modules/ckeditor/ckeditor-js.phtml
blob: ece14fd238da4c0a7066a4a880e4b5f3bfb3b787 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php use Fisharebest\Webtrees\Module\CkeditorModule; ?>
<?php use Fisharebest\Webtrees\Services\ModuleService; ?>
<?php use Fisharebest\Webtrees\View; ?>

<?php if (app()->make(ModuleService::class)->findByClass(CkeditorModule::class)): ?>
    <?php View::push('javascript') ?>
    <script src="<?= e(CkeditorModule::CKEDITOR_PATH) ?>ckeditor.js"></script>
    <script src="<?= e(CkeditorModule::CKEDITOR_PATH) ?>adapters/jquery.js"></script>

    <script>
    var CKEDITOR_BASEPATH = <?= json_encode(CkeditorModule::CKEDITOR_PATH) ?>;

    // Enable for all browsers
    CKEDITOR.env.isCompatible = true;

    // Disable toolbars
    CKEDITOR.config.removePlugins = "forms,newpage,preview,print,save,templates";
    CKEDITOR.config.extraAllowedContent = "area[shape,coords,href,target,alt,title];map[name];img[usemap];*[class,style]";

    // Activate the editor
    $("textarea.html-edit").ckeditor(function(config){config.removePlugins = "forms";}, {
      language: "<?= strtolower(WT_LOCALE) ?>"
    });
    </script>
    <?php View::endpush() ?>
<?php endif ?>