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:
TIP: Disable the back button!


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.

 


apinstein
New User

Sep 19, 2003, 9:01 PM

Post #1 of 3 (2061 views)
Shortcut
TIP: Disable the back button! Can't Post

Hi all-

Is it just me, or is anyone else ever frustrated by accidentally pressing the BACKSPACE key when an item is selected and having the browser go BACK!

The good news is, I have figured out how to fix it Smile

There are 2 options really for fixing this problem:
1) IGNORE the keypress entirely...
2) TREAT IT LIKE DELETE, which I think is the 'logical' thing to do.

The code:
in file editor.js, in function editor_event, in this "if" block: if (editEvent && editEvent.keyCode) {

1) IGNORE IT:

Code
      if (ord == 8) { 
editEvent.returnValue = false;
return false;
}


2) TREAT IT LIKE DELETE WAS PRESSED:

Code
      if (ord == 8) { 
// convert delete key to backspace
editEvent.keyCode = 46;
return;
}


One question tho - is it OK to return at this point in the function? seems like there is stuff happening later on in the function that could be important.

Well, that's bascially it... I would like to hear comments on if #1 or #2 is preferred.

Enjoy,
Alan


apinstein
New User

Sep 19, 2003, 10:44 PM

Post #2 of 3 (2048 views)
Shortcut
Re: [apinstein] TIP: Disable the back button! [In reply to] Can't Post

In further testing, I realized that this fix does something bad as a side effect.. you can no longer BACKSPACE to delete plain old text!

PLEASE if anyone knows how to test whether or not an 'object' is selected to determine whether or not to eat the BS char, let me know.

Thanks,
Alan


josh_j
New User

Nov 21, 2004, 4:36 AM

Post #3 of 3 (1632 views)
Shortcut
Re: [apinstein] TIP: Disable the back button! [In reply to] Can't Post

hmm, been awhile since this post began, but I was just trying to solve the very same problem. But I noticed that object selections come up as 'undefined'. So you can delete objects, but backspace normal text:


Code
   

// capture backspace key
if (ord == 8) {
selection = editor_obj.contentWindow.document.selection.createRange().htmlText;

if (selection == undefined) {


// if it's an object selected, convert

// the backspace to a delete
editEvent.keyCode = 46;
return;
}
}


 
 
 


Search for (options)