| | |
| | | |
| | | // Fixes an issue on Gecko where it's impossible to place the caret behind a table |
| | | // This fix will force a paragraph element after the table but only when the forced_root_block setting is enabled |
| | | if (!tinymce.isIE) { |
| | | function fixTableCaretPos() { |
| | | var last; |
| | | |
| | | // Skip empty text nodes form the end |
| | | for (last = ed.getBody().lastChild; last && last.nodeType == 3 && !last.nodeValue.length; last = last.previousSibling) ; |
| | | |
| | | if (last && last.nodeName == 'TABLE') |
| | | ed.dom.add(ed.getBody(), 'p', null, '<br data-mce-bogus="1" />'); |
| | | if (last && last.nodeName == 'TABLE') {
|
| | | if (ed.settings.forced_root_block)
|
| | | ed.dom.add(ed.getBody(), ed.settings.forced_root_block, null, tinymce.isIE ? ' ' : '<br data-mce-bogus="1" />');
|
| | | else
|
| | | ed.dom.add(ed.getBody(), 'br', {'data-mce-bogus': '1'});
|
| | | }
|
| | | }; |
| | | |
| | | // Fixes an bug where it's impossible to place the caret before a table in Gecko |
| | |
| | | ed.onPreProcess.add(function(ed, o) { |
| | | var last = o.node.lastChild; |
| | | |
| | | if (last && last.childNodes.length == 1 && last.firstChild.nodeName == 'BR' && last.previousSibling && last.previousSibling.nodeName == "TABLE") |
| | | if (last && (last.nodeName == "BR" || (last.childNodes.length == 1 && (last.firstChild.nodeName == 'BR' || last.firstChild.nodeValue == '\u00a0'))) && last.previousSibling && last.previousSibling.nodeName == "TABLE") {
|
| | | ed.dom.remove(last); |
| | | }
|
| | | }); |
| | | |
| | | |
| | |
| | | |
| | | fixTableCaretPos(); |
| | | ed.startContent = ed.getContent({format : 'raw'}); |
| | | } |
| | | }); |
| | | |
| | | // Register action commands |