includes/clientside/tinymce/plugins/table/editor_plugin_src.js
changeset 476 f26a69c40431
parent 459 31c23016ab62
child 543 dffcbfbc4e59
equal deleted inserted replaced
475:51386f1852b8 476:f26a69c40431
     1 /**
     1 /**
     2  * $Id: editor_plugin_src.js 612 2008-02-19 12:33:44Z spocke $
     2  * $Id: editor_plugin_src.js 651 2008-02-29 10:00:25Z spocke $
     3  *
     3  *
     4  * @author Moxiecode
     4  * @author Moxiecode
     5  * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
     5  * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
     6  */
     6  */
     7 
     7 
    71 						} else
    71 						} else
    72 							m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', ui : true});
    72 							m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', ui : true});
    73 					});
    73 					});
    74 				}
    74 				}
    75 			});
    75 			});
       
    76 
       
    77 			// Block delete on gecko inside TD:s. Gecko is removing table elements and then produces incorrect tables
       
    78 			// The backspace key also removed TD:s but this one can not be blocked
       
    79 			if (tinymce.isGecko) {
       
    80 				ed.onKeyPress.add(function(ed, e) {
       
    81 					var n;
       
    82 
       
    83 					if (e.keyCode == 46) {
       
    84 						n = ed.dom.getParent(ed.selection.getNode(), 'TD,TH');
       
    85 						if (n && (!n.hasChildNodes() || (n.childNodes.length == 1 && n.firstChild.nodeName == 'BR')))
       
    86 							tinymce.dom.Event.cancel(e);
       
    87 					}
       
    88 				});
       
    89 			}
    76 
    90 
    77 			// Add undo level when new rows are created using the tab key
    91 			// Add undo level when new rows are created using the tab key
    78 			ed.onKeyDown.add(function(ed, e) {
    92 			ed.onKeyDown.add(function(ed, e) {
    79 				if (e.keyCode == 9 && ed.dom.getParent(ed.selection.getNode(), 'TABLE'))
    93 				if (e.keyCode == 9 && ed.dom.getParent(ed.selection.getNode(), 'TABLE'))
    80 					ed.undoManager.add();
    94 					ed.undoManager.add();