Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
TYPO3 ckeditor:允许在不启用图像插件的情况下使用img标记_Ckeditor_Typo3 - Fatal编程技术网

TYPO3 ckeditor:允许在不启用图像插件的情况下使用img标记

TYPO3 ckeditor:允许在不启用图像插件的情况下使用img标记,ckeditor,typo3,Ckeditor,Typo3,在普通的TYPO3 8安装中,我希望ckeditor允许源代码中使用img标记,而不启用图像插件。TYPO3中ckeditor的默认配置会删除图像插件,这会导致img标签也被删除 根据ckeditor文档,这可以通过属性实现 config.extraAllowedContent = 'img' 但它在我的自定义yaml配置中不起作用。当我从源代码切换到wysiwyg模式时,img标记总是条带化的 如果我启用图像插件,img标签将保留。但我不想给编辑这个按钮作为一个选项 我做错了什么 这是我的测

在普通的TYPO3 8安装中,我希望ckeditor允许源代码中使用img标记,而不启用图像插件。TYPO3中ckeditor的默认配置会删除图像插件,这会导致img标签也被删除

根据ckeditor文档,这可以通过属性实现

config.extraAllowedContent = 'img'
但它在我的自定义yaml配置中不起作用。当我从源代码切换到wysiwyg模式时,img标记总是条带化的

如果我启用图像插件,img标签将保留。但我不想给编辑这个按钮作为一个选项

我做错了什么

这是我的测试yaml配置。底部是extraAllowedContent选项

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:rte_ckeditor/Resources/Public/Css/contents.css", "EXT:tucmmforumhook/Resources/Public/Styles/Tucmain.css"]
    stylesSet:
      - { name: "XYZ Text", element: "span", attributes: { class: "highlighted red"} }
      - { name: "Button", element: "a", attributes: { class: "button"} }
      - { name: "Checklist", element: "ul", attributes: { class: "check-list"} }
    format_tags: "p;h2;h3;h4;h5"
    toolbarGroups:
      - { name: styles, groups: [ styles, format ] }
      - { 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 ] }
    justifyClasses:
      - text-left
      - text-center
      - text-right
      - text-justify
    extraPlugins:
      - justify
    removePlugins:
      - image
    removeButtons:
      - Strike
      - Anchor
      - Outdent
      - Indent
      - Blockquote
      - JustifyBlock

    extraAllowedContent:
      - img

为了实现这一点,您需要切换到AFC的自定义模式: .

使用:


因为它会允许一切

基于@ikon-answer,我成功地让额外的内容发挥作用。而不是

extraAllowedContent:
  - img
这就足够用了

extraAllowedContent:
  - img[!src,alt,width,height]

这将保持img标签的完整性,而不需要图像插件

谢谢@ikon的回复。首先,我要说的是,您的方法导致了正确的结果,但当您自己指出我们的问题时,我必须为所有标记添加更多的配置设置。根据您的回答,我成功地使extraAllowedContent配置工作。基本上,仅指定img是不够的,我必须添加您的示例的其余部分。我将自己补充这个问题的答案。
extraAllowedContent:
  - img
extraAllowedContent:
  - img[!src,alt,width,height]