我需要创建一个obout:可切换的普通模式和更全面的RTF模式的编辑器。我在.aspx中声明了编辑器如下:
<obout:Editor ID="edtComment" runat="server" PathPrefix="../styles/" Submit="false" modeSwitch="false" Appearance="custom" AutoFocus="true" ShowQuickFormat="false" />
...我在Page_Init例程中添加了以下内容:
protected void Page_Init(object sender, EventArgs e)
{
if (cConfig.FEATURE_ENABLERICHTEXTCOMMENTS)
{
// Add buttons
OboutInc.Editor.Method btnUndo = new OboutInc.Editor.Method(); btnUndo.Name = OboutInc.Editor.Method.Names.Undo; edtComment.Buttons.Add(btnUndo);
OboutInc.Editor.Method btnRedo = new OboutInc.Editor.Method(); btnRedo.Name = OboutInc.Editor.Method.Names.Redo; edtComment.Buttons.Add(btnRedo);
OboutInc.Editor.Method btnToLowerCase = new OboutInc.Editor.Method(); btnToLowerCase.Name = OboutInc.Editor.Method.Names.ToLowerCase; edtComment.Buttons.Add(btnToLowerCase);
OboutInc.Editor.Method btnToUpperCase = new OboutInc.Editor.Method(); btnToUpperCase.Name = OboutInc.Editor.Method.Names.ToUpperCase; edtComment.Buttons.Add(btnToUpperCase);
OboutInc.Editor.Toggle btnBold = new OboutInc.Editor.Toggle(); btnBold.Name = OboutInc.Editor.Toggle.Names.Bold; edtComment.Buttons.Add(btnBold);
OboutInc.Editor.Toggle btnItalic = new OboutInc.Editor.Toggle(); btnItalic.Name = OboutInc.Editor.Toggle.Names.Italic; edtComment.Buttons.Add(btnItalic);
OboutInc.Editor.Toggle btnUnderline = new OboutInc.Editor.Toggle(); btnUnderline.Name = OboutInc.Editor.Toggle.Names.Underline; edtComment.Buttons.Add(btnUnderline);
OboutInc.Editor.Toggle btnStrikeThrough = new OboutInc.Editor.Toggle(); btnStrikeThrough.Name = OboutInc.Editor.Toggle.Names.StrikeThrough; edtComment.Buttons.Add(btnStrikeThrough);
OboutInc.Editor.Method btnCut = new OboutInc.Editor.Method(); btnCut.Name = OboutInc.Editor.Method.Names.Cut; edtComment.Buttons.Add(btnCut);
OboutInc.Editor.Method btnCopy = new OboutInc.Editor.Method(); btnCopy.Name = OboutInc.Editor.Method.Names.Copy; edtComment.Buttons.Add(btnCopy);
OboutInc.Editor.Method btnPaste = new OboutInc.Editor.Method(); btnPaste.Name = OboutInc.Editor.Method.Names.Paste; edtComment.Buttons.Add(btnPaste);
OboutInc.Editor.Method btnPasteWord = new OboutInc.Editor.Method(); btnPasteWord.Name = OboutInc.Editor.Method.Names.PasteWord; edtComment.Buttons.Add(btnPasteWord);
OboutInc.Editor.Method btnClearStyles = new OboutInc.Editor.Method(); btnClearStyles.Name = OboutInc.Editor.Method.Names.ClearStyles; edtComment.Buttons.Add(btnClearStyles);
OboutInc.Editor.Method btnSpellCheck = new OboutInc.Editor.Method(); btnSpellCheck.Name = OboutInc.Editor.Method.Names.SpellCheck; edtComment.Buttons.Add(btnSpellCheck);
// Add Dictionary
OboutInc.Editor.Dictionary dic;
dic = new OboutInc.Editor.Dictionary();
dic.FileName = "en-CA.dic";
dic.DisplayName = "Canada English";
edtComment.Dictionaries.Add(dic);
dic = new OboutInc.Editor.Dictionary();
dic.FileName = "en-US.dic";
dic.DisplayName = "English(US)";
edtComment.Dictionaries.Add(dic);
// Add QuickFormatting
edtComment.ShowQuickFormat = true;
edtComment.QuickFormatFile = "AEMS_RTF_Quickformat.css";
}
}
但是,当我启用RichTextComments功能时,我的代码没有触发,或者编辑器没有响应更改。 Page_Init是适合这个的地方吗?有没有更好的方法来控制这些选项?