0

在阅读了文档(请参阅https://docs.typo3.org/typo3cms/extensions/rte_ckeditor_image/)和其他相关问题(请参阅FAL 中的 Typo3 CKEditor 图像)后,我仍然遇到问题,图像在保存后保持在 300px 宽度内容。

有趣的是,第一次加载后端视图时,调整大小功能在保存 cpntent 后起作用。后端和前端的图像大小正确。

当我第二次更改大小并保存内容时,它再次获得 300px 的宽度。

在我看来,配置被第二次忽略了。

有人给点建议吗?

我已经多次清除缓存,重新加载框架以便在后端获取其他 js 并再次保存。

配置:

page_ts_config.ts(行中没有注释)

RTE.default.buttons.image.options.magic {
    maxWidth = 1200
    maxHeight = 1200
}

RTE.default.buttons.image.options.plain {
    maxWidth = 1200
    maxHeight = 1200
}

ext_localconf.php

$GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['default'] = 'fileadmin/templates/yaml/rte/config.yaml'; 

文件管理员/模板/yaml/rte/config.yaml

#
# Load default processing options
imports:
    - { resource: "fileadmin/templates/yaml/rte/processing.yaml" }
    - { resource: "EXT:rte_ckeditor/Configuration/RTE/Editor/Base.yaml" }
    - { resource: "EXT:rte_ckeditor/Configuration/RTE/Editor/Plugins.yaml" }
    - { resource: "EXT:rte_ckeditor_image/Configuration/RTE/Plugin.yaml" }
# Custom configuration for the editor
editor:
  #externalPlugins: find, dialog, dialogui, fakeobjects, ckfinder
  #externalPlugins: 
    #imageuploader: { resource: 'SYSEXT:rte_ckeditor/plugins/imageuploader' } 
    #ckfinder: { resource: "EXT:rte_ckeditor/plugins/ckfinder" }

  config:
    toolbarGroups:
    # TODO: find/replace doesn't work/show up although given in config
      - { name: editing, groups: [find, replace, selection, spellchecker, editing] }
      - { name: basicstyles, groups: [ basicstyles, cleanup] }
      - { name: clipboard, groups: [clipboard, undo] }
      - { name: document, groups: [mode, document, doctools] }
      - { name: forms, groups: [forms] }
      - { name: paragraph, groups: [list, indent, blocks, align, bidi, paragraph] }
      - { name: links, groups: [links] }
      - { name: insert, groups: [insert] }
      - { name: styles, groups: [styles, format] }
      - { name: colors, groups: [colors] }
      - { name: tools, groups: [tools] }
      - { name: others, groups: [others] }
      - { name: about, groups: [about] }
    removeButtons:
      - Anchor
      - Superscript
      - Subscript
      - Strike
      - Font
      - FontSize
      - Save
      - NewPage
      - Preview
      - Print
      - Templates
      - Cut
      - Copy
      - Paste
      - PasteText
      - PasteFromWord
      - SelectAll
      - Scayt
      - Form
      - Checkbox
      - HiddenField
      - Radio
      - TextField
      - Textarea
      - Button
      - ImageButton
      - CopyFormatting
      - Blockquote
      - CreateDiv
      - JustifyLeft
      - JustifyCenter
      - JustifyRight
      - JustifyBlock
      - BidiLtr
      - BidiRtl
      - Language
      - Unlink
      - Flash
      - Smiley
      - PageBreak
      - Iframe
      - Maximize
      - ShowBlocks
      - About
      - TextColor
      - BGColor      
    format_tags: "p;h1;h2;h3;h4"
    contentsCss: "/fileadmin/templates/css/rte.css"
    stylesSet:
      - { name: "Textlink", element: "a",  attributes: { class: "textlink" } } 
      - { name: "Textlink im Layer öffnen", element: "a",  attributes: { class: "textlink layerbox" } }
      - { name: "RSS", element: "a",  attributes: { class: "rss" } }
      - { name: "Button-Link", element: "a",  attributes: { class: "button" } }
      - { name: "Button-Link im Layer öffnen", element: "a",  attributes: { class: "button layerbox" } }
      - { name: "Großer Button-Link", element: "a",  attributes: { class: "button big" } }
      - { name: "Großer Button-Link im Layer", element: "a",  attributes: { class: "button big layerbox" } }
      - { name: "Blauer Button-Link", element: "a",  attributes: { class: "button blue" } }
      - { name: "Blauer Button-Link im Layer", element: "a",  attributes: { class: "button blue layerbox" } }
      - { name: "Großer blauer Button-Link", element: "a",  attributes: { class: "button big blue" } }
      - { name: "Großer blauer Button-Link im Layer", element: "a",  attributes: { class: "button big blue layerbox" } }
      - { name: "Umfließen links", element: "img",  attributes: { class: "floatleft" } }
      - { name: "Umfließen rechts", element: "img",  attributes: { class: "floatright" } }
      - { name: "nicht umfließen", element: "img",  attributes: { class: "floatnone" } }
      - { name: "Zentrieren", element: "p", attributes: { class: "center"}}

文件管理员/模板/yaml/rte/processing.yaml

processing:
  # previously known as "ts_css" for transformations
  mode: default
  # Tags that are allowed in the content in general
  allowTags:
    - table 
    - tbody 
    - tr 
    - th
    - td
    - h1
    - h2
    - h3
    - h4
    - h5
    - h6
    - div
    - p
    - br
    - span
    - ul
    - ol
    - li
    - re
    - blockquote
    - strong
    - em
    - b
    - i
    - u
    - ub
    - sup
    - strike
    - a
    - img
    - nobr
    - hr
    - tt
    - q
    - cite
    - abbr
    - acronym
    - center

  denyTags:
    - font
## erlaubte Attribute in p, div tags
  keepPDIVattribs: [align, class, style, id]

  ## br wird nicht zu p konvertiert
  dontConvBRtoParagraph: 1

  ## List all class selectors that are allowed on the way to the database
  allowedClasses: [txtlink, button, layerbox, zebra_row, zebra_column,visual, big, blue, center]

  ## Keine Maskierung für HTML-Chars
  htmlSpecialChars: 0
  htmlSpecialChars.preserveEntities: 1

  rmTagIfNoAttrib: span,div,font

  ## Do not allow insertion of the following tags
  hideTags: font

  ## tags die untersagt sind
  removeTags: font

  ## entfernt html-kommentare
  removeComments: 1

  ## Tags die nicht übereinstimmen werden nicht entfernt (protect / 1 / 0)
  keepNonMatchedTags: 0
## Tags that are allowed outside of paragraphs
  allowTagsOutside: img, hr
## allowed default attributes
  allowAttributes: [class, id, title, dir, lang, xml:lang, itemscope, itemtype, itemprop]
## CONTENT TO DATABASE
  HTMLparser_db:
    ## STRIP ALL ATTRIBUTES FROM THESE TAGS
    ## If this list of tags is not set, it will default to: b,i,u,br,center,hr,sub,sup,strong,em,li,ul,ol,blockquote,strike.
    ## However, we want to keep xml:lang attribute on most tags and tags from the default list were cleaned on entry.
    noAttrib: b, i, u, strike, sub, sup, strong, em, quote, blockquote, cite, tt, br, center
    # Can be disabled if you trust ckeditor (If Automatic Content Formatting is enabled, this should be OK)
    # allowTags: %default%
    allowTags: table, tbody, tr, th, td, h1, h2, h3, h4, h5, h6, div, p, br, span, ul, ol, li, re, blockquote, strong, em, b, i, u, sub, sup, strike, a, img, nobr, hr, tt, q, cite, abbr, acronym, center
    denyTags: font
    tags:
      hr:
        allowedAttribs:
          - class

    # Keine Maskierung beim Speichern von HTML-Chars
    htmlSpecialChars: -1

    rmTagIfNoAttrib: span,div,font
## REMOVE OPEN OFFICE META DATA TAGS, WORD 2003 TAGS, LINK, META, STYLE AND TITLE TAGS, AND DEPRECATED HTML TAGS
    ## We use this rule instead of the denyTags rule so that we can protect custom tags without protecting these unwanted tags.
    removeTags: center, font, link, meta, o:p, sdfield, strike, style, title, u
## PROTECT CUSTOM TAGS
    keepNonMatchedTags: protect
4

2 回答 2

0

对于 Contentelement Images,我在页面的通用 TypoScript 模板中使用此设置来扩展呈现的宽度:

tt_content.image {
  dataProcessing.20 {
    maxGalleryWidth = 644
    maxGalleryWidthInText = 644
  }
}

但 Contentelementimage与 CKEditor 无关。

如果您在 TypoSript 对象浏览器中搜索,您还会发现300其他 ContentElements 的最大值,可能textpictextmedia. 这些元素你也可以以同样的方式改变。看起来像这样:

tt_content.textmedia {
  dataProcessing.20 {
    maxGalleryWidth = 644
    maxGalleryWidthInText = 644
  }
}

tt_content.textpic {
  dataProcessing.20 {
    maxGalleryWidth = 644
    maxGalleryWidthInText = 644
  }
}

然后将这些元素与 CKEditor 相关联。
您也可以尝试以相同的方式更改高度,我不确定这是否有效,因为我在 TypoSript 对象浏览器中看不到相应的高度变量。

当然,您可以根据您的布局使用您想要定义的值。

于 2018-06-19T17:11:27.400 回答
0

对于 TYPO3 9.5.x 中的我来说,这个设置有效:

#this makes the images in bodytext larger for in news articles also
RTE.default.buttons.image.options.magic {
    maxWidth = 1020  # Default: 300
    maxHeight = 800  # Default: 1000
}
于 2021-09-10T14:59:06.093 回答