<?php use Fisharebest\Webtrees\Module; ?>
<?php use Fisharebest\Webtrees\View; ?>
<?php use Fisharebest\Webtrees\Webtrees; ?>

<?php if (Module::getModuleByName('ckeditor')) : ?>
    <?php View::push('javascript') ?>
    <script src="<?= e(Webtrees::CKEDITOR_PATH) ?>ckeditor.js"></script>
    <script src="<?= e(Webtrees::CKEDITOR_PATH) ?>adapters/jquery.js"></script>

    <script>
    var CKEDITOR_BASEPATH = <?= json_encode(Webtrees::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 ?>
