Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    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


  • #2
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Thanked 600 Times in 580 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:
    my site (updated 2014/10/20)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.3, IE11:9.2, IE9:2.7, IE10:2.6, FF:16.8, CH:47.5, SF:7.8, NON-MOUSE:37%


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts