This project is read-only.

Using with Html Field

Sep 8, 2011 at 4:58 PM

CKEditor does not seem to automatically override the edtior template for Contrib.HtmlField part. For the CKEditor module in Body-Html.Editor.cshtml we have:

<script type="text/javascript">

Widgets that are using Contrib.HtmlField, have and id="<PartName>_Html_Text". CKEditor throws a Javascript error stating that the "Body_Text" element was not found.  

Am I missing a configuration item?



Sep 11, 2011 at 8:40 PM
Edited Sep 11, 2011 at 9:27 PM

I am also having problems with this functionality.

Sep 11, 2011 at 10:00 PM
Edited Sep 11, 2011 at 10:00 PM

After some trial and error, I came up with this:

In my theme, I added the following file: (\Themes\MyTheme) \Views\EditorTemplates\Fields\Contrib.Html.cshtml

In this file I put this code:


@model Contrib.HtmlField.ViewModels.HtmlEditorViewModel
@using Orchard.Core.Common.ViewModels;
@using Orchard.Utility.Extensions;
    @Html.TextArea("Text", (string)Model.Text, 25, 80, new { @class = "html" })
    @Html.ValidationMessageFor(m => m.Text)

@using(Script.Foot()) {
<script type="text/javascript">
    CKEDITOR.replace("@Html.FieldIdFor(m => m.Text)");
Oct 5, 2011 at 1:41 PM

I've fixed this in the latest commit. Thanks for letting me know!

Oct 5, 2011 at 1:44 PM

@randompete: No problem. Thank you for a great contribution.

@carruthersr: Your workaround helped me out in the meantime; I appreciate your help.