5

In Firefox: when placing the cursor into a table cell the browser will display 4 controls (one in the mid of each cell border). (The content is in editable mode.) How can those be disabled?

Thanks in advance.

T.J. Crowder
  • 1,031,962
  • 187
  • 1,923
  • 1,875
Thomas
  • 81
  • 2

1 Answers1

11

If you mean the controls you get on editable tables, you can disable these with the following command. It works in recent Firefox, at least:

document.execCommand("enableInlineTableEditing", null, false);
Tim Down
  • 318,141
  • 75
  • 454
  • 536
  • Sorry, I think I need to tell more about my (foreign) environment: In the code I'm looking at dojo is used and the document is in edit mode, which is probably the reason why _moz_resizing is set to "true" for the table. I'm sorry if I'm still missing some crucial details. I just started with javascript a month ago and wanted to modify some existing code. ^^° As for the add-ons, I don't think I have installed something that influences this. (Adblock, Flashblock, Firebug, ...) Link to screen shot: http://www.mediafire.com/?y2lxvvqv03dbw97 Thanks for helping out! – Thomas Jan 19 '11 at 16:11
  • @Thomas: OK. My answer still stands though. Doesn't it work for you? You can run the command when the document loads, for example. – Tim Down Jan 19 '11 at 16:23
  • 1
    @Tim: Unfortunately it does not work. I'm using Firefox 3.6.11, and I just found a similar question in the net where it is stated that your solution worked before 3.6 but not since. (See http://mozilla-xp.com/mozilla.dev.tech.editor/execCommand-enableInlineTableEditing-deprecation-in-3.6) If it is not the above problem maybe it is a problem of the point in time I'm calling that function? I'm doing it when the table buttons belonging to the table bar get activated when the cursor is placed into a cell. Thanks for your time! – Thomas Jan 20 '11 at 09:09
  • @Thomas: It works fine for me in Firefox 3.6.13. Try this: http://jsfiddle.net/timdown/r2Umq – Tim Down Jan 20 '11 at 12:02
  • 1
    @Tim: Ok, it works as you say. It seems my problem with "enableInlineTableEditing" was one or both of a) that I forgot to explicitly clear the browser cache. Now it does work. b) that previously I called the function when the focus was already set to the table. Thanks to your kind example I was able to see that problem as well. ^_^ Two more question though: Is it also possible to get rid of the 9 resizing handles on the very outer border of the table itself? Maybe even while keeping them on images? – Thomas Jan 20 '11 at 12:21
  • @Thomas: Yes, the `enableObjectResizing` command does that, although it will also affect other resizable elements such as images. See my updated fiddle at http://jsfiddle.net/r2Umq/2/, and also see https://developer.mozilla.org/en/rich-text_editing_in_mozilla. I don't think there's a way round that, except perhaps for intercepting `mousedown` and `keydown` events, examining the selection and executing the command depending on the element containing the caret, which I haven't tried. – Tim Down Jan 20 '11 at 14:19
  • Ok, thanks for the idea. I will have look into to this and see if that can be intercepted when using dojo. – Thomas Jan 21 '11 at 10:21
  • Does anyone know if there is an equivalent or solution for Internet Explorer? – Blowsie Aug 19 '11 at 14:32
  • @Blowsie: You can do it by handling the `selectionchange` event, checking the selection type and emptying the selection if it is of type "Control": http://jsfiddle.net/ZW9G9/3/ – Tim Down Aug 20 '11 at 16:01