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 10 of 10
  1. #1
    Regular Coder Krupski's Avatar
    Join Date
    Dec 2010
    Location
    United States of America
    Posts
    505
    Thanks
    39
    Thanked 47 Times in 46 Posts

    Please explain DOM range to me.

    Hi all,

    First of all, I am not a student and this is not homework. Secondly, I've been programming in C, Motorola assembler, Intel assembler and even GWBasic for years.

    I recently (this year) got into Web / Javascript / PHP / HTML programming and I'm clawing up the learning curve. I know a fair amount, but have a long way to go.

    OK here's my problem: I've been trying to integrate a WYSIWYG editor (TinyMCE) into a bulletin board software package (PHPBB3).

    All is working well except for one big stumbling block that I've been battling for the past MONTH!...:

    I want to support the original BBCode system of PHPBB3 (mostly because of the ability for the admin to add custom BBCodes).

    So, what I need to do is this:

    (1) Select a range of text.
    (2) Either REPLACE it with "[tag]selection[/tag]" or else INSERT "[tag]" before and "[/tag]" after.
    (3) Lastly, the original selection must remain selected so that additional BBCodes can be wrapped without the need to re-select.

    The purpose of (3) is, say, the user clicks "bold" and "italic" and "underline".... all they should have to do is click those 3, not re-select each time.

    I've tried doing this:

    (1) get the selection range
    (2) get the selection text
    (3) delete the range contents
    (4) create two "contextual fragments" (one for the opening tag, the other for the closing tag).
    (5) create a <span> element containing the selection text
    (6) Insert it all into the range with range.insertNode()
    (7) finally select the new span element

    This seems to work fine, but Internet Explorer fails (it complains when I try to get the selection range).

    I just don't know what I'm doing wrong... and worse I'm not even sure if I'm attacking the problem the proper way.

    Any ideas would be greatly appreciated!

    Thanks!

    -- Roger

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,184
    Thanks
    75
    Thanked 4,340 Times in 4,306 Posts
    Ummm...I'd say this is a well known--or at least common--problem with TinyMCE.

    Just do http://www.google.com/search?q=tinym...lems+with+msie

    You will find you are by no means alone.

    I know there are other browser-based WYSIWYG editors that work fine with MSIE, at least 7 and above, so maybe it's time to stop fighting TinyMCE and find a different one??
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    Regular Coder Krupski's Avatar
    Join Date
    Dec 2010
    Location
    United States of America
    Posts
    505
    Thanks
    39
    Thanked 47 Times in 46 Posts
    Quote Originally Posted by Old Pedant View Post
    Ummm...I'd say this is a well known--or at least common--problem with TinyMCE.

    Just do http://www.google.com/search?q=tinym...lems+with+msie

    You will find you are by no means alone.

    I know there are other browser-based WYSIWYG editors that work fine with MSIE, at least 7 and above, so maybe it's time to stop fighting TinyMCE and find a different one??
    Wow. Not exactly what I wanted to hear (though I'm not surprised).

    Actually, I have thought of giving up on TinyMCE, but I have so much time invested in making it work that I've been reluctant to.

    Any suggestions on an editor that does work properly?

    Oh, BTW that's for the quick reply!

    -- Roger

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,184
    Thanks
    75
    Thanked 4,340 Times in 4,306 Posts
    I've used FCKEditor in the past, but I think there are better ones out there.

    I've been looking at this one:
    http://www.openwebware.com/

    You could try it out in a few browsers first, before even bothering to download it.

    EDIT: Never mind, that one doesn't work with Chrome!!! A shame.
    Last edited by Old Pedant; 12-21-2010 at 11:50 PM.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #5
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,184
    Thanks
    75
    Thanked 4,340 Times in 4,306 Posts
    Hmmm...this one looks pretty good:
    http://www.kevinroth.com/rte/demo.htm

    Looks good in FF, Chrome, and MSIE 8, at least.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • Users who have thanked Old Pedant for this post:

    Krupski (12-22-2010)

  • #6
    Regular Coder Krupski's Avatar
    Join Date
    Dec 2010
    Location
    United States of America
    Posts
    505
    Thanks
    39
    Thanked 47 Times in 46 Posts
    Quote Originally Posted by Old Pedant View Post
    Hmmm...this one looks pretty good:
    http://www.kevinroth.com/rte/demo.htm

    Looks good in FF, Chrome, and MSIE 8, at least.
    Thank you! I'll give it a try. After pounding my head against the wall for over a month now with TinyMCE, I think you're right... it's time to move on. I'll check out the link you gave me.

    Thanks!

    -- Roger

  • #7
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,184
    Thanks
    75
    Thanked 4,340 Times in 4,306 Posts
    Ahhh...I just checked, and CKEditor is the replacement for FCKEditor, and it is *AMAZING*!!! All the things that were wrong with FCKEditor have been fixed and it's truly a commercial-grade product, now. And yet free for non-commercial use. I'd seriously consider using it, were I you.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • Users who have thanked Old Pedant for this post:

    Krupski (12-23-2010)

  • #8
    Regular Coder Krupski's Avatar
    Join Date
    Dec 2010
    Location
    United States of America
    Posts
    505
    Thanks
    39
    Thanked 47 Times in 46 Posts
    Quote Originally Posted by Old Pedant View Post
    Ahhh...I just checked, and CKEditor is the replacement for FCKEditor, and it is *AMAZING*!!! All the things that were wrong with FCKEditor have been fixed and it's truly a commercial-grade product, now. And yet free for non-commercial use. I'd seriously consider using it, were I you.
    I've heard of it, but haven't tried it. I will now. Thanks!

  • #9
    Regular Coder Krupski's Avatar
    Join Date
    Dec 2010
    Location
    United States of America
    Posts
    505
    Thanks
    39
    Thanked 47 Times in 46 Posts
    Quote Originally Posted by Old Pedant View Post
    Ahhh...I just checked, and CKEditor is the replacement for FCKEditor, and it is *AMAZING*!!! All the things that were wrong with FCKEditor have been fixed and it's truly a commercial-grade product, now. And yet free for non-commercial use. I'd seriously consider using it, were I you.
    Just wanted to give you a BIG "Thank You" for suggesting CKEditor. I downloaded it yesterday and started configuring it today.

    In about 2 hours of work, I am already further ahead than I was after 2 weeks fighting TinyMCE.

    This is going to work like a charm!

    If I knew about CKEditor a month or so ago, I would have long since been done with my project (and had a few less gray hairs).

    Thanks again!!!!

    -- Roger

  • #10
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,184
    Thanks
    75
    Thanked 4,340 Times in 4,306 Posts
    Hey, you are more than welcome. It made me discover that CKEditor had replaced the older FCKEditor and so I might find good use for it myself!
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

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