我为果园创建了模块。 我有以下模型:
public class SliderPart : ContentPart<SliderPartRecord>
{
[Required]
public string Slide1
{
get { return Record.Slide1; }
set { Record.Slide1 = value; }
}
[Required]
public string Slide3
{
get { return Record.Slide3; }
set { Record.Slide3 = value; }
}
[Required]
public string Slide2
{
get { return Record.Slide2; }
set { Record.Slide2 = value; }
}
}
假设我也有编辑模板:
@Html.EditorFor(m => m.Slide1, new { @class = "text" })
@Html.EditorFor(m => m.Slide2, new { @class = "text" })
@Html.EditorFor(m => m.Slide3, new { @class = "text" })
如何使我的字段可以像HTML一样编辑,就像Pages模块上的正文一样?
有什么想法吗? 也许某些属性设置为Model?
谢谢。
答案 0 :(得分:3)
@{ Script.Require("OrchardTinyMce"); } @Html.TextArea("Slide1", Model.Slide1, 25, 80, new Dictionary { {"class", "html tinymce"}, {"data-mediapicker-uploadpath",""}, {"data-mediapicker-title",T("Insert/Update Media") } })and etc for 2nd and 3rd