Symfony 4.4 中的 CKEditor 与 SonataFormatter

我正在尝试将 SonataNewsBundle 集成到 Symfony 4.4 中。


CKEditor未显示在新闻帖子的“内容”字段中。我已经阅读了可能在网上找到的所有内容,但找不到解决此问题的方法。


fos_ck_editor.yaml:


editor:

    base_path: "bundles/fosckeditor"

    js_path:   "bundles/fosckeditor/ckeditor.js"

    input_sync: true

    default_config: base_config

    configs:

        base_config:

            toolbar: full


twig:

    form_themes:

        - '@FOSCKEditor/Form/ckeditor_widget.html.twig'


sonata_admin.yaml:


sonata_admin:

    title: 'Something...'

    dashboard:

        blocks:

            - { type: sonata.admin.block.admin_list, position: left }

    options:

        legacy_twig_text_extension: false


    security:

        handler: sonata.admin.security.handler.role


    # DEPRECATED: override templates to enable CKEditor

    templates:

        edit: Admin/CRUD/edit.html.twig


    # extra CSS/JS to for SonataFormatter

    assets:

        extra_javascripts:

            - bundles/fosckeditor/ckeditor.js

            - bundles/sonataformatter/vendor/markitup-markitup/markitup/jquery.markitup.js

            - bundles/sonataformatter/markitup/sets/markdown/set.js

            - bundles/sonataformatter/markitup/sets/html/set.js

            - bundles/sonataformatter/markitup/sets/textile/set.js


        extra_stylesheets:

            - bundles/sonataformatter/markitup/skins/sonata/style.css

            - bundles/sonataformatter/markitup/sets/markdown/style.css

            - bundles/sonataformatter/markitup/sets/html/style.css

            - bundles/sonataformatter/markitup/sets/textile/style.css


# General block configuration

sonata_block:

    blocks:


        # Enable the SonataAdminBundle block

        sonata.admin.block.admin_list:

            contexts: [admin]


        # Enable SonataFormatter block

        sonata.formatter.block.formatter: ~


慕勒3428872
浏览 71回答 1
1回答

白板的微信

不管你信不信,但唯一缺少的是:twig:     form_themes:         - 'SonataFormatterBundle:Form:formatter.html.twig'在sonata_formatter.yamlSymfony 4.4 的官方文档应该更新!
打开App,查看更多内容
随时随地看视频慕课网APP