asdasd
This commit is contained in:
@@ -31,6 +31,13 @@
|
||||
|
||||
const unwrap = (el, addBreak) => {
|
||||
const frag = document.createDocumentFragment();
|
||||
if (addBreak) {
|
||||
const prev = el.previousSibling;
|
||||
const needsLeadBreak = !!(prev && (prev.nodeType === 3 ? prev.textContent.trim() : (prev.tagName && prev.tagName !== 'BR')));
|
||||
if (needsLeadBreak) {
|
||||
frag.appendChild(document.createElement('br'));
|
||||
}
|
||||
}
|
||||
while (el.firstChild) {
|
||||
frag.appendChild(el.firstChild);
|
||||
}
|
||||
@@ -60,6 +67,7 @@
|
||||
|
||||
let html = wrapper.innerHTML
|
||||
.replace(/<br\s*\/?>/gi, '<br>')
|
||||
.replace(/(<br>)+$/g, '')
|
||||
.trim();
|
||||
if (!html) {
|
||||
const text = String(fallbackText || wrapper.textContent || '').trim();
|
||||
|
||||
Reference in New Issue
Block a user