From: Alexander Ebert Date: Mon, 12 Feb 2018 11:30:52 +0000 (+0100) Subject: Work-around for Firefox being unable to backspace tables X-Git-Tag: 3.0.12_pl_1~4^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=54437de24985f00a9ad9373e15d63d13656b4086;p=GitHub%2FWoltLab%2FWCF.git Work-around for Firefox being unable to backspace tables --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js index edfeafe41d..9c8866011f 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js @@ -1953,6 +1953,27 @@ RedactorPlugins.wbbcode = function() { data.cancel = true; } + + // Firefox is unable to backspace an empty table + if (this.utils.browser('mozilla')) { + var block = this.selection.getBlock(); + if (block && block.nodeName === 'TD') { + var table = block.closest('table'); + var isEmpty = true; + + var tds = table.querySelectorAll('td'); + for (var i = 0, length = tds.length; i < length; i++) { + if (!this.utils.isEmpty(tds[i].innerHTML)) { + isEmpty = false; + break; + } + } + + if (isEmpty) { + this.selection.selectElement(table); + } + } + } } break;