htmlArea

A directory of browser-based WYSIWYG editors

  MAIN
INDEX
SEARCH
POSTS
WHO'S
ONLINE
LOG
IN

Home: htmlArea 3 (beta): htmlArea 2 & 3 archive (read only): htmlArea v3.0 - Discussion:
<b> and <i> vs <span>


The htmlArea 2 & 3 editors have been discontinued.

We've made these forums available as a read-only reference and knowledge-base for people using or developing editors based on htmlArea 2 or 3.

Anyone who is interested in taking over version 2 or 3 is free to do so. All we ask is that you choose a new name that doesn't have "htmlarea" in it to avoid confusion with this site. We'll even give you a link in the directory to make it easier for people to find you. If you are developing or hosting an htmlArea based-editor under a new name, please submit it to our directory.

First page Previous page 1 2 Next page Last page  View All


bsutton
Novice

Mar 2, 2004, 4:03 PM

Post #26 of 28 (6390 views)
Shortcut
Re: [Shovelface] <b> and <i> vs <span> [In reply to] Can't Post

Here is what I have done. I set useCSS at the top (thanks nels) of the execCommand function.

Code
HTMLArea.prototype.execCommand = function(cmdID, UI, param) { 
var editor = this; // for nested functions
// Patch to stop Mozilla using span for bold etc bsutton
if (HTMLArea.is_gecko) {
editor._iframe.contentWindow.document.execCommand("useCSS",false,true);
}
// end patch


In function initIframe(), setTimeout, I set strong to b and em to i if its gecko.

Code
		setTimeout(function() { 
if (HTMLArea.is_gecko) {
var code = editor.getInnerHTML();
code = code.replace(/<(\/?)strong>/ig, "<$1b>");
code = code.replace(/<(\/?)em>/ig, "<$1i>");
editor.setHTML(code);
}
editor.updateToolbar();
}, 250);


And in onsubmit I change b to strong and i to em

Code
		f.onsubmit = function() { 
// Inserted to change b to strong etc bsutton
var code = editor.getInnerHTML();
code = code.replace(/<(\/?)b>/ig, "<$1strong>");
code = code.replace(/<(\/?)i>/ig, "<$1em>");
editor.setHTML(code);


Bill


Shovelface
New User

Mar 3, 2004, 12:51 PM

Post #27 of 28 (6378 views)
Shortcut
Re: [bsutton] <b> and <i> vs <span> [In reply to] Can't Post

Hi, thanks! I'll try that out.

-trout


datagnom
New User

Mar 17, 2004, 2:34 PM

Post #28 of 28 (6333 views)
Shortcut
Re: [bsutton] <b> and <i> vs <span> [In reply to] Can't Post

Hi bsutton

I used your advise / code and it worked perfectly for me in following browsers Mozilla (mac) and Mozilla (pc).

I ran into a related problem that I would like to hear if you or others have solved out or do have at all?

When I insert a Horizontal Rule in Mozilla (Pc/Mac) it creates following element: <hr width="100%" size="2" />

In Explorer Pc the same action inserts: <hr />

Do you or others have a suggestion to get the html-area editor to do the same in Mozilla.

Thanks in advance for all suggestions.

Pelle

Code


First page Previous page 1 2 Next page Last page  View All
 
 


Search for (options)