RTE的PageTS如下所示:RTE.default.hidePStyleItems := removeFromList(pre)RTE.default.proc { allowTags := addToList(pre) entryHTMLparser_db.allowTags < RTE.default.proc.allowTags overruleMode = tx_vjrtecodesnippets,ts_css,cleanenc allowTags := addToList(code) allowTagsOutside := addToList(code) entryHTMLparser_db { allowTags < RTE.default.proc.allowTags allowTagsOutside < RTE.default.proc.allowTagsOutside } HTMLparser_rte { allowTags < RTE.default.proc.allowTags allowTagsOutside < RTE.default.proc.allowTagsOutside }} Edit2 :我们已经发布了TYPO3扩展news_blog来完成此操作.解决方案我想写评论,但简短的答案加上复杂的猜测可能同样好:我在自己的网站上进行了检查,<code>标签工作正常.空格在正文文本字段中存储为 ,因此保留保存并重新打开时.您是否尝试过删除行RTE.default.hidePStyleItems := removeFromList(pre)?根据手册,仅vjrtecodesnippets支持c1>标记.您真的需要两个标签来突出显示语法吗?还,您是否尝试过如下更改PageTS来启用<pre>?:-RTE.default.proc { allowTagsOutside := addToList(code,pre)}我找到了一个相关的 TypoScript片段,这可能对您的情况值得注意.请尝试进行以下调整:在模板设置"部分:lib.parseFunc.allowTags := addToList(code,pre)lib.parseFunc_RTE.allowTags := addToList(code,pre)在PAGE TSconfig中:RTE.default.proc { allowTags := addToList(code,pre) allowTagsOutside := addToList(code,pre) overruleMode = tx_vjrtecodesnippets,ts_css,cleanenc // CONTENT TO DATABASE HTMLparser_rte { allowTags < RTE.default.proc.allowTags allowTagsOutside < RTE.default.proc.allowTagsOutside } // Entry HTML parser entryHTMLparser_db { allowTags < RTE.default.proc.allowTags allowTagsOutside < RTE.default.proc.allowTagsOutside }}I want to display code through <pre> and/or <code> tags, which works fine. White spaces are saved on first save and displayed properly in the front-end. However, when reloading the content in the backend, the editor shows the code without the additional whitespaces. Saving again drops the whole code formatting.I assume there is some setting for this but I couldn't find anything until now. Any hints on this?For the code highlighting, I am using the GeshiLib and vjrtecodesnippetsextensions.Edit:Sorry, missed the configuration. There is the basic rtehtmlarea involved, currently v4.7.5, there is no TCA specific change since it is a standard bodytext field from TYPO3's standard Text content element (displayed through css_styled_content).PageTS for the RTE looks like the following:RTE.default.hidePStyleItems := removeFromList(pre)RTE.default.proc { allowTags := addToList(pre) entryHTMLparser_db.allowTags < RTE.default.proc.allowTags overruleMode = tx_vjrtecodesnippets,ts_css,cleanenc allowTags := addToList(code) allowTagsOutside := addToList(code) entryHTMLparser_db { allowTags < RTE.default.proc.allowTags allowTagsOutside < RTE.default.proc.allowTagsOutside } HTMLparser_rte { allowTags < RTE.default.proc.allowTags allowTagsOutside < RTE.default.proc.allowTagsOutside }}Edit2: We've published the TYPO3 extension news_blog which does exactly this. 解决方案 I wanted to write a comment, but a short answer with sophisticated guesses might be just as good:I checked at my own site, the <code> tag works fine. Whitespacesare stored as in the bodytext field, therefore preservedwhen saved and re-opened.Have you tried deleting the lineRTE.default.hidePStyleItems := removeFromList(pre)?According to the manual, only <code> tags are supported by vjrtecodesnippets. Do you really need both tags for syntax highlighting?Also, have you tried changing your PageTS like follows to enable <pre>?:-RTE.default.proc { allowTagsOutside := addToList(code,pre)}EDIT:I found a related TypoScript snippet, which might be noteworthy for your case. Please try making the following adjustments:In the Template SETUP section:lib.parseFunc.allowTags := addToList(code,pre)lib.parseFunc_RTE.allowTags := addToList(code,pre)In the PAGE TSconfig:RTE.default.proc { allowTags := addToList(code,pre) allowTagsOutside := addToList(code,pre) overruleMode = tx_vjrtecodesnippets,ts_css,cleanenc // CONTENT TO DATABASE HTMLparser_rte { allowTags < RTE.default.proc.allowTags allowTagsOutside < RTE.default.proc.allowTagsOutside } // Entry HTML parser entryHTMLparser_db { allowTags < RTE.default.proc.allowTags allowTagsOutside < RTE.default.proc.allowTagsOutside }} 这篇关于在RTE中保留空格,以保留pre和code标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!