将TinyMCE插件添加到symfony控制器

时间:2018-04-09 11:33:04

标签: symfony tinymce tinymce-plugins

我正在一个博客的登陆页面和简报经理工作。我们正在使用symfony和tinymce bundle(stfalcon)来为wysiwyg编辑。

客户希望将模板设计器(或使用Mailchimp创建)的登录页面或简报的完整结构直接复制粘贴到TinyMce中,因此根据文档,我应该添加@gen.coroutine def connect(self): print("trying to connect") try: self.ws = yield websocket_connect(self.url, connect_timeout=99999, on_message_callback=on_message) except Exception as e: print("connection error : {}".format(e)) print("connected") 插件symfony的配置。

问题是我们希望保留我们为博客设计的布局,并且只保留登陆控制器或新闻稿控制器中的fullpage插件。

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

有什么办法可以在渲染窗体时加载Tinymce插件吗?

1 个答案:

答案 0 :(得分: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"`

之后,在控制器中,使用以下命令更改要渲染的主题:

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