php 微小的MCE Anpassung

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 微小的MCE Anpassung相关的知识,希望对你有一定的参考价值。

<?php

namespace Contao;

if ($GLOBALS['TL_CONFIG']['useRTE']):

?>
<script>window.tinymce || document.write('<script src="<?= TL_ASSETS_URL ?>assets/tinymce4/js/tinymce.min.js">\x3C/script>')</script>
<script>
setTimeout(function() {
  window.tinymce && tinymce.init({
    skin: 'contao',
    selector: '#<?= $this->selector ?>',
    language: '<?= Backend::getTinyMceLanguage() ?>',
    element_format: 'html',
    document_base_url: '<?= Environment::get('base') ?>',
    entities: '160,nbsp,60,lt,62,gt,173,shy',
    branding: false,
    setup: function(editor) {
      editor.getElement().removeAttribute('required');
    },
    init_instance_callback: function(editor) {
      if (document.activeElement && document.activeElement.id && document.activeElement.id == editor.id) {
        editor.editorManager.get(editor.id).focus();
      }
      editor.on('focus', function() { Backend.getScrollOffset(); });
    },
    file_browser_callback: function(field_name, url, type, win) {
      Backend.openModalBrowser(field_name, url, type, win);
    },
    file_browser_callback_types: <?= json_encode($this->fileBrowserTypes) ?>,
    plugins: 'autosave charmap code fullscreen importcss link lists paste searchreplace stripnbsp tabfocus table visualblocks',
    browser_spellcheck: true,
    tabfocus_elements: ':prev,:next',
    importcss_append: true,																									 
    extended_valid_elements: 'q[cite|class|title],article,section,hgroup,figure,figcaption',
    menubar: 'file edit insert view format',
    // toolbar reduziert damit keine inline-Styles moeglich sind und erweitert um styleselect
	toolbar: 'link unlink | bold italic | styleselect | bullist numlist | undo redo | <?php if (BackendUser::getInstance()->isAdmin): ?>code<?php endif; ?>',
    paste_as_text: true, // activate 'paste as text' in menu bar
	// only use SPAN when necessary
    importcss_selector_converter: function(selector) {
      if(selector.charAt(0) == '.') {
        return {title: selector.substr(1), inline: 'span', selector: '*', classes: selector.substr(1)};
      }
    }
    		   
  });
}, 0);
</script>
<?php endif; ?>

以上是关于php 微小的MCE Anpassung的主要内容,如果未能解决你的问题,请参考以下文章

php 微小的mce自定义按钮

php 微小的MCE

php 微小的MCE为短代码添加按钮

php 回调函数用于过滤MCE设置

在php文件中标记MCE按钮,所以我可以翻译它

PHP 微小的联系表格PHP