includes/clientside/tinymce/plugins/table/editor_plugin_src.js
changeset 476 f26a69c40431
parent 459 31c23016ab62
child 543 dffcbfbc4e59
--- a/includes/clientside/tinymce/plugins/table/editor_plugin_src.js	Thu Mar 06 20:45:46 2008 -0500
+++ b/includes/clientside/tinymce/plugins/table/editor_plugin_src.js	Thu Mar 06 20:47:11 2008 -0500
@@ -1,5 +1,5 @@
 /**
- * $Id: editor_plugin_src.js 612 2008-02-19 12:33:44Z spocke $
+ * $Id: editor_plugin_src.js 651 2008-02-29 10:00:25Z spocke $
  *
  * @author Moxiecode
  * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
@@ -74,6 +74,20 @@
 				}
 			});
 
+			// Block delete on gecko inside TD:s. Gecko is removing table elements and then produces incorrect tables
+			// The backspace key also removed TD:s but this one can not be blocked
+			if (tinymce.isGecko) {
+				ed.onKeyPress.add(function(ed, e) {
+					var n;
+
+					if (e.keyCode == 46) {
+						n = ed.dom.getParent(ed.selection.getNode(), 'TD,TH');
+						if (n && (!n.hasChildNodes() || (n.childNodes.length == 1 && n.firstChild.nodeName == 'BR')))
+							tinymce.dom.Event.cancel(e);
+					}
+				});
+			}
+
 			// Add undo level when new rows are created using the tab key
 			ed.onKeyDown.add(function(ed, e) {
 				if (e.keyCode == 9 && ed.dom.getParent(ed.selection.getNode(), 'TABLE'))