This problem happens regardless of whether you choose Keep or Clean in the Word Paste Detected dialog.
Editor version.
3.1.1
OS.
Windows 10 x64, but it doesn't really matter.
Browser.
Google Chrome | 84.0.4147.105 (Official Build) (64-bit), but it doesn't really matter.
Suggested fix.
Here is the code that unconditionally removes empty cells (in js/plugins.pkgd.min.js, PLUGINS.wordPaste):
u(r, function (e) {
if (e.nodeType === Node.ELEMENT_NODE) {
var t = e.tagName;
if (!e.innerHTML && -1 === ["BR", "IMG", "INPUT"].indexOf(t)) {
for (var a = e.parentNode; a && (C(e), !(e = a).innerHTML); ) a = e.parentNode; <<< While node has empty innerHTML, remove it and all its parents recursively
return !1;
}
...
}
return !0;
})
Expected behavior.
I have the following HTML originally exported from Word:
Source (rename to
.html
): empty-cells-test.html.txtWhen I copy the HTML from the browser and paste into Froala, I expect to see empty cells.
Actual behavior.
https://froala.com/wysiwyg-editor/examples/destroy-init/
Empty cells are gone.
In real-world cases it ruins table structure because tables normally contain >1 row.
Steps to reproduce the problem.
empty-cell-test.html
in a browserThis problem happens regardless of whether you choose Keep or Clean in the Word Paste Detected dialog.
Editor version.
3.1.1
OS.
Windows 10 x64, but it doesn't really matter.
Browser.
Google Chrome | 84.0.4147.105 (Official Build) (64-bit), but it doesn't really matter.
Suggested fix.
Here is the code that unconditionally removes empty cells (in
js/plugins.pkgd.min.js
,PLUGINS.wordPaste
):Call stack (abbreviated):
I guess you need to take htmlAllowedEmptyTags into account here.