Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Exiting <h1> style in designmode
08-07-2008, 12:12 AM #1
- Join Date
- Apr 2007
- Thanked 0 Times in 0 Posts
Exiting <h1> style in designmode
Hey, folks, I've got myself a rich text editor in an Iframe with designmode=on.
everything is fine. So then I go and make a "headline" style button using something like this:
ok, good. It formats the selection in <h1>. except it is now difficult (or even impossible) to leave the h1 tag.
You can't just (formatBlock , h1) it back off the way you can add and remove italics or bold or something. In FF the only way to exit the style is to press return a few times and retype. in Safari, that doesn't even work - if you add the headline style to the entire body, it actually becomes impossible to exit headline. RemoveFormatting doesn't really work either.
So, uh any thoughts? am I going to have to figure out a way to parse through the document and find the H1s myself? if so any thoughts about how to do that?
Thanks in advance
08-07-2008, 05:02 PM #2
- Join Date
- Jun 2007
- Thanked 588 Times in 569 Posts
yeah. you will have to poke around the dom. design mode is a little dumb, using tags to style. h1 is already a tag, so that kinda limits your options.
you can write usable handler functions to apply css attribs to the object's style property, making your own execCommand sorta thing.
as far as referring to the dom, this article might help you out: