...

View Full Version : Please explain DOM range to me.



Krupski
12-22-2010, 12:21 AM
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 "selection" or else INSERT "" before and "" 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 :mad: 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

Old Pedant
12-22-2010, 12:30 AM
Ummm...I'd say this is a well known--or at least common--problem with TinyMCE.

Just do http://www.google.com/search?q=tinymce+problems+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??

Krupski
12-22-2010, 12:37 AM
Ummm...I'd say this is a well known--or at least common--problem with TinyMCE.

Just do http://www.google.com/search?q=tinymce+problems+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

Old Pedant
12-22-2010, 12:47 AM
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.

Old Pedant
12-22-2010, 12:59 AM
Hmmm...this one looks pretty good:
http://www.kevinroth.com/rte/demo.htm

Looks good in FF, Chrome, and MSIE 8, at least.

Krupski
12-22-2010, 02:51 PM
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

Old Pedant
12-22-2010, 08:10 PM
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.

Krupski
12-22-2010, 08:19 PM
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! :thumbsup:

Krupski
12-23-2010, 03:07 PM
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!!!! :thumbsup:

-- Roger

Old Pedant
12-23-2010, 08:42 PM
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!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum