0

我在博客的登陆页面和时事通讯经理工作。我们将 symfony 与 tinymce 包(stfalcon)一起用于所见即所得的编辑器。

客户想要将来自模板设计器(或使用 Mailchimp 创建)的登录页面或时事通讯的完整结构直接复制粘贴到 TinyMce,因此根据文档,我应该fullpage在 symfony 的配置中添加插件。

问题是我们想要保留我们为博客设计的布局,并且只在登陆控制器或新闻通讯控制器中保持整页插件处于活动状态。

我找到了本教程,但适用于 symfony 1.4,我们实际上是在 2.8 中工作(是的,我知道我们应该更新到 3.4,但它是遗留代码)

有什么方法可以在渲染表单时加载 Tinymce 插件?

4

1 回答 1

1

最后我找到了答案(我离开这里是为了文档),

您可以在 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']
于 2018-04-09T14:52:51.350 回答