![](/img/trans.png)
[英]Changing the value of a Telerik RadEditor with Javascript/jQuery
[英]Telerik RadEditor Add Snippets to Include JavaScript
我正在嘗試向Telerik
RadEditor
片段添加一些JavaScript。 以下代碼將其添加到RadEditor
並可以運行。
當我運行它並將代碼段添加到RadEditor
,它將添加它。 當我檢查Video時,HTML元素顯示和,以及下面添加的代碼段的JavaScript代碼。
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>
但是然后我使用命令按鈕將其保存到InductionNotes中,並且僅保存<video></video>
及其內容。 如何獲取“ RadEditor”以保存JavaScript?
Tools.xml
文件在代碼片段中包含以下內容
<tool name="InsertSnippet"/>
</tools>
我以為可能已經在Tools.xml
文件中添加了一些內容,但不確定。
我應該補充說RadGrid在DetailsView
,其他所有東西都可以保存並正常工作。
解決方案是此代碼行,該代碼禁用默認情況下啟用的RemoveScripts篩選器。
RadEditor1.DisableFilter(Telerik.Web.UI.EditorFilters.RemoveScripts);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.