【问题标题】:Typo3 9.5.11 wraps <p> around <iframe> (CKEditor?)Typo3 9.5.11 将 <p> 包裹在 <iframe> 周围(CKEditor?)
【发布时间】:2020-04-03 17:17:11
【问题描述】:

我使用嵌入插件向我的 CKEditor 添加了 iframe。

当我尝试在 iframe 中添加它时它可以工作,什么时候保存它,它会在前端工作并像这样将它保存在数据库中:

<div data-oembed-url="https://www.youtube.com/watch?v=C0DPdy98e4c">
  <div style="left: 0; width: 100%; height: 0; position: relative; padding-bottom: 75%;">
    <iframe allow="encrypted-media; accelerometer; gyroscope; picture-in-picture" allowfullscreen="" scrolling="no" src="https://www.youtube.com/embed/C0DPdy98e4c?rel=0" style="border: 0; top: 0; left: 0; width: 100%; height: 100%; position: absolute;" tabindex="-1">
    </iframe>
  </div>
</div>

但是当我现在在后端再次打开编辑器时,iframe 坏了,当我点击源代码时,它看起来像这样:

<div data-oembed-url="https://www.youtube.com/watch?v=C0DPdy98e4c">
  <div style="left: 0; width: 100%; height: 0; position: relative; padding-bottom: 75%;">
     <p>
        &lt;iframe allow="encrypted-media; accelerometer; gyroscope; picture-in-picture" allowfullscreen="" scrolling="no" src="https://www.youtube.com/embed/C0DPdy98e4c?rel=0" style="border: 0; top: 0; left: 0; width: 100%; height: 100%; position: absolute;" tabindex="-1"
       &gt;&lt;/iframe&gt;
     </p>
  </div>
</div>

我的编辑器的配置如下所示:

editor:

     config:

        removePlugins:
            - null

        removeButtons:
            - Strike

        AllowedContent:
            - true

        allowTagsOutside:
            - iframe

        allowTags:
            - iframe

在我的 Page.ts 中我添加了这个:

RTE {
     default {
        proc.allowTags := addToList(object,param,embed,iframe)
        proc.allowTagsOutside := addToList(object,embed,iframe)
        proc.entryHTMLparser_db.allowTags < .allowTags
        proc.entryHTMLparser_db.allowTags := addToList(iframe) 
     }
}

【问题讨论】:

    标签: iframe ckeditor typo3 typo3-8.x typo3-9.x


    【解决方案1】:

    我认为我的问题是我的typo3 6.x 版本的rte.ts 中的旧配置仍然被加载。我将此添加到我的 default.yaml 中:

    editor:
        processing:
            allowTags:
                - s
                - span
                - iframe
                - i
        HTMLparser_db:
            tags:
            span:
            rmTagIfNoAttrib: false
    
    config:
    
        allowedContent: true
        removeFormatAttributes: ""
    
        extraAllowedContent:
            - span
            - iframe
    

    并将其添加到我的 page.ts

    RTE.default.proc.blockElementList = PRE,UL,OL,H1,H2,H3,H4,H5,H6,ADDRESS,DL,DD,HEADER,SECTION,FOOTER,NAV,ARTICLE,ASIDE,IFRAME
    

    如果您遇到同样的问题,希望这对您有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-05-09
      • 1970-01-01
      • 2016-09-05
      • 1970-01-01
      • 1970-01-01
      • 2011-12-26
      • 2013-01-07
      • 1970-01-01
      相关资源
      最近更新 更多