Trouble duplicating insert hyperlink functionality

Last post 10-28-2005, 8:00 AM by gjackson. 1 replies.
Sort Posts: Previous Next
  •  10-28-2005, 7:41 AM 12074

    Trouble duplicating insert hyperlink functionality

    Hi There
     
    I'm trying to create something very similar to the "insert hyperlink" functionality of the cute editor.
     
    Unfortunately I just can't seem to get the JavaScript function in the modal window correct.
     
    I have the following in the modal so far.
     
    function button_click(){
     var editor=window.dialogArguments;
     //_Format(editorID,'Cut');
     var sel = editor.document.selection.createRange();
     if (editor.document.selection.type == 'Control') {
      return;
     }
     sel.pasteHTML("test");
    }
     
    This is the latest version I've tried after looking through the other posts.
    The problem is that it works just fine, and long as nothing is selected.
    As soon as I select something and trigger the click I get a JavaScript error saying "incompatible markup pointers for this operation"
     
    Could you please give me the function you use for the "insert hyperlink" dialog, so I can alter it to suit my needs?
    I've taken a look at that dialog - and I really have no idea what you guys are doing :(
     
    Thank you
  •  10-28-2005, 8:00 AM 12075 in reply to 12074

    Re: Trouble duplicating insert hyperlink functionality

    Hi There
     
    Dont worry, I've solved my own problem.
    its as simple as :
     
    function button_click(){
     var editor=window.dialogArguments;
     editor.ExecCommand("CreateLink",false,"www.blabla.com");
    }
View as RSS news feed in XML