This question is locked. New answers and comments are not allowed.
hi,
I've wrapped up the editor in a template.
Looks like this
This way I can have several simple editor's on the same page, only the active one displaying a simple toolbar.
I've wrapped up the editor in a template.
Looks like this
@using Telerik.Web.Mvc.UI
@model string
@{
var documentName = ViewData.TemplateInfo.HtmlFieldPrefix;
var hideShowFunction = "HideShow" + documentName;
string documentContent = HttpUtility.HtmlDecode(ViewData.TemplateInfo.FormattedModelValue.ToString());
}
<
script
type
=
"text/javascript"
>
function @(hideShowFunction)() {
var editor = $("#@documentName").data("tEditor");
$(editor.window).bind("focus", function () {
$("#@documentName .t-editor-toolbar").show();
}).bind("blur", function () {
$("#@documentName .t-editor-toolbar").hide();
});
$("#@documentName .t-editor-toolbar").hide();
}
</
script
>
@(
Html.Telerik().Editor()
.Name(documentName)
.ClientEvents(events => events.OnLoad(hideShowFunction))
.Tools(tools =>
{
tools.Clear();
tools.Bold();
tools.Italic();
tools.Underline();
tools.Strikethrough();
tools.InsertOrderedList();
tools.InsertUnorderedList();
tools.InsertImage();
})
.Value(documentContent)
.HtmlAttributes(new { style = "height:120px" }))
This way I can have several simple editor's on the same page, only the active one displaying a simple toolbar.
My problem are the ordered-list tools. Being clicked they result in a general Telerik error: "Unable to get value of the property 'parentNode': object is null or undefined"
I have already tried striking the custom toolbar and striking the client event. The error remains. So I guess it has to do with the fact I'm using the editor in a template.
What am I missing ?
kind regards,
Peter