如何在Umbraco 10的富文本编辑器中直接添加样式

huangapple go评论51阅读模式
英文:

How to add styles directly in Rich Text Editor in Umbraco 10

问题

我尝试在Umbraco 10的富文本编辑器内容中直接编写样式,但这并不起作用,写入样式并保存后,整个RTE变成白色,打开源代码后,所有内容和样式都消失了。我已经搜索了论坛,但没有找到可以解决我的问题的解决方案。有人可以帮助我吗?

请帮助我如何在Umbraco 10的RTE内容中直接添加样式。

英文:

I'm trying to write styles directly in the content of Rich text Editor in Umbraco 10, but that was not working and after writing style and saving it, the whole RTE getting white and when opening the source code all content and styles are disappearing. I've searched the forums and haven't found a solution that could fix the issue for me.
Can anyone help me?

Please help me how to add styles directly in content of RTE in umbraco 10

答案1

得分: 1

Not entirely sure I'm following what you are trying to do, but if you configure "validElements" to include "style" (like in the example in the link) you should be allowed to have a <style> tag in your RTE code.

If you are trying to inline styles via a style attribute on some other element, you can configure that too.

Say you want to add style="something: something" to a div, should be able to add +div[style] to the validElements config.

And of course, if there is no RichTextEditor section in your appsettings.json, you'll need to add it yourself, just like in the example on Umbraco Docs.

英文:

Have you (googled and) taken a look at https://docs.umbraco.com/umbraco-cms/v/10.latest-lts/reference/configuration/richtexteditorsettings already?

Not entirely sure I'm following what you are trying to do, but if you configure "validElements" to include "style" (like in the example in the link) you should be allowed to have a &lt;style&gt; tag in your RTE code.

If you are trying to inline styles via a style attribute on some other element, you can configure that too.

Say you want to add style="something: something" to a div, should be able to add +div[style] to the validElements config.

And of course, if there is no RichTextEditor section in your appsettings.json, you'll need to add it yourself, just like in the example on Umbraco Docs.

huangapple
  • 本文由 发表于 2023年3月9日 15:42:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/75681676.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定