Hello,

I was missing the ability to format a block with <h1> - <h6> tags. I
researched the topic and build a patch which allows to insert block
tags. It makes use of the FormatBlock command.

I would like to ask, if you are interested in the patch and discuss
the coding decision I took.

1)
I couldn't find any guidance on testing. I have tested with Safari 4,
Firefox 3.5, IE 6, IE 8 and IE 8 in IE 7 mode.

2)
Currently only the tags <h1> to <h6>, <pre>, <address> and <p> work
stable across browsers. To limit the choice of tags, I have created an
enum to limit the possible values.

public static enum BlockTag {
                H1, H2, H3, H4, H5, H6, PRE, ADDRESS, P;
      final String OPEN = "<";
      final String CLOSE = ">";
      public String toTag() {
        return OPEN+name()+CLOSE;
      }
    }

The advantage is that you cannot provide the wrong tags. The
disadvantage is that you cannot provide tags which are for example
supported in newer browser versions.

The rest of the tag is just a new method in RichTextAreaImplStd.
  public void formatBlock(RichTextArea.BlockTag blockTag) {
    execCommand("FormatBlock", blockTag.toTag());
  }

Shall I leave it that way or turn it into a String parameter?

3)
Should I create a bug tracking entry for this?

If somebody is interested, here are some links, I found interesting
while exploring the topic.

http://discerning.com/topics/software/ttw.html
http://help.dottoro.com/ljcvtcaw.php
http://www.quirksmode.org/dom/execCommand.html

Best Regards

Sebastian Hennebrueder

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to