styles - How to prevent | Mozilla FireFox (3.6) ContentEditable -- applies CSS to the editable container instead of it's content -


i have page this:

<div id="editor" contenteditable="true">sometext</div> 

i have selfmade js editor issues

document.execcommand(some_command,false,optional_value); 

when user presses button in editor. (for example have plain, simple [bold] button).

everything fine long apply editing part of "sometext". example selecting "text" mouse , pressing [bold] button (which leads document.execcommand("bold",false,false);) produce:

<div id="editor" contenteditable="true">some<span style="some-css-here">text</span></div> 

but when select entire content of div ("sometext" in example) , press [bold] in editor, ff not produce expected

<div id="editor" contenteditable="true"><span style="some-css-here">sometext</span></div> 

but rather

<div id="editor" contenteditable="true"  style="some-css-here">sometext</div> 

notice "style" attribute went editable div!

why makes difference me? --it's because after editing done take content of editable div, along styles, formating etc , further use on page. can't -- styling sits inside div. solution when advised extract styles div not acceptable -- div during life takes lot of styles other active elements of page (heavy jquery usage)

so in brief: how tell ff never touch editable div , apply styling inner contents only?

sincere time. (just pulled last of hair, browsing ff dev site along many others(((( )

call once before other execcommand , switch ff tag mode

document.execcommand('stylewithcss', false, false); 

Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -