0

I am trying to add some JavaScript to a Telerik RadEditor Snippets. The following code adds it to the RadEditor and works.

When I run it and add the snippet to the RadEditor, it adds it. When I inspect the Video, the HTML elements shows the and below that the JavaScript code I added with snippet as well.

if (indVideoLink != null)
{
    RadEditor1.Snippets.Add("VideoLink",
    "<video id=\"azuremediaplayer\" class=\"azuremediaplayer amp - default- skin amp - big - play - centered\" tabindex=\"0\"></video>\"" +
    "<script type=\"text/javascript\">var myOptions = {\"nativeControlsForTouch\": false,controls: true,autoplay: true,width: \"640\",height: \"400\",}" +
    "myPlayer = amp(\"azuremediaplayer\", myOptions);myPlayer.src([{\"src\":" + 
    "\"" + indVideoLink + "\",\"type\":  \"appication/vnd.ms.sstr+xml" + 
    "}]);" +
    "</script>");
}

<telerik:RadEditor ID="RadEditor1" Runat="server" Content='<%# Bind("InductionNotes") %>' 
ToolsFile="~/intranet/OHS/Tools.xml"  Width="800px" Height="400px" ContentAreaCssFile="~/Intranet/OHS/ContentEditor.css" OnLoad="RadEditor1_Load">
</telerik:RadEditor>

But then I save it to InductionNotes using a Command Button and it only saves the <video></video> and its contents. How do I get the `RadEditor' to save the JavaScript?

The Tools.xml file contains the following in Snippet

<tool name="InsertSnippet"/>
</tools>

I thought I might have add something to the Tools.xml file but I am not sure.

I should add that the RadGrid is in a DetailsView and everthing else is saving and working correctly.

1 Answer 1

1

The solution is this line of code which disables the RemoveScripts filter which is enabled by default.

RadEditor1.DisableFilter(Telerik.Web.UI.EditorFilters.RemoveScripts);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.