htmlArea

A directory of browser-based WYSIWYG editors

  MAIN
INDEX
SEARCH
POSTS
WHO'S
ONLINE
LOG
IN

Home: htmlArea 2: htmlArea 2 & 3 archive (read only): htmlArea v2.0 - Add-Ons:
Focus problem with tables


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.

 


andy
Novice

Mar 2, 2004, 6:12 AM

Post #1 of 6 (6301 views)
Shortcut
Focus problem with tables Can't Post

Hello All,

We have come across a problem with HTMLArea that I would appreciate your thoughts on. Ill try to explain as clearly as a can:

1) The user highlights some text content and then uses the Font style drop down box to apply a CSS style to the content. This works fine.

2) The user then clicks inside of the editor, at which point the focus is transferred away from the Font Style drop down and back in to the editor, with the cursor blinking at the location clicked.

This works ok EXCEPT for when the user clicks inside of a table. In this case, focus is not transferred away from the Font Stlye box and back in to the editor. If the entire editor is filled with a table then the user finds themselves unable to transfer focus back in to the editor - they are stuck on the Font Style box.

Does anyone have any ideas about this one?

Im going to be chucking code around today looking for a solution, so if any one has any suggestions this would be appreciated.

Thanks in advance, Andy


Luis
Veteran

Mar 2, 2004, 11:52 AM

Post #2 of 6 (6295 views)
Shortcut
Re: [andy] Focus problem with tables [In reply to] Can't Post

Hi Andy:

I found out this "not-very-elegant" solution but it works.

In function editor_generate(), add an id to the toolbar:

var tblOpen = '<table id="toolbar" border=1 cellspacing=0 cellpadding=0 style="float: left;" unselectable="on"><tr><td style="border: none; padding: 1 0 0 0; font-family: MS Shell Dlg;" oncontextmenu="return false"><nobr>';

Then, at the very end of function editor_action(), add the code in red:

// all other commands microsoft Command Identifiers
else {editdoc.execCommand(cmdID.toLowerCase());}
}
//Allow to change Fonts inside Tables
editor_event(objname);
if(cmdID == "FontName" ||cmdID == "FontSize"||cmdID == "FontStyle"||cmdID == "FormatBlock"){
document.getElementById("toolbar").focus();
}
}

/* ---------------------------------------------------------------------- *\

What this will do is to release the focus from the pulldowns transfering it to the toolbar immediately after the onChange event. As the text remains selected after the font is changed, the user will have to unselect the text manually, causing the editor to gain focus again.

Greetings


Don't give up!!
http://webstationone.com/test/htmlarea


andy
Novice

Mar 4, 2004, 10:19 AM

Post #3 of 6 (6269 views)
Shortcut
Re: [Luis] Focus problem with tables [In reply to] Can't Post

Luis,

That works perfectly! You rock dude!

Thats for your help. It's appreciated.

Andy


Luis
Veteran

Mar 4, 2004, 11:21 AM

Post #4 of 6 (6268 views)
Shortcut
Re: [andy] Focus problem with tables [In reply to] Can't Post

Hi Andy:
Thanks for your thanks.

I just realized yesterday that it doesn't work well if you have several textareas in the same page. To correct this issue, just append the object name to the toolbar ID in both places. Make it "toolbar_"+objname.

Greetings


Don't give up!!
http://webstationone.com/test/htmlarea


(This post was edited by Luis on Mar 4, 2004, 11:22 AM)


andy
Novice

Mar 8, 2004, 9:44 AM

Post #5 of 6 (6245 views)
Shortcut
Re: [Luis] Focus problem with tables [In reply to] Can't Post

Will do.


jstucken
Novice

Jun 26, 2004, 9:29 PM

Post #6 of 6 (5998 views)
Shortcut
Re: [Luis] Focus problem with tables [In reply to] Can't Post

Thanks for posting this solution Luis. I was struggling with the same thing as Andy, losing the cursor after changing text within a table, and this fix works great.

I notice they have fixed this problem problem with html area3.

But I'm sticking with html area 2 because I like all the custom functionality you have added with your Luiseditor (tm) Wink

 
 
 


Search for (options)