Krupski
12-21-2010, 11:21 PM
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
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