.Editable(editable => { editable.Mode(GridEditMode.PopUp); editable.TemplateName("EmailTemplate"); })
@model Young_Ealing.Models.EmailTemplate@Html.LabelFor(m=>m.Name)@Html.TextBoxFor(m=>m.Name)@Html.LabelFor(m=>m.Subject)@Html.TextBoxFor(m=>m.Subject)@Html.LabelFor(m=>m.Body)@(Html.Kendo().EditorFor(m=>m.Body).Name("Body").Tools(tools => tools.FontName().Bold().Clear().CreateLink().FontSize().FormatBlock().Indent() .InsertImage().InsertOrderedList().InsertUnorderedList().Italic().JustifyCenter() .JustifyFull().JustifyLeft().JustifyRight().Outdent().Separator().Strikethrough() .SubScript().SuperScript().Underline().Unlink().ViewHtml().CustomButton(cb => cb.Name("add_name").ToolTip("insert individual name").Exec(@<text> function(e) { var editor = $(this).data("kendoEditor"); editor.exec("inserthtml", { value: "@(Young_Ealing.Code.EmailUtils.TEMPLATE_INDIVIDUAL_NAME)" }); } </text>))).HtmlAttributes(new { style = "width: 785px;height:295px;"}))@Html.LabelFor(m => m.IsHtml)@Html.CheckBoxFor(m => m.IsHtml)<div class="clear"></div>6 Answers, 1 is accepted
I tried to reproduce the problem locally but to no avail – everything is working as expected on our side. Could you please provide runable project where the issue is reproduced and more information about the exact browser (and version) that you are using? This would help us pinpoint the exact reason for this behavior.
Vladimir Iliev
Telerik
Within the template form, I added an Editor control. The problem is .. It is not loading any information from the model.
When the control is loading you can see the model information during less than 0.5 second. After that, the information is removed and the control is set like in not enable mode. What's going on there?
But if I change the Editor for a text area everything is working fine! I also have the editor in other Web Pages and it is also working without problem. The issue only occurs in the PopUp Template Form.
Please help me..
BTW.. I am using Firefox 21.0 and Kendo UI Complete v2012.3.1315
This is an already know issue and currently our dev team is after it. It can be reproduced when the Editor widget is initialized before the PopUp window (which moves it in the DOM) in FireFox. Possible workaround is to use the Edit event of the Grid to trigger the "DOMNodeInserted" event:
function onEdit(e) { e.container.trigger("DOMNodeInserted");}Vladimir Iliev
Telerik
Dear Team,
I have a Kendo EditorFor control, where I am displaying content from the database(an email thread) and now I wanted to insert the email signature of the user to the content area on the click of a CustomTemplate button added to the tools of the EditorFor contro as below.
@(Html.Kendo().EditorFor(model => model.RequestDescription)
.Name("new_editorForRequestDescription")
.HtmlAttributes(new {style = "height:440px", aria_label = "editor", tabindex = 195 })
.Encode(false)
.HtmlAttributes(new { style = "float: right;" })
.Tools(tools=>tools
.CustomTemplate(c => c.Template("<button class='k-button' style='margin-right: 10px;' onclick='insertEmailSignature()'>Insert Signature</button>"))
))
And the function as below.
function insertEmailSignature()
{
var currentUser = JSON.parse('@Html.Raw(Json.Encode(ViewData["CurrentUserName"]))');
var fullSignature = currentUser + '<br>' + getStandardEmailSignature() + '<hr/>';
InsertToBody(fullSignature);
}
function InsertToBody(signature) {
$("#new_editorForRequestDescription").kendoEditor();
var editor = $("#new_editorForRequestDescription").data("kendoEditor").value();
var storedRange = editor.getRange();
editor.selectRange(storedRange);
editor.exec("inserthtml", { value: signature });
return
}
Now I am getting issues in getRange(), SelectRange() and Exec() and giving error as "editor.exec is not a function", editor.getRange is not a function etc.
My requirement is to just insert the email signature to the editor area.
Please help me.
Thanks,
Sajitha
Hello,
In the shared code the editor variable is assigned to .data("kendoEditor").value() and that is returning the value of the editor and not the editor itself. I have changed it to the code below and it worked correctly at my side:
var editor = $("#new_editorForRequestDescription").data("kendoEditor");Regards,
Plamen
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
