autop.js 20 KB

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