Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Angry Iframe ExecCommand Hyperlink problem

    I am having a very odd problem with using IFrames as a wysiwyg editor

    I am using the editor to enter information into a db and also edit the information in the db.

    The inputting works fine and any links i add work correctly. However if i then go to edit the data when i put the info through the editor the second time it breaks the link by adding a bit at the beginning of the HREF (example below)

    If the link was href="http://www.bbc.co.uk" when it is edited and saved it becomes
    href='http://intranet/test/"http://www.bbc.co.uk"'
    (with the beginning bit being the root of the page)

    This is really annoying as this happens even when the link is not touched second time around.

    Any Ideas??

  • #2
    New Coder
    Join Date
    May 2004
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by 3lions
    I am having a very odd problem with using IFrames as a wysiwyg editor

    I am using the editor to enter information into a db and also edit the information in the db.

    The inputting works fine and any links i add work correctly. However if i then go to edit the data when i put the info through the editor the second time it breaks the link by adding a bit at the beginning of the HREF (example below)

    If the link was href="http://www.bbc.co.uk" when it is edited and saved it becomes
    href='http://intranet/test/"http://www.bbc.co.uk"'
    (with the beginning bit being the root of the page)

    This is really annoying as this happens even when the link is not touched second time around.

    Any Ideas??
    It seems to be default behavior for IE-based editors to convert link paths to absolute on saving the page or toggling between HTML and WYSIWYG mode. In the WYSIWYG editor I developed the only way I could get around this was by adding the copy and paste code to the toggle script. Don't ask me why it works, but it does.

    function doToggleView() {
    //----- Convert WYSIWYG editor to HTML -----
    if(viewMode == 1) {
    iHTML = iView.document.body.innerHTML;
    iView.document.body.innerText = iHTML;
    iView.focus();
    viewMode = 2;
    //----- Convert HTML editor to WYSIWYG -----
    } else{
    txtRange = iView.document.body.createTextRange();
    txtRange.select();
    txtRange.execCommand("Copy");
    txtRange.execCommand("Paste");
    iText = iView.document.body.innerText;
    iView.document.body.innerHTML = iText;
    iView.focus();
    viewMode = 1;
    }
    }


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •