Is there a way to "select none" before the PasteHTML command

Last post 10-04-2005, 2:16 PM by jamesdean. 3 replies.
Sort Posts: Previous Next
  •  10-03-2005, 8:25 PM 11322

    Is there a way to "select none" before the PasteHTML command

    I have added a custom button that inserts some HTML when clicked. the ExecCommand('PasteHTML'... command works fine, but it overwrites any previously selected text (or controls).

    Is there a way to insert html without replacing selected text.

    Thanks in advance,

    James
     
  •  10-03-2005, 11:14 PM 11348 in reply to 11322

    Re: Is there a way to "select none" before the PasteHTML command

    James,
     
    Just call SelectNone before you pasteHTML to the editor.
    Keep me posted.

     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  10-04-2005, 1:19 PM 11368 in reply to 11348

    Re: Is there a way to "select none" before the PasteHTML command

    Thanks for the quick response, Adam.
     
    Unfortunately, the page that you referenced doesn't include an example for a "SelectNone" command. I tried the following with no luck:
    CuteEditor_GetEditor(this).ExecCommand('SelectNone',false,'')
    CuteEditor_GetEditor(this).ExecCommand('SelectNone')
    CuteEditor_GetEditor(this).ExecCommand('selectnone')
    CuteEditor_GetEditor(this).SelectNone
    CuteEditor_GetEditor(this).SelectNone()
     
    Could you provide an example demonstrating how to select none?
     
    Thanks,
     
    James
  •  10-04-2005, 2:16 PM 11371 in reply to 11368

    Re: Is there a way to "select none" before the PasteHTML command

    Adam,
     
    After upgrading to version 5, the 'SelectNone' command worked, however it didn't unselect tags such as <div> and <img> as I expected. It only seems to unselect text. I was able to make it work by executing 'SelectAll'  and then 'SelectNone'. For the benifit of others, here's the code that I used:
     
    tc = Editor1.ToolControls("insertcustombutonhere")
    Image1 = New System.Web.UI.WebControls.Image
    Image1.ToolTip = "Select None and Insert HTML"
    Image1.ImageUrl = "images/myimage.gif"
    Image1.CssClass = "CuteEditorButton"
    SetMouseEvents(Image1)
    Image1.Attributes("onclick") = "CuteEditor_GetEditor(this).ExecCommand('SelectAll',false,'');CuteEditor_GetEditor(this).ExecCommand('SelectNone',false,'');CuteEditor_GetEditor(this).ExecCommand('PasteHTML',false,'<div>my html</div>')"
    tc.Control.Controls.Add(Image1)
     
     
    Thanks for your help,
     
    James
View as RSS news feed in XML