From 54437de24985f00a9ad9373e15d63d13656b4086 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 12 Feb 2018 12:30:52 +0100 Subject: [PATCH] Work-around for Firefox being unable to backspace tables --- .../js/3rdParty/redactor/plugins/wbbcode.js | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) 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; -- 2.20.1