Fixed pasting of empty lines from Microsoft Word
authorAlexander Ebert <ebert@woltlab.com>
Fri, 28 Oct 2016 11:08:21 +0000 (13:08 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 28 Oct 2016 11:08:21 +0000 (13:08 +0200)
wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabClean.js

index 5ce312b49e74a6a9681cdba9406cc076f77c7cb3..17e789a2a302c86fb4f336231526692420414d0e 100644 (file)
@@ -133,6 +133,13 @@ $.Redactor.prototype.WoltLabClean = function() {
                                        }
                                });
                                
+                               // Empty lines in Microsoft Word are represented with <o:p>&nbsp;</o:p>
+                               elBySelAll('p.MsoNormal', div, function (p) {
+                                       if (p.childElementCount === 1 && p.children[0].nodeName === 'O:P' && p.textContent === '\u00A0') {
+                                               p.innerHTML = '<br>';
+                                       }
+                               });
+                               
                                elBySelAll('br', div, function (br) {
                                        br.parentNode.insertBefore(document.createTextNode('@@@WOLTLAB-BR-MARKER@@@'), br);
                                });