File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
wcfsetup/install/files/lib/system/html/input/node Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -351,11 +351,19 @@ protected function fixDom()
351351 }
352352 }
353353
354- $ appendToPreviousParagraph = static function ($ node ) {
355- /** @var \DOMElement $paragraph */
356- $ paragraph = $ node ->previousSibling ;
354+ $ appendToPreviousParagraph = static function (\DOMNode $ node ) {
355+ $ paragraph = $ node ;
356+ while ($ paragraph = $ paragraph ->previousSibling ) {
357+ if ($ paragraph instanceof \DOMText) {
358+ if (!\str_contains ($ paragraph ->textContent , ' ' ) && StringUtil::trim ($ paragraph ->textContent ) === '' ) {
359+ continue ;
360+ }
361+ }
362+
363+ break ;
364+ }
357365
358- if (! $ paragraph || $ paragraph ->nodeName !== 'p ' ) {
366+ if ($ paragraph === null || $ paragraph ->nodeName !== 'p ' ) {
359367 $ paragraph = $ node ->ownerDocument ->createElement ('p ' );
360368 $ node ->parentNode ->insertBefore ($ paragraph , $ node );
361369 }
You can’t perform that action at this time.
0 commit comments