将HtmlBodyPart附加到内容类型时,将呈现如下形状(Shapes)html
Name | Display Type | Default Location | Model Type |
---|---|---|---|
HtmlBodyPart |
Detail |
Content:5 |
HtmlBodyPartViewModel |
HtmlBodyPart |
Summary |
Content:10 |
HtmlBodyPartViewModel |
HtmlBodyPartViewModel类提供如下属性。git
Property | Type | Description |
---|---|---|
Body |
string |
The content that was edited. It might contain tokens. |
Html |
string |
The HTML content once all tokens have been processed |
ContentItem |
ContentItem |
The content item of the part |
HtmlBodyPart |
HtmlBodyPart |
The HtmlBodyPart instance |
TypePartSettings |
HtmlBodyPartSettings |
The settings of the part |
HtmlBodyPart上提供了如下属性github
Name | Type | Description |
---|---|---|
Body |
string |
The HTML content in the body. It can contain Liquid tags so using it directly might result in unexpected results. Prefer rendering the HtmlBodyPart shape instead |
Content |
The raw content of the part | |
ContentItem |
The content item containing this part |
HtmlBody Part编辑器对于每种内容类型能够是不一样的。 在内容类型的HtmlBody Part 设置中,只需选择须要使用的设置便可。编辑器
有两个预约义的编辑器名称:ui
Default是默认使用的编辑器
自定义编辑器可能意味着用不一样的体验替换预约义的编辑器,或者为用户提供可供选择的新选项。this
要建立新的自定义编辑器,须要提供两个形状模板( shape templates),一个用于提供编辑器的名称(若是要覆盖现有编辑器,则为可选),以及用于呈现编辑器的实际HTML格式。spa
要声明新编辑器,请建立名为HtmlBody_Option__{Name}的格式,其中{Name}是您选择的值。 这将由一个名为的文件表示 HtmlBody-{Name}.Option.cshtml
.翻译
Sample content:code
@{ string currentEditor = Model.Editor; } <option value="Wysiwyg" selected="@(currentEditor == "Wysiwyg")">@T["Wysiwyg editor"]</option>
要定义从设置中选择编辑器时要呈现的HTML,能够建立与文件Body-{Name} .Editor.cshtml 对应的名为HtmlBody_Editor __ {Name}的格式。orm
Sample content:
@using OrchardCore.Html.ViewModels; @model HtmlBodyPartViewModel <fieldset class="form-group"> <label asp-for="Body">@T["Body"]</label> <textarea asp-for="Body" rows="5" class="form-control"></textarea> <span class="hint">@T["The body of the content item."]</span> </fieldset>
您能够经过建立名为HtmlBody.Editor.cshtml的文件来覆盖默认编辑器的HTML编辑器。 Wysiwyg编辑器是使用名为HtmlBody-Wysiwyg.Editor.cshtml的文件定义的。
https://github.com/Alex-D/Trumbowyg
Copyright (c) 2012-2016 Alexandre Demode (Alex-D)
License: MIT