【发布时间】:2010-11-17 01:39:11
【问题描述】:
我正在尝试使用 Javascript 手动清理 Telerik RadEditor 的 HTML,但我似乎无法找到存储该值的正确位置,以便在回发时将其保存。
这是我的 JS:
$(function () {
jQuery.fixHash = function ($html) {
// modify $html
return $html;
};
$("#adminEditingArea input[id$='SaveButton']").unbind("click").click(function () {
$("iframe[id$='_contentIframe']").trigger("save");
// call .net postback
return false;
});
});
var editorSaveEventInit = false;
function InitSaveEvent() {
if (!editorSaveEventInit) {
var $EditFrames = $("iframe[id$='_contentIframe']");
if ($EditFrames && $EditFrames.length > 0) {
$EditFrames.bind("save", function (e) {
var $thisFrame = $(this);
var thisFrameContents = $thisFrame.contents();
if (thisFrameContents) {
var telerikContentIFrame = thisFrameContents.get(0);
var $body = $("body", telerikContentIFrame);
var html = $.fixHash($body).html();
$body.html(html);
// also tried storing the modified HTML in the textarea, but it doesn't seem to save:
//$thisFrame.prev("textarea").html(encodeURIComponent("<body>" + html + "</body>"));
}
});
editorSaveEventInit = true;
}
}
};
$(window).load(function () {
InitSaveEvent();
});
有什么方法可以使用 JavaScript 访问 Telerik RadEditor 对象(使用OnClientCommandExecuted()?),以便我可以访问.get_html() 和.set_html(value) 函数?如果没有,在回发之前我需要设置什么值?
【问题讨论】:
标签: asp.net javascript jquery telerik radeditor