0

I am using a jquery based rich text editor "lwRTE"

It works well in all ways except in changing fontsize

I traced the problem as follows:

when i change the font size the command and the argument is chosen correctly as "font size" and "[the font size in number Eg.6]"

now the execCommand is executed and chrome executes it differently.

firefox changes the selected text as

 <font size="6px">sample text</font>

chrome changes the selected text as

<span class="Apple-style-span" style="font-size: xx-large;">sample text</span>

this is what causes the problem. when i edit and save using Chrome, firefox seems to not understand the above way of formatting.

how do i make chrome also do the same? (i.e) insert font tag and insert crazy font sizes.

Thanks in advance

ZX12R
  • 4,760
  • 8
  • 38
  • 53
  • 1
    http://stackoverflow.com/questions/1817441/javascript-document-execcommand-cross-browser – jAndy Apr 23 '10 at 09:31

1 Answers1

2

See the compatibility charts for execCommand at http://quirksmode.org. Internet Explorer doesn't support font-size changing at all, Opera and Firefox wrap the font tag and Safari/Chrome behave as you suggested.

You can't change this functionality, you would have to build an alternative that works with the current selection range to implement one x-browser compatible method.

Andy E
  • 338,112
  • 86
  • 474
  • 445
  • thanks.. now restricted font size options to 6. If it goes beyond 7 chrome starts using webkit which creates problems – ZX12R Apr 23 '10 at 10:44