1

如果我输入以下 html 并将其保存到 CKEditor,则所有 span 标签都会被删除。

 <p class="animate" data-animate="fadeIn"><span>Maschinenlager</span> <span>Schwergutlager</span> <span>Frei- vs. Festplatzprinzip</span></p>

我在stackoverflow上找到了以下解决方案,使其适应我的需要,但它不起作用。

 editor:
   config:
    extraAllowedContent: "*(*)[data-*];span;p span"  

我使用了 EXT 的默认配置,并将其包含在我自己的中。

 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" }

默认配置中允许使用标签。

  processing:
    allowTags:
      - a
      - abbr
      - acronym
      - address
      - article
      - big
      - blockquote
      - br
      - caption
      - cite
      - code
      - col
      - colgroup
      - dd
      - del
      - dfn
      - dl
      - div
      - dt
      - em
      - footer
      - header
      - h1
      - h2
      - h3
      - h4
      - h5
      - h6
      - hr
      - i
      - img
      - ins
      - kbd
      - label
      - li
      - nav
      - ol
      - p
      - pre
      - q
      - samp
      - section
      - small
      - span
      - strong
      - style
      - sub
      - sup
      - table
      - thead
      - tbody
      - tfoot
      - td
      - th
      - tr
      - tt
      - ul
      - var

我该如何存档?

4

1 回答 1

3

也许您的配置中不允许使用 span 标签?然后像这样添加它:

# Allow additional tags
processing:
  allowTags:
    - s
    - span
    - iframe
    - i

编辑:似乎有必要将跨度添加到 extraAllowedContent:

editor:
  config:
    extraAllowedContent:
      - span

更重要的是,为了防止空标签被剥离:

processing:
  HTMLparser_db:
    tags:
      span:
        rmTagIfNoAttrib: false
于 2018-08-22T10:09:25.467 回答