禁用Sitecore页面编辑器中的文本字段编辑

时间:2021-12-14 04:04:45

I'm using SiteCore 7 MVC and Glassmapper.

我正在使用SiteCore 7 MVC和Glassmapper。

I have a set of samples which are rendered using razor and set as standard values when an Author/Editor creates a new page. I wish to prevent the editor from modifying these samples in the PageEditor.

我有一组样本,使用剃刀渲染,并在作者/编辑器创建新页面时设置为标准值。我希望阻止编辑器在PageEditor中修改这些示例。

I have used

我用过

Model.FullPath.Contains("sample") 

to check if the item being rendered is an item from the sample folder.

检查正在呈现的项目是否是示例文件夹中的项目。

This technique works with images using:

此技术适用于以下图像:

@RenderImage(x => x.Image, isEditable:!Model.FullPath.Contains("sample"))

However when I render rich edited text fields (generated by TinyMce) in the following manner:

但是,当我以下列方式渲染丰富的编辑文本字段(由TinyMce生成)时:

@(Model.FullPath.Contains("sample") ? 
       Html.Raw(Model.RichTextLeft) : 
       Editable(x => x.RichTextLeft))

The field remains editable even when rendered separately. I have tried using

即使单独渲染,该字段仍可编辑。我试过用

@Html.Sitecore().Field("SectionTitle")

to render the field (which actually renders nothing).

渲染字段(实际上什么都不呈现)。

and

@Html.Raw(Model.RichTextLeft)

to no avail

无济于事

Any advice would be appreciated.

任何意见,将不胜感激。

1 个解决方案

#1


0  

This issue has been fixed and is available in from the Glass.Mapper build server, this will be in the main release soon.

此问题已得到修复,可从Glass.Mapper构建服务器获得,这将很快在主要版本中提供。

#1


0  

This issue has been fixed and is available in from the Glass.Mapper build server, this will be in the main release soon.

此问题已得到修复,可从Glass.Mapper构建服务器获得,这将很快在主要版本中提供。