我無法訪問實際的asp.net服務器標籤本身,因此我需要將StripFormattingOnPaste
property更改爲使用JavaScript的EditorStripFormattingOptions
enum,我不確定如何。我有一些代碼,增加了一個OnClientLoad()
和OnClientCommandExecuted()
功能的作品,所以我可以在裏面添加它,我只是不知道在哪裏存在於客戶端的性能,什麼枚舉值是:如何使用JavaScript設置Telerik RadEditor的StripFormattingOnPaste屬性?
// init OnClientLoad and OnClientCommandExecuted event handlers for all radeditors on the page
Sys.Application.add_load(function() {
if (typeof ($telerik) != "undefined") {
if ($telerik.radControls && Telerik.Web.UI.RadEditor) {
for (var i = 0, l = $telerik.radControls.length; i < l; i++) {
var control = $telerik.radControls[i];
if (Telerik.Web.UI.RadEditor.isInstanceOfType(control)) {
var editor = control;
// ??? editor._stripFormattingOptions = Telerik.Web.UI.StripFormattingOptions.NoneSupressCleanMessage
// editor already loaded, fire event
OnClientLoad(editor);
// attach event handler for paste commands
editor.add_commandExecuted(function(ed, args) {
return OnClientCommandExecuted(ed, args);
});
}
}
}
}
});
更新:我發現我想要的正確枚舉設置是Telerik.Web.UI.StripFormattingOptions.NoneSupressCleanMessage
。
更新#2:我看到RadEditor JS對象有一個_stripFormattingOptions
屬性,但我認爲它可能只是私人使用。
太棒了,感謝您的信息! – travis 2009-12-01 15:07:47