How to add buttons with function of inserting mark/tag ?

  •  04-01-2010, 8:31 PM

    How to add buttons with function of inserting mark/tag ?

    <%
    // The follow code from the help document attached in my CuteEditor  will realize the function of inserting a custombuton.

    ToolControl tc = Editor1.ToolControls["insertcustombutonhere"];
    if (tc != null)
    {
    Image Image1 = new Image();
    Image1.ToolTip = "Insert today's date";
    Image1.ImageUrl = "tools.gif";
    Image1.CssClass = "CuteEditorButton";
    Image1.Attributes["onclick"] = "var d = new Date(); CuteEditor_GetEditor(this).ExecCommand('PasteHTML',false,d.toLocaleDateString())";
    tc.Control.Controls.Add(Image1);
    %>
     
    //But those code can only insert a string after the cursor. I want to insert a tag such as [vi][/vi]. When there are some characters selected the tag will wrap it, eg: [vi]selected characters[/vi]. And when there are not any character selected the tag will be placed after the cursor, eg:the  cursor[vi][/vi]. I know that we can finish it with javascript, but I believe that some functions internal the CE like CuteEditor_GetEditor(this).Exec*** will be more effective.  The warm-hearted thread reader who will provide me some heuristic code?
View Complete Thread