23 // Safari will crash if the build in createlink command is used |
23 // Safari will crash if the build in createlink command is used |
24 /* ed.addCommand('CreateLink', function(u, v) { |
24 /* ed.addCommand('CreateLink', function(u, v) { |
25 ed.execCommand("mceInsertContent", false, '<a href="' + dom.encode(v) + '">' + ed.selection.getContent() + '</a>'); |
25 ed.execCommand("mceInsertContent", false, '<a href="' + dom.encode(v) + '">' + ed.selection.getContent() + '</a>'); |
26 });*/ |
26 });*/ |
27 |
27 |
|
28 ed.onKeyUp.add(function(ed, e) { |
|
29 var h; |
|
30 |
|
31 // If backspace or delete key |
|
32 if (e.keyCode == 46 || e.keyCode == 8) { |
|
33 h = ed.getBody().innerHTML; |
|
34 |
|
35 // If there is no text content or images or hr elements then remove everything |
|
36 if (!/<(img|hr)/.test(h) && tinymce.trim(h.replace(/<[^>]+>/g, '')).length == 0) |
|
37 ed.setContent('', {format : 'raw'}); |
|
38 } |
|
39 }); |
|
40 |
28 // Workaround for FormatBlock bug, http://bugs.webkit.org/show_bug.cgi?id=16004 |
41 // Workaround for FormatBlock bug, http://bugs.webkit.org/show_bug.cgi?id=16004 |
29 ed.addCommand('FormatBlock', function(u, v) { |
42 ed.addCommand('FormatBlock', function(u, v) { |
30 var dom = ed.dom, e = dom.getParent(ed.selection.getNode(), dom.isBlock); |
43 var dom = ed.dom, e = dom.getParent(ed.selection.getNode(), dom.isBlock); |
31 |
44 |
32 if (e) |
45 if (e) |