<?php

if (!defined('PARENT') || !isset($mswWysCfg['lang'])) { exit; }

/* WYSIWYG EDITOR
------------------------------------------*/

?>
<script src="content/js/plugins/jquery.trumbowyg.js"></script>
<script src="content/js/plugins/jquery.trumbowyg.colors.js"></script>
<script src="content/js/plugins/jquery.trumbowyg.pasteembed.js"></script>
<?php
if ($mswWysCfg['lang']) {
?>
<script src="content/js/plugins/i18n-wysiwyg/<?php echo $mswWysCfg['lang']; ?>.min.js"></script>
<?php
}
?>
<script>
//<![CDATA[
jQuery('<?php echo (isset($mswWysCfg['textarea']) ? $mswWysCfg['textarea'] : 'textarea'); ?>').trumbowyg({
  <?php
  // Alter button display based on platform
  switch(MSW_PFDTCT) {
    case 'pc':
      ?>
      btns: [
        ['viewHTML'],
        ['undo', 'redo'],
        ['formatting'],
        ['strong', 'em', 'del'],
        ['superscript', 'subscript'],
        ['link'],
        ['insertImage'],
        ['justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull'],
        ['unorderedList', 'orderedList'],
        ['horizontalRule'],
        ['foreColor', 'backColor'],
        ['removeformat'],
        ['fullscreen']
      ],
      <?php
      break;
    default:
      ?>
      btnsDef: {
        align: {
          dropdown: ['justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull'],
          ico: 'justifyLeft'
        }
      },
      btnsDef: {
        format: {
          dropdown: ['strong', 'em', 'del', 'superscript', 'subscript', 'horizontalRule', 'orderedList', 'unorderedList'],
          ico: 'strong'
        }
      },
      btns: [
          ['viewHTML'],
          ['align'],
          ['foreColor', 'backColor'],
          ['formatting'],
          ['format'],
          ['link'],
          ['insertImage'],
          ['removeformat'],
          ['undo', 'redo'],
          ['fullscreen']
      ],
      <?php
      break;
  }
  ?>
  tagsToRemove : ['script','link'],
  svgPath      : 'content/images/plugins/trumbowyg/icons.svg',
  semantic     : false,
  autogrow     : true,
  _dir         : '<?php echo $msw_html_dir; ?>'
  <?php echo ($mswWysCfg['lang'] ? ",lang : '" . $mswWysCfg['lang'] . "'" : ''); ?>
});
//]]>
</script>