I'm building a custom RTE that converts user input to a homebrewn markup, now idiot that I am I did this using an iframe with designMode = "On" and got it to work in firefox using styleWithCSS = false so that I could easily convert the <b>
(yes... b :( ) into my markup which would then output the proper code instead of me having to read from <span style="...
now my problem is, I cant seem to find something that looks or acts like styleWithCSS = false for IE, Chrome or Opera, any suggestions are welcome.
Asked
Active
Viewed 6,598 times
6

Kristoffer Sall-Storgaard
- 10,576
- 5
- 36
- 46
-
Its okay if its `` instead of `` as long as its one tag for one "effect" – Kristoffer Sall-Storgaard Feb 11 '09 at 10:19
1 Answers
18
Use this:
try {
Editor.execCommand("styleWithCSS", 0, false);
} catch (e) {
try {
Editor.execCommand("useCSS", 0, true);
} catch (e) {
try {
Editor.execCommand('styleWithCSS', false, false);
}
catch (e) {
}
}
}
Before any other execCommands. Tested on ff3 ie7 ie8 safari chrome

Hossein
- 1,640
- 2
- 26
- 41
-
I'll give it a go later today... yeah, I dont stop by that often, sorry. – Kristoffer Sall-Storgaard Sep 18 '09 at 07:36
-
Your welcome, if this my post was your answer, please mark it and let others know that. – Hossein Apr 27 '10 at 20:37
-
1why do you try the styleWithCSS twice, once with 0 and once with false? Won't 0 cast to false? – thomasrutter Oct 26 '10 at 06:34
-
Editor.execCommand("styleWithCSS", false, false) will not work on some old browsers. I do not remember exactly witch one :) – Hossein Aug 19 '11 at 00:59
-
1