允许在ckeditor中使用oembed标记

时间:2018-02-05 12:13:09

标签: ckeditor typo3 typo3-8.x

我想将oembed标签放入TYPO3的ckeditor RTE中。这样我想把Instagram,facebook或twitter等社交帖子放到一些新闻文章中(在某些文字的中间)。

为此,我已激活ckeditor的嵌入插件,并将oembed标记放在processing allowedTags下。我还在styles.content.allowTags的常量中定义了oembed标记。

这里是我的yaml:

imports:
    - { resource: "EXT:rte_ckeditor/Configuration/RTE/Processing.yaml" }
    - { resource: "EXT:rte_ckeditor/Configuration/RTE/Editor/Base.yaml" }
    - { resource: "EXT:rte_ckeditor/Configuration/RTE/Editor/Plugins.yaml" }

editor:
    config:
        contentsCss: "EXT:mysitepackage/Resources/Public/Css/rte.css"

        stylesSet:
            - { name: "Lead", element: "p", attributes: { 'class': 'lead' } }

        toolbarGroups:
            - { name: styles, groups: [ format, styles ] }
            - { name: basicstyles, groups: [ basicstyles ] }
            - { name: paragraph, groups: [ list, indent, blocks, align ] }
            - "/"
            - { name: links, groups: [ links ] }
            - { name: clipboard, groups: [ clipboard, cleanup, undo ] }
            - { name: editing, groups: [ spellchecker ] }
            - { name: insert, groups: [ insert ] }
            - { name: tools, groups: [ table, specialchar ] }
            - { name: document, groups: [ mode ] }

        format_tags: "p;h1;h2;h3;h4;h5;pre"

        justifyClasses:
            - text-left
            - text-center
            - text-right
            - text-justify

        extraPlugins:
            - justify
            - embedsemantic
            - autoembed

        removePlugins:
            - image

        removeButtons:
            - Anchor
            - Underline
            - Strike

        autoEmbedWidget: "embedsemantic"
        embed_provider: "https://my.iframely.instance/oembed?url={url}&callback={callback}"

        extraAllowedContent: '*(*)[data-*]; oembed'

processing:
    allowTags:
        - oembed

常量中的这一行:

styles.content.allowTags := addToList(oembed)

我现在能够将oembed放入RTE及其显示的社交帖子的预告片中。保存内容后,oembed代码将替换为p代码

我错过了什么?

1 个答案:

答案 0 :(得分:1)

根据我的经验,如果某些东西被其他东西取代(尤其是p标签),那么它很可能与Advanced content filter有关。

我无法查明配置中的错误,但您是否尝试过完全取消ACF? (见allowedContent

allowedContent = true;
(and remove the extraAllowedContent)

如果有效,请不要这样做(请参阅security best practices),但请继续努力寻找正确的设置。

也许在extraAllowedContent:

中显式添加通配符属性
extraAllowedContent: '*(*)[data-*]; oembed(*){*}[*];'