Skip to content

Body (OrchardCore.Html)

身体(OrchardCore.Html)

Theming

主题化

Shapes

形状

The following shapes are rendered when the HtmlBodyPart is attached to a content type

HtmlBodyPart 附加到内容类型时,将呈现以下形状

| Name | Display Type | Default Location | Model Type |

|名称|显示类型|默认位置|型号类型|

| ------| ------------ |----------------- | ---------- |

| ------ | ------------ | ----------------- | ---------- |

| HtmlBodyPart | Detail | Content:5 | HtmlBodyPartViewModel |

| HtmlBodyPart | 细节| 内容:5 | HtmlBodyPartViewModel |

| HtmlBodyPart | Summary | Content:10 | HtmlBodyPartViewModel |

| HtmlBodyPart | 摘要| 内容:10 | HtmlBodyPartViewModel |

HtmlBodyPartViewModel

HtmlBodyPartViewModel

The following properties are available on the HtmlBodyPartViewModel class.

HtmlBodyPartViewModel类提供以下属性。

| Property | Type | Description |

|财产|输入|说明|

| --------- | ---- |------------ |

| --------- | ---- | ------------ |

| Body | string | The content that was edited. It might contain tokens. |

| 身体| string |已编辑的内容。它可能包含令牌。 |

| Html | string | The HTML content once all tokens have been processed |

| Html | string |处理完所有令牌后的HTML内容|

| ContentItem | ContentItem | The content item of the part |

| ContentItem | ContentItem |部分的内容项目

| HtmlBodyPart | HtmlBodyPart | The HtmlBodyPart instance|

| HtmlBodyPart | HtmlBodyPart | HtmlBodyPart实例|

| TypePartSettings | HtmlBodyPartSettings | The settings of the part |

| TypePartSettings | HtmlBodyPartSettings |部分的设置|

HtmlBodyPart

HtmlBodyPart

The following properties are available on HtmlBodyPart

HtmlBodyPart提供以下属性

| 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 |

| 身体| string |正文中的HTML内容。它可以包含Liquid标签,因此直接使用它可能会导致意外结果。更喜欢渲染HtmlBodyPart形状

| Content | The raw content of the part |

| 内容|部分的原始内容|

| ContentItem | The content item containing this part |

| ContentItem |包含此部分的内容项目

Editors

编者

The HtmlBody Part editor can be different for each content type. In the HtmlBody Part settings of a

__HtmlBody Part__编辑器对于每种内容类型可以是不同的。在__HtmlBody Part__设置中

content type, just select the one that needs to be used.

内容类型,只需选择需要使用的内容。

There are two predefined editor names:

有两个预定义的编辑器名称:

  • Default is the editor that is used by default

  • Default是默认使用的编辑器

  • Wysiwyg is the editor that provides a WYSIWYG experience

  • Wysiwyg是提供WYSIWYG体验的编辑器

Custom Editors

自定义编辑器

Customizing the editor can mean to replace the predefined one with different experiences, or to provide

自定义编辑器可能意味着用不同的体验替换预定义的编辑器,或者提供

new options for the user to choose from.

用户可供选择的新选项。

To create a new custom editor, it is required to provide two shape templates, one to provide

要创建新的自定义编辑器,需要提供两个形状模板,一个用于提供

the name of the editor (optional if you want to override an existing one), and a shape to

编辑器的名称(如果要覆盖现有编辑器,则为可选项)和形状

render the actual HTML for the editor.

呈现编辑器的实际HTML。

Declaration

宣言

To declare a new editor, create a shape named HtmlBody_Option__{Name} where {Name} is a value

要声明一个新的编辑器,创建一个名为HtmlBody_Option __ {Name}的形状,其中{Name}是一个值

of your choosing. This will be represented by a file named HtmlBody-{Name}.Option.cshtml.

你选择的。这将由名为HtmlBody- {Name} .Option.cshtml的文件表示。

Sample content:

示例内容:


@{

 <font color=#0099ff size=4 face="黑体">@ {</font> 


    string currentEditor = Model.Editor;

}

 <font color=#0099ff size=4 face="黑体">}</font> 


<option value="Wysiwyg" selected="@(currentEditor == "Wysiwyg")">@T["Wysiwyg editor"]</option>

 <font color=#0099ff size=4 face="黑体"><option value =“Wysiwyg”selected =“@(currentEditor ==”Wysiwyg“)”> @ T [“Wysiwyg编辑”] </ option></font> 


HTML Editor

HTML编辑器

To define what HTML to render when the editor is selected from the settings, a shape named

要定义从设置中选择编辑器时要呈现的HTML,请使用名为的形状

HtmlBody_Editor__{Name} corresponding to a file Body-{Name}.Editor.cshtml can be created.

Sample content:

示例内容:


@using OrchardCore.Html.ViewModels;

 <font color=#0099ff size=4 face="黑体">@using OrchardCore.Html.ViewModels;</font> 


@model HtmlBodyPartViewModel

 <font color=#0099ff size=4 face="黑体">@model HtmlBodyPartViewModel</font> 





 <font color=#0099ff size=4 face="黑体"></font> 


<fieldset class="form-group">

 <font color=#0099ff size=4 face="黑体"><fieldset class =“form-group”></font> 


    <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>

 <font color=#0099ff size=4 face="黑体"></字段集></font> 


Overriding the predefined editors

覆盖预定义的编辑器

You can override the HTML editor for the Default editor by creating a shape file named

您可以通过创建名为的形状文件来覆盖“Default”编辑器的HTML编辑器

HtmlBody.Editor.cshtml. The Wysiwyg editor is defined by using the file named

HtmlBody-Wysiwyg.Editor.cshtml.

CREDITS

学分

Trumbowyg

Trumbowyg

https://github.com/Alex-D/Trumbowyg

https://github.com/Alex-D/Trumbowyg

Copyright (c) 2012-2016 Alexandre Demode (Alex-D)

版权所有(c)2012-2016 Alexandre Demode(Alex-D)

License: MIT

执照:麻省理工学院