Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

styleWithCSS for IE

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.

like image 819
Kristoffer Sall-Storgaard Avatar asked Feb 11 '09 09:02

Kristoffer Sall-Storgaard


1 Answers

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

like image 80
desmati Avatar answered Nov 12 '22 01:11

desmati