Sitecore中的Richtext

编程入门 行业动态 更新时间:2024-10-26 01:34:01
Sitecore中的Richtext-field不显示来自HTML的medialibrary图像(Richtext-field in Sitecore not showing medialibrary image from HTML)

我好像有一个有趣的问题。 我有以下设置。

有一个电子邮件模板,其中包含一些单行文本字段和一个富文本字段。

我用这个模板填充了一些信息。 现在我有发送者,接收者,抄送,密件抄送字段,所有这些都是单行文本字段,除了一个,这是消息字段(这是一个富文本字段)。 此字段已填充哪些HTML,除非我想从媒体库添加图像,否则一切正常。

http://postimg.org/image/moiew26fx/

现在我可以看到我项目中的图像出现,除非我测试它(一封电子邮件将被发送到我的收件箱),我可以看到整个邮件带有html标记,除了我的图像似乎已被删除。 当我在我的标记中插入另一个图像(来自互联网的随机图像)时,一切似乎都很好。 有没有人知道在richtext字段中发生了什么以及为什么它拒绝输出我的图像。

运行版本:Sitecore.NET 6.6.0

编辑:我发现了一个与我的情况非常相似的情况: http : //sdn.sitecore.net/SDN5/Forum/ShowPost.aspx?PostID = 12071

I seem to be having an interesting problem. I have the following setup.

There is an email template which contains some single-line text fields and 1 rich text field.

I filled the item created from this template with some information. Now I've got sender , receiver , cc , bcc fields all of which are single-line text fields except for one, that's the message field(this one is a rich text field). This field has been populated which HTML which all works fine except when I want to add an image from my media library.

http://postimg.org/image/moiew26fx/

Now I can see the image in my item appearing except when I test it ( an email will be sent to my inbox), I can see the entire mail with html markup except my image seems to have been removed. When I insert another image in my markup ( a random one from the internet ) all seems good. Does anyone have an idea what happens here in the richtext field and why it refuses to output my image.

Running version: Sitecore.NET 6.6.0

EDIT : I found a situation quite similar to mine here : http://sdn.sitecore.net/SDN5/Forum/ShowPost.aspx?PostID=12071

最满意答案

您找到的sdn上的帖子是正确的。 图像的网址必须是绝对的网址。 如你所说,你有这个电子邮件模板,但从上下文我不知道它将如何消费。 您可以在项目保存事件或电子邮件发送操作之前处理此问题。

正如在SDN帖子中所说的自定义富文本编辑器并不容易,您也不希望所有图像都使用绝对URL,这可能需要一些时间,以防您将来需要对其他域进行内容搜集。 您可以添加仅适用于此模板的自定义插入图像按钮,您可以在其中使用绝对URL。

但在发送电子邮件动作之前更新媒体网址似乎是最简单的方法。

The post on sdn you found is correct. The url of the image needs to be an absolute url. As you mentioned you have this email template but from the context I don’t know how it will be consumed. You can handle this on item saving event or before the email send action.

As in SDN post said customize rich text editor is not easy also you don’t want all the image to use absolute url which might take time in case you need to do content marination to a different domain in the future. You can add a custom insert image button only available to this template where you use absolute url instead.

But update the media url before sending the email action seems the easiest way to go.

更多推荐

本文发布于:2023-07-30 01:27:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1321381.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Sitecore   Richtext

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!