19
|
1 |
/******/ (function() { // webpackBootstrap |
|
2 |
/******/ "use strict"; |
|
3 |
/******/ // The require scope |
|
4 |
/******/ var __webpack_require__ = {}; |
|
5 |
/******/ |
|
6 |
/************************************************************************/ |
|
7 |
/******/ /* webpack/runtime/define property getters */ |
|
8 |
/******/ !function() { |
|
9 |
/******/ // define getter functions for harmony exports |
|
10 |
/******/ __webpack_require__.d = function(exports, definition) { |
|
11 |
/******/ for(var key in definition) { |
|
12 |
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
|
13 |
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
|
14 |
/******/ } |
|
15 |
/******/ } |
9
|
16 |
/******/ }; |
19
|
17 |
/******/ }(); |
|
18 |
/******/ |
|
19 |
/******/ /* webpack/runtime/hasOwnProperty shorthand */ |
|
20 |
/******/ !function() { |
|
21 |
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } |
|
22 |
/******/ }(); |
|
23 |
/******/ |
|
24 |
/******/ /* webpack/runtime/make namespace object */ |
|
25 |
/******/ !function() { |
|
26 |
/******/ // define __esModule on exports |
|
27 |
/******/ __webpack_require__.r = function(exports) { |
|
28 |
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
|
29 |
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
|
30 |
/******/ } |
|
31 |
/******/ Object.defineProperty(exports, '__esModule', { value: true }); |
|
32 |
/******/ }; |
|
33 |
/******/ }(); |
|
34 |
/******/ |
9
|
35 |
/************************************************************************/ |
19
|
36 |
var __webpack_exports__ = {}; |
9
|
37 |
__webpack_require__.r(__webpack_exports__); |
19
|
38 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
|
39 |
/* harmony export */ "autop": function() { return /* binding */ autop; }, |
|
40 |
/* harmony export */ "removep": function() { return /* binding */ removep; } |
|
41 |
/* harmony export */ }); |
9
|
42 |
/** |
|
43 |
* The regular expression for an HTML element. |
|
44 |
* |
16
|
45 |
* @type {RegExp} |
9
|
46 |
*/ |
18
|
47 |
const htmlSplitRegex = (() => { |
9
|
48 |
/* eslint-disable no-multi-spaces */ |
18
|
49 |
const comments = '!' + // Start of comment, after the <. |
9
|
50 |
'(?:' + // Unroll the loop: Consume everything until --> is found. |
|
51 |
'-(?!->)' + // Dash not followed by end of comment. |
|
52 |
'[^\\-]*' + // Consume non-dashes. |
|
53 |
')*' + // Loop possessively. |
|
54 |
'(?:-->)?'; // End of comment. If not found, match all input. |
|
55 |
|
18
|
56 |
const cdata = '!\\[CDATA\\[' + // Start of comment, after the <. |
9
|
57 |
'[^\\]]*' + // Consume non-]. |
|
58 |
'(?:' + // Unroll the loop: Consume everything until ]]> is found. |
|
59 |
'](?!]>)' + // One ] not followed by end of comment. |
|
60 |
'[^\\]]*' + // Consume non-]. |
|
61 |
')*?' + // Loop possessively. |
|
62 |
'(?:]]>)?'; // End of comment. If not found, match all input. |
|
63 |
|
18
|
64 |
const escaped = '(?=' + // Is the element escaped? |
9
|
65 |
'!--' + '|' + '!\\[CDATA\\[' + ')' + '((?=!-)' + // If yes, which type? |
|
66 |
comments + '|' + cdata + ')'; |
18
|
67 |
const regex = '(' + // Capture the entire match. |
9
|
68 |
'<' + // Find start of element. |
|
69 |
'(' + // Conditional expression follows. |
|
70 |
escaped + // Find end of escaped element. |
|
71 |
'|' + // ... else ... |
|
72 |
'[^>]*>?' + // Find end of normal element. |
|
73 |
')' + ')'; |
|
74 |
return new RegExp(regex); |
|
75 |
/* eslint-enable no-multi-spaces */ |
18
|
76 |
})(); |
9
|
77 |
/** |
|
78 |
* Separate HTML elements and comments from the text. |
|
79 |
* |
19
|
80 |
* @param {string} input The text which has to be formatted. |
|
81 |
* |
|
82 |
* @return {string[]} The formatted text. |
9
|
83 |
*/ |
|
84 |
|
|
85 |
|
|
86 |
function htmlSplit(input) { |
18
|
87 |
const parts = []; |
|
88 |
let workingInput = input; |
|
89 |
let match; |
9
|
90 |
|
|
91 |
while (match = workingInput.match(htmlSplitRegex)) { |
16
|
92 |
// The `match` result, when invoked on a RegExp with the `g` flag (`/foo/g`) will not include `index`. |
|
93 |
// If the `g` flag is omitted, `index` is included. |
|
94 |
// `htmlSplitRegex` does not have the `g` flag so we can assert it will have an index number. |
|
95 |
// Assert `match.index` is a number. |
18
|
96 |
const index = |
16
|
97 |
/** @type {number} */ |
|
98 |
match.index; |
|
99 |
parts.push(workingInput.slice(0, index)); |
9
|
100 |
parts.push(match[0]); |
16
|
101 |
workingInput = workingInput.slice(index + match[0].length); |
9
|
102 |
} |
|
103 |
|
|
104 |
if (workingInput.length) { |
|
105 |
parts.push(workingInput); |
|
106 |
} |
|
107 |
|
|
108 |
return parts; |
|
109 |
} |
|
110 |
/** |
|
111 |
* Replace characters or phrases within HTML elements only. |
|
112 |
* |
19
|
113 |
* @param {string} haystack The text which has to be formatted. |
|
114 |
* @param {Record<string,string>} replacePairs In the form {from: 'to', …}. |
|
115 |
* |
|
116 |
* @return {string} The formatted text. |
9
|
117 |
*/ |
|
118 |
|
|
119 |
|
|
120 |
function replaceInHtmlTags(haystack, replacePairs) { |
|
121 |
// Find all elements. |
18
|
122 |
const textArr = htmlSplit(haystack); |
|
123 |
let changed = false; // Extract all needles. |
9
|
124 |
|
18
|
125 |
const needles = Object.keys(replacePairs); // Loop through delimiters (elements) only. |
9
|
126 |
|
18
|
127 |
for (let i = 1; i < textArr.length; i += 2) { |
|
128 |
for (let j = 0; j < needles.length; j++) { |
|
129 |
const needle = needles[j]; |
9
|
130 |
|
|
131 |
if (-1 !== textArr[i].indexOf(needle)) { |
|
132 |
textArr[i] = textArr[i].replace(new RegExp(needle, 'g'), replacePairs[needle]); |
|
133 |
changed = true; // After one strtr() break out of the foreach loop and look at next element. |
|
134 |
|
|
135 |
break; |
|
136 |
} |
|
137 |
} |
|
138 |
} |
|
139 |
|
|
140 |
if (changed) { |
|
141 |
haystack = textArr.join(''); |
|
142 |
} |
|
143 |
|
|
144 |
return haystack; |
|
145 |
} |
|
146 |
/** |
|
147 |
* Replaces double line-breaks with paragraph elements. |
|
148 |
* |
|
149 |
* A group of regex replaces used to identify text formatted with newlines and |
|
150 |
* replace double line-breaks with HTML paragraph tags. The remaining line- |
|
151 |
* breaks after conversion become `<br />` tags, unless br is set to 'false'. |
|
152 |
* |
19
|
153 |
* @param {string} text The text which has to be formatted. |
|
154 |
* @param {boolean} br Optional. If set, will convert all remaining line- |
|
155 |
* breaks after paragraphing. Default true. |
9
|
156 |
* |
|
157 |
* @example |
|
158 |
*```js |
|
159 |
* import { autop } from '@wordpress/autop'; |
|
160 |
* autop( 'my text' ); // "<p>my text</p>" |
|
161 |
* ``` |
|
162 |
* |
19
|
163 |
* @return {string} Text which has been converted into paragraph tags. |
9
|
164 |
*/ |
|
165 |
|
|
166 |
|
19
|
167 |
function autop(text) { |
|
168 |
let br = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; |
18
|
169 |
const preTags = []; |
9
|
170 |
|
|
171 |
if (text.trim() === '') { |
|
172 |
return ''; |
|
173 |
} // Just to make things a little easier, pad the end. |
|
174 |
|
|
175 |
|
|
176 |
text = text + '\n'; |
|
177 |
/* |
|
178 |
* Pre tags shouldn't be touched by autop. |
|
179 |
* Replace pre tags with placeholders and bring them back after autop. |
|
180 |
*/ |
|
181 |
|
|
182 |
if (text.indexOf('<pre') !== -1) { |
18
|
183 |
const textParts = text.split('</pre>'); |
|
184 |
const lastText = textParts.pop(); |
9
|
185 |
text = ''; |
|
186 |
|
18
|
187 |
for (let i = 0; i < textParts.length; i++) { |
|
188 |
const textPart = textParts[i]; |
|
189 |
const start = textPart.indexOf('<pre'); // Malformed html? |
9
|
190 |
|
|
191 |
if (start === -1) { |
|
192 |
text += textPart; |
|
193 |
continue; |
|
194 |
} |
|
195 |
|
18
|
196 |
const name = '<pre wp-pre-tag-' + i + '></pre>'; |
9
|
197 |
preTags.push([name, textPart.substr(start) + '</pre>']); |
|
198 |
text += textPart.substr(0, start) + name; |
|
199 |
} |
|
200 |
|
|
201 |
text += lastText; |
|
202 |
} // Change multiple <br>s into two line breaks, which will turn into paragraphs. |
|
203 |
|
|
204 |
|
|
205 |
text = text.replace(/<br\s*\/?>\s*<br\s*\/?>/g, '\n\n'); |
18
|
206 |
const allBlocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)'; // Add a double line break above block-level opening tags. |
9
|
207 |
|
16
|
208 |
text = text.replace(new RegExp('(<' + allBlocks + '[\\s/>])', 'g'), '\n\n$1'); // Add a double line break below block-level closing tags. |
9
|
209 |
|
16
|
210 |
text = text.replace(new RegExp('(</' + allBlocks + '>)', 'g'), '$1\n\n'); // Standardize newline characters to "\n". |
9
|
211 |
|
|
212 |
text = text.replace(/\r\n|\r/g, '\n'); // Find newlines in all elements and add placeholders. |
|
213 |
|
|
214 |
text = replaceInHtmlTags(text, { |
|
215 |
'\n': ' <!-- wpnl --> ' |
|
216 |
}); // Collapse line breaks before and after <option> elements so they don't get autop'd. |
|
217 |
|
|
218 |
if (text.indexOf('<option') !== -1) { |
|
219 |
text = text.replace(/\s*<option/g, '<option'); |
|
220 |
text = text.replace(/<\/option>\s*/g, '</option>'); |
|
221 |
} |
|
222 |
/* |
|
223 |
* Collapse line breaks inside <object> elements, before <param> and <embed> elements |
|
224 |
* so they don't get autop'd. |
|
225 |
*/ |
|
226 |
|
|
227 |
|
|
228 |
if (text.indexOf('</object>') !== -1) { |
|
229 |
text = text.replace(/(<object[^>]*>)\s*/g, '$1'); |
|
230 |
text = text.replace(/\s*<\/object>/g, '</object>'); |
|
231 |
text = text.replace(/\s*(<\/?(?:param|embed)[^>]*>)\s*/g, '$1'); |
|
232 |
} |
|
233 |
/* |
|
234 |
* Collapse line breaks inside <audio> and <video> elements, |
|
235 |
* before and after <source> and <track> elements. |
|
236 |
*/ |
|
237 |
|
|
238 |
|
|
239 |
if (text.indexOf('<source') !== -1 || text.indexOf('<track') !== -1) { |
|
240 |
text = text.replace(/([<\[](?:audio|video)[^>\]]*[>\]])\s*/g, '$1'); |
|
241 |
text = text.replace(/\s*([<\[]\/(?:audio|video)[>\]])/g, '$1'); |
|
242 |
text = text.replace(/\s*(<(?:source|track)[^>]*>)\s*/g, '$1'); |
|
243 |
} // Collapse line breaks before and after <figcaption> elements. |
|
244 |
|
|
245 |
|
|
246 |
if (text.indexOf('<figcaption') !== -1) { |
|
247 |
text = text.replace(/\s*(<figcaption[^>]*>)/, '$1'); |
|
248 |
text = text.replace(/<\/figcaption>\s*/, '</figcaption>'); |
|
249 |
} // Remove more than two contiguous line breaks. |
|
250 |
|
|
251 |
|
|
252 |
text = text.replace(/\n\n+/g, '\n\n'); // Split up the contents into an array of strings, separated by double line breaks. |
|
253 |
|
18
|
254 |
const texts = text.split(/\n\s*\n/).filter(Boolean); // Reset text prior to rebuilding. |
9
|
255 |
|
|
256 |
text = ''; // Rebuild the content as a string, wrapping every bit with a <p>. |
|
257 |
|
18
|
258 |
texts.forEach(textPiece => { |
9
|
259 |
text += '<p>' + textPiece.replace(/^\n*|\n*$/g, '') + '</p>\n'; |
|
260 |
}); // Under certain strange conditions it could create a P of entirely whitespace. |
|
261 |
|
|
262 |
text = text.replace(/<p>\s*<\/p>/g, ''); // Add a closing <p> inside <div>, <address>, or <form> tag if missing. |
|
263 |
|
|
264 |
text = text.replace(/<p>([^<]+)<\/(div|address|form)>/g, '<p>$1</p></$2>'); // If an opening or closing block element tag is wrapped in a <p>, unwrap it. |
|
265 |
|
16
|
266 |
text = text.replace(new RegExp('<p>\\s*(</?' + allBlocks + '[^>]*>)\\s*</p>', 'g'), '$1'); // In some cases <li> may get wrapped in <p>, fix them. |
9
|
267 |
|
|
268 |
text = text.replace(/<p>(<li.+?)<\/p>/g, '$1'); // If a <blockquote> is wrapped with a <p>, move it inside the <blockquote>. |
|
269 |
|
|
270 |
text = text.replace(/<p><blockquote([^>]*)>/gi, '<blockquote$1><p>'); |
|
271 |
text = text.replace(/<\/blockquote><\/p>/g, '</p></blockquote>'); // If an opening or closing block element tag is preceded by an opening <p> tag, remove it. |
|
272 |
|
16
|
273 |
text = text.replace(new RegExp('<p>\\s*(</?' + allBlocks + '[^>]*>)', 'g'), '$1'); // If an opening or closing block element tag is followed by a closing <p> tag, remove it. |
9
|
274 |
|
16
|
275 |
text = text.replace(new RegExp('(</?' + allBlocks + '[^>]*>)\\s*</p>', 'g'), '$1'); // Optionally insert line breaks. |
9
|
276 |
|
|
277 |
if (br) { |
|
278 |
// Replace newlines that shouldn't be touched with a placeholder. |
18
|
279 |
text = text.replace(/<(script|style).*?<\/\\1>/g, match => match[0].replace(/\n/g, '<WPPreserveNewline />')); // Normalize <br> |
9
|
280 |
|
|
281 |
text = text.replace(/<br>|<br\/>/g, '<br />'); // Replace any new line characters that aren't preceded by a <br /> with a <br />. |
|
282 |
|
18
|
283 |
text = text.replace(/(<br \/>)?\s*\n/g, (a, b) => b ? a : '<br />\n'); // Replace newline placeholders with newlines. |
9
|
284 |
|
|
285 |
text = text.replace(/<WPPreserveNewline \/>/g, '\n'); |
|
286 |
} // If a <br /> tag is after an opening or closing block tag, remove it. |
|
287 |
|
|
288 |
|
16
|
289 |
text = text.replace(new RegExp('(</?' + allBlocks + '[^>]*>)\\s*<br />', 'g'), '$1'); // If a <br /> tag is before a subset of opening or closing block tags, remove it. |
9
|
290 |
|
|
291 |
text = text.replace(/<br \/>(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)/g, '$1'); |
|
292 |
text = text.replace(/\n<\/p>$/g, '</p>'); // Replace placeholder <pre> tags with their original content. |
|
293 |
|
18
|
294 |
preTags.forEach(preTag => { |
|
295 |
const [name, original] = preTag; |
9
|
296 |
text = text.replace(name, original); |
|
297 |
}); // Restore newlines in all elements. |
|
298 |
|
|
299 |
if (-1 !== text.indexOf('<!-- wpnl -->')) { |
|
300 |
text = text.replace(/\s?<!-- wpnl -->\s?/g, '\n'); |
|
301 |
} |
|
302 |
|
|
303 |
return text; |
|
304 |
} |
|
305 |
/** |
|
306 |
* Replaces `<p>` tags with two line breaks. "Opposite" of autop(). |
|
307 |
* |
|
308 |
* Replaces `<p>` tags with two line breaks except where the `<p>` has attributes. |
|
309 |
* Unifies whitespace. Indents `<li>`, `<dt>` and `<dd>` for better readability. |
|
310 |
* |
19
|
311 |
* @param {string} html The content from the editor. |
9
|
312 |
* |
|
313 |
* @example |
|
314 |
* ```js |
|
315 |
* import { removep } from '@wordpress/autop'; |
|
316 |
* removep( '<p>my text</p>' ); // "my text" |
|
317 |
* ``` |
|
318 |
* |
19
|
319 |
* @return {string} The content with stripped paragraph tags. |
9
|
320 |
*/ |
|
321 |
|
|
322 |
function removep(html) { |
18
|
323 |
const blocklist = 'blockquote|ul|ol|li|dl|dt|dd|table|thead|tbody|tfoot|tr|th|td|h[1-6]|fieldset|figure'; |
|
324 |
const blocklist1 = blocklist + '|div|p'; |
|
325 |
const blocklist2 = blocklist + '|pre'; |
16
|
326 |
/** @type {string[]} */ |
|
327 |
|
18
|
328 |
const preserve = []; |
|
329 |
let preserveLinebreaks = false; |
|
330 |
let preserveBr = false; |
9
|
331 |
|
|
332 |
if (!html) { |
|
333 |
return ''; |
|
334 |
} // Protect script and style tags. |
|
335 |
|
|
336 |
|
|
337 |
if (html.indexOf('<script') !== -1 || html.indexOf('<style') !== -1) { |
18
|
338 |
html = html.replace(/<(script|style)[^>]*>[\s\S]*?<\/\1>/g, match => { |
9
|
339 |
preserve.push(match); |
|
340 |
return '<wp-preserve>'; |
|
341 |
}); |
|
342 |
} // Protect pre tags. |
|
343 |
|
|
344 |
|
|
345 |
if (html.indexOf('<pre') !== -1) { |
|
346 |
preserveLinebreaks = true; |
18
|
347 |
html = html.replace(/<pre[^>]*>[\s\S]+?<\/pre>/g, a => { |
9
|
348 |
a = a.replace(/<br ?\/?>(\r\n|\n)?/g, '<wp-line-break>'); |
|
349 |
a = a.replace(/<\/?p( [^>]*)?>(\r\n|\n)?/g, '<wp-line-break>'); |
|
350 |
return a.replace(/\r?\n/g, '<wp-line-break>'); |
|
351 |
}); |
|
352 |
} // Remove line breaks but keep <br> tags inside image captions. |
|
353 |
|
|
354 |
|
|
355 |
if (html.indexOf('[caption') !== -1) { |
|
356 |
preserveBr = true; |
18
|
357 |
html = html.replace(/\[caption[\s\S]+?\[\/caption\]/g, a => { |
9
|
358 |
return a.replace(/<br([^>]*)>/g, '<wp-temp-br$1>').replace(/[\r\n\t]+/, ''); |
|
359 |
}); |
|
360 |
} // Normalize white space characters before and after block tags. |
|
361 |
|
|
362 |
|
|
363 |
html = html.replace(new RegExp('\\s*</(' + blocklist1 + ')>\\s*', 'g'), '</$1>\n'); |
|
364 |
html = html.replace(new RegExp('\\s*<((?:' + blocklist1 + ')(?: [^>]*)?)>', 'g'), '\n<$1>'); // Mark </p> if it has any attributes. |
|
365 |
|
16
|
366 |
html = html.replace(/(<p [^>]+>[\s\S]*?)<\/p>/g, '$1</p#>'); // Preserve the first <p> inside a <div>. |
9
|
367 |
|
|
368 |
html = html.replace(/<div( [^>]*)?>\s*<p>/gi, '<div$1>\n\n'); // Remove paragraph tags. |
|
369 |
|
|
370 |
html = html.replace(/\s*<p>/gi, ''); |
|
371 |
html = html.replace(/\s*<\/p>\s*/gi, '\n\n'); // Normalize white space chars and remove multiple line breaks. |
|
372 |
|
|
373 |
html = html.replace(/\n[\s\u00a0]+\n/g, '\n\n'); // Replace <br> tags with line breaks. |
|
374 |
|
18
|
375 |
html = html.replace(/(\s*)<br ?\/?>\s*/gi, (_, space) => { |
9
|
376 |
if (space && space.indexOf('\n') !== -1) { |
|
377 |
return '\n\n'; |
|
378 |
} |
|
379 |
|
|
380 |
return '\n'; |
|
381 |
}); // Fix line breaks around <div>. |
|
382 |
|
|
383 |
html = html.replace(/\s*<div/g, '\n<div'); |
|
384 |
html = html.replace(/<\/div>\s*/g, '</div>\n'); // Fix line breaks around caption shortcodes. |
|
385 |
|
|
386 |
html = html.replace(/\s*\[caption([^\[]+)\[\/caption\]\s*/gi, '\n\n[caption$1[/caption]\n\n'); |
|
387 |
html = html.replace(/caption\]\n\n+\[caption/g, 'caption]\n\n[caption'); // Pad block elements tags with a line break. |
|
388 |
|
|
389 |
html = html.replace(new RegExp('\\s*<((?:' + blocklist2 + ')(?: [^>]*)?)\\s*>', 'g'), '\n<$1>'); |
|
390 |
html = html.replace(new RegExp('\\s*</(' + blocklist2 + ')>\\s*', 'g'), '</$1>\n'); // Indent <li>, <dt> and <dd> tags. |
|
391 |
|
|
392 |
html = html.replace(/<((li|dt|dd)[^>]*)>/g, ' \t<$1>'); // Fix line breaks around <select> and <option>. |
|
393 |
|
|
394 |
if (html.indexOf('<option') !== -1) { |
|
395 |
html = html.replace(/\s*<option/g, '\n<option'); |
|
396 |
html = html.replace(/\s*<\/select>/g, '\n</select>'); |
|
397 |
} // Pad <hr> with two line breaks. |
|
398 |
|
|
399 |
|
|
400 |
if (html.indexOf('<hr') !== -1) { |
|
401 |
html = html.replace(/\s*<hr( [^>]*)?>\s*/g, '\n\n<hr$1>\n\n'); |
|
402 |
} // Remove line breaks in <object> tags. |
|
403 |
|
|
404 |
|
|
405 |
if (html.indexOf('<object') !== -1) { |
18
|
406 |
html = html.replace(/<object[\s\S]+?<\/object>/g, a => { |
9
|
407 |
return a.replace(/[\r\n]+/g, ''); |
|
408 |
}); |
|
409 |
} // Unmark special paragraph closing tags. |
|
410 |
|
|
411 |
|
|
412 |
html = html.replace(/<\/p#>/g, '</p>\n'); // Pad remaining <p> tags whit a line break. |
|
413 |
|
|
414 |
html = html.replace(/\s*(<p [^>]+>[\s\S]*?<\/p>)/g, '\n$1'); // Trim. |
|
415 |
|
|
416 |
html = html.replace(/^\s+/, ''); |
|
417 |
html = html.replace(/[\s\u00a0]+$/, ''); |
|
418 |
|
|
419 |
if (preserveLinebreaks) { |
|
420 |
html = html.replace(/<wp-line-break>/g, '\n'); |
|
421 |
} |
|
422 |
|
|
423 |
if (preserveBr) { |
|
424 |
html = html.replace(/<wp-temp-br([^>]*)>/g, '<br$1>'); |
|
425 |
} // Restore preserved tags. |
|
426 |
|
|
427 |
|
|
428 |
if (preserve.length) { |
18
|
429 |
html = html.replace(/<wp-preserve>/g, () => { |
16
|
430 |
return ( |
|
431 |
/** @type {string} */ |
|
432 |
preserve.shift() |
|
433 |
); |
9
|
434 |
}); |
|
435 |
} |
|
436 |
|
|
437 |
return html; |
|
438 |
} |
|
439 |
|
19
|
440 |
(window.wp = window.wp || {}).autop = __webpack_exports__; |
|
441 |
/******/ })() |
|
442 |
; |