代码之家  ›  专栏  ›  技术社区  ›  Antonio Baena Guerrero

向symfony控制器添加TinyMCE插件

  •  0
  • Antonio Baena Guerrero  · 技术社区  · 7 年前

    我正在一个博客的登录页和时事通讯管理器中工作。我们正在使用symfony和tinymce捆绑包( stfalcon )所见即所得编辑器。

    客户希望将模板设计器(或使用Mailchimp创建)的登录页或新闻稿的完整结构直接复制粘贴到TinyMce中,因此根据文档,我应该添加 fullpage symfony配置中的插件。

    问题是,我们希望保持我们为博客设计的布局,并在landing Controller或Newsletter Controller中仅保持fullpage插件处于活动状态。

    我找到了这个 tutorial ,但是针对symfony 1.4的,实际上我们正在2.8中工作(是的,我知道我们应该更新到3.4,但这是遗留代码)

    有没有办法在呈现表单时加载Tinymce插件?

    1 回复  |  直到 7 年前
        1
  •  1
  •   Antonio Baena Guerrero    7 年前

    最后我找到了答案(我留下来准备文档),

    您可以在Symfony中创建任意多个主题 config.yml 根据您的喜好,首先是复制所需的主题并添加所需的插件:

    advanced:
                convert_urls: false
                file_browser_callback:  'elFinderBrowser'
                plugins:
                    - "advlist autolink lists link image charmap print preview hr anchor pagebreak"
                    - "searchreplace wordcount visualblocks visualchars code fullscreen"
                    - "insertdatetime media nonbreaking save table contextmenu directionality"
                    - "emoticons template paste textcolor"
                toolbar1: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | print preview media | forecolor backcolor | stfalcon | example"
                image_advtab: true
                templates: "/admin/newsletter/templates/templatelist"
                entity_encoding : "raw"
    
        fullpage:
            convert_urls: false
            file_browser_callback:  'elFinderBrowser'
            plugins:
                - "advlist autolink lists link image charmap print preview hr anchor pagebreak"
                - "searchreplace wordcount visualblocks visualchars code fullscreen fullpage"
                - "insertdatetime media nonbreaking save table contextmenu directionality"
                - "emoticons template paste textcolor"
            toolbar1: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | print preview media | forecolor backcolor | stfalcon | example"
            image_advtab: true
            templates: "/admin/newsletter/templates/templatelist"
            entity_encoding : "raw"`
    

    之后,在控制器中,更改渲染tinymce的主题:

    ->add('content', 'textarea', [
                    'label'             => 'Contenido',
                    'required'          => false,
                    'attr'              => ['class' => 'tinymce', 'data-theme' => 'fullpage']