changeset 16 | a86126ab1dd4 |
parent 9 | 177826044cd9 |
child 18 | be944660c56a |
15:3d4e9c994f10 | 16:a86126ab1dd4 |
---|---|
80 /******/ // __webpack_public_path__ |
80 /******/ // __webpack_public_path__ |
81 /******/ __webpack_require__.p = ""; |
81 /******/ __webpack_require__.p = ""; |
82 /******/ |
82 /******/ |
83 /******/ |
83 /******/ |
84 /******/ // Load entry module and return exports |
84 /******/ // Load entry module and return exports |
85 /******/ return __webpack_require__(__webpack_require__.s = 362); |
85 /******/ return __webpack_require__(__webpack_require__.s = 441); |
86 /******/ }) |
86 /******/ }) |
87 /************************************************************************/ |
87 /************************************************************************/ |
88 /******/ ({ |
88 /******/ ({ |
89 |
89 |
90 /***/ 0: |
90 /***/ 0: |
99 |
99 |
100 (function() { module.exports = this["wp"]["i18n"]; }()); |
100 (function() { module.exports = this["wp"]["i18n"]; }()); |
101 |
101 |
102 /***/ }), |
102 /***/ }), |
103 |
103 |
104 /***/ 10: |
104 /***/ 103: |
105 /***/ (function(module, exports) { |
|
106 |
|
107 (function() { module.exports = this["wp"]["autop"]; }()); |
|
108 |
|
109 /***/ }), |
|
110 |
|
111 /***/ 125: |
|
112 /***/ (function(module, exports) { |
|
113 |
|
114 (function() { module.exports = this["wp"]["shortcode"]; }()); |
|
115 |
|
116 /***/ }), |
|
117 |
|
118 /***/ 14: |
|
119 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
120 |
|
121 "use strict"; |
|
122 |
|
123 // EXPORTS |
|
124 __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _slicedToArray; }); |
|
125 |
|
126 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js |
|
127 var arrayWithHoles = __webpack_require__(38); |
|
128 |
|
129 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js |
|
130 function _iterableToArrayLimit(arr, i) { |
|
131 if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; |
|
132 var _arr = []; |
|
133 var _n = true; |
|
134 var _d = false; |
|
135 var _e = undefined; |
|
136 |
|
137 try { |
|
138 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { |
|
139 _arr.push(_s.value); |
|
140 |
|
141 if (i && _arr.length === i) break; |
|
142 } |
|
143 } catch (err) { |
|
144 _d = true; |
|
145 _e = err; |
|
146 } finally { |
|
147 try { |
|
148 if (!_n && _i["return"] != null) _i["return"](); |
|
149 } finally { |
|
150 if (_d) throw _e; |
|
151 } |
|
152 } |
|
153 |
|
154 return _arr; |
|
155 } |
|
156 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js |
|
157 var unsupportedIterableToArray = __webpack_require__(29); |
|
158 |
|
159 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js |
|
160 var nonIterableRest = __webpack_require__(39); |
|
161 |
|
162 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js |
|
163 |
|
164 |
|
165 |
|
166 |
|
167 function _slicedToArray(arr, i) { |
|
168 return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(unsupportedIterableToArray["a" /* default */])(arr, i) || Object(nonIterableRest["a" /* default */])(); |
|
169 } |
|
170 |
|
171 /***/ }), |
|
172 |
|
173 /***/ 146: |
|
174 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
175 |
|
176 "use strict"; |
|
177 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _toArray; }); |
|
178 /* harmony import */ var _arrayWithHoles__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(38); |
|
179 /* harmony import */ var _iterableToArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(35); |
|
180 /* harmony import */ var _unsupportedIterableToArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(29); |
|
181 /* harmony import */ var _nonIterableRest__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(39); |
|
182 |
|
183 |
|
184 |
|
185 |
|
186 function _toArray(arr) { |
|
187 return Object(_arrayWithHoles__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(arr) || Object(_iterableToArray__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(arr) || Object(_unsupportedIterableToArray__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(arr) || Object(_nonIterableRest__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])(); |
|
188 } |
|
189 |
|
190 /***/ }), |
|
191 |
|
192 /***/ 18: |
|
193 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
194 |
|
195 "use strict"; |
|
196 |
|
197 // EXPORTS |
|
198 __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _toConsumableArray; }); |
|
199 |
|
200 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js |
|
201 var arrayLikeToArray = __webpack_require__(26); |
|
202 |
|
203 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js |
|
204 |
|
205 function _arrayWithoutHoles(arr) { |
|
206 if (Array.isArray(arr)) return Object(arrayLikeToArray["a" /* default */])(arr); |
|
207 } |
|
208 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js |
|
209 var iterableToArray = __webpack_require__(35); |
|
210 |
|
211 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js |
|
212 var unsupportedIterableToArray = __webpack_require__(29); |
|
213 |
|
214 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js |
|
215 function _nonIterableSpread() { |
|
216 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); |
|
217 } |
|
218 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js |
|
219 |
|
220 |
|
221 |
|
222 |
|
223 function _toConsumableArray(arr) { |
|
224 return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || Object(unsupportedIterableToArray["a" /* default */])(arr) || _nonIterableSpread(); |
|
225 } |
|
226 |
|
227 /***/ }), |
|
228 |
|
229 /***/ 19: |
|
230 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
231 |
|
232 "use strict"; |
|
233 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _createClass; }); |
|
234 function _defineProperties(target, props) { |
|
235 for (var i = 0; i < props.length; i++) { |
|
236 var descriptor = props[i]; |
|
237 descriptor.enumerable = descriptor.enumerable || false; |
|
238 descriptor.configurable = true; |
|
239 if ("value" in descriptor) descriptor.writable = true; |
|
240 Object.defineProperty(target, descriptor.key, descriptor); |
|
241 } |
|
242 } |
|
243 |
|
244 function _createClass(Constructor, protoProps, staticProps) { |
|
245 if (protoProps) _defineProperties(Constructor.prototype, protoProps); |
|
246 if (staticProps) _defineProperties(Constructor, staticProps); |
|
247 return Constructor; |
|
248 } |
|
249 |
|
250 /***/ }), |
|
251 |
|
252 /***/ 2: |
|
253 /***/ (function(module, exports) { |
|
254 |
|
255 (function() { module.exports = this["lodash"]; }()); |
|
256 |
|
257 /***/ }), |
|
258 |
|
259 /***/ 20: |
|
105 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
260 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
106 |
261 |
107 "use strict"; |
262 "use strict"; |
108 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _classCallCheck; }); |
263 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _classCallCheck; }); |
109 function _classCallCheck(instance, Constructor) { |
264 function _classCallCheck(instance, Constructor) { |
112 } |
267 } |
113 } |
268 } |
114 |
269 |
115 /***/ }), |
270 /***/ }), |
116 |
271 |
117 /***/ 134: |
272 /***/ 202: |
273 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
274 |
|
275 "use strict"; |
|
276 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); |
|
277 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
|
278 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6); |
|
279 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); |
|
280 |
|
281 |
|
282 /** |
|
283 * WordPress dependencies |
|
284 */ |
|
285 |
|
286 var blockDefault = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { |
|
287 xmlns: "http://www.w3.org/2000/svg", |
|
288 viewBox: "0 0 24 24" |
|
289 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { |
|
290 d: "M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z" |
|
291 })); |
|
292 /* harmony default export */ __webpack_exports__["a"] = (blockDefault); |
|
293 |
|
294 |
|
295 /***/ }), |
|
296 |
|
297 /***/ 26: |
|
298 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
299 |
|
300 "use strict"; |
|
301 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayLikeToArray; }); |
|
302 function _arrayLikeToArray(arr, len) { |
|
303 if (len == null || len > arr.length) len = arr.length; |
|
304 |
|
305 for (var i = 0, arr2 = new Array(len); i < len; i++) { |
|
306 arr2[i] = arr[i]; |
|
307 } |
|
308 |
|
309 return arr2; |
|
310 } |
|
311 |
|
312 /***/ }), |
|
313 |
|
314 /***/ 268: |
|
118 /***/ (function(module, exports) { |
315 /***/ (function(module, exports) { |
119 |
316 |
120 (function() { module.exports = this["wp"]["shortcode"]; }()); |
317 (function() { module.exports = this["wp"]["blockSerializationDefaultParser"]; }()); |
121 |
318 |
122 /***/ }), |
319 /***/ }), |
123 |
320 |
124 /***/ 15: |
321 /***/ 269: |
125 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
126 |
|
127 "use strict"; |
|
128 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; }); |
|
129 function _defineProperty(obj, key, value) { |
|
130 if (key in obj) { |
|
131 Object.defineProperty(obj, key, { |
|
132 value: value, |
|
133 enumerable: true, |
|
134 configurable: true, |
|
135 writable: true |
|
136 }); |
|
137 } else { |
|
138 obj[key] = value; |
|
139 } |
|
140 |
|
141 return obj; |
|
142 } |
|
143 |
|
144 /***/ }), |
|
145 |
|
146 /***/ 17: |
|
147 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
148 |
|
149 "use strict"; |
|
150 |
|
151 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js |
|
152 function _arrayWithoutHoles(arr) { |
|
153 if (Array.isArray(arr)) { |
|
154 for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { |
|
155 arr2[i] = arr[i]; |
|
156 } |
|
157 |
|
158 return arr2; |
|
159 } |
|
160 } |
|
161 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js |
|
162 var iterableToArray = __webpack_require__(34); |
|
163 |
|
164 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js |
|
165 function _nonIterableSpread() { |
|
166 throw new TypeError("Invalid attempt to spread non-iterable instance"); |
|
167 } |
|
168 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js |
|
169 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _toConsumableArray; }); |
|
170 |
|
171 |
|
172 |
|
173 function _toConsumableArray(arr) { |
|
174 return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || _nonIterableSpread(); |
|
175 } |
|
176 |
|
177 /***/ }), |
|
178 |
|
179 /***/ 19: |
|
180 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
181 |
|
182 "use strict"; |
|
183 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; }); |
|
184 function _extends() { |
|
185 _extends = Object.assign || function (target) { |
|
186 for (var i = 1; i < arguments.length; i++) { |
|
187 var source = arguments[i]; |
|
188 |
|
189 for (var key in source) { |
|
190 if (Object.prototype.hasOwnProperty.call(source, key)) { |
|
191 target[key] = source[key]; |
|
192 } |
|
193 } |
|
194 } |
|
195 |
|
196 return target; |
|
197 }; |
|
198 |
|
199 return _extends.apply(this, arguments); |
|
200 } |
|
201 |
|
202 /***/ }), |
|
203 |
|
204 /***/ 2: |
|
205 /***/ (function(module, exports) { |
|
206 |
|
207 (function() { module.exports = this["lodash"]; }()); |
|
208 |
|
209 /***/ }), |
|
210 |
|
211 /***/ 205: |
|
212 /***/ (function(module, exports) { |
|
213 |
|
214 (function() { module.exports = this["wp"]["blockSerializationDefaultParser"]; }()); |
|
215 |
|
216 /***/ }), |
|
217 |
|
218 /***/ 206: |
|
219 /***/ (function(module, exports, __webpack_require__) { |
322 /***/ (function(module, exports, __webpack_require__) { |
220 |
323 |
221 var __WEBPACK_AMD_DEFINE_RESULT__;;/*! showdown v 1.9.0 - 10-11-2018 */ |
324 var __WEBPACK_AMD_DEFINE_RESULT__;;/*! showdown v 1.9.1 - 02-11-2019 */ |
222 (function(){ |
325 (function(){ |
223 /** |
326 /** |
224 * Created by Tivie on 13-07-2015. |
327 * Created by Tivie on 13-07-2015. |
225 */ |
328 */ |
226 |
329 |
1188 |
1291 |
1189 /** |
1292 /** |
1190 * POLYFILLS |
1293 * POLYFILLS |
1191 */ |
1294 */ |
1192 // use this instead of builtin is undefined for IE8 compatibility |
1295 // use this instead of builtin is undefined for IE8 compatibility |
1193 if (typeof(console) === 'undefined') { |
1296 if (typeof console === 'undefined') { |
1194 console = { |
1297 console = { |
1195 warn: function (msg) { |
1298 warn: function (msg) { |
1196 'use strict'; |
1299 'use strict'; |
1197 alert(msg); |
1300 alert(msg); |
1198 }, |
1301 }, |
2443 /** |
2546 /** |
2444 * The flavor set in this converter |
2547 * The flavor set in this converter |
2445 */ |
2548 */ |
2446 setConvFlavor = setFlavor, |
2549 setConvFlavor = setFlavor, |
2447 |
2550 |
2448 /** |
2551 /** |
2449 * Metadata of the document |
2552 * Metadata of the document |
2450 * @type {{parsed: {}, raw: string, format: string}} |
2553 * @type {{parsed: {}, raw: string, format: string}} |
2451 */ |
2554 */ |
2452 metadata = { |
2555 metadata = { |
2453 parsed: {}, |
2556 parsed: {}, |
2454 raw: '', |
2557 raw: '', |
2455 format: '' |
2558 format: '' |
2456 }; |
2559 }; |
2505 if (showdown.extensions[ext]) { |
2608 if (showdown.extensions[ext]) { |
2506 console.warn('DEPRECATION WARNING: ' + ext + ' is an old extension that uses a deprecated loading method.' + |
2609 console.warn('DEPRECATION WARNING: ' + ext + ' is an old extension that uses a deprecated loading method.' + |
2507 'Please inform the developer that the extension should be updated!'); |
2610 'Please inform the developer that the extension should be updated!'); |
2508 legacyExtensionLoading(showdown.extensions[ext], ext); |
2611 legacyExtensionLoading(showdown.extensions[ext], ext); |
2509 return; |
2612 return; |
2510 // END LEGACY SUPPORT CODE |
2613 // END LEGACY SUPPORT CODE |
2511 |
2614 |
2512 } else if (!showdown.helper.isUndefined(extensions[ext])) { |
2615 } else if (!showdown.helper.isUndefined(extensions[ext])) { |
2513 ext = extensions[ext]; |
2616 ext = extensions[ext]; |
2514 |
2617 |
2515 } else { |
2618 } else { |
3049 |
3152 |
3050 // optionLinksInNewWindow only applies |
3153 // optionLinksInNewWindow only applies |
3051 // to external links. Hash links (#) open in same page |
3154 // to external links. Hash links (#) open in same page |
3052 if (options.openLinksInNewWindow && !/^#/.test(url)) { |
3155 if (options.openLinksInNewWindow && !/^#/.test(url)) { |
3053 // escaped _ |
3156 // escaped _ |
3054 result += ' target="¨E95Eblank"'; |
3157 result += ' rel="noopener noreferrer" target="¨E95Eblank"'; |
3055 } |
3158 } |
3056 |
3159 |
3057 result += '>' + linkText + '</a>'; |
3160 result += '>' + linkText + '</a>'; |
3058 |
3161 |
3059 return result; |
3162 return result; |
3067 text = text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g, |
3170 text = text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g, |
3068 writeAnchorTag); |
3171 writeAnchorTag); |
3069 |
3172 |
3070 // normal cases |
3173 // normal cases |
3071 text = text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g, |
3174 text = text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g, |
3072 writeAnchorTag); |
3175 writeAnchorTag); |
3073 |
3176 |
3074 // handle reference-style shortcuts: [link text] |
3177 // handle reference-style shortcuts: [link text] |
3075 // These must come last in case you've also got [link test][1] |
3178 // These must come last in case you've also got [link test][1] |
3076 // or [link test](/foo) |
3179 // or [link test](/foo) |
3077 text = text.replace(/\[([^\[\]]+)]()()()()()/g, writeAnchorTag); |
3180 text = text.replace(/\[([^\[\]]+)]()()()()()/g, writeAnchorTag); |
3088 throw new Error('ghMentionsLink option must be a string'); |
3191 throw new Error('ghMentionsLink option must be a string'); |
3089 } |
3192 } |
3090 var lnk = options.ghMentionsLink.replace(/\{u}/g, username), |
3193 var lnk = options.ghMentionsLink.replace(/\{u}/g, username), |
3091 target = ''; |
3194 target = ''; |
3092 if (options.openLinksInNewWindow) { |
3195 if (options.openLinksInNewWindow) { |
3093 target = ' target="¨E95Eblank"'; |
3196 target = ' rel="noopener noreferrer" target="¨E95Eblank"'; |
3094 } |
3197 } |
3095 return st + '<a href="' + lnk + '"' + target + '>' + mentions + '</a>'; |
3198 return st + '<a href="' + lnk + '"' + target + '>' + mentions + '</a>'; |
3096 }); |
3199 }); |
3097 } |
3200 } |
3098 |
3201 |
3122 } |
3225 } |
3123 if (options.excludeTrailingPunctuationFromURLs && trailingPunctuation) { |
3226 if (options.excludeTrailingPunctuationFromURLs && trailingPunctuation) { |
3124 append = trailingPunctuation; |
3227 append = trailingPunctuation; |
3125 } |
3228 } |
3126 if (options.openLinksInNewWindow) { |
3229 if (options.openLinksInNewWindow) { |
3127 target = ' target="¨E95Eblank"'; |
3230 target = ' rel="noopener noreferrer" target="¨E95Eblank"'; |
3128 } |
3231 } |
3129 return lmc + '<a href="' + link + '"' + target + '>' + lnkTxt + '</a>' + append + tmc; |
3232 return lmc + '<a href="' + link + '"' + target + '>' + lnkTxt + '</a>' + append + tmc; |
3130 }; |
3233 }; |
3131 }, |
3234 }, |
3132 |
3235 |
3323 showdown.subParser('codeSpans', function (text, options, globals) { |
3426 showdown.subParser('codeSpans', function (text, options, globals) { |
3324 'use strict'; |
3427 'use strict'; |
3325 |
3428 |
3326 text = globals.converter._dispatch('codeSpans.before', text, options, globals); |
3429 text = globals.converter._dispatch('codeSpans.before', text, options, globals); |
3327 |
3430 |
3328 if (typeof(text) === 'undefined') { |
3431 if (typeof text === 'undefined') { |
3329 text = ''; |
3432 text = ''; |
3330 } |
3433 } |
3331 text = text.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm, |
3434 text = text.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm, |
3332 function (wholeMatch, m1, m2, m3) { |
3435 function (wholeMatch, m1, m2, m3) { |
3333 var c = m3; |
3436 var c = m3; |
3743 // if the HTML tag is \ escaped, we need to escape it and break |
3846 // if the HTML tag is \ escaped, we need to escape it and break |
3744 |
3847 |
3745 |
3848 |
3746 //2. Split the text in that position |
3849 //2. Split the text in that position |
3747 var subTexts = showdown.helper.splitAtIndex(text, opTagPos), |
3850 var subTexts = showdown.helper.splitAtIndex(text, opTagPos), |
3748 //3. Match recursively |
3851 //3. Match recursively |
3749 newSubText1 = showdown.helper.replaceRecursiveRegExp(subTexts[1], repFunc, patLeft, patRight, 'im'); |
3852 newSubText1 = showdown.helper.replaceRecursiveRegExp(subTexts[1], repFunc, patLeft, patRight, 'im'); |
3750 |
3853 |
3751 // prevent an infinite loop |
3854 // prevent an infinite loop |
3752 if (newSubText1 === subTexts[1]) { |
3855 if (newSubText1 === subTexts[1]) { |
3753 break; |
3856 break; |
3862 |
3965 |
3863 text = globals.converter._dispatch('headers.before', text, options, globals); |
3966 text = globals.converter._dispatch('headers.before', text, options, globals); |
3864 |
3967 |
3865 var headerLevelStart = (isNaN(parseInt(options.headerLevelStart))) ? 1 : parseInt(options.headerLevelStart), |
3968 var headerLevelStart = (isNaN(parseInt(options.headerLevelStart))) ? 1 : parseInt(options.headerLevelStart), |
3866 |
3969 |
3867 // Set text-style headers: |
3970 // Set text-style headers: |
3868 // Header 1 |
3971 // Header 1 |
3869 // ======== |
3972 // ======== |
3870 // |
3973 // |
3871 // Header 2 |
3974 // Header 2 |
3872 // -------- |
3975 // -------- |
3873 // |
3976 // |
3874 setextRegexH1 = (options.smoothLivePreview) ? /^(.+)[ \t]*\n={2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n=+[ \t]*\n+/gm, |
3977 setextRegexH1 = (options.smoothLivePreview) ? /^(.+)[ \t]*\n={2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n=+[ \t]*\n+/gm, |
3875 setextRegexH2 = (options.smoothLivePreview) ? /^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n-+[ \t]*\n+/gm; |
3978 setextRegexH2 = (options.smoothLivePreview) ? /^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n-+[ \t]*\n+/gm; |
3876 |
3979 |
3877 text = text.replace(setextRegexH1, function (wholeMatch, m1) { |
3980 text = text.replace(setextRegexH1, function (wholeMatch, m1) { |
3878 |
3981 |
4669 if (!options.tables) { |
4772 if (!options.tables) { |
4670 return text; |
4773 return text; |
4671 } |
4774 } |
4672 |
4775 |
4673 var tableRgx = /^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm, |
4776 var tableRgx = /^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm, |
4674 //singeColTblRgx = /^ {0,3}\|.+\|\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n(?: {0,3}\|.+\|\n)+(?:\n\n|¨0)/gm; |
4777 //singeColTblRgx = /^ {0,3}\|.+\|\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n(?: {0,3}\|.+\|\n)+(?:\n\n|¨0)/gm; |
4675 singeColTblRgx = /^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm; |
4778 singeColTblRgx = /^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm; |
4676 |
4779 |
4677 function parseStyles (sLine) { |
4780 function parseStyles (sLine) { |
4678 if (/^:[ \t]*--*$/.test(sLine)) { |
4781 if (/^:[ \t]*--*$/.test(sLine)) { |
4679 return ' style="text-align:left;"'; |
4782 return ' style="text-align:left;"'; |
5357 |
5460 |
5358 |
5461 |
5359 |
5462 |
5360 /***/ }), |
5463 /***/ }), |
5361 |
5464 |
5362 /***/ 24: |
5465 /***/ 29: |
5466 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
5467 |
|
5468 "use strict"; |
|
5469 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _unsupportedIterableToArray; }); |
|
5470 /* harmony import */ var _arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26); |
|
5471 |
|
5472 function _unsupportedIterableToArray(o, minLen) { |
|
5473 if (!o) return; |
|
5474 if (typeof o === "string") return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen); |
|
5475 var n = Object.prototype.toString.call(o).slice(8, -1); |
|
5476 if (n === "Object" && o.constructor) n = o.constructor.name; |
|
5477 if (n === "Map" || n === "Set") return Array.from(o); |
|
5478 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen); |
|
5479 } |
|
5480 |
|
5481 /***/ }), |
|
5482 |
|
5483 /***/ 30: |
|
5363 /***/ (function(module, exports) { |
5484 /***/ (function(module, exports) { |
5364 |
5485 |
5365 (function() { module.exports = this["wp"]["dom"]; }()); |
5486 (function() { module.exports = this["wp"]["dom"]; }()); |
5366 |
5487 |
5367 /***/ }), |
5488 /***/ }), |
5368 |
5489 |
5369 /***/ 26: |
5490 /***/ 32: |
5370 /***/ (function(module, exports) { |
5491 /***/ (function(module, exports) { |
5371 |
5492 |
5372 (function() { module.exports = this["wp"]["hooks"]; }()); |
5493 (function() { module.exports = this["wp"]["hooks"]; }()); |
5373 |
5494 |
5374 /***/ }), |
5495 /***/ }), |
5375 |
5496 |
5376 /***/ 28: |
5497 /***/ 35: |
5377 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
5498 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
5378 |
5499 |
5379 "use strict"; |
5500 "use strict"; |
5380 |
5501 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; }); |
5381 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js |
5502 function _iterableToArray(iter) { |
5382 var arrayWithHoles = __webpack_require__(37); |
5503 if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); |
5383 |
|
5384 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js |
|
5385 function _iterableToArrayLimit(arr, i) { |
|
5386 var _arr = []; |
|
5387 var _n = true; |
|
5388 var _d = false; |
|
5389 var _e = undefined; |
|
5390 |
|
5391 try { |
|
5392 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { |
|
5393 _arr.push(_s.value); |
|
5394 |
|
5395 if (i && _arr.length === i) break; |
|
5396 } |
|
5397 } catch (err) { |
|
5398 _d = true; |
|
5399 _e = err; |
|
5400 } finally { |
|
5401 try { |
|
5402 if (!_n && _i["return"] != null) _i["return"](); |
|
5403 } finally { |
|
5404 if (_d) throw _e; |
|
5405 } |
|
5406 } |
|
5407 |
|
5408 return _arr; |
|
5409 } |
|
5410 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js |
|
5411 var nonIterableRest = __webpack_require__(38); |
|
5412 |
|
5413 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js |
|
5414 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _slicedToArray; }); |
|
5415 |
|
5416 |
|
5417 |
|
5418 function _slicedToArray(arr, i) { |
|
5419 return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(nonIterableRest["a" /* default */])(); |
|
5420 } |
5504 } |
5421 |
5505 |
5422 /***/ }), |
5506 /***/ }), |
5423 |
5507 |
5424 /***/ 30: |
5508 /***/ 38: |
5509 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
5510 |
|
5511 "use strict"; |
|
5512 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; }); |
|
5513 function _arrayWithHoles(arr) { |
|
5514 if (Array.isArray(arr)) return arr; |
|
5515 } |
|
5516 |
|
5517 /***/ }), |
|
5518 |
|
5519 /***/ 39: |
|
5520 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
5521 |
|
5522 "use strict"; |
|
5523 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; }); |
|
5524 function _nonIterableRest() { |
|
5525 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); |
|
5526 } |
|
5527 |
|
5528 /***/ }), |
|
5529 |
|
5530 /***/ 4: |
|
5531 /***/ (function(module, exports) { |
|
5532 |
|
5533 (function() { module.exports = this["wp"]["data"]; }()); |
|
5534 |
|
5535 /***/ }), |
|
5536 |
|
5537 /***/ 42: |
|
5425 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
5538 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
5426 |
5539 |
5427 "use strict"; |
5540 "use strict"; |
5428 |
5541 |
5429 |
5542 |
5701 }); |
5814 }); |
5702 |
5815 |
5703 |
5816 |
5704 /***/ }), |
5817 /***/ }), |
5705 |
5818 |
5706 /***/ 34: |
5819 /***/ 44: |
5820 /***/ (function(module, exports) { |
|
5821 |
|
5822 (function() { module.exports = this["wp"]["blob"]; }()); |
|
5823 |
|
5824 /***/ }), |
|
5825 |
|
5826 /***/ 441: |
|
5707 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
5827 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
5708 |
5828 |
5709 "use strict"; |
5829 "use strict"; |
5710 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; }); |
5830 // ESM COMPAT FLAG |
5711 function _iterableToArray(iter) { |
|
5712 if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); |
|
5713 } |
|
5714 |
|
5715 /***/ }), |
|
5716 |
|
5717 /***/ 35: |
|
5718 /***/ (function(module, exports) { |
|
5719 |
|
5720 (function() { module.exports = this["wp"]["blob"]; }()); |
|
5721 |
|
5722 /***/ }), |
|
5723 |
|
5724 /***/ 362: |
|
5725 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
5726 |
|
5727 "use strict"; |
|
5728 __webpack_require__.r(__webpack_exports__); |
5831 __webpack_require__.r(__webpack_exports__); |
5832 |
|
5833 // EXPORTS |
|
5834 __webpack_require__.d(__webpack_exports__, "createBlock", function() { return /* reexport */ createBlock; }); |
|
5835 __webpack_require__.d(__webpack_exports__, "cloneBlock", function() { return /* reexport */ cloneBlock; }); |
|
5836 __webpack_require__.d(__webpack_exports__, "getPossibleBlockTransformations", function() { return /* reexport */ getPossibleBlockTransformations; }); |
|
5837 __webpack_require__.d(__webpack_exports__, "switchToBlockType", function() { return /* reexport */ switchToBlockType; }); |
|
5838 __webpack_require__.d(__webpack_exports__, "getBlockTransforms", function() { return /* reexport */ getBlockTransforms; }); |
|
5839 __webpack_require__.d(__webpack_exports__, "findTransform", function() { return /* reexport */ findTransform; }); |
|
5840 __webpack_require__.d(__webpack_exports__, "getBlockFromExample", function() { return /* reexport */ factory_getBlockFromExample; }); |
|
5841 __webpack_require__.d(__webpack_exports__, "parse", function() { return /* reexport */ parser; }); |
|
5842 __webpack_require__.d(__webpack_exports__, "getBlockAttributes", function() { return /* reexport */ getBlockAttributes; }); |
|
5843 __webpack_require__.d(__webpack_exports__, "parseWithAttributeSchema", function() { return /* reexport */ parseWithAttributeSchema; }); |
|
5844 __webpack_require__.d(__webpack_exports__, "pasteHandler", function() { return /* reexport */ pasteHandler; }); |
|
5845 __webpack_require__.d(__webpack_exports__, "rawHandler", function() { return /* reexport */ rawHandler; }); |
|
5846 __webpack_require__.d(__webpack_exports__, "getPhrasingContentSchema", function() { return /* reexport */ getPhrasingContentSchema; }); |
|
5847 __webpack_require__.d(__webpack_exports__, "serialize", function() { return /* reexport */ serialize; }); |
|
5848 __webpack_require__.d(__webpack_exports__, "getBlockContent", function() { return /* reexport */ getBlockContent; }); |
|
5849 __webpack_require__.d(__webpack_exports__, "getBlockDefaultClassName", function() { return /* reexport */ getBlockDefaultClassName; }); |
|
5850 __webpack_require__.d(__webpack_exports__, "getBlockMenuDefaultClassName", function() { return /* reexport */ getBlockMenuDefaultClassName; }); |
|
5851 __webpack_require__.d(__webpack_exports__, "getSaveElement", function() { return /* reexport */ getSaveElement; }); |
|
5852 __webpack_require__.d(__webpack_exports__, "getSaveContent", function() { return /* reexport */ getSaveContent; }); |
|
5853 __webpack_require__.d(__webpack_exports__, "isValidBlockContent", function() { return /* reexport */ isValidBlockContent; }); |
|
5854 __webpack_require__.d(__webpack_exports__, "getCategories", function() { return /* reexport */ categories_getCategories; }); |
|
5855 __webpack_require__.d(__webpack_exports__, "setCategories", function() { return /* reexport */ categories_setCategories; }); |
|
5856 __webpack_require__.d(__webpack_exports__, "updateCategory", function() { return /* reexport */ categories_updateCategory; }); |
|
5857 __webpack_require__.d(__webpack_exports__, "registerBlockType", function() { return /* reexport */ registerBlockType; }); |
|
5858 __webpack_require__.d(__webpack_exports__, "registerBlockCollection", function() { return /* reexport */ registerBlockCollection; }); |
|
5859 __webpack_require__.d(__webpack_exports__, "unregisterBlockType", function() { return /* reexport */ unregisterBlockType; }); |
|
5860 __webpack_require__.d(__webpack_exports__, "setFreeformContentHandlerName", function() { return /* reexport */ setFreeformContentHandlerName; }); |
|
5861 __webpack_require__.d(__webpack_exports__, "getFreeformContentHandlerName", function() { return /* reexport */ getFreeformContentHandlerName; }); |
|
5862 __webpack_require__.d(__webpack_exports__, "setUnregisteredTypeHandlerName", function() { return /* reexport */ setUnregisteredTypeHandlerName; }); |
|
5863 __webpack_require__.d(__webpack_exports__, "getUnregisteredTypeHandlerName", function() { return /* reexport */ getUnregisteredTypeHandlerName; }); |
|
5864 __webpack_require__.d(__webpack_exports__, "setDefaultBlockName", function() { return /* reexport */ registration_setDefaultBlockName; }); |
|
5865 __webpack_require__.d(__webpack_exports__, "getDefaultBlockName", function() { return /* reexport */ registration_getDefaultBlockName; }); |
|
5866 __webpack_require__.d(__webpack_exports__, "setGroupingBlockName", function() { return /* reexport */ registration_setGroupingBlockName; }); |
|
5867 __webpack_require__.d(__webpack_exports__, "getGroupingBlockName", function() { return /* reexport */ registration_getGroupingBlockName; }); |
|
5868 __webpack_require__.d(__webpack_exports__, "getBlockType", function() { return /* reexport */ registration_getBlockType; }); |
|
5869 __webpack_require__.d(__webpack_exports__, "getBlockTypes", function() { return /* reexport */ registration_getBlockTypes; }); |
|
5870 __webpack_require__.d(__webpack_exports__, "getBlockSupport", function() { return /* reexport */ registration_getBlockSupport; }); |
|
5871 __webpack_require__.d(__webpack_exports__, "hasBlockSupport", function() { return /* reexport */ registration_hasBlockSupport; }); |
|
5872 __webpack_require__.d(__webpack_exports__, "isReusableBlock", function() { return /* reexport */ isReusableBlock; }); |
|
5873 __webpack_require__.d(__webpack_exports__, "getChildBlockNames", function() { return /* reexport */ registration_getChildBlockNames; }); |
|
5874 __webpack_require__.d(__webpack_exports__, "hasChildBlocks", function() { return /* reexport */ registration_hasChildBlocks; }); |
|
5875 __webpack_require__.d(__webpack_exports__, "hasChildBlocksWithInserterSupport", function() { return /* reexport */ registration_hasChildBlocksWithInserterSupport; }); |
|
5876 __webpack_require__.d(__webpack_exports__, "unstable__bootstrapServerSideBlockDefinitions", function() { return /* reexport */ unstable__bootstrapServerSideBlockDefinitions; }); |
|
5877 __webpack_require__.d(__webpack_exports__, "registerBlockStyle", function() { return /* reexport */ registration_registerBlockStyle; }); |
|
5878 __webpack_require__.d(__webpack_exports__, "unregisterBlockStyle", function() { return /* reexport */ registration_unregisterBlockStyle; }); |
|
5879 __webpack_require__.d(__webpack_exports__, "registerBlockVariation", function() { return /* reexport */ registration_registerBlockVariation; }); |
|
5880 __webpack_require__.d(__webpack_exports__, "unregisterBlockVariation", function() { return /* reexport */ registration_unregisterBlockVariation; }); |
|
5881 __webpack_require__.d(__webpack_exports__, "isUnmodifiedDefaultBlock", function() { return /* reexport */ isUnmodifiedDefaultBlock; }); |
|
5882 __webpack_require__.d(__webpack_exports__, "normalizeIconObject", function() { return /* reexport */ normalizeIconObject; }); |
|
5883 __webpack_require__.d(__webpack_exports__, "isValidIcon", function() { return /* reexport */ isValidIcon; }); |
|
5884 __webpack_require__.d(__webpack_exports__, "__experimentalGetBlockLabel", function() { return /* reexport */ getBlockLabel; }); |
|
5885 __webpack_require__.d(__webpack_exports__, "__experimentalGetAccessibleBlockLabel", function() { return /* reexport */ getAccessibleBlockLabel; }); |
|
5886 __webpack_require__.d(__webpack_exports__, "doBlocksMatchTemplate", function() { return /* reexport */ doBlocksMatchTemplate; }); |
|
5887 __webpack_require__.d(__webpack_exports__, "synchronizeBlocksWithTemplate", function() { return /* reexport */ synchronizeBlocksWithTemplate; }); |
|
5888 __webpack_require__.d(__webpack_exports__, "children", function() { return /* reexport */ api_children; }); |
|
5889 __webpack_require__.d(__webpack_exports__, "node", function() { return /* reexport */ api_node; }); |
|
5890 __webpack_require__.d(__webpack_exports__, "withBlockContentContext", function() { return /* reexport */ withBlockContentContext; }); |
|
5891 |
|
5892 // NAMESPACE OBJECT: ./node_modules/@wordpress/blocks/build-module/store/selectors.js |
|
5729 var selectors_namespaceObject = {}; |
5893 var selectors_namespaceObject = {}; |
5730 __webpack_require__.r(selectors_namespaceObject); |
5894 __webpack_require__.r(selectors_namespaceObject); |
5731 __webpack_require__.d(selectors_namespaceObject, "getBlockTypes", function() { return getBlockTypes; }); |
5895 __webpack_require__.d(selectors_namespaceObject, "getBlockTypes", function() { return getBlockTypes; }); |
5732 __webpack_require__.d(selectors_namespaceObject, "getBlockType", function() { return getBlockType; }); |
5896 __webpack_require__.d(selectors_namespaceObject, "getBlockType", function() { return getBlockType; }); |
5733 __webpack_require__.d(selectors_namespaceObject, "getBlockStyles", function() { return getBlockStyles; }); |
5897 __webpack_require__.d(selectors_namespaceObject, "getBlockStyles", function() { return getBlockStyles; }); |
5898 __webpack_require__.d(selectors_namespaceObject, "getBlockVariations", function() { return getBlockVariations; }); |
|
5899 __webpack_require__.d(selectors_namespaceObject, "getDefaultBlockVariation", function() { return getDefaultBlockVariation; }); |
|
5734 __webpack_require__.d(selectors_namespaceObject, "getCategories", function() { return getCategories; }); |
5900 __webpack_require__.d(selectors_namespaceObject, "getCategories", function() { return getCategories; }); |
5901 __webpack_require__.d(selectors_namespaceObject, "getCollections", function() { return getCollections; }); |
|
5735 __webpack_require__.d(selectors_namespaceObject, "getDefaultBlockName", function() { return getDefaultBlockName; }); |
5902 __webpack_require__.d(selectors_namespaceObject, "getDefaultBlockName", function() { return getDefaultBlockName; }); |
5736 __webpack_require__.d(selectors_namespaceObject, "getFreeformFallbackBlockName", function() { return getFreeformFallbackBlockName; }); |
5903 __webpack_require__.d(selectors_namespaceObject, "getFreeformFallbackBlockName", function() { return getFreeformFallbackBlockName; }); |
5737 __webpack_require__.d(selectors_namespaceObject, "getUnregisteredFallbackBlockName", function() { return getUnregisteredFallbackBlockName; }); |
5904 __webpack_require__.d(selectors_namespaceObject, "getUnregisteredFallbackBlockName", function() { return getUnregisteredFallbackBlockName; }); |
5905 __webpack_require__.d(selectors_namespaceObject, "getGroupingBlockName", function() { return getGroupingBlockName; }); |
|
5738 __webpack_require__.d(selectors_namespaceObject, "getChildBlockNames", function() { return selectors_getChildBlockNames; }); |
5906 __webpack_require__.d(selectors_namespaceObject, "getChildBlockNames", function() { return selectors_getChildBlockNames; }); |
5739 __webpack_require__.d(selectors_namespaceObject, "getBlockSupport", function() { return selectors_getBlockSupport; }); |
5907 __webpack_require__.d(selectors_namespaceObject, "getBlockSupport", function() { return selectors_getBlockSupport; }); |
5740 __webpack_require__.d(selectors_namespaceObject, "hasBlockSupport", function() { return hasBlockSupport; }); |
5908 __webpack_require__.d(selectors_namespaceObject, "hasBlockSupport", function() { return hasBlockSupport; }); |
5741 __webpack_require__.d(selectors_namespaceObject, "isMatchingSearchTerm", function() { return isMatchingSearchTerm; }); |
5909 __webpack_require__.d(selectors_namespaceObject, "isMatchingSearchTerm", function() { return isMatchingSearchTerm; }); |
5742 __webpack_require__.d(selectors_namespaceObject, "hasChildBlocks", function() { return selectors_hasChildBlocks; }); |
5910 __webpack_require__.d(selectors_namespaceObject, "hasChildBlocks", function() { return selectors_hasChildBlocks; }); |
5743 __webpack_require__.d(selectors_namespaceObject, "hasChildBlocksWithInserterSupport", function() { return selectors_hasChildBlocksWithInserterSupport; }); |
5911 __webpack_require__.d(selectors_namespaceObject, "hasChildBlocksWithInserterSupport", function() { return selectors_hasChildBlocksWithInserterSupport; }); |
5912 |
|
5913 // NAMESPACE OBJECT: ./node_modules/@wordpress/blocks/build-module/store/actions.js |
|
5744 var actions_namespaceObject = {}; |
5914 var actions_namespaceObject = {}; |
5745 __webpack_require__.r(actions_namespaceObject); |
5915 __webpack_require__.r(actions_namespaceObject); |
5746 __webpack_require__.d(actions_namespaceObject, "addBlockTypes", function() { return addBlockTypes; }); |
5916 __webpack_require__.d(actions_namespaceObject, "addBlockTypes", function() { return addBlockTypes; }); |
5747 __webpack_require__.d(actions_namespaceObject, "removeBlockTypes", function() { return removeBlockTypes; }); |
5917 __webpack_require__.d(actions_namespaceObject, "removeBlockTypes", function() { return removeBlockTypes; }); |
5748 __webpack_require__.d(actions_namespaceObject, "addBlockStyles", function() { return addBlockStyles; }); |
5918 __webpack_require__.d(actions_namespaceObject, "addBlockStyles", function() { return addBlockStyles; }); |
5749 __webpack_require__.d(actions_namespaceObject, "removeBlockStyles", function() { return removeBlockStyles; }); |
5919 __webpack_require__.d(actions_namespaceObject, "removeBlockStyles", function() { return removeBlockStyles; }); |
5920 __webpack_require__.d(actions_namespaceObject, "addBlockVariations", function() { return addBlockVariations; }); |
|
5921 __webpack_require__.d(actions_namespaceObject, "removeBlockVariations", function() { return removeBlockVariations; }); |
|
5750 __webpack_require__.d(actions_namespaceObject, "setDefaultBlockName", function() { return setDefaultBlockName; }); |
5922 __webpack_require__.d(actions_namespaceObject, "setDefaultBlockName", function() { return setDefaultBlockName; }); |
5751 __webpack_require__.d(actions_namespaceObject, "setFreeformFallbackBlockName", function() { return setFreeformFallbackBlockName; }); |
5923 __webpack_require__.d(actions_namespaceObject, "setFreeformFallbackBlockName", function() { return setFreeformFallbackBlockName; }); |
5752 __webpack_require__.d(actions_namespaceObject, "setUnregisteredFallbackBlockName", function() { return setUnregisteredFallbackBlockName; }); |
5924 __webpack_require__.d(actions_namespaceObject, "setUnregisteredFallbackBlockName", function() { return setUnregisteredFallbackBlockName; }); |
5925 __webpack_require__.d(actions_namespaceObject, "setGroupingBlockName", function() { return setGroupingBlockName; }); |
|
5753 __webpack_require__.d(actions_namespaceObject, "setCategories", function() { return setCategories; }); |
5926 __webpack_require__.d(actions_namespaceObject, "setCategories", function() { return setCategories; }); |
5754 __webpack_require__.d(actions_namespaceObject, "updateCategory", function() { return updateCategory; }); |
5927 __webpack_require__.d(actions_namespaceObject, "updateCategory", function() { return updateCategory; }); |
5928 __webpack_require__.d(actions_namespaceObject, "addBlockCollection", function() { return addBlockCollection; }); |
|
5929 __webpack_require__.d(actions_namespaceObject, "removeBlockCollection", function() { return removeBlockCollection; }); |
|
5755 |
5930 |
5756 // EXTERNAL MODULE: external {"this":["wp","data"]} |
5931 // EXTERNAL MODULE: external {"this":["wp","data"]} |
5757 var external_this_wp_data_ = __webpack_require__(5); |
5932 var external_this_wp_data_ = __webpack_require__(4); |
5933 |
|
5934 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules |
|
5935 var toConsumableArray = __webpack_require__(18); |
|
5758 |
5936 |
5759 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js |
5937 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js |
5760 var defineProperty = __webpack_require__(15); |
5938 var defineProperty = __webpack_require__(5); |
5761 |
5939 |
5762 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules |
5940 // EXTERNAL MODULE: external {"this":"lodash"} |
5763 var toConsumableArray = __webpack_require__(17); |
5941 var external_this_lodash_ = __webpack_require__(2); |
5764 |
|
5765 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread.js |
|
5766 var objectSpread = __webpack_require__(7); |
|
5767 |
|
5768 // EXTERNAL MODULE: external "lodash" |
|
5769 var external_lodash_ = __webpack_require__(2); |
|
5770 |
5942 |
5771 // EXTERNAL MODULE: external {"this":["wp","i18n"]} |
5943 // EXTERNAL MODULE: external {"this":["wp","i18n"]} |
5772 var external_this_wp_i18n_ = __webpack_require__(1); |
5944 var external_this_wp_i18n_ = __webpack_require__(1); |
5773 |
5945 |
5774 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/reducer.js |
5946 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/reducer.js |
5775 |
5947 |
5776 |
5948 |
5777 |
5949 |
5950 function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
|
5951 |
|
5952 function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
5778 |
5953 |
5779 /** |
5954 /** |
5780 * External dependencies |
5955 * External dependencies |
5781 */ |
5956 */ |
5782 |
5957 |
5785 */ |
5960 */ |
5786 |
5961 |
5787 |
5962 |
5788 |
5963 |
5789 /** |
5964 /** |
5790 * Module Constants |
5965 * @typedef {Object} WPBlockCategory |
5966 * |
|
5967 * @property {string} slug Unique category slug. |
|
5968 * @property {string} title Category label, for display in user interface. |
|
5969 */ |
|
5970 |
|
5971 /** |
|
5972 * Default set of categories. |
|
5973 * |
|
5974 * @type {WPBlockCategory[]} |
|
5791 */ |
5975 */ |
5792 |
5976 |
5793 var DEFAULT_CATEGORIES = [{ |
5977 var DEFAULT_CATEGORIES = [{ |
5794 slug: 'common', |
5978 slug: 'text', |
5795 title: Object(external_this_wp_i18n_["__"])('Common Blocks') |
5979 title: Object(external_this_wp_i18n_["__"])('Text') |
5796 }, { |
5980 }, { |
5797 slug: 'formatting', |
5981 slug: 'media', |
5798 title: Object(external_this_wp_i18n_["__"])('Formatting') |
5982 title: Object(external_this_wp_i18n_["__"])('Media') |
5799 }, { |
5983 }, { |
5800 slug: 'layout', |
5984 slug: 'design', |
5801 title: Object(external_this_wp_i18n_["__"])('Layout Elements') |
5985 title: Object(external_this_wp_i18n_["__"])('Design') |
5802 }, { |
5986 }, { |
5803 slug: 'widgets', |
5987 slug: 'widgets', |
5804 title: Object(external_this_wp_i18n_["__"])('Widgets') |
5988 title: Object(external_this_wp_i18n_["__"])('Widgets') |
5805 }, { |
5989 }, { |
5806 slug: 'embed', |
5990 slug: 'embed', |
5807 title: Object(external_this_wp_i18n_["__"])('Embeds') |
5991 title: Object(external_this_wp_i18n_["__"])('Embeds') |
5808 }, { |
5992 }, { |
5809 slug: 'reusable', |
5993 slug: 'reusable', |
5810 title: Object(external_this_wp_i18n_["__"])('Reusable Blocks') |
5994 title: Object(external_this_wp_i18n_["__"])('Reusable blocks') |
5811 }]; |
5995 }]; |
5812 /** |
5996 /** |
5813 * Reducer managing the block types |
5997 * Reducer managing the block types |
5814 * |
5998 * |
5815 * @param {Object} state Current state. |
5999 * @param {Object} state Current state. |
5822 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
6006 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
5823 var action = arguments.length > 1 ? arguments[1] : undefined; |
6007 var action = arguments.length > 1 ? arguments[1] : undefined; |
5824 |
6008 |
5825 switch (action.type) { |
6009 switch (action.type) { |
5826 case 'ADD_BLOCK_TYPES': |
6010 case 'ADD_BLOCK_TYPES': |
5827 return Object(objectSpread["a" /* default */])({}, state, Object(external_lodash_["keyBy"])(Object(external_lodash_["map"])(action.blockTypes, function (blockType) { |
6011 return _objectSpread({}, state, {}, Object(external_this_lodash_["keyBy"])(Object(external_this_lodash_["map"])(action.blockTypes, function (blockType) { |
5828 return Object(external_lodash_["omit"])(blockType, 'styles '); |
6012 return Object(external_this_lodash_["omit"])(blockType, 'styles '); |
5829 }), 'name')); |
6013 }), 'name')); |
5830 |
6014 |
5831 case 'REMOVE_BLOCK_TYPES': |
6015 case 'REMOVE_BLOCK_TYPES': |
5832 return Object(external_lodash_["omit"])(state, action.names); |
6016 return Object(external_this_lodash_["omit"])(state, action.names); |
5833 } |
6017 } |
5834 |
6018 |
5835 return state; |
6019 return state; |
5836 } |
6020 } |
5837 /** |
6021 /** |
5847 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
6031 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
5848 var action = arguments.length > 1 ? arguments[1] : undefined; |
6032 var action = arguments.length > 1 ? arguments[1] : undefined; |
5849 |
6033 |
5850 switch (action.type) { |
6034 switch (action.type) { |
5851 case 'ADD_BLOCK_TYPES': |
6035 case 'ADD_BLOCK_TYPES': |
5852 return Object(objectSpread["a" /* default */])({}, state, Object(external_lodash_["mapValues"])(Object(external_lodash_["keyBy"])(action.blockTypes, 'name'), function (blockType) { |
6036 return _objectSpread({}, state, {}, Object(external_this_lodash_["mapValues"])(Object(external_this_lodash_["keyBy"])(action.blockTypes, 'name'), function (blockType) { |
5853 return Object(external_lodash_["uniqBy"])([].concat(Object(toConsumableArray["a" /* default */])(Object(external_lodash_["get"])(blockType, ['styles'], [])), Object(toConsumableArray["a" /* default */])(Object(external_lodash_["get"])(state, [blockType.name], []))), function (style) { |
6037 return Object(external_this_lodash_["uniqBy"])([].concat(Object(toConsumableArray["a" /* default */])(Object(external_this_lodash_["get"])(blockType, ['styles'], [])), Object(toConsumableArray["a" /* default */])(Object(external_this_lodash_["get"])(state, [blockType.name], []))), function (style) { |
5854 return style.name; |
6038 return style.name; |
5855 }); |
6039 }); |
5856 })); |
6040 })); |
5857 |
6041 |
5858 case 'ADD_BLOCK_STYLES': |
6042 case 'ADD_BLOCK_STYLES': |
5859 return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, action.blockName, Object(external_lodash_["uniqBy"])([].concat(Object(toConsumableArray["a" /* default */])(Object(external_lodash_["get"])(state, [action.blockName], [])), Object(toConsumableArray["a" /* default */])(action.styles)), function (style) { |
6043 return _objectSpread({}, state, Object(defineProperty["a" /* default */])({}, action.blockName, Object(external_this_lodash_["uniqBy"])([].concat(Object(toConsumableArray["a" /* default */])(Object(external_this_lodash_["get"])(state, [action.blockName], [])), Object(toConsumableArray["a" /* default */])(action.styles)), function (style) { |
5860 return style.name; |
6044 return style.name; |
5861 }))); |
6045 }))); |
5862 |
6046 |
5863 case 'REMOVE_BLOCK_STYLES': |
6047 case 'REMOVE_BLOCK_STYLES': |
5864 return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, action.blockName, Object(external_lodash_["filter"])(Object(external_lodash_["get"])(state, [action.blockName], []), function (style) { |
6048 return _objectSpread({}, state, Object(defineProperty["a" /* default */])({}, action.blockName, Object(external_this_lodash_["filter"])(Object(external_this_lodash_["get"])(state, [action.blockName], []), function (style) { |
5865 return action.styleNames.indexOf(style.name) === -1; |
6049 return action.styleNames.indexOf(style.name) === -1; |
5866 }))); |
6050 }))); |
5867 } |
6051 } |
5868 |
6052 |
5869 return state; |
6053 return state; |
5870 } |
6054 } |
5871 /** |
6055 /** |
6056 * Reducer managing the block variations. |
|
6057 * |
|
6058 * @param {Object} state Current state. |
|
6059 * @param {Object} action Dispatched action. |
|
6060 * |
|
6061 * @return {Object} Updated state. |
|
6062 */ |
|
6063 |
|
6064 function blockVariations() { |
|
6065 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
6066 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
6067 |
|
6068 switch (action.type) { |
|
6069 case 'ADD_BLOCK_TYPES': |
|
6070 return _objectSpread({}, state, {}, Object(external_this_lodash_["mapValues"])(Object(external_this_lodash_["keyBy"])(action.blockTypes, 'name'), function (blockType) { |
|
6071 return Object(external_this_lodash_["uniqBy"])([].concat(Object(toConsumableArray["a" /* default */])(Object(external_this_lodash_["get"])(blockType, ['variations'], [])), Object(toConsumableArray["a" /* default */])(Object(external_this_lodash_["get"])(state, [blockType.name], []))), function (variation) { |
|
6072 return variation.name; |
|
6073 }); |
|
6074 })); |
|
6075 |
|
6076 case 'ADD_BLOCK_VARIATIONS': |
|
6077 return _objectSpread({}, state, Object(defineProperty["a" /* default */])({}, action.blockName, Object(external_this_lodash_["uniqBy"])([].concat(Object(toConsumableArray["a" /* default */])(Object(external_this_lodash_["get"])(state, [action.blockName], [])), Object(toConsumableArray["a" /* default */])(action.variations)), function (variation) { |
|
6078 return variation.name; |
|
6079 }))); |
|
6080 |
|
6081 case 'REMOVE_BLOCK_VARIATIONS': |
|
6082 return _objectSpread({}, state, Object(defineProperty["a" /* default */])({}, action.blockName, Object(external_this_lodash_["filter"])(Object(external_this_lodash_["get"])(state, [action.blockName], []), function (variation) { |
|
6083 return action.variationNames.indexOf(variation.name) === -1; |
|
6084 }))); |
|
6085 } |
|
6086 |
|
6087 return state; |
|
6088 } |
|
6089 /** |
|
5872 * Higher-order Reducer creating a reducer keeping track of given block name. |
6090 * Higher-order Reducer creating a reducer keeping track of given block name. |
5873 * |
6091 * |
5874 * @param {string} setActionType Action type. |
6092 * @param {string} setActionType Action type. |
5875 * |
6093 * |
5876 * @return {function} Reducer. |
6094 * @return {Function} Reducer. |
5877 */ |
6095 */ |
5878 |
6096 |
5879 function createBlockNameSetterReducer(setActionType) { |
6097 function createBlockNameSetterReducer(setActionType) { |
5880 return function () { |
6098 return function () { |
5881 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; |
6099 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; |
5897 }; |
6115 }; |
5898 } |
6116 } |
5899 var reducer_defaultBlockName = createBlockNameSetterReducer('SET_DEFAULT_BLOCK_NAME'); |
6117 var reducer_defaultBlockName = createBlockNameSetterReducer('SET_DEFAULT_BLOCK_NAME'); |
5900 var freeformFallbackBlockName = createBlockNameSetterReducer('SET_FREEFORM_FALLBACK_BLOCK_NAME'); |
6118 var freeformFallbackBlockName = createBlockNameSetterReducer('SET_FREEFORM_FALLBACK_BLOCK_NAME'); |
5901 var unregisteredFallbackBlockName = createBlockNameSetterReducer('SET_UNREGISTERED_FALLBACK_BLOCK_NAME'); |
6119 var unregisteredFallbackBlockName = createBlockNameSetterReducer('SET_UNREGISTERED_FALLBACK_BLOCK_NAME'); |
6120 var groupingBlockName = createBlockNameSetterReducer('SET_GROUPING_BLOCK_NAME'); |
|
5902 /** |
6121 /** |
5903 * Reducer managing the categories |
6122 * Reducer managing the categories |
5904 * |
6123 * |
5905 * @param {Object} state Current state. |
6124 * @param {WPBlockCategory[]} state Current state. |
5906 * @param {Object} action Dispatched action. |
6125 * @param {Object} action Dispatched action. |
5907 * |
6126 * |
5908 * @return {Object} Updated state. |
6127 * @return {WPBlockCategory[]} Updated state. |
5909 */ |
6128 */ |
5910 |
6129 |
5911 function reducer_categories() { |
6130 function reducer_categories() { |
5912 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_CATEGORIES; |
6131 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_CATEGORIES; |
5913 var action = arguments.length > 1 ? arguments[1] : undefined; |
6132 var action = arguments.length > 1 ? arguments[1] : undefined; |
5916 case 'SET_CATEGORIES': |
6135 case 'SET_CATEGORIES': |
5917 return action.categories || []; |
6136 return action.categories || []; |
5918 |
6137 |
5919 case 'UPDATE_CATEGORY': |
6138 case 'UPDATE_CATEGORY': |
5920 { |
6139 { |
5921 if (!action.category || Object(external_lodash_["isEmpty"])(action.category)) { |
6140 if (!action.category || Object(external_this_lodash_["isEmpty"])(action.category)) { |
5922 return state; |
6141 return state; |
5923 } |
6142 } |
5924 |
6143 |
5925 var categoryToChange = Object(external_lodash_["find"])(state, ['slug', action.slug]); |
6144 var categoryToChange = Object(external_this_lodash_["find"])(state, ['slug', action.slug]); |
5926 |
6145 |
5927 if (categoryToChange) { |
6146 if (categoryToChange) { |
5928 return Object(external_lodash_["map"])(state, function (category) { |
6147 return Object(external_this_lodash_["map"])(state, function (category) { |
5929 if (category.slug === action.slug) { |
6148 if (category.slug === action.slug) { |
5930 return Object(objectSpread["a" /* default */])({}, category, action.category); |
6149 return _objectSpread({}, category, {}, action.category); |
5931 } |
6150 } |
5932 |
6151 |
5933 return category; |
6152 return category; |
5934 }); |
6153 }); |
5935 } |
6154 } |
5936 } |
6155 } |
5937 } |
6156 } |
5938 |
6157 |
5939 return state; |
6158 return state; |
5940 } |
6159 } |
6160 function collections() { |
|
6161 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
6162 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
6163 |
|
6164 switch (action.type) { |
|
6165 case 'ADD_BLOCK_COLLECTION': |
|
6166 return _objectSpread({}, state, Object(defineProperty["a" /* default */])({}, action.namespace, { |
|
6167 title: action.title, |
|
6168 icon: action.icon |
|
6169 })); |
|
6170 |
|
6171 case 'REMOVE_BLOCK_COLLECTION': |
|
6172 return Object(external_this_lodash_["omit"])(state, action.namespace); |
|
6173 } |
|
6174 |
|
6175 return state; |
|
6176 } |
|
5941 /* harmony default export */ var reducer = (Object(external_this_wp_data_["combineReducers"])({ |
6177 /* harmony default export */ var reducer = (Object(external_this_wp_data_["combineReducers"])({ |
5942 blockTypes: reducer_blockTypes, |
6178 blockTypes: reducer_blockTypes, |
5943 blockStyles: blockStyles, |
6179 blockStyles: blockStyles, |
6180 blockVariations: blockVariations, |
|
5944 defaultBlockName: reducer_defaultBlockName, |
6181 defaultBlockName: reducer_defaultBlockName, |
5945 freeformFallbackBlockName: freeformFallbackBlockName, |
6182 freeformFallbackBlockName: freeformFallbackBlockName, |
5946 unregisteredFallbackBlockName: unregisteredFallbackBlockName, |
6183 unregisteredFallbackBlockName: unregisteredFallbackBlockName, |
5947 categories: reducer_categories |
6184 groupingBlockName: groupingBlockName, |
6185 categories: reducer_categories, |
|
6186 collections: collections |
|
5948 })); |
6187 })); |
5949 |
6188 |
5950 // EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js |
6189 // EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js |
5951 var rememo = __webpack_require__(30); |
6190 var rememo = __webpack_require__(42); |
5952 |
6191 |
5953 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/selectors.js |
6192 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/selectors.js |
6193 |
|
6194 |
|
6195 |
|
6196 function selectors_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
|
6197 |
|
6198 function selectors_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { selectors_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { selectors_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
6199 |
|
5954 /** |
6200 /** |
5955 * External dependencies |
6201 * External dependencies |
5956 */ |
6202 */ |
5957 |
6203 |
6204 |
|
6205 /** @typedef {import('../api/registration').WPBlockVariation} WPBlockVariation */ |
|
6206 |
|
6207 /** @typedef {import('../api/registration').WPBlockVariationScope} WPBlockVariationScope */ |
|
6208 |
|
6209 /** @typedef {import('./reducer').WPBlockCategory} WPBlockCategory */ |
|
5958 |
6210 |
5959 /** |
6211 /** |
5960 * Given a block name or block type object, returns the corresponding |
6212 * Given a block name or block type object, returns the corresponding |
5961 * normalized block type object. |
6213 * normalized block type object. |
5962 * |
6214 * |
5977 * @return {Array} Block Types. |
6229 * @return {Array} Block Types. |
5978 */ |
6230 */ |
5979 |
6231 |
5980 |
6232 |
5981 var getBlockTypes = Object(rememo["a" /* default */])(function (state) { |
6233 var getBlockTypes = Object(rememo["a" /* default */])(function (state) { |
5982 return Object.values(state.blockTypes); |
6234 return Object.values(state.blockTypes).map(function (blockType) { |
6235 return selectors_objectSpread({}, blockType, { |
|
6236 variations: getBlockVariations(state, blockType.name) |
|
6237 }); |
|
6238 }); |
|
5983 }, function (state) { |
6239 }, function (state) { |
5984 return [state.blockTypes]; |
6240 return [state.blockTypes, state.blockVariations]; |
5985 }); |
6241 }); |
5986 /** |
6242 /** |
5987 * Returns a block type by name. |
6243 * Returns a block type by name. |
5988 * |
6244 * |
5989 * @param {Object} state Data state. |
6245 * @param {Object} state Data state. |
6006 |
6262 |
6007 function getBlockStyles(state, name) { |
6263 function getBlockStyles(state, name) { |
6008 return state.blockStyles[name]; |
6264 return state.blockStyles[name]; |
6009 } |
6265 } |
6010 /** |
6266 /** |
6267 * Returns block variations by block name. |
|
6268 * |
|
6269 * @param {Object} state Data state. |
|
6270 * @param {string} blockName Block type name. |
|
6271 * @param {WPBlockVariationScope} [scope] Block variation scope name. |
|
6272 * |
|
6273 * @return {(WPBlockVariation[]|void)} Block variations. |
|
6274 */ |
|
6275 |
|
6276 function getBlockVariations(state, blockName, scope) { |
|
6277 var variations = state.blockVariations[blockName]; |
|
6278 |
|
6279 if (!variations || !scope) { |
|
6280 return variations; |
|
6281 } |
|
6282 |
|
6283 return variations.filter(function (variation) { |
|
6284 return !variation.scope || variation.scope.includes(scope); |
|
6285 }); |
|
6286 } |
|
6287 /** |
|
6288 * Returns the default block variation for the given block type. |
|
6289 * When there are multiple variations annotated as the default one, |
|
6290 * the last added item is picked. This simplifies registering overrides. |
|
6291 * When there is no default variation set, it returns the first item. |
|
6292 * |
|
6293 * @param {Object} state Data state. |
|
6294 * @param {string} blockName Block type name. |
|
6295 * @param {WPBlockVariationScope} [scope] Block variation scope name. |
|
6296 * |
|
6297 * @return {?WPBlockVariation} The default block variation. |
|
6298 */ |
|
6299 |
|
6300 function getDefaultBlockVariation(state, blockName, scope) { |
|
6301 var variations = getBlockVariations(state, blockName, scope); |
|
6302 return Object(external_this_lodash_["findLast"])(variations, 'isDefault') || Object(external_this_lodash_["first"])(variations); |
|
6303 } |
|
6304 /** |
|
6011 * Returns all the available categories. |
6305 * Returns all the available categories. |
6012 * |
6306 * |
6013 * @param {Object} state Data state. |
6307 * @param {Object} state Data state. |
6014 * |
6308 * |
6015 * @return {Array} Categories list. |
6309 * @return {WPBlockCategory[]} Categories list. |
6016 */ |
6310 */ |
6017 |
6311 |
6018 function getCategories(state) { |
6312 function getCategories(state) { |
6019 return state.categories; |
6313 return state.categories; |
6020 } |
6314 } |
6021 /** |
6315 /** |
6316 * Returns all the available collections. |
|
6317 * |
|
6318 * @param {Object} state Data state. |
|
6319 * |
|
6320 * @return {Object} Collections list. |
|
6321 */ |
|
6322 |
|
6323 function getCollections(state) { |
|
6324 return state.collections; |
|
6325 } |
|
6326 /** |
|
6022 * Returns the name of the default block name. |
6327 * Returns the name of the default block name. |
6023 * |
6328 * |
6024 * @param {Object} state Data state. |
6329 * @param {Object} state Data state. |
6025 * |
6330 * |
6026 * @return {string?} Default block name. |
6331 * @return {string?} Default block name. |
6050 |
6355 |
6051 function getUnregisteredFallbackBlockName(state) { |
6356 function getUnregisteredFallbackBlockName(state) { |
6052 return state.unregisteredFallbackBlockName; |
6357 return state.unregisteredFallbackBlockName; |
6053 } |
6358 } |
6054 /** |
6359 /** |
6360 * Returns the name of the block for handling unregistered blocks. |
|
6361 * |
|
6362 * @param {Object} state Data state. |
|
6363 * |
|
6364 * @return {string?} Name of the block for handling unregistered blocks. |
|
6365 */ |
|
6366 |
|
6367 function getGroupingBlockName(state) { |
|
6368 return state.groupingBlockName; |
|
6369 } |
|
6370 /** |
|
6055 * Returns an array with the child blocks of a given block. |
6371 * Returns an array with the child blocks of a given block. |
6056 * |
6372 * |
6057 * @param {Object} state Data state. |
6373 * @param {Object} state Data state. |
6058 * @param {string} blockName Block type name. |
6374 * @param {string} blockName Block type name. |
6059 * |
6375 * |
6060 * @return {Array} Array of child block names. |
6376 * @return {Array} Array of child block names. |
6061 */ |
6377 */ |
6062 |
6378 |
6063 var selectors_getChildBlockNames = Object(rememo["a" /* default */])(function (state, blockName) { |
6379 var selectors_getChildBlockNames = Object(rememo["a" /* default */])(function (state, blockName) { |
6064 return Object(external_lodash_["map"])(Object(external_lodash_["filter"])(state.blockTypes, function (blockType) { |
6380 return Object(external_this_lodash_["map"])(Object(external_this_lodash_["filter"])(state.blockTypes, function (blockType) { |
6065 return Object(external_lodash_["includes"])(blockType.parent, blockName); |
6381 return Object(external_this_lodash_["includes"])(blockType.parent, blockName); |
6066 }), function (_ref) { |
6382 }), function (_ref) { |
6067 var name = _ref.name; |
6383 var name = _ref.name; |
6068 return name; |
6384 return name; |
6069 }); |
6385 }); |
6070 }, function (state) { |
6386 }, function (state) { |
6082 * @return {?*} Block support value |
6398 * @return {?*} Block support value |
6083 */ |
6399 */ |
6084 |
6400 |
6085 var selectors_getBlockSupport = function getBlockSupport(state, nameOrType, feature, defaultSupports) { |
6401 var selectors_getBlockSupport = function getBlockSupport(state, nameOrType, feature, defaultSupports) { |
6086 var blockType = getNormalizedBlockType(state, nameOrType); |
6402 var blockType = getNormalizedBlockType(state, nameOrType); |
6087 return Object(external_lodash_["get"])(blockType, ['supports', feature], defaultSupports); |
6403 return Object(external_this_lodash_["get"])(blockType, ['supports'].concat(Object(toConsumableArray["a" /* default */])(feature.split('.'))), defaultSupports); |
6088 }; |
6404 }; |
6089 /** |
6405 /** |
6090 * Returns true if the block defines support for a feature, or false otherwise. |
6406 * Returns true if the block defines support for a feature, or false otherwise. |
6091 * |
6407 * |
6092 * @param {Object} state Data state. |
6408 * @param {Object} state Data state. |
6107 * |
6423 * |
6108 * @param {Object} state Blocks state. |
6424 * @param {Object} state Blocks state. |
6109 * @param {(string|Object)} nameOrType Block name or type object. |
6425 * @param {(string|Object)} nameOrType Block name or type object. |
6110 * @param {string} searchTerm Search term by which to filter. |
6426 * @param {string} searchTerm Search term by which to filter. |
6111 * |
6427 * |
6112 * @return {Object[]} Wheter block type matches search term. |
6428 * @return {Object[]} Whether block type matches search term. |
6113 */ |
6429 */ |
6114 |
6430 |
6115 function isMatchingSearchTerm(state, nameOrType, searchTerm) { |
6431 function isMatchingSearchTerm(state, nameOrType, searchTerm) { |
6116 var blockType = getNormalizedBlockType(state, nameOrType); |
6432 var blockType = getNormalizedBlockType(state, nameOrType); |
6117 var getNormalizedSearchTerm = Object(external_lodash_["flow"])([// Disregard diacritics. |
6433 var getNormalizedSearchTerm = Object(external_this_lodash_["flow"])([// Disregard diacritics. |
6118 // Input: "média" |
6434 // Input: "média" |
6119 external_lodash_["deburr"], // Lowercase. |
6435 external_this_lodash_["deburr"], // Lowercase. |
6120 // Input: "MEDIA" |
6436 // Input: "MEDIA" |
6121 function (term) { |
6437 function (term) { |
6122 return term.toLowerCase(); |
6438 return term.toLowerCase(); |
6123 }, // Strip leading and trailing whitespace. |
6439 }, // Strip leading and trailing whitespace. |
6124 // Input: " media " |
6440 // Input: " media " |
6125 function (term) { |
6441 function (term) { |
6126 return term.trim(); |
6442 return term.trim(); |
6127 }]); |
6443 }]); |
6128 var normalizedSearchTerm = getNormalizedSearchTerm(searchTerm); |
6444 var normalizedSearchTerm = getNormalizedSearchTerm(searchTerm); |
6129 var isSearchMatch = Object(external_lodash_["flow"])([getNormalizedSearchTerm, function (normalizedCandidate) { |
6445 var isSearchMatch = Object(external_this_lodash_["flow"])([getNormalizedSearchTerm, function (normalizedCandidate) { |
6130 return Object(external_lodash_["includes"])(normalizedCandidate, normalizedSearchTerm); |
6446 return Object(external_this_lodash_["includes"])(normalizedCandidate, normalizedSearchTerm); |
6131 }]); |
6447 }]); |
6132 return isSearchMatch(blockType.title) || Object(external_lodash_["some"])(blockType.keywords, isSearchMatch) || isSearchMatch(blockType.category); |
6448 return isSearchMatch(blockType.title) || Object(external_this_lodash_["some"])(blockType.keywords, isSearchMatch) || isSearchMatch(blockType.category); |
6133 } |
6449 } |
6134 /** |
6450 /** |
6135 * Returns a boolean indicating if a block has child blocks or not. |
6451 * Returns a boolean indicating if a block has child blocks or not. |
6136 * |
6452 * |
6137 * @param {Object} state Data state. |
6453 * @param {Object} state Data state. |
6152 * @return {boolean} True if a block contains at least one child blocks with inserter support |
6468 * @return {boolean} True if a block contains at least one child blocks with inserter support |
6153 * and false otherwise. |
6469 * and false otherwise. |
6154 */ |
6470 */ |
6155 |
6471 |
6156 var selectors_hasChildBlocksWithInserterSupport = function hasChildBlocksWithInserterSupport(state, blockName) { |
6472 var selectors_hasChildBlocksWithInserterSupport = function hasChildBlocksWithInserterSupport(state, blockName) { |
6157 return Object(external_lodash_["some"])(selectors_getChildBlockNames(state, blockName), function (childBlockName) { |
6473 return Object(external_this_lodash_["some"])(selectors_getChildBlockNames(state, blockName), function (childBlockName) { |
6158 return hasBlockSupport(state, childBlockName, 'inserter', true); |
6474 return hasBlockSupport(state, childBlockName, 'inserter', true); |
6159 }); |
6475 }); |
6160 }; |
6476 }; |
6161 |
6477 |
6162 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/actions.js |
6478 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/actions.js |
6163 /** |
6479 /** |
6164 * External dependencies |
6480 * External dependencies |
6165 */ |
6481 */ |
6166 |
6482 |
6483 /** @typedef {import('../api/registration').WPBlockVariation} WPBlockVariation */ |
|
6484 |
|
6167 /** |
6485 /** |
6168 * Returns an action object used in signalling that block types have been added. |
6486 * Returns an action object used in signalling that block types have been added. |
6169 * |
6487 * |
6170 * @param {Array|Object} blockTypes Block types received. |
6488 * @param {Array|Object} blockTypes Block types received. |
6171 * |
6489 * |
6173 */ |
6491 */ |
6174 |
6492 |
6175 function addBlockTypes(blockTypes) { |
6493 function addBlockTypes(blockTypes) { |
6176 return { |
6494 return { |
6177 type: 'ADD_BLOCK_TYPES', |
6495 type: 'ADD_BLOCK_TYPES', |
6178 blockTypes: Object(external_lodash_["castArray"])(blockTypes) |
6496 blockTypes: Object(external_this_lodash_["castArray"])(blockTypes) |
6179 }; |
6497 }; |
6180 } |
6498 } |
6181 /** |
6499 /** |
6182 * Returns an action object used to remove a registered block type. |
6500 * Returns an action object used to remove a registered block type. |
6183 * |
6501 * |
6187 */ |
6505 */ |
6188 |
6506 |
6189 function removeBlockTypes(names) { |
6507 function removeBlockTypes(names) { |
6190 return { |
6508 return { |
6191 type: 'REMOVE_BLOCK_TYPES', |
6509 type: 'REMOVE_BLOCK_TYPES', |
6192 names: Object(external_lodash_["castArray"])(names) |
6510 names: Object(external_this_lodash_["castArray"])(names) |
6193 }; |
6511 }; |
6194 } |
6512 } |
6195 /** |
6513 /** |
6196 * Returns an action object used in signalling that new block styles have been added. |
6514 * Returns an action object used in signalling that new block styles have been added. |
6197 * |
6515 * |
6202 */ |
6520 */ |
6203 |
6521 |
6204 function addBlockStyles(blockName, styles) { |
6522 function addBlockStyles(blockName, styles) { |
6205 return { |
6523 return { |
6206 type: 'ADD_BLOCK_STYLES', |
6524 type: 'ADD_BLOCK_STYLES', |
6207 styles: Object(external_lodash_["castArray"])(styles), |
6525 styles: Object(external_this_lodash_["castArray"])(styles), |
6208 blockName: blockName |
6526 blockName: blockName |
6209 }; |
6527 }; |
6210 } |
6528 } |
6211 /** |
6529 /** |
6212 * Returns an action object used in signalling that block styles have been removed. |
6530 * Returns an action object used in signalling that block styles have been removed. |
6218 */ |
6536 */ |
6219 |
6537 |
6220 function removeBlockStyles(blockName, styleNames) { |
6538 function removeBlockStyles(blockName, styleNames) { |
6221 return { |
6539 return { |
6222 type: 'REMOVE_BLOCK_STYLES', |
6540 type: 'REMOVE_BLOCK_STYLES', |
6223 styleNames: Object(external_lodash_["castArray"])(styleNames), |
6541 styleNames: Object(external_this_lodash_["castArray"])(styleNames), |
6542 blockName: blockName |
|
6543 }; |
|
6544 } |
|
6545 /** |
|
6546 * Returns an action object used in signalling that new block variations have been added. |
|
6547 * |
|
6548 * @param {string} blockName Block name. |
|
6549 * @param {WPBlockVariation|WPBlockVariation[]} variations Block variations. |
|
6550 * |
|
6551 * @return {Object} Action object. |
|
6552 */ |
|
6553 |
|
6554 function addBlockVariations(blockName, variations) { |
|
6555 return { |
|
6556 type: 'ADD_BLOCK_VARIATIONS', |
|
6557 variations: Object(external_this_lodash_["castArray"])(variations), |
|
6558 blockName: blockName |
|
6559 }; |
|
6560 } |
|
6561 /** |
|
6562 * Returns an action object used in signalling that block variations have been removed. |
|
6563 * |
|
6564 * @param {string} blockName Block name. |
|
6565 * @param {string|string[]} variationNames Block variation names. |
|
6566 * |
|
6567 * @return {Object} Action object. |
|
6568 */ |
|
6569 |
|
6570 function removeBlockVariations(blockName, variationNames) { |
|
6571 return { |
|
6572 type: 'REMOVE_BLOCK_VARIATIONS', |
|
6573 variationNames: Object(external_this_lodash_["castArray"])(variationNames), |
|
6224 blockName: blockName |
6574 blockName: blockName |
6225 }; |
6575 }; |
6226 } |
6576 } |
6227 /** |
6577 /** |
6228 * Returns an action object used to set the default block name. |
6578 * Returns an action object used to set the default block name. |
6263 */ |
6613 */ |
6264 |
6614 |
6265 function setUnregisteredFallbackBlockName(name) { |
6615 function setUnregisteredFallbackBlockName(name) { |
6266 return { |
6616 return { |
6267 type: 'SET_UNREGISTERED_FALLBACK_BLOCK_NAME', |
6617 type: 'SET_UNREGISTERED_FALLBACK_BLOCK_NAME', |
6618 name: name |
|
6619 }; |
|
6620 } |
|
6621 /** |
|
6622 * Returns an action object used to set the name of the block used |
|
6623 * when grouping other blocks |
|
6624 * eg: in "Group/Ungroup" interactions |
|
6625 * |
|
6626 * @param {string} name Block name. |
|
6627 * |
|
6628 * @return {Object} Action object. |
|
6629 */ |
|
6630 |
|
6631 function setGroupingBlockName(name) { |
|
6632 return { |
|
6633 type: 'SET_GROUPING_BLOCK_NAME', |
|
6268 name: name |
6634 name: name |
6269 }; |
6635 }; |
6270 } |
6636 } |
6271 /** |
6637 /** |
6272 * Returns an action object used to set block categories. |
6638 * Returns an action object used to set block categories. |
6296 type: 'UPDATE_CATEGORY', |
6662 type: 'UPDATE_CATEGORY', |
6297 slug: slug, |
6663 slug: slug, |
6298 category: category |
6664 category: category |
6299 }; |
6665 }; |
6300 } |
6666 } |
6667 /** |
|
6668 * Returns an action object used to add block collections |
|
6669 * |
|
6670 * @param {string} namespace The namespace of the blocks to put in the collection |
|
6671 * @param {string} title The title to display in the block inserter |
|
6672 * @param {Object} icon (optional) The icon to display in the block inserter |
|
6673 * |
|
6674 * @return {Object} Action object. |
|
6675 */ |
|
6676 |
|
6677 function addBlockCollection(namespace, title, icon) { |
|
6678 return { |
|
6679 type: 'ADD_BLOCK_COLLECTION', |
|
6680 namespace: namespace, |
|
6681 title: title, |
|
6682 icon: icon |
|
6683 }; |
|
6684 } |
|
6685 /** |
|
6686 * Returns an action object used to remove block collections |
|
6687 * |
|
6688 * @param {string} namespace The namespace of the blocks to put in the collection |
|
6689 * |
|
6690 * @return {Object} Action object. |
|
6691 */ |
|
6692 |
|
6693 function removeBlockCollection(namespace) { |
|
6694 return { |
|
6695 type: 'REMOVE_BLOCK_COLLECTION', |
|
6696 namespace: namespace |
|
6697 }; |
|
6698 } |
|
6301 |
6699 |
6302 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/index.js |
6700 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/index.js |
6303 /** |
6701 /** |
6304 * WordPress dependencies |
6702 * WordPress dependencies |
6305 */ |
6703 */ |
6315 reducer: reducer, |
6713 reducer: reducer, |
6316 selectors: selectors_namespaceObject, |
6714 selectors: selectors_namespaceObject, |
6317 actions: actions_namespaceObject |
6715 actions: actions_namespaceObject |
6318 }); |
6716 }); |
6319 |
6717 |
6320 // EXTERNAL MODULE: ./node_modules/uuid/v4.js |
6718 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/node_modules/uuid/dist/esm-browser/rng.js |
6321 var v4 = __webpack_require__(65); |
6719 // Unique ID creation requires a high quality random # generator. In the browser we therefore |
6322 var v4_default = /*#__PURE__*/__webpack_require__.n(v4); |
6720 // require the crypto API and do not support built-in fallback to lower quality random number |
6323 |
6721 // generators (like Math.random()). |
6722 // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also, |
|
6723 // find the complete implementation of crypto (msCrypto) on IE11. |
|
6724 var getRandomValues = typeof crypto != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto != 'undefined' && typeof msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto); |
|
6725 var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef |
|
6726 |
|
6727 function rng() { |
|
6728 if (!getRandomValues) { |
|
6729 throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); |
|
6730 } |
|
6731 |
|
6732 return getRandomValues(rnds8); |
|
6733 } |
|
6734 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/node_modules/uuid/dist/esm-browser/bytesToUuid.js |
|
6735 /** |
|
6736 * Convert array of 16 byte values to UUID string format of the form: |
|
6737 * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX |
|
6738 */ |
|
6739 var byteToHex = []; |
|
6740 |
|
6741 for (var bytesToUuid_i = 0; bytesToUuid_i < 256; ++bytesToUuid_i) { |
|
6742 byteToHex[bytesToUuid_i] = (bytesToUuid_i + 0x100).toString(16).substr(1); |
|
6743 } |
|
6744 |
|
6745 function bytesToUuid(buf, offset) { |
|
6746 var i = offset || 0; |
|
6747 var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 |
|
6748 |
|
6749 return [bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]].join(''); |
|
6750 } |
|
6751 |
|
6752 /* harmony default export */ var esm_browser_bytesToUuid = (bytesToUuid); |
|
6753 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/node_modules/uuid/dist/esm-browser/v4.js |
|
6754 |
|
6755 |
|
6756 |
|
6757 function v4(options, buf, offset) { |
|
6758 var i = buf && offset || 0; |
|
6759 |
|
6760 if (typeof options == 'string') { |
|
6761 buf = options === 'binary' ? new Array(16) : null; |
|
6762 options = null; |
|
6763 } |
|
6764 |
|
6765 options = options || {}; |
|
6766 var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` |
|
6767 |
|
6768 rnds[6] = rnds[6] & 0x0f | 0x40; |
|
6769 rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided |
|
6770 |
|
6771 if (buf) { |
|
6772 for (var ii = 0; ii < 16; ++ii) { |
|
6773 buf[i + ii] = rnds[ii]; |
|
6774 } |
|
6775 } |
|
6776 |
|
6777 return buf || esm_browser_bytesToUuid(rnds); |
|
6778 } |
|
6779 |
|
6780 /* harmony default export */ var esm_browser_v4 = (v4); |
|
6324 // EXTERNAL MODULE: external {"this":["wp","hooks"]} |
6781 // EXTERNAL MODULE: external {"this":["wp","hooks"]} |
6325 var external_this_wp_hooks_ = __webpack_require__(26); |
6782 var external_this_wp_hooks_ = __webpack_require__(32); |
6783 |
|
6784 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/block-default.js |
|
6785 var block_default = __webpack_require__(202); |
|
6326 |
6786 |
6327 // EXTERNAL MODULE: ./node_modules/tinycolor2/tinycolor.js |
6787 // EXTERNAL MODULE: ./node_modules/tinycolor2/tinycolor.js |
6328 var tinycolor = __webpack_require__(45); |
6788 var tinycolor = __webpack_require__(66); |
6329 var tinycolor_default = /*#__PURE__*/__webpack_require__.n(tinycolor); |
6789 var tinycolor_default = /*#__PURE__*/__webpack_require__.n(tinycolor); |
6330 |
6790 |
6331 // EXTERNAL MODULE: external {"this":["wp","element"]} |
6791 // EXTERNAL MODULE: external {"this":["wp","element"]} |
6332 var external_this_wp_element_ = __webpack_require__(0); |
6792 var external_this_wp_element_ = __webpack_require__(0); |
6333 |
6793 |
6794 // EXTERNAL MODULE: external {"this":["wp","dom"]} |
|
6795 var external_this_wp_dom_ = __webpack_require__(30); |
|
6796 |
|
6334 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/utils.js |
6797 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/utils.js |
6335 |
6798 |
6336 |
6799 |
6800 function utils_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
|
6801 |
|
6802 function utils_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { utils_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { utils_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
6803 |
|
6337 /** |
6804 /** |
6338 * External dependencies |
6805 * External dependencies |
6339 */ |
6806 */ |
6340 |
6807 |
6341 |
6808 |
6342 /** |
6809 /** |
6343 * WordPress dependencies |
6810 * WordPress dependencies |
6344 */ |
6811 */ |
6812 |
|
6813 |
|
6345 |
6814 |
6346 |
6815 |
6347 /** |
6816 /** |
6348 * Internal dependencies |
6817 * Internal dependencies |
6349 */ |
6818 */ |
6381 isUnmodifiedDefaultBlock.block = createBlock(defaultBlockName); |
6850 isUnmodifiedDefaultBlock.block = createBlock(defaultBlockName); |
6382 } |
6851 } |
6383 |
6852 |
6384 var newDefaultBlock = isUnmodifiedDefaultBlock.block; |
6853 var newDefaultBlock = isUnmodifiedDefaultBlock.block; |
6385 var blockType = registration_getBlockType(defaultBlockName); |
6854 var blockType = registration_getBlockType(defaultBlockName); |
6386 return Object(external_lodash_["every"])(blockType.attributes, function (value, key) { |
6855 return Object(external_this_lodash_["every"])(blockType.attributes, function (value, key) { |
6387 return newDefaultBlock.attributes[key] === block.attributes[key]; |
6856 return newDefaultBlock.attributes[key] === block.attributes[key]; |
6388 }); |
6857 }); |
6389 } |
6858 } |
6390 /** |
6859 /** |
6391 * Function that checks if the parameter is a valid icon. |
6860 * Function that checks if the parameter is a valid icon. |
6394 * |
6863 * |
6395 * @return {boolean} True if the parameter is a valid icon and false otherwise. |
6864 * @return {boolean} True if the parameter is a valid icon and false otherwise. |
6396 */ |
6865 */ |
6397 |
6866 |
6398 function isValidIcon(icon) { |
6867 function isValidIcon(icon) { |
6399 return !!icon && (Object(external_lodash_["isString"])(icon) || Object(external_this_wp_element_["isValidElement"])(icon) || Object(external_lodash_["isFunction"])(icon) || icon instanceof external_this_wp_element_["Component"]); |
6868 return !!icon && (Object(external_this_lodash_["isString"])(icon) || Object(external_this_wp_element_["isValidElement"])(icon) || Object(external_this_lodash_["isFunction"])(icon) || icon instanceof external_this_wp_element_["Component"]); |
6400 } |
6869 } |
6401 /** |
6870 /** |
6402 * Function that receives an icon as set by the blocks during the registration |
6871 * Function that receives an icon as set by the blocks during the registration |
6403 * and returns a new icon object that is normalized so we can rely on just on possible icon structure |
6872 * and returns a new icon object that is normalized so we can rely on just on possible icon structure |
6404 * in the codebase. |
6873 * in the codebase. |
6405 * |
6874 * |
6406 * @param {(Object|string|WPElement)} icon Slug of the Dashicon to be shown |
6875 * @param {WPBlockTypeIconRender} icon Render behavior of a block type icon; |
6407 * as the icon for the block in the |
6876 * one of a Dashicon slug, an element, or a |
6408 * inserter, or element or an object describing the icon. |
6877 * component. |
6409 * |
6878 * |
6410 * @return {Object} Object describing the icon. |
6879 * @return {WPBlockTypeIconDescriptor} Object describing the icon. |
6411 */ |
6880 */ |
6412 |
6881 |
6413 function normalizeIconObject(icon) { |
6882 function normalizeIconObject(icon) { |
6414 if (!icon) { |
|
6415 icon = 'block-default'; |
|
6416 } |
|
6417 |
|
6418 if (isValidIcon(icon)) { |
6883 if (isValidIcon(icon)) { |
6419 return { |
6884 return { |
6420 src: icon |
6885 src: icon |
6421 }; |
6886 }; |
6422 } |
6887 } |
6423 |
6888 |
6424 if (Object(external_lodash_["has"])(icon, ['background'])) { |
6889 if (Object(external_this_lodash_["has"])(icon, ['background'])) { |
6425 var tinyBgColor = tinycolor_default()(icon.background); |
6890 var tinyBgColor = tinycolor_default()(icon.background); |
6426 return Object(objectSpread["a" /* default */])({}, icon, { |
6891 return utils_objectSpread({}, icon, { |
6427 foreground: icon.foreground ? icon.foreground : Object(tinycolor["mostReadable"])(tinyBgColor, ICON_COLORS, { |
6892 foreground: icon.foreground ? icon.foreground : Object(tinycolor["mostReadable"])(tinyBgColor, ICON_COLORS, { |
6428 includeFallbackColors: true, |
6893 includeFallbackColors: true, |
6429 level: 'AA', |
6894 level: 'AA', |
6430 size: 'large' |
6895 size: 'large' |
6431 }).toHexString(), |
6896 }).toHexString(), |
6444 * |
6909 * |
6445 * @return {?Object} Block type. |
6910 * @return {?Object} Block type. |
6446 */ |
6911 */ |
6447 |
6912 |
6448 function normalizeBlockType(blockTypeOrName) { |
6913 function normalizeBlockType(blockTypeOrName) { |
6449 if (Object(external_lodash_["isString"])(blockTypeOrName)) { |
6914 if (Object(external_this_lodash_["isString"])(blockTypeOrName)) { |
6450 return registration_getBlockType(blockTypeOrName); |
6915 return registration_getBlockType(blockTypeOrName); |
6451 } |
6916 } |
6452 |
6917 |
6453 return blockTypeOrName; |
6918 return blockTypeOrName; |
6454 } |
6919 } |
6920 /** |
|
6921 * Get the label for the block, usually this is either the block title, |
|
6922 * or the value of the block's `label` function when that's specified. |
|
6923 * |
|
6924 * @param {Object} blockType The block type. |
|
6925 * @param {Object} attributes The values of the block's attributes. |
|
6926 * @param {Object} context The intended use for the label. |
|
6927 * |
|
6928 * @return {string} The block label. |
|
6929 */ |
|
6930 |
|
6931 function getBlockLabel(blockType, attributes) { |
|
6932 var context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'visual'; |
|
6933 var getLabel = blockType.__experimentalLabel, |
|
6934 title = blockType.title; |
|
6935 var label = getLabel && getLabel(attributes, { |
|
6936 context: context |
|
6937 }); |
|
6938 |
|
6939 if (!label) { |
|
6940 return title; |
|
6941 } // Strip any HTML (i.e. RichText formatting) before returning. |
|
6942 |
|
6943 |
|
6944 return Object(external_this_wp_dom_["__unstableStripHTML"])(label); |
|
6945 } |
|
6946 /** |
|
6947 * Get a label for the block for use by screenreaders, this is more descriptive |
|
6948 * than the visual label and includes the block title and the value of the |
|
6949 * `getLabel` function if it's specified. |
|
6950 * |
|
6951 * @param {Object} blockType The block type. |
|
6952 * @param {Object} attributes The values of the block's attributes. |
|
6953 * @param {?number} position The position of the block in the block list. |
|
6954 * @param {string} [direction='vertical'] The direction of the block layout. |
|
6955 * |
|
6956 * @return {string} The block label. |
|
6957 */ |
|
6958 |
|
6959 function getAccessibleBlockLabel(blockType, attributes, position) { |
|
6960 var direction = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'vertical'; |
|
6961 // `title` is already localized, `label` is a user-supplied value. |
|
6962 var title = blockType.title; |
|
6963 var label = getBlockLabel(blockType, attributes, 'accessibility'); |
|
6964 var hasPosition = position !== undefined; // getBlockLabel returns the block title as a fallback when there's no label, |
|
6965 // if it did return the title, this function needs to avoid adding the |
|
6966 // title twice within the accessible label. Use this `hasLabel` boolean to |
|
6967 // handle that. |
|
6968 |
|
6969 var hasLabel = label && label !== title; |
|
6970 |
|
6971 if (hasPosition && direction === 'vertical') { |
|
6972 if (hasLabel) { |
|
6973 return Object(external_this_wp_i18n_["sprintf"])( |
|
6974 /* translators: accessibility text. 1: The block title. 2: The block row number. 3: The block label.. */ |
|
6975 Object(external_this_wp_i18n_["__"])('%1$s Block. Row %2$d. %3$s'), title, position, label); |
|
6976 } |
|
6977 |
|
6978 return Object(external_this_wp_i18n_["sprintf"])( |
|
6979 /* translators: accessibility text. 1: The block title. 2: The block row number. */ |
|
6980 Object(external_this_wp_i18n_["__"])('%1$s Block. Row %2$d'), title, position); |
|
6981 } else if (hasPosition && direction === 'horizontal') { |
|
6982 if (hasLabel) { |
|
6983 return Object(external_this_wp_i18n_["sprintf"])( |
|
6984 /* translators: accessibility text. 1: The block title. 2: The block column number. 3: The block label.. */ |
|
6985 Object(external_this_wp_i18n_["__"])('%1$s Block. Column %2$d. %3$s'), title, position, label); |
|
6986 } |
|
6987 |
|
6988 return Object(external_this_wp_i18n_["sprintf"])( |
|
6989 /* translators: accessibility text. 1: The block title. 2: The block column number. */ |
|
6990 Object(external_this_wp_i18n_["__"])('%1$s Block. Column %2$d'), title, position); |
|
6991 } |
|
6992 |
|
6993 if (hasLabel) { |
|
6994 return Object(external_this_wp_i18n_["sprintf"])( |
|
6995 /* translators: accessibility text. %1: The block title. %2: The block label. */ |
|
6996 Object(external_this_wp_i18n_["__"])('%1$s Block. %2$s'), title, label); |
|
6997 } |
|
6998 |
|
6999 return Object(external_this_wp_i18n_["sprintf"])( |
|
7000 /* translators: accessibility text. %s: The block title. */ |
|
7001 Object(external_this_wp_i18n_["__"])('%s Block'), title); |
|
7002 } |
|
7003 |
|
7004 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/constants.js |
|
7005 /** |
|
7006 * Array of valid keys in a block type settings deprecation object. |
|
7007 * |
|
7008 * @type {string[]} |
|
7009 */ |
|
7010 var DEPRECATED_ENTRY_KEYS = ['attributes', 'supports', 'save', 'migrate', 'isEligible']; |
|
6455 |
7011 |
6456 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/registration.js |
7012 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/registration.js |
6457 |
7013 |
6458 |
7014 |
6459 /* eslint no-console: [ 'error', { allow: [ 'error' ] } ] */ |
7015 function registration_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
7016 |
|
7017 function registration_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { registration_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { registration_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
7018 |
|
7019 /* eslint no-console: [ 'error', { allow: [ 'error', 'warn' ] } ] */ |
|
6460 |
7020 |
6461 /** |
7021 /** |
6462 * External dependencies |
7022 * External dependencies |
6463 */ |
7023 */ |
6464 |
7024 |
6466 * WordPress dependencies |
7026 * WordPress dependencies |
6467 */ |
7027 */ |
6468 |
7028 |
6469 |
7029 |
6470 |
7030 |
7031 |
|
6471 /** |
7032 /** |
6472 * Internal dependencies |
7033 * Internal dependencies |
6473 */ |
7034 */ |
6474 |
7035 |
6475 |
7036 |
7037 |
|
7038 /** |
|
7039 * An icon type definition. One of a Dashicon slug, an element, |
|
7040 * or a component. |
|
7041 * |
|
7042 * @typedef {(string|WPElement|WPComponent)} WPIcon |
|
7043 * |
|
7044 * @see https://developer.wordpress.org/resource/dashicons/ |
|
7045 */ |
|
7046 |
|
7047 /** |
|
7048 * Render behavior of a block type icon; one of a Dashicon slug, an element, |
|
7049 * or a component. |
|
7050 * |
|
7051 * @typedef {WPIcon} WPBlockTypeIconRender |
|
7052 */ |
|
7053 |
|
7054 /** |
|
7055 * An object describing a normalized block type icon. |
|
7056 * |
|
7057 * @typedef {Object} WPBlockTypeIconDescriptor |
|
7058 * |
|
7059 * @property {WPBlockTypeIconRender} src Render behavior of the icon, |
|
7060 * one of a Dashicon slug, an |
|
7061 * element, or a component. |
|
7062 * @property {string} background Optimal background hex string |
|
7063 * color when displaying icon. |
|
7064 * @property {string} foreground Optimal foreground hex string |
|
7065 * color when displaying icon. |
|
7066 * @property {string} shadowColor Optimal shadow hex string |
|
7067 * color when displaying icon. |
|
7068 */ |
|
7069 |
|
7070 /** |
|
7071 * Value to use to render the icon for a block type in an editor interface, |
|
7072 * either a Dashicon slug, an element, a component, or an object describing |
|
7073 * the icon. |
|
7074 * |
|
7075 * @typedef {(WPBlockTypeIconDescriptor|WPBlockTypeIconRender)} WPBlockTypeIcon |
|
7076 */ |
|
7077 |
|
7078 /** |
|
7079 * Named block variation scopes. |
|
7080 * |
|
7081 * @typedef {'block'|'inserter'} WPBlockVariationScope |
|
7082 */ |
|
7083 |
|
7084 /** |
|
7085 * An object describing a variation defined for the block type. |
|
7086 * |
|
7087 * @typedef {Object} WPBlockVariation |
|
7088 * |
|
7089 * @property {string} name The unique and machine-readable name. |
|
7090 * @property {string} title A human-readable variation title. |
|
7091 * @property {string} [description] A detailed variation description. |
|
7092 * @property {WPIcon} [icon] An icon helping to visualize the variation. |
|
7093 * @property {boolean} [isDefault] Indicates whether the current variation is |
|
7094 * the default one. Defaults to `false`. |
|
7095 * @property {Object} [attributes] Values which override block attributes. |
|
7096 * @property {Array[]} [innerBlocks] Initial configuration of nested blocks. |
|
7097 * @property {Object} [example] Example provides structured data for |
|
7098 * the block preview. You can set to |
|
7099 * `undefined` to disable the preview shown |
|
7100 * for the block type. |
|
7101 * @property {WPBlockVariationScope[]} [scope] The list of scopes where the variation |
|
7102 * is applicable. When not provided, it |
|
7103 * assumes all available scopes. |
|
7104 */ |
|
7105 |
|
6476 /** |
7106 /** |
6477 * Defined behavior of a block type. |
7107 * Defined behavior of a block type. |
6478 * |
7108 * |
6479 * @typedef {WPBlockType} |
7109 * @typedef {Object} WPBlock |
6480 * |
7110 * |
6481 * @property {string} name Block's namespaced name. |
7111 * @property {string} name Block type's namespaced name. |
6482 * @property {string} title Human-readable label for a block. |
7112 * @property {string} title Human-readable block type label. |
6483 * Shown in the block inserter. |
7113 * @property {string} [description] A detailed block type description. |
6484 * @property {string} category Category classification of block, |
7114 * @property {string} [category] Block type category classification, |
6485 * impacting where block is shown in |
7115 * used in search interfaces to arrange |
6486 * inserter results. |
7116 * block types by category. |
6487 * @property {(Object|string|WPElement)} icon Slug of the Dashicon to be shown |
7117 * @property {WPBlockTypeIcon} [icon] Block type icon. |
6488 * as the icon for the block in the |
7118 * @property {string[]} [keywords] Additional keywords to produce block |
6489 * inserter, or element or an object describing the icon. |
7119 * type as result in search interfaces. |
6490 * @property {?string[]} keywords Additional keywords to produce |
7120 * @property {Object} [attributes] Block type attributes. |
6491 * block as inserter search result. |
7121 * @property {WPComponent} [save] Optional component describing |
6492 * @property {?Object} attributes Block attributes. |
7122 * serialized markup structure of a |
6493 * @property {Function} save Serialize behavior of a block, |
7123 * block type. |
6494 * returning an element describing |
7124 * @property {WPComponent} edit Component rendering an element to |
6495 * structure of the block's post |
7125 * manipulate the attributes of a block |
6496 * content markup. |
7126 * in the context of an editor. |
6497 * @property {WPComponent} edit Component rendering element to be |
7127 * @property {WPBlockVariation[]} [variations] The list of block variations. |
6498 * interacted with in an editor. |
7128 * @property {Object} [example] Example provides structured data for |
6499 */ |
7129 * the block preview. When not defined |
6500 |
7130 * then no preview is shown. |
7131 */ |
|
7132 |
|
7133 /** |
|
7134 * Mapping of legacy category slugs to their latest normal values, used to |
|
7135 * accommodate updates of the default set of block categories. |
|
7136 * |
|
7137 * @type {Record<string,string>} |
|
7138 */ |
|
7139 |
|
7140 var LEGACY_CATEGORY_MAPPING = { |
|
7141 common: 'text', |
|
7142 formatting: 'text', |
|
7143 layout: 'design' |
|
7144 }; |
|
6501 var serverSideBlockDefinitions = {}; |
7145 var serverSideBlockDefinitions = {}; |
6502 /** |
7146 /** |
6503 * Set the server side block definition of blocks. |
7147 * Sets the server side block definition of blocks. |
6504 * |
7148 * |
6505 * @param {Object} definitions Server-side block definitions |
7149 * @param {Object} definitions Server-side block definitions |
6506 */ |
7150 */ |
7151 // eslint-disable-next-line camelcase |
|
6507 |
7152 |
6508 function unstable__bootstrapServerSideBlockDefinitions(definitions) { |
7153 function unstable__bootstrapServerSideBlockDefinitions(definitions) { |
6509 // eslint-disable-line camelcase |
7154 serverSideBlockDefinitions = registration_objectSpread({}, serverSideBlockDefinitions, {}, definitions); |
6510 serverSideBlockDefinitions = definitions; |
|
6511 } |
7155 } |
6512 /** |
7156 /** |
6513 * Registers a new block provided a unique name and an object defining its |
7157 * Registers a new block provided a unique name and an object defining its |
6514 * behavior. Once registered, the block is made available as an option to any |
7158 * behavior. Once registered, the block is made available as an option to any |
6515 * editor interface where blocks are implemented. |
7159 * editor interface where blocks are implemented. |
6516 * |
7160 * |
6517 * @param {string} name Block name. |
7161 * @param {string} name Block name. |
6518 * @param {Object} settings Block settings. |
7162 * @param {Object} settings Block settings. |
6519 * |
7163 * |
6520 * @return {?WPBlock} The block, if it has been successfully registered; |
7164 * @return {?WPBlock} The block, if it has been successfully registered; |
6521 * otherwise `undefined`. |
7165 * otherwise `undefined`. |
6522 */ |
7166 */ |
6523 |
7167 |
6524 function registerBlockType(name, settings) { |
7168 function registerBlockType(name, settings) { |
6525 settings = Object(objectSpread["a" /* default */])({ |
7169 settings = registration_objectSpread({ |
6526 name: name |
7170 name: name, |
6527 }, Object(external_lodash_["get"])(serverSideBlockDefinitions, name), settings); |
7171 icon: block_default["a" /* default */], |
7172 keywords: [], |
|
7173 attributes: {}, |
|
7174 providesContext: {}, |
|
7175 usesContext: [], |
|
7176 supports: {}, |
|
7177 styles: [], |
|
7178 save: function save() { |
|
7179 return null; |
|
7180 } |
|
7181 }, Object(external_this_lodash_["pickBy"])(Object(external_this_lodash_["get"])(serverSideBlockDefinitions, name, {}), function (value) { |
|
7182 return !Object(external_this_lodash_["isNil"])(value); |
|
7183 }), {}, settings); |
|
6528 |
7184 |
6529 if (typeof name !== 'string') { |
7185 if (typeof name !== 'string') { |
6530 console.error('Block names must be strings.'); |
7186 console.error('Block names must be strings.'); |
6531 return; |
7187 return; |
6532 } |
7188 } |
6539 if (Object(external_this_wp_data_["select"])('core/blocks').getBlockType(name)) { |
7195 if (Object(external_this_wp_data_["select"])('core/blocks').getBlockType(name)) { |
6540 console.error('Block "' + name + '" is already registered.'); |
7196 console.error('Block "' + name + '" is already registered.'); |
6541 return; |
7197 return; |
6542 } |
7198 } |
6543 |
7199 |
7200 var preFilterSettings = registration_objectSpread({}, settings); |
|
7201 |
|
6544 settings = Object(external_this_wp_hooks_["applyFilters"])('blocks.registerBlockType', settings, name); |
7202 settings = Object(external_this_wp_hooks_["applyFilters"])('blocks.registerBlockType', settings, name); |
6545 |
7203 |
6546 if (!settings || !Object(external_lodash_["isFunction"])(settings.save)) { |
7204 if (settings.deprecated) { |
6547 console.error('The "save" property must be specified and must be a valid function.'); |
7205 settings.deprecated = settings.deprecated.map(function (deprecation) { |
7206 return Object(external_this_lodash_["pick"])( // Only keep valid deprecation keys. |
|
7207 Object(external_this_wp_hooks_["applyFilters"])('blocks.registerBlockType', // Merge deprecation keys with pre-filter settings |
|
7208 // so that filters that depend on specific keys being |
|
7209 // present don't fail. |
|
7210 registration_objectSpread({}, Object(external_this_lodash_["omit"])(preFilterSettings, DEPRECATED_ENTRY_KEYS), {}, deprecation), name), DEPRECATED_ENTRY_KEYS); |
|
7211 }); |
|
7212 } |
|
7213 |
|
7214 if (!Object(external_this_lodash_["isPlainObject"])(settings)) { |
|
7215 console.error('Block settings must be a valid object.'); |
|
6548 return; |
7216 return; |
6549 } |
7217 } |
6550 |
7218 |
6551 if ('edit' in settings && !Object(external_lodash_["isFunction"])(settings.edit)) { |
7219 if (!Object(external_this_lodash_["isFunction"])(settings.save)) { |
7220 console.error('The "save" property must be a valid function.'); |
|
7221 return; |
|
7222 } |
|
7223 |
|
7224 if ('edit' in settings && !Object(external_this_lodash_["isFunction"])(settings.edit)) { |
|
6552 console.error('The "edit" property must be a valid function.'); |
7225 console.error('The "edit" property must be a valid function.'); |
6553 return; |
7226 return; |
6554 } |
7227 } // Canonicalize legacy categories to equivalent fallback. |
6555 |
7228 |
6556 if (!('category' in settings)) { |
7229 |
6557 console.error('The block "' + name + '" must have a category.'); |
7230 if (LEGACY_CATEGORY_MAPPING.hasOwnProperty(settings.category)) { |
6558 return; |
7231 settings.category = LEGACY_CATEGORY_MAPPING[settings.category]; |
6559 } |
7232 } |
6560 |
7233 |
6561 if ('category' in settings && !Object(external_lodash_["some"])(Object(external_this_wp_data_["select"])('core/blocks').getCategories(), { |
7234 if ('category' in settings && !Object(external_this_lodash_["some"])(Object(external_this_wp_data_["select"])('core/blocks').getCategories(), { |
6562 slug: settings.category |
7235 slug: settings.category |
6563 })) { |
7236 })) { |
6564 console.error('The block "' + name + '" must have a registered category.'); |
7237 console.warn('The block "' + name + '" is registered with an invalid category "' + settings.category + '".'); |
6565 return; |
7238 delete settings.category; |
6566 } |
7239 } |
6567 |
7240 |
6568 if (!('title' in settings) || settings.title === '') { |
7241 if (!('title' in settings) || settings.title === '') { |
6569 console.error('The block "' + name + '" must have a title.'); |
7242 console.error('The block "' + name + '" must have a title.'); |
6570 return; |
7243 return; |
6576 } |
7249 } |
6577 |
7250 |
6578 settings.icon = normalizeIconObject(settings.icon); |
7251 settings.icon = normalizeIconObject(settings.icon); |
6579 |
7252 |
6580 if (!isValidIcon(settings.icon.src)) { |
7253 if (!isValidIcon(settings.icon.src)) { |
6581 console.error('The icon passed is invalid. ' + 'The icon should be a string, an element, a function, or an object following the specifications documented in https://wordpress.org/gutenberg/handbook/designers-developers/developers/block-api/block-registration/#icon-optional'); |
7254 console.error('The icon passed is invalid. ' + 'The icon should be a string, an element, a function, or an object following the specifications documented in https://developer.wordpress.org/block-editor/developers/block-api/block-registration/#icon-optional'); |
6582 return; |
7255 return; |
6583 } |
7256 } |
6584 |
7257 |
6585 Object(external_this_wp_data_["dispatch"])('core/blocks').addBlockTypes(settings); |
7258 Object(external_this_wp_data_["dispatch"])('core/blocks').addBlockTypes(settings); |
6586 return settings; |
7259 return settings; |
6587 } |
7260 } |
6588 /** |
7261 /** |
7262 * Registers a new block collection to group blocks in the same namespace in the inserter. |
|
7263 * |
|
7264 * @param {string} namespace The namespace to group blocks by in the inserter; corresponds to the block namespace. |
|
7265 * @param {Object} settings The block collection settings. |
|
7266 * @param {string} settings.title The title to display in the block inserter. |
|
7267 * @param {Object} [settings.icon] The icon to display in the block inserter. |
|
7268 */ |
|
7269 |
|
7270 function registerBlockCollection(namespace, _ref) { |
|
7271 var title = _ref.title, |
|
7272 icon = _ref.icon; |
|
7273 Object(external_this_wp_data_["dispatch"])('core/blocks').addBlockCollection(namespace, title, icon); |
|
7274 } |
|
7275 /** |
|
7276 * Unregisters a block collection |
|
7277 * |
|
7278 * @param {string} namespace The namespace to group blocks by in the inserter; corresponds to the block namespace |
|
7279 * |
|
7280 */ |
|
7281 |
|
7282 function unregisterBlockCollection(namespace) { |
|
7283 Object(external_this_wp_data_["dispatch"])('core/blocks').removeBlockCollection(namespace); |
|
7284 } |
|
7285 /** |
|
6589 * Unregisters a block. |
7286 * Unregisters a block. |
6590 * |
7287 * |
6591 * @param {string} name Block name. |
7288 * @param {string} name Block name. |
6592 * |
7289 * |
6593 * @return {?WPBlock} The previous block value, if it has been successfully |
7290 * @return {?WPBlock} The previous block value, if it has been successfully |
6594 * unregistered; otherwise `undefined`. |
7291 * unregistered; otherwise `undefined`. |
6595 */ |
7292 */ |
6596 |
7293 |
6597 function unregisterBlockType(name) { |
7294 function unregisterBlockType(name) { |
6598 var oldBlock = Object(external_this_wp_data_["select"])('core/blocks').getBlockType(name); |
7295 var oldBlock = Object(external_this_wp_data_["select"])('core/blocks').getBlockType(name); |
6599 |
7296 |
6616 } |
7313 } |
6617 /** |
7314 /** |
6618 * Retrieves name of block handling non-block content, or undefined if no |
7315 * Retrieves name of block handling non-block content, or undefined if no |
6619 * handler has been defined. |
7316 * handler has been defined. |
6620 * |
7317 * |
6621 * @return {?string} Blog name. |
7318 * @return {?string} Block name. |
6622 */ |
7319 */ |
6623 |
7320 |
6624 function getFreeformContentHandlerName() { |
7321 function getFreeformContentHandlerName() { |
6625 return Object(external_this_wp_data_["select"])('core/blocks').getFreeformFallbackBlockName(); |
7322 return Object(external_this_wp_data_["select"])('core/blocks').getFreeformFallbackBlockName(); |
6626 } |
7323 } |
6627 /** |
7324 /** |
7325 * Retrieves name of block used for handling grouping interactions. |
|
7326 * |
|
7327 * @return {?string} Block name. |
|
7328 */ |
|
7329 |
|
7330 function registration_getGroupingBlockName() { |
|
7331 return Object(external_this_wp_data_["select"])('core/blocks').getGroupingBlockName(); |
|
7332 } |
|
7333 /** |
|
6628 * Assigns name of block handling unregistered block types. |
7334 * Assigns name of block handling unregistered block types. |
6629 * |
7335 * |
6630 * @param {string} blockName Block name. |
7336 * @param {string} blockName Block name. |
6631 */ |
7337 */ |
6632 |
7338 |
6635 } |
7341 } |
6636 /** |
7342 /** |
6637 * Retrieves name of block handling unregistered block types, or undefined if no |
7343 * Retrieves name of block handling unregistered block types, or undefined if no |
6638 * handler has been defined. |
7344 * handler has been defined. |
6639 * |
7345 * |
6640 * @return {?string} Blog name. |
7346 * @return {?string} Block name. |
6641 */ |
7347 */ |
6642 |
7348 |
6643 function getUnregisteredTypeHandlerName() { |
7349 function getUnregisteredTypeHandlerName() { |
6644 return Object(external_this_wp_data_["select"])('core/blocks').getUnregisteredFallbackBlockName(); |
7350 return Object(external_this_wp_data_["select"])('core/blocks').getUnregisteredFallbackBlockName(); |
6645 } |
7351 } |
6649 * @param {string} name Block name. |
7355 * @param {string} name Block name. |
6650 */ |
7356 */ |
6651 |
7357 |
6652 function registration_setDefaultBlockName(name) { |
7358 function registration_setDefaultBlockName(name) { |
6653 Object(external_this_wp_data_["dispatch"])('core/blocks').setDefaultBlockName(name); |
7359 Object(external_this_wp_data_["dispatch"])('core/blocks').setDefaultBlockName(name); |
7360 } |
|
7361 /** |
|
7362 * Assigns name of block for handling block grouping interactions. |
|
7363 * |
|
7364 * @param {string} name Block name. |
|
7365 */ |
|
7366 |
|
7367 function registration_setGroupingBlockName(name) { |
|
7368 Object(external_this_wp_data_["dispatch"])('core/blocks').setGroupingBlockName(name); |
|
6654 } |
7369 } |
6655 /** |
7370 /** |
6656 * Retrieves the default block name. |
7371 * Retrieves the default block name. |
6657 * |
7372 * |
6658 * @return {?string} Block name. |
7373 * @return {?string} Block name. |
6774 */ |
7489 */ |
6775 |
7490 |
6776 var registration_unregisterBlockStyle = function unregisterBlockStyle(blockName, styleVariationName) { |
7491 var registration_unregisterBlockStyle = function unregisterBlockStyle(blockName, styleVariationName) { |
6777 Object(external_this_wp_data_["dispatch"])('core/blocks').removeBlockStyles(blockName, styleVariationName); |
7492 Object(external_this_wp_data_["dispatch"])('core/blocks').removeBlockStyles(blockName, styleVariationName); |
6778 }; |
7493 }; |
7494 /** |
|
7495 * Registers a new block variation for the given block type. |
|
7496 * |
|
7497 * @param {string} blockName Name of the block (example: “core/columns”). |
|
7498 * @param {WPBlockVariation} variation Object describing a block variation. |
|
7499 */ |
|
7500 |
|
7501 var registration_registerBlockVariation = function registerBlockVariation(blockName, variation) { |
|
7502 Object(external_this_wp_data_["dispatch"])('core/blocks').addBlockVariations(blockName, variation); |
|
7503 }; |
|
7504 /** |
|
7505 * Unregisters a block variation defined for the given block type. |
|
7506 * |
|
7507 * @param {string} blockName Name of the block (example: “core/columns”). |
|
7508 * @param {string} variationName Name of the variation defined for the block. |
|
7509 */ |
|
7510 |
|
7511 var registration_unregisterBlockVariation = function unregisterBlockVariation(blockName, variationName) { |
|
7512 Object(external_this_wp_data_["dispatch"])('core/blocks').removeBlockVariations(blockName, variationName); |
|
7513 }; |
|
6779 |
7514 |
6780 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/factory.js |
7515 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/factory.js |
6781 |
7516 |
6782 |
7517 |
7518 |
|
7519 function factory_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
|
7520 |
|
7521 function factory_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { factory_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { factory_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
6783 |
7522 |
6784 /** |
7523 /** |
6785 * External dependencies |
7524 * External dependencies |
6786 */ |
7525 */ |
6787 |
7526 |
6812 var innerBlocks = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; |
7551 var innerBlocks = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; |
6813 // Get the type definition associated with a registered block. |
7552 // Get the type definition associated with a registered block. |
6814 var blockType = registration_getBlockType(name); // Ensure attributes contains only values defined by block type, and merge |
7553 var blockType = registration_getBlockType(name); // Ensure attributes contains only values defined by block type, and merge |
6815 // default values for missing attributes. |
7554 // default values for missing attributes. |
6816 |
7555 |
6817 var sanitizedAttributes = Object(external_lodash_["reduce"])(blockType.attributes, function (result, schema, key) { |
7556 var sanitizedAttributes = Object(external_this_lodash_["reduce"])(blockType.attributes, function (accumulator, schema, key) { |
6818 var value = attributes[key]; |
7557 var value = attributes[key]; |
6819 |
7558 |
6820 if (undefined !== value) { |
7559 if (undefined !== value) { |
6821 result[key] = value; |
7560 accumulator[key] = value; |
6822 } else if (schema.hasOwnProperty('default')) { |
7561 } else if (schema.hasOwnProperty('default')) { |
6823 result[key] = schema.default; |
7562 accumulator[key] = schema.default; |
6824 } |
7563 } |
6825 |
7564 |
6826 if (['node', 'children'].indexOf(schema.source) !== -1) { |
7565 if (['node', 'children'].indexOf(schema.source) !== -1) { |
6827 // Ensure value passed is always an array, which we're expecting in |
7566 // Ensure value passed is always an array, which we're expecting in |
6828 // the RichText component to handle the deprecated value. |
7567 // the RichText component to handle the deprecated value. |
6829 if (typeof result[key] === 'string') { |
7568 if (typeof accumulator[key] === 'string') { |
6830 result[key] = [result[key]]; |
7569 accumulator[key] = [accumulator[key]]; |
6831 } else if (!Array.isArray(result[key])) { |
7570 } else if (!Array.isArray(accumulator[key])) { |
6832 result[key] = []; |
7571 accumulator[key] = []; |
6833 } |
7572 } |
6834 } |
7573 } |
6835 |
7574 |
6836 return result; |
7575 return accumulator; |
6837 }, {}); |
7576 }, {}); |
6838 var clientId = v4_default()(); // Blocks are stored with a unique ID, the assigned type name, the block |
7577 var clientId = esm_browser_v4(); // Blocks are stored with a unique ID, the assigned type name, the block |
6839 // attributes, and their inner blocks. |
7578 // attributes, and their inner blocks. |
6840 |
7579 |
6841 return { |
7580 return { |
6842 clientId: clientId, |
7581 clientId: clientId, |
6843 name: name, |
7582 name: name, |
6858 */ |
7597 */ |
6859 |
7598 |
6860 function cloneBlock(block) { |
7599 function cloneBlock(block) { |
6861 var mergeAttributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; |
7600 var mergeAttributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; |
6862 var newInnerBlocks = arguments.length > 2 ? arguments[2] : undefined; |
7601 var newInnerBlocks = arguments.length > 2 ? arguments[2] : undefined; |
6863 var clientId = v4_default()(); |
7602 var clientId = esm_browser_v4(); |
6864 return Object(objectSpread["a" /* default */])({}, block, { |
7603 return factory_objectSpread({}, block, { |
6865 clientId: clientId, |
7604 clientId: clientId, |
6866 attributes: Object(objectSpread["a" /* default */])({}, block.attributes, mergeAttributes), |
7605 attributes: factory_objectSpread({}, block.attributes, {}, mergeAttributes), |
6867 innerBlocks: newInnerBlocks || block.innerBlocks.map(function (innerBlock) { |
7606 innerBlocks: newInnerBlocks || block.innerBlocks.map(function (innerBlock) { |
6868 return cloneBlock(innerBlock); |
7607 return cloneBlock(innerBlock); |
6869 }) |
7608 }) |
6870 }); |
7609 }); |
6871 } |
7610 } |
6879 * |
7618 * |
6880 * @return {boolean} Is the transform possible? |
7619 * @return {boolean} Is the transform possible? |
6881 */ |
7620 */ |
6882 |
7621 |
6883 var factory_isPossibleTransformForSource = function isPossibleTransformForSource(transform, direction, blocks) { |
7622 var factory_isPossibleTransformForSource = function isPossibleTransformForSource(transform, direction, blocks) { |
6884 if (Object(external_lodash_["isEmpty"])(blocks)) { |
7623 if (Object(external_this_lodash_["isEmpty"])(blocks)) { |
6885 return false; |
7624 return false; |
6886 } // If multiple blocks are selected, only multi block transforms are allowed. |
7625 } // If multiple blocks are selected, only multi block transforms |
7626 // or wildcard transforms are allowed. |
|
6887 |
7627 |
6888 |
7628 |
6889 var isMultiBlock = blocks.length > 1; |
7629 var isMultiBlock = blocks.length > 1; |
6890 var isValidForMultiBlocks = !isMultiBlock || transform.isMultiBlock; |
7630 var firstBlockName = Object(external_this_lodash_["first"])(blocks).name; |
7631 var isValidForMultiBlocks = isWildcardBlockTransform(transform) || !isMultiBlock || transform.isMultiBlock; |
|
6891 |
7632 |
6892 if (!isValidForMultiBlocks) { |
7633 if (!isValidForMultiBlocks) { |
6893 return false; |
7634 return false; |
7635 } // Check non-wildcard transforms to ensure that transform is valid |
|
7636 // for a block selection of multiple blocks of different types |
|
7637 |
|
7638 |
|
7639 if (!isWildcardBlockTransform(transform) && !Object(external_this_lodash_["every"])(blocks, { |
|
7640 name: firstBlockName |
|
7641 })) { |
|
7642 return false; |
|
6894 } // Only consider 'block' type transforms as valid. |
7643 } // Only consider 'block' type transforms as valid. |
6895 |
7644 |
6896 |
7645 |
6897 var isBlockType = transform.type === 'block'; |
7646 var isBlockType = transform.type === 'block'; |
6898 |
7647 |
6899 if (!isBlockType) { |
7648 if (!isBlockType) { |
6900 return false; |
7649 return false; |
6901 } // Check if the transform's block name matches the source block only if this is a transform 'from'. |
7650 } // Check if the transform's block name matches the source block (or is a wildcard) |
6902 |
7651 // only if this is a transform 'from'. |
6903 |
7652 |
6904 var sourceBlock = Object(external_lodash_["first"])(blocks); |
7653 |
6905 var hasMatchingName = direction !== 'from' || transform.blocks.indexOf(sourceBlock.name) !== -1; |
7654 var sourceBlock = Object(external_this_lodash_["first"])(blocks); |
7655 var hasMatchingName = direction !== 'from' || transform.blocks.indexOf(sourceBlock.name) !== -1 || isWildcardBlockTransform(transform); |
|
6906 |
7656 |
6907 if (!hasMatchingName) { |
7657 if (!hasMatchingName) { |
6908 return false; |
7658 return false; |
7659 } // Don't allow single Grouping blocks to be transformed into |
|
7660 // a Grouping block. |
|
7661 |
|
7662 |
|
7663 if (!isMultiBlock && factory_isContainerGroupBlock(sourceBlock.name) && factory_isContainerGroupBlock(transform.blockName)) { |
|
7664 return false; |
|
6909 } // If the transform has a `isMatch` function specified, check that it returns true. |
7665 } // If the transform has a `isMatch` function specified, check that it returns true. |
6910 |
7666 |
6911 |
7667 |
6912 if (Object(external_lodash_["isFunction"])(transform.isMatch)) { |
7668 if (Object(external_this_lodash_["isFunction"])(transform.isMatch)) { |
6913 var attributes = transform.isMultiBlock ? blocks.map(function (block) { |
7669 var attributes = transform.isMultiBlock ? blocks.map(function (block) { |
6914 return block.attributes; |
7670 return block.attributes; |
6915 }) : sourceBlock.attributes; |
7671 }) : sourceBlock.attributes; |
6916 |
7672 |
6917 if (!transform.isMatch(attributes)) { |
7673 if (!transform.isMatch(attributes)) { |
6930 * @return {Array} Block types that the blocks can be transformed into. |
7686 * @return {Array} Block types that the blocks can be transformed into. |
6931 */ |
7687 */ |
6932 |
7688 |
6933 |
7689 |
6934 var factory_getBlockTypesForPossibleFromTransforms = function getBlockTypesForPossibleFromTransforms(blocks) { |
7690 var factory_getBlockTypesForPossibleFromTransforms = function getBlockTypesForPossibleFromTransforms(blocks) { |
6935 if (Object(external_lodash_["isEmpty"])(blocks)) { |
7691 if (Object(external_this_lodash_["isEmpty"])(blocks)) { |
6936 return []; |
7692 return []; |
6937 } |
7693 } |
6938 |
7694 |
6939 var allBlockTypes = registration_getBlockTypes(); // filter all blocks to find those with a 'from' transform. |
7695 var allBlockTypes = registration_getBlockTypes(); // filter all blocks to find those with a 'from' transform. |
6940 |
7696 |
6941 var blockTypesWithPossibleFromTransforms = Object(external_lodash_["filter"])(allBlockTypes, function (blockType) { |
7697 var blockTypesWithPossibleFromTransforms = Object(external_this_lodash_["filter"])(allBlockTypes, function (blockType) { |
6942 var fromTransforms = getBlockTransforms('from', blockType.name); |
7698 var fromTransforms = getBlockTransforms('from', blockType.name); |
6943 return !!findTransform(fromTransforms, function (transform) { |
7699 return !!findTransform(fromTransforms, function (transform) { |
6944 return factory_isPossibleTransformForSource(transform, 'from', blocks); |
7700 return factory_isPossibleTransformForSource(transform, 'from', blocks); |
6945 }); |
7701 }); |
6946 }); |
7702 }); |
6955 * @return {Array} Block types that the source can be transformed into. |
7711 * @return {Array} Block types that the source can be transformed into. |
6956 */ |
7712 */ |
6957 |
7713 |
6958 |
7714 |
6959 var factory_getBlockTypesForPossibleToTransforms = function getBlockTypesForPossibleToTransforms(blocks) { |
7715 var factory_getBlockTypesForPossibleToTransforms = function getBlockTypesForPossibleToTransforms(blocks) { |
6960 if (Object(external_lodash_["isEmpty"])(blocks)) { |
7716 if (Object(external_this_lodash_["isEmpty"])(blocks)) { |
6961 return []; |
7717 return []; |
6962 } |
7718 } |
6963 |
7719 |
6964 var sourceBlock = Object(external_lodash_["first"])(blocks); |
7720 var sourceBlock = Object(external_this_lodash_["first"])(blocks); |
6965 var blockType = registration_getBlockType(sourceBlock.name); |
7721 var blockType = registration_getBlockType(sourceBlock.name); |
6966 var transformsTo = getBlockTransforms('to', blockType.name); // filter all 'to' transforms to find those that are possible. |
7722 var transformsTo = getBlockTransforms('to', blockType.name); // filter all 'to' transforms to find those that are possible. |
6967 |
7723 |
6968 var possibleTransforms = Object(external_lodash_["filter"])(transformsTo, function (transform) { |
7724 var possibleTransforms = Object(external_this_lodash_["filter"])(transformsTo, function (transform) { |
6969 return factory_isPossibleTransformForSource(transform, 'to', blocks); |
7725 return transform && factory_isPossibleTransformForSource(transform, 'to', blocks); |
6970 }); // Build a list of block names using the possible 'to' transforms. |
7726 }); // Build a list of block names using the possible 'to' transforms. |
6971 |
7727 |
6972 var blockNames = Object(external_lodash_["flatMap"])(possibleTransforms, function (transformation) { |
7728 var blockNames = Object(external_this_lodash_["flatMap"])(possibleTransforms, function (transformation) { |
6973 return transformation.blocks; |
7729 return transformation.blocks; |
6974 }); // Map block names to block types. |
7730 }); // Map block names to block types. |
6975 |
7731 |
6976 return blockNames.map(function (name) { |
7732 return blockNames.map(function (name) { |
6977 return registration_getBlockType(name); |
7733 return registration_getBlockType(name); |
6978 }); |
7734 }); |
6979 }; |
7735 }; |
6980 /** |
7736 /** |
7737 * Determines whether transform is a "block" type |
|
7738 * and if so whether it is a "wildcard" transform |
|
7739 * ie: targets "any" block type |
|
7740 * |
|
7741 * @param {Object} t the Block transform object |
|
7742 * |
|
7743 * @return {boolean} whether transform is a wildcard transform |
|
7744 */ |
|
7745 |
|
7746 |
|
7747 var isWildcardBlockTransform = function isWildcardBlockTransform(t) { |
|
7748 return t && t.type === 'block' && Array.isArray(t.blocks) && t.blocks.includes('*'); |
|
7749 }; |
|
7750 /** |
|
7751 * Determines whether the given Block is the core Block which |
|
7752 * acts as a container Block for other Blocks as part of the |
|
7753 * Grouping mechanics |
|
7754 * |
|
7755 * @param {string} name the name of the Block to test against |
|
7756 * |
|
7757 * @return {boolean} whether or not the Block is the container Block type |
|
7758 */ |
|
7759 |
|
7760 var factory_isContainerGroupBlock = function isContainerGroupBlock(name) { |
|
7761 return name === registration_getGroupingBlockName(); |
|
7762 }; |
|
7763 /** |
|
6981 * Returns an array of block types that the set of blocks received as argument |
7764 * Returns an array of block types that the set of blocks received as argument |
6982 * can be transformed into. |
7765 * can be transformed into. |
6983 * |
7766 * |
6984 * @param {Array} blocks Blocks array. |
7767 * @param {Array} blocks Blocks array. |
6985 * |
7768 * |
6986 * @return {Array} Block types that the blocks argument can be transformed to. |
7769 * @return {Array} Block types that the blocks argument can be transformed to. |
6987 */ |
7770 */ |
6988 |
7771 |
6989 |
|
6990 function getPossibleBlockTransformations(blocks) { |
7772 function getPossibleBlockTransformations(blocks) { |
6991 if (Object(external_lodash_["isEmpty"])(blocks)) { |
7773 if (Object(external_this_lodash_["isEmpty"])(blocks)) { |
6992 return []; |
|
6993 } |
|
6994 |
|
6995 var sourceBlock = Object(external_lodash_["first"])(blocks); |
|
6996 var isMultiBlock = blocks.length > 1; |
|
6997 |
|
6998 if (isMultiBlock && !Object(external_lodash_["every"])(blocks, { |
|
6999 name: sourceBlock.name |
|
7000 })) { |
|
7001 return []; |
7774 return []; |
7002 } |
7775 } |
7003 |
7776 |
7004 var blockTypesForFromTransforms = factory_getBlockTypesForPossibleFromTransforms(blocks); |
7777 var blockTypesForFromTransforms = factory_getBlockTypesForPossibleFromTransforms(blocks); |
7005 var blockTypesForToTransforms = factory_getBlockTypesForPossibleToTransforms(blocks); |
7778 var blockTypesForToTransforms = factory_getBlockTypesForPossibleToTransforms(blocks); |
7006 return Object(external_lodash_["uniq"])([].concat(Object(toConsumableArray["a" /* default */])(blockTypesForFromTransforms), Object(toConsumableArray["a" /* default */])(blockTypesForToTransforms))); |
7779 return Object(external_this_lodash_["uniq"])([].concat(Object(toConsumableArray["a" /* default */])(blockTypesForFromTransforms), Object(toConsumableArray["a" /* default */])(blockTypesForToTransforms))); |
7007 } |
7780 } |
7008 /** |
7781 /** |
7009 * Given an array of transforms, returns the highest-priority transform where |
7782 * Given an array of transforms, returns the highest-priority transform where |
7010 * the predicate function returns a truthy value. A higher-priority transform |
7783 * the predicate function returns a truthy value. A higher-priority transform |
7011 * is one with a lower priority value (i.e. first in priority order). Returns |
7784 * is one with a lower priority value (i.e. first in priority order). Returns |
7053 */ |
7826 */ |
7054 |
7827 |
7055 function getBlockTransforms(direction, blockTypeOrName) { |
7828 function getBlockTransforms(direction, blockTypeOrName) { |
7056 // When retrieving transforms for all block types, recurse into self. |
7829 // When retrieving transforms for all block types, recurse into self. |
7057 if (blockTypeOrName === undefined) { |
7830 if (blockTypeOrName === undefined) { |
7058 return Object(external_lodash_["flatMap"])(registration_getBlockTypes(), function (_ref) { |
7831 return Object(external_this_lodash_["flatMap"])(registration_getBlockTypes(), function (_ref) { |
7059 var name = _ref.name; |
7832 var name = _ref.name; |
7060 return getBlockTransforms(direction, name); |
7833 return getBlockTransforms(direction, name); |
7061 }); |
7834 }); |
7062 } // Validate that block type exists and has array of direction. |
7835 } // Validate that block type exists and has array of direction. |
7063 |
7836 |
7072 return []; |
7845 return []; |
7073 } // Map transforms to normal form. |
7846 } // Map transforms to normal form. |
7074 |
7847 |
7075 |
7848 |
7076 return transforms[direction].map(function (transform) { |
7849 return transforms[direction].map(function (transform) { |
7077 return Object(objectSpread["a" /* default */])({}, transform, { |
7850 return factory_objectSpread({}, transform, { |
7078 blockName: blockName |
7851 blockName: blockName |
7079 }); |
7852 }); |
7080 }); |
7853 }); |
7081 } |
7854 } |
7082 /** |
7855 /** |
7083 * Switch one or more blocks into one or more blocks of the new block type. |
7856 * Switch one or more blocks into one or more blocks of the new block type. |
7084 * |
7857 * |
7085 * @param {Array|Object} blocks Blocks array or block object. |
7858 * @param {Array|Object} blocks Blocks array or block object. |
7086 * @param {string} name Block name. |
7859 * @param {string} name Block name. |
7087 * |
7860 * |
7088 * @return {Array} Array of blocks. |
7861 * @return {?Array} Array of blocks or null. |
7089 */ |
7862 */ |
7090 |
7863 |
7091 function switchToBlockType(blocks, name) { |
7864 function switchToBlockType(blocks, name) { |
7092 var blocksArray = Object(external_lodash_["castArray"])(blocks); |
7865 var blocksArray = Object(external_this_lodash_["castArray"])(blocks); |
7093 var isMultiBlock = blocksArray.length > 1; |
7866 var isMultiBlock = blocksArray.length > 1; |
7094 var firstBlock = blocksArray[0]; |
7867 var firstBlock = blocksArray[0]; |
7095 var sourceName = firstBlock.name; |
7868 var sourceName = firstBlock.name; // Find the right transformation by giving priority to the "to" |
7096 |
|
7097 if (isMultiBlock && !Object(external_lodash_["every"])(blocksArray, function (block) { |
|
7098 return block.name === sourceName; |
|
7099 })) { |
|
7100 return null; |
|
7101 } // Find the right transformation by giving priority to the "to" |
|
7102 // transformation. |
7869 // transformation. |
7103 |
|
7104 |
7870 |
7105 var transformationsFrom = getBlockTransforms('from', name); |
7871 var transformationsFrom = getBlockTransforms('from', name); |
7106 var transformationsTo = getBlockTransforms('to', sourceName); |
7872 var transformationsTo = getBlockTransforms('to', sourceName); |
7107 var transformation = findTransform(transformationsTo, function (t) { |
7873 var transformation = findTransform(transformationsTo, function (t) { |
7108 return t.type === 'block' && t.blocks.indexOf(name) !== -1 && (!isMultiBlock || t.isMultiBlock); |
7874 return t.type === 'block' && (isWildcardBlockTransform(t) || t.blocks.indexOf(name) !== -1) && (!isMultiBlock || t.isMultiBlock); |
7109 }) || findTransform(transformationsFrom, function (t) { |
7875 }) || findTransform(transformationsFrom, function (t) { |
7110 return t.type === 'block' && t.blocks.indexOf(sourceName) !== -1 && (!isMultiBlock || t.isMultiBlock); |
7876 return t.type === 'block' && (isWildcardBlockTransform(t) || t.blocks.indexOf(sourceName) !== -1) && (!isMultiBlock || t.isMultiBlock); |
7111 }); // Stop if there is no valid transformation. |
7877 }); // Stop if there is no valid transformation. |
7112 |
7878 |
7113 if (!transformation) { |
7879 if (!transformation) { |
7114 return null; |
7880 return null; |
7115 } |
7881 } |
7116 |
7882 |
7117 var transformationResults; |
7883 var transformationResults; |
7118 |
7884 |
7119 if (transformation.isMultiBlock) { |
7885 if (transformation.isMultiBlock) { |
7120 transformationResults = transformation.transform(blocksArray.map(function (currentBlock) { |
7886 if (Object(external_this_lodash_["has"])(transformation, '__experimentalConvert')) { |
7121 return currentBlock.attributes; |
7887 transformationResults = transformation.__experimentalConvert(blocksArray); |
7122 }), blocksArray.map(function (currentBlock) { |
7888 } else { |
7123 return currentBlock.innerBlocks; |
7889 transformationResults = transformation.transform(blocksArray.map(function (currentBlock) { |
7124 })); |
7890 return currentBlock.attributes; |
7891 }), blocksArray.map(function (currentBlock) { |
|
7892 return currentBlock.innerBlocks; |
|
7893 })); |
|
7894 } |
|
7895 } else if (Object(external_this_lodash_["has"])(transformation, '__experimentalConvert')) { |
|
7896 transformationResults = transformation.__experimentalConvert(firstBlock); |
|
7125 } else { |
7897 } else { |
7126 transformationResults = transformation.transform(firstBlock.attributes, firstBlock.innerBlocks); |
7898 transformationResults = transformation.transform(firstBlock.attributes, firstBlock.innerBlocks); |
7127 } // Ensure that the transformation function returned an object or an array |
7899 } // Ensure that the transformation function returned an object or an array |
7128 // of objects. |
7900 // of objects. |
7129 |
7901 |
7130 |
7902 |
7131 if (!Object(external_lodash_["isObjectLike"])(transformationResults)) { |
7903 if (!Object(external_this_lodash_["isObjectLike"])(transformationResults)) { |
7132 return null; |
7904 return null; |
7133 } // If the transformation function returned a single object, we want to work |
7905 } // If the transformation function returned a single object, we want to work |
7134 // with an array instead. |
7906 // with an array instead. |
7135 |
7907 |
7136 |
7908 |
7137 transformationResults = Object(external_lodash_["castArray"])(transformationResults); // Ensure that every block object returned by the transformation has a |
7909 transformationResults = Object(external_this_lodash_["castArray"])(transformationResults); // Ensure that every block object returned by the transformation has a |
7138 // valid block type. |
7910 // valid block type. |
7139 |
7911 |
7140 if (transformationResults.some(function (result) { |
7912 if (transformationResults.some(function (result) { |
7141 return !registration_getBlockType(result.name); |
7913 return !registration_getBlockType(result.name); |
7142 })) { |
7914 })) { |
7143 return null; |
7915 return null; |
7144 } |
7916 } |
7145 |
7917 |
7146 var firstSwitchedBlock = Object(external_lodash_["findIndex"])(transformationResults, function (result) { |
7918 var firstSwitchedBlock = Object(external_this_lodash_["findIndex"])(transformationResults, function (result) { |
7147 return result.name === name; |
7919 return result.name === name; |
7148 }); // Ensure that at least one block object returned by the transformation has |
7920 }); // Ensure that at least one block object returned by the transformation has |
7149 // the expected "destination" block type. |
7921 // the expected "destination" block type. |
7150 |
7922 |
7151 if (firstSwitchedBlock < 0) { |
7923 if (firstSwitchedBlock < 0) { |
7152 return null; |
7924 return null; |
7153 } |
7925 } |
7154 |
7926 |
7155 return transformationResults.map(function (result, index) { |
7927 return transformationResults.map(function (result, index) { |
7156 var transformedBlock = Object(objectSpread["a" /* default */])({}, result, { |
7928 var transformedBlock = factory_objectSpread({}, result, { |
7157 // The first transformed block whose type matches the "destination" |
7929 // The first transformed block whose type matches the "destination" |
7158 // type gets to keep the existing client ID of the first block. |
7930 // type gets to keep the existing client ID of the first block. |
7159 clientId: index === firstSwitchedBlock ? firstBlock.clientId : result.clientId |
7931 clientId: index === firstSwitchedBlock ? firstBlock.clientId : result.clientId |
7160 }); |
7932 }); |
7161 /** |
7933 /** |
7169 |
7941 |
7170 |
7942 |
7171 return Object(external_this_wp_hooks_["applyFilters"])('blocks.switchToBlockType.transformedBlock', transformedBlock, blocks); |
7943 return Object(external_this_wp_hooks_["applyFilters"])('blocks.switchToBlockType.transformedBlock', transformedBlock, blocks); |
7172 }); |
7944 }); |
7173 } |
7945 } |
7946 /** |
|
7947 * Create a block object from the example API. |
|
7948 * |
|
7949 * @param {string} name |
|
7950 * @param {Object} example |
|
7951 * |
|
7952 * @return {Object} block. |
|
7953 */ |
|
7954 |
|
7955 var factory_getBlockFromExample = function getBlockFromExample(name, example) { |
|
7956 return createBlock(name, example.attributes, Object(external_this_lodash_["map"])(example.innerBlocks, function (innerBlock) { |
|
7957 return getBlockFromExample(innerBlock.name, innerBlock); |
|
7958 })); |
|
7959 }; |
|
7174 |
7960 |
7175 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules |
7961 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules |
7176 var slicedToArray = __webpack_require__(28); |
7962 var slicedToArray = __webpack_require__(14); |
7177 |
7963 |
7178 // CONCATENATED MODULE: ./node_modules/hpq/es/get-path.js |
7964 // CONCATENATED MODULE: ./node_modules/hpq/es/get-path.js |
7179 /** |
7965 /** |
7180 * Given object and string of dot-delimited path segments, returns value at |
7966 * Given object and string of dot-delimited path segments, returns value at |
7181 * path or undefined if path cannot be resolved. |
7967 * path or undefined if path cannot be resolved. |
7353 return es_parse(match, matchers); |
8139 return es_parse(match, matchers); |
7354 }); |
8140 }); |
7355 }; |
8141 }; |
7356 } |
8142 } |
7357 // EXTERNAL MODULE: external {"this":["wp","autop"]} |
8143 // EXTERNAL MODULE: external {"this":["wp","autop"]} |
7358 var external_this_wp_autop_ = __webpack_require__(66); |
8144 var external_this_wp_autop_ = __webpack_require__(103); |
7359 |
8145 |
7360 // EXTERNAL MODULE: external {"this":["wp","blockSerializationDefaultParser"]} |
8146 // EXTERNAL MODULE: external {"this":["wp","blockSerializationDefaultParser"]} |
7361 var external_this_wp_blockSerializationDefaultParser_ = __webpack_require__(205); |
8147 var external_this_wp_blockSerializationDefaultParser_ = __webpack_require__(268); |
7362 |
8148 |
7363 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js |
8149 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toArray.js |
7364 var arrayWithHoles = __webpack_require__(37); |
8150 var toArray = __webpack_require__(146); |
7365 |
8151 |
7366 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js |
|
7367 var iterableToArray = __webpack_require__(34); |
|
7368 |
|
7369 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js |
|
7370 var nonIterableRest = __webpack_require__(38); |
|
7371 |
|
7372 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toArray.js |
|
7373 |
|
7374 |
|
7375 |
|
7376 function _toArray(arr) { |
|
7377 return Object(arrayWithHoles["a" /* default */])(arr) || Object(iterableToArray["a" /* default */])(arr) || Object(nonIterableRest["a" /* default */])(); |
|
7378 } |
|
7379 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js |
8152 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js |
7380 var classCallCheck = __webpack_require__(10); |
8153 var classCallCheck = __webpack_require__(20); |
7381 |
8154 |
7382 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js |
8155 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js |
7383 var createClass = __webpack_require__(9); |
8156 var createClass = __webpack_require__(19); |
7384 |
8157 |
7385 // CONCATENATED MODULE: ./node_modules/simple-html-tokenizer/dist/es6/utils.js |
8158 // CONCATENATED MODULE: ./node_modules/simple-html-tokenizer/dist/es6/index.js |
8159 /** |
|
8160 * generated from https://raw.githubusercontent.com/w3c/html/26b5126f96f736f796b9e29718138919dd513744/entities.json |
|
8161 * do not edit |
|
8162 */ |
|
8163 var namedCharRefs = { |
|
8164 Aacute: "Á", aacute: "á", Abreve: "Ă", abreve: "ă", ac: "∾", acd: "∿", acE: "∾̳", Acirc: "Â", acirc: "â", acute: "´", Acy: "А", acy: "а", AElig: "Æ", aelig: "æ", af: "\u2061", Afr: "𝔄", afr: "𝔞", Agrave: "À", agrave: "à", alefsym: "ℵ", aleph: "ℵ", Alpha: "Α", alpha: "α", Amacr: "Ā", amacr: "ā", amalg: "⨿", amp: "&", AMP: "&", andand: "⩕", And: "⩓", and: "∧", andd: "⩜", andslope: "⩘", andv: "⩚", ang: "∠", ange: "⦤", angle: "∠", angmsdaa: "⦨", angmsdab: "⦩", angmsdac: "⦪", angmsdad: "⦫", angmsdae: "⦬", angmsdaf: "⦭", angmsdag: "⦮", angmsdah: "⦯", angmsd: "∡", angrt: "∟", angrtvb: "⊾", angrtvbd: "⦝", angsph: "∢", angst: "Å", angzarr: "⍼", Aogon: "Ą", aogon: "ą", Aopf: "𝔸", aopf: "𝕒", apacir: "⩯", ap: "≈", apE: "⩰", ape: "≊", apid: "≋", apos: "'", ApplyFunction: "\u2061", approx: "≈", approxeq: "≊", Aring: "Å", aring: "å", Ascr: "𝒜", ascr: "𝒶", Assign: "≔", ast: "*", asymp: "≈", asympeq: "≍", Atilde: "Ã", atilde: "ã", Auml: "Ä", auml: "ä", awconint: "∳", awint: "⨑", backcong: "≌", backepsilon: "϶", backprime: "‵", backsim: "∽", backsimeq: "⋍", Backslash: "∖", Barv: "⫧", barvee: "⊽", barwed: "⌅", Barwed: "⌆", barwedge: "⌅", bbrk: "⎵", bbrktbrk: "⎶", bcong: "≌", Bcy: "Б", bcy: "б", bdquo: "„", becaus: "∵", because: "∵", Because: "∵", bemptyv: "⦰", bepsi: "϶", bernou: "ℬ", Bernoullis: "ℬ", Beta: "Β", beta: "β", beth: "ℶ", between: "≬", Bfr: "𝔅", bfr: "𝔟", bigcap: "⋂", bigcirc: "◯", bigcup: "⋃", bigodot: "⨀", bigoplus: "⨁", bigotimes: "⨂", bigsqcup: "⨆", bigstar: "★", bigtriangledown: "▽", bigtriangleup: "△", biguplus: "⨄", bigvee: "⋁", bigwedge: "⋀", bkarow: "⤍", blacklozenge: "⧫", blacksquare: "▪", blacktriangle: "▴", blacktriangledown: "▾", blacktriangleleft: "◂", blacktriangleright: "▸", blank: "␣", blk12: "▒", blk14: "░", blk34: "▓", block: "█", bne: "=⃥", bnequiv: "≡⃥", bNot: "⫭", bnot: "⌐", Bopf: "𝔹", bopf: "𝕓", bot: "⊥", bottom: "⊥", bowtie: "⋈", boxbox: "⧉", boxdl: "┐", boxdL: "╕", boxDl: "╖", boxDL: "╗", boxdr: "┌", boxdR: "╒", boxDr: "╓", boxDR: "╔", boxh: "─", boxH: "═", boxhd: "┬", boxHd: "╤", boxhD: "╥", boxHD: "╦", boxhu: "┴", boxHu: "╧", boxhU: "╨", boxHU: "╩", boxminus: "⊟", boxplus: "⊞", boxtimes: "⊠", boxul: "┘", boxuL: "╛", boxUl: "╜", boxUL: "╝", boxur: "└", boxuR: "╘", boxUr: "╙", boxUR: "╚", boxv: "│", boxV: "║", boxvh: "┼", boxvH: "╪", boxVh: "╫", boxVH: "╬", boxvl: "┤", boxvL: "╡", boxVl: "╢", boxVL: "╣", boxvr: "├", boxvR: "╞", boxVr: "╟", boxVR: "╠", bprime: "‵", breve: "˘", Breve: "˘", brvbar: "¦", bscr: "𝒷", Bscr: "ℬ", bsemi: "⁏", bsim: "∽", bsime: "⋍", bsolb: "⧅", bsol: "\\", bsolhsub: "⟈", bull: "•", bullet: "•", bump: "≎", bumpE: "⪮", bumpe: "≏", Bumpeq: "≎", bumpeq: "≏", Cacute: "Ć", cacute: "ć", capand: "⩄", capbrcup: "⩉", capcap: "⩋", cap: "∩", Cap: "⋒", capcup: "⩇", capdot: "⩀", CapitalDifferentialD: "ⅅ", caps: "∩︀", caret: "⁁", caron: "ˇ", Cayleys: "ℭ", ccaps: "⩍", Ccaron: "Č", ccaron: "č", Ccedil: "Ç", ccedil: "ç", Ccirc: "Ĉ", ccirc: "ĉ", Cconint: "∰", ccups: "⩌", ccupssm: "⩐", Cdot: "Ċ", cdot: "ċ", cedil: "¸", Cedilla: "¸", cemptyv: "⦲", cent: "¢", centerdot: "·", CenterDot: "·", cfr: "𝔠", Cfr: "ℭ", CHcy: "Ч", chcy: "ч", check: "✓", checkmark: "✓", Chi: "Χ", chi: "χ", circ: "ˆ", circeq: "≗", circlearrowleft: "↺", circlearrowright: "↻", circledast: "⊛", circledcirc: "⊚", circleddash: "⊝", CircleDot: "⊙", circledR: "®", circledS: "Ⓢ", CircleMinus: "⊖", CirclePlus: "⊕", CircleTimes: "⊗", cir: "○", cirE: "⧃", cire: "≗", cirfnint: "⨐", cirmid: "⫯", cirscir: "⧂", ClockwiseContourIntegral: "∲", CloseCurlyDoubleQuote: "”", CloseCurlyQuote: "’", clubs: "♣", clubsuit: "♣", colon: ":", Colon: "∷", Colone: "⩴", colone: "≔", coloneq: "≔", comma: ",", commat: "@", comp: "∁", compfn: "∘", complement: "∁", complexes: "ℂ", cong: "≅", congdot: "⩭", Congruent: "≡", conint: "∮", Conint: "∯", ContourIntegral: "∮", copf: "𝕔", Copf: "ℂ", coprod: "∐", Coproduct: "∐", copy: "©", COPY: "©", copysr: "℗", CounterClockwiseContourIntegral: "∳", crarr: "↵", cross: "✗", Cross: "⨯", Cscr: "𝒞", cscr: "𝒸", csub: "⫏", csube: "⫑", csup: "⫐", csupe: "⫒", ctdot: "⋯", cudarrl: "⤸", cudarrr: "⤵", cuepr: "⋞", cuesc: "⋟", cularr: "↶", cularrp: "⤽", cupbrcap: "⩈", cupcap: "⩆", CupCap: "≍", cup: "∪", Cup: "⋓", cupcup: "⩊", cupdot: "⊍", cupor: "⩅", cups: "∪︀", curarr: "↷", curarrm: "⤼", curlyeqprec: "⋞", curlyeqsucc: "⋟", curlyvee: "⋎", curlywedge: "⋏", curren: "¤", curvearrowleft: "↶", curvearrowright: "↷", cuvee: "⋎", cuwed: "⋏", cwconint: "∲", cwint: "∱", cylcty: "⌭", dagger: "†", Dagger: "‡", daleth: "ℸ", darr: "↓", Darr: "↡", dArr: "⇓", dash: "‐", Dashv: "⫤", dashv: "⊣", dbkarow: "⤏", dblac: "˝", Dcaron: "Ď", dcaron: "ď", Dcy: "Д", dcy: "д", ddagger: "‡", ddarr: "⇊", DD: "ⅅ", dd: "ⅆ", DDotrahd: "⤑", ddotseq: "⩷", deg: "°", Del: "∇", Delta: "Δ", delta: "δ", demptyv: "⦱", dfisht: "⥿", Dfr: "𝔇", dfr: "𝔡", dHar: "⥥", dharl: "⇃", dharr: "⇂", DiacriticalAcute: "´", DiacriticalDot: "˙", DiacriticalDoubleAcute: "˝", DiacriticalGrave: "`", DiacriticalTilde: "˜", diam: "⋄", diamond: "⋄", Diamond: "⋄", diamondsuit: "♦", diams: "♦", die: "¨", DifferentialD: "ⅆ", digamma: "ϝ", disin: "⋲", div: "÷", divide: "÷", divideontimes: "⋇", divonx: "⋇", DJcy: "Ђ", djcy: "ђ", dlcorn: "⌞", dlcrop: "⌍", dollar: "$", Dopf: "𝔻", dopf: "𝕕", Dot: "¨", dot: "˙", DotDot: "⃜", doteq: "≐", doteqdot: "≑", DotEqual: "≐", dotminus: "∸", dotplus: "∔", dotsquare: "⊡", doublebarwedge: "⌆", DoubleContourIntegral: "∯", DoubleDot: "¨", DoubleDownArrow: "⇓", DoubleLeftArrow: "⇐", DoubleLeftRightArrow: "⇔", DoubleLeftTee: "⫤", DoubleLongLeftArrow: "⟸", DoubleLongLeftRightArrow: "⟺", DoubleLongRightArrow: "⟹", DoubleRightArrow: "⇒", DoubleRightTee: "⊨", DoubleUpArrow: "⇑", DoubleUpDownArrow: "⇕", DoubleVerticalBar: "∥", DownArrowBar: "⤓", downarrow: "↓", DownArrow: "↓", Downarrow: "⇓", DownArrowUpArrow: "⇵", DownBreve: "̑", downdownarrows: "⇊", downharpoonleft: "⇃", downharpoonright: "⇂", DownLeftRightVector: "⥐", DownLeftTeeVector: "⥞", DownLeftVectorBar: "⥖", DownLeftVector: "↽", DownRightTeeVector: "⥟", DownRightVectorBar: "⥗", DownRightVector: "⇁", DownTeeArrow: "↧", DownTee: "⊤", drbkarow: "⤐", drcorn: "⌟", drcrop: "⌌", Dscr: "𝒟", dscr: "𝒹", DScy: "Ѕ", dscy: "ѕ", dsol: "⧶", Dstrok: "Đ", dstrok: "đ", dtdot: "⋱", dtri: "▿", dtrif: "▾", duarr: "⇵", duhar: "⥯", dwangle: "⦦", DZcy: "Џ", dzcy: "џ", dzigrarr: "⟿", Eacute: "É", eacute: "é", easter: "⩮", Ecaron: "Ě", ecaron: "ě", Ecirc: "Ê", ecirc: "ê", ecir: "≖", ecolon: "≕", Ecy: "Э", ecy: "э", eDDot: "⩷", Edot: "Ė", edot: "ė", eDot: "≑", ee: "ⅇ", efDot: "≒", Efr: "𝔈", efr: "𝔢", eg: "⪚", Egrave: "È", egrave: "è", egs: "⪖", egsdot: "⪘", el: "⪙", Element: "∈", elinters: "⏧", ell: "ℓ", els: "⪕", elsdot: "⪗", Emacr: "Ē", emacr: "ē", empty: "∅", emptyset: "∅", EmptySmallSquare: "◻", emptyv: "∅", EmptyVerySmallSquare: "▫", emsp13: " ", emsp14: " ", emsp: " ", ENG: "Ŋ", eng: "ŋ", ensp: " ", Eogon: "Ę", eogon: "ę", Eopf: "𝔼", eopf: "𝕖", epar: "⋕", eparsl: "⧣", eplus: "⩱", epsi: "ε", Epsilon: "Ε", epsilon: "ε", epsiv: "ϵ", eqcirc: "≖", eqcolon: "≕", eqsim: "≂", eqslantgtr: "⪖", eqslantless: "⪕", Equal: "⩵", equals: "=", EqualTilde: "≂", equest: "≟", Equilibrium: "⇌", equiv: "≡", equivDD: "⩸", eqvparsl: "⧥", erarr: "⥱", erDot: "≓", escr: "ℯ", Escr: "ℰ", esdot: "≐", Esim: "⩳", esim: "≂", Eta: "Η", eta: "η", ETH: "Ð", eth: "ð", Euml: "Ë", euml: "ë", euro: "€", excl: "!", exist: "∃", Exists: "∃", expectation: "ℰ", exponentiale: "ⅇ", ExponentialE: "ⅇ", fallingdotseq: "≒", Fcy: "Ф", fcy: "ф", female: "♀", ffilig: "ffi", fflig: "ff", ffllig: "ffl", Ffr: "𝔉", ffr: "𝔣", filig: "fi", FilledSmallSquare: "◼", FilledVerySmallSquare: "▪", fjlig: "fj", flat: "♭", fllig: "fl", fltns: "▱", fnof: "ƒ", Fopf: "𝔽", fopf: "𝕗", forall: "∀", ForAll: "∀", fork: "⋔", forkv: "⫙", Fouriertrf: "ℱ", fpartint: "⨍", frac12: "½", frac13: "⅓", frac14: "¼", frac15: "⅕", frac16: "⅙", frac18: "⅛", frac23: "⅔", frac25: "⅖", frac34: "¾", frac35: "⅗", frac38: "⅜", frac45: "⅘", frac56: "⅚", frac58: "⅝", frac78: "⅞", frasl: "⁄", frown: "⌢", fscr: "𝒻", Fscr: "ℱ", gacute: "ǵ", Gamma: "Γ", gamma: "γ", Gammad: "Ϝ", gammad: "ϝ", gap: "⪆", Gbreve: "Ğ", gbreve: "ğ", Gcedil: "Ģ", Gcirc: "Ĝ", gcirc: "ĝ", Gcy: "Г", gcy: "г", Gdot: "Ġ", gdot: "ġ", ge: "≥", gE: "≧", gEl: "⪌", gel: "⋛", geq: "≥", geqq: "≧", geqslant: "⩾", gescc: "⪩", ges: "⩾", gesdot: "⪀", gesdoto: "⪂", gesdotol: "⪄", gesl: "⋛︀", gesles: "⪔", Gfr: "𝔊", gfr: "𝔤", gg: "≫", Gg: "⋙", ggg: "⋙", gimel: "ℷ", GJcy: "Ѓ", gjcy: "ѓ", gla: "⪥", gl: "≷", glE: "⪒", glj: "⪤", gnap: "⪊", gnapprox: "⪊", gne: "⪈", gnE: "≩", gneq: "⪈", gneqq: "≩", gnsim: "⋧", Gopf: "𝔾", gopf: "𝕘", grave: "`", GreaterEqual: "≥", GreaterEqualLess: "⋛", GreaterFullEqual: "≧", GreaterGreater: "⪢", GreaterLess: "≷", GreaterSlantEqual: "⩾", GreaterTilde: "≳", Gscr: "𝒢", gscr: "ℊ", gsim: "≳", gsime: "⪎", gsiml: "⪐", gtcc: "⪧", gtcir: "⩺", gt: ">", GT: ">", Gt: "≫", gtdot: "⋗", gtlPar: "⦕", gtquest: "⩼", gtrapprox: "⪆", gtrarr: "⥸", gtrdot: "⋗", gtreqless: "⋛", gtreqqless: "⪌", gtrless: "≷", gtrsim: "≳", gvertneqq: "≩︀", gvnE: "≩︀", Hacek: "ˇ", hairsp: " ", half: "½", hamilt: "ℋ", HARDcy: "Ъ", hardcy: "ъ", harrcir: "⥈", harr: "↔", hArr: "⇔", harrw: "↭", Hat: "^", hbar: "ℏ", Hcirc: "Ĥ", hcirc: "ĥ", hearts: "♥", heartsuit: "♥", hellip: "…", hercon: "⊹", hfr: "𝔥", Hfr: "ℌ", HilbertSpace: "ℋ", hksearow: "⤥", hkswarow: "⤦", hoarr: "⇿", homtht: "∻", hookleftarrow: "↩", hookrightarrow: "↪", hopf: "𝕙", Hopf: "ℍ", horbar: "―", HorizontalLine: "─", hscr: "𝒽", Hscr: "ℋ", hslash: "ℏ", Hstrok: "Ħ", hstrok: "ħ", HumpDownHump: "≎", HumpEqual: "≏", hybull: "⁃", hyphen: "‐", Iacute: "Í", iacute: "í", ic: "\u2063", Icirc: "Î", icirc: "î", Icy: "И", icy: "и", Idot: "İ", IEcy: "Е", iecy: "е", iexcl: "¡", iff: "⇔", ifr: "𝔦", Ifr: "ℑ", Igrave: "Ì", igrave: "ì", ii: "ⅈ", iiiint: "⨌", iiint: "∭", iinfin: "⧜", iiota: "℩", IJlig: "IJ", ijlig: "ij", Imacr: "Ī", imacr: "ī", image: "ℑ", ImaginaryI: "ⅈ", imagline: "ℐ", imagpart: "ℑ", imath: "ı", Im: "ℑ", imof: "⊷", imped: "Ƶ", Implies: "⇒", incare: "℅", in: "∈", infin: "∞", infintie: "⧝", inodot: "ı", intcal: "⊺", int: "∫", Int: "∬", integers: "ℤ", Integral: "∫", intercal: "⊺", Intersection: "⋂", intlarhk: "⨗", intprod: "⨼", InvisibleComma: "\u2063", InvisibleTimes: "\u2062", IOcy: "Ё", iocy: "ё", Iogon: "Į", iogon: "į", Iopf: "𝕀", iopf: "𝕚", Iota: "Ι", iota: "ι", iprod: "⨼", iquest: "¿", iscr: "𝒾", Iscr: "ℐ", isin: "∈", isindot: "⋵", isinE: "⋹", isins: "⋴", isinsv: "⋳", isinv: "∈", it: "\u2062", Itilde: "Ĩ", itilde: "ĩ", Iukcy: "І", iukcy: "і", Iuml: "Ï", iuml: "ï", Jcirc: "Ĵ", jcirc: "ĵ", Jcy: "Й", jcy: "й", Jfr: "𝔍", jfr: "𝔧", jmath: "ȷ", Jopf: "𝕁", jopf: "𝕛", Jscr: "𝒥", jscr: "𝒿", Jsercy: "Ј", jsercy: "ј", Jukcy: "Є", jukcy: "є", Kappa: "Κ", kappa: "κ", kappav: "ϰ", Kcedil: "Ķ", kcedil: "ķ", Kcy: "К", kcy: "к", Kfr: "𝔎", kfr: "𝔨", kgreen: "ĸ", KHcy: "Х", khcy: "х", KJcy: "Ќ", kjcy: "ќ", Kopf: "𝕂", kopf: "𝕜", Kscr: "𝒦", kscr: "𝓀", lAarr: "⇚", Lacute: "Ĺ", lacute: "ĺ", laemptyv: "⦴", lagran: "ℒ", Lambda: "Λ", lambda: "λ", lang: "⟨", Lang: "⟪", langd: "⦑", langle: "⟨", lap: "⪅", Laplacetrf: "ℒ", laquo: "«", larrb: "⇤", larrbfs: "⤟", larr: "←", Larr: "↞", lArr: "⇐", larrfs: "⤝", larrhk: "↩", larrlp: "↫", larrpl: "⤹", larrsim: "⥳", larrtl: "↢", latail: "⤙", lAtail: "⤛", lat: "⪫", late: "⪭", lates: "⪭︀", lbarr: "⤌", lBarr: "⤎", lbbrk: "❲", lbrace: "{", lbrack: "[", lbrke: "⦋", lbrksld: "⦏", lbrkslu: "⦍", Lcaron: "Ľ", lcaron: "ľ", Lcedil: "Ļ", lcedil: "ļ", lceil: "⌈", lcub: "{", Lcy: "Л", lcy: "л", ldca: "⤶", ldquo: "“", ldquor: "„", ldrdhar: "⥧", ldrushar: "⥋", ldsh: "↲", le: "≤", lE: "≦", LeftAngleBracket: "⟨", LeftArrowBar: "⇤", leftarrow: "←", LeftArrow: "←", Leftarrow: "⇐", LeftArrowRightArrow: "⇆", leftarrowtail: "↢", LeftCeiling: "⌈", LeftDoubleBracket: "⟦", LeftDownTeeVector: "⥡", LeftDownVectorBar: "⥙", LeftDownVector: "⇃", LeftFloor: "⌊", leftharpoondown: "↽", leftharpoonup: "↼", leftleftarrows: "⇇", leftrightarrow: "↔", LeftRightArrow: "↔", Leftrightarrow: "⇔", leftrightarrows: "⇆", leftrightharpoons: "⇋", leftrightsquigarrow: "↭", LeftRightVector: "⥎", LeftTeeArrow: "↤", LeftTee: "⊣", LeftTeeVector: "⥚", leftthreetimes: "⋋", LeftTriangleBar: "⧏", LeftTriangle: "⊲", LeftTriangleEqual: "⊴", LeftUpDownVector: "⥑", LeftUpTeeVector: "⥠", LeftUpVectorBar: "⥘", LeftUpVector: "↿", LeftVectorBar: "⥒", LeftVector: "↼", lEg: "⪋", leg: "⋚", leq: "≤", leqq: "≦", leqslant: "⩽", lescc: "⪨", les: "⩽", lesdot: "⩿", lesdoto: "⪁", lesdotor: "⪃", lesg: "⋚︀", lesges: "⪓", lessapprox: "⪅", lessdot: "⋖", lesseqgtr: "⋚", lesseqqgtr: "⪋", LessEqualGreater: "⋚", LessFullEqual: "≦", LessGreater: "≶", lessgtr: "≶", LessLess: "⪡", lesssim: "≲", LessSlantEqual: "⩽", LessTilde: "≲", lfisht: "⥼", lfloor: "⌊", Lfr: "𝔏", lfr: "𝔩", lg: "≶", lgE: "⪑", lHar: "⥢", lhard: "↽", lharu: "↼", lharul: "⥪", lhblk: "▄", LJcy: "Љ", ljcy: "љ", llarr: "⇇", ll: "≪", Ll: "⋘", llcorner: "⌞", Lleftarrow: "⇚", llhard: "⥫", lltri: "◺", Lmidot: "Ŀ", lmidot: "ŀ", lmoustache: "⎰", lmoust: "⎰", lnap: "⪉", lnapprox: "⪉", lne: "⪇", lnE: "≨", lneq: "⪇", lneqq: "≨", lnsim: "⋦", loang: "⟬", loarr: "⇽", lobrk: "⟦", longleftarrow: "⟵", LongLeftArrow: "⟵", Longleftarrow: "⟸", longleftrightarrow: "⟷", LongLeftRightArrow: "⟷", Longleftrightarrow: "⟺", longmapsto: "⟼", longrightarrow: "⟶", LongRightArrow: "⟶", Longrightarrow: "⟹", looparrowleft: "↫", looparrowright: "↬", lopar: "⦅", Lopf: "𝕃", lopf: "𝕝", loplus: "⨭", lotimes: "⨴", lowast: "∗", lowbar: "_", LowerLeftArrow: "↙", LowerRightArrow: "↘", loz: "◊", lozenge: "◊", lozf: "⧫", lpar: "(", lparlt: "⦓", lrarr: "⇆", lrcorner: "⌟", lrhar: "⇋", lrhard: "⥭", lrm: "\u200e", lrtri: "⊿", lsaquo: "‹", lscr: "𝓁", Lscr: "ℒ", lsh: "↰", Lsh: "↰", lsim: "≲", lsime: "⪍", lsimg: "⪏", lsqb: "[", lsquo: "‘", lsquor: "‚", Lstrok: "Ł", lstrok: "ł", ltcc: "⪦", ltcir: "⩹", lt: "<", LT: "<", Lt: "≪", ltdot: "⋖", lthree: "⋋", ltimes: "⋉", ltlarr: "⥶", ltquest: "⩻", ltri: "◃", ltrie: "⊴", ltrif: "◂", ltrPar: "⦖", lurdshar: "⥊", luruhar: "⥦", lvertneqq: "≨︀", lvnE: "≨︀", macr: "¯", male: "♂", malt: "✠", maltese: "✠", Map: "⤅", map: "↦", mapsto: "↦", mapstodown: "↧", mapstoleft: "↤", mapstoup: "↥", marker: "▮", mcomma: "⨩", Mcy: "М", mcy: "м", mdash: "—", mDDot: "∺", measuredangle: "∡", MediumSpace: " ", Mellintrf: "ℳ", Mfr: "𝔐", mfr: "𝔪", mho: "℧", micro: "µ", midast: "*", midcir: "⫰", mid: "∣", middot: "·", minusb: "⊟", minus: "−", minusd: "∸", minusdu: "⨪", MinusPlus: "∓", mlcp: "⫛", mldr: "…", mnplus: "∓", models: "⊧", Mopf: "𝕄", mopf: "𝕞", mp: "∓", mscr: "𝓂", Mscr: "ℳ", mstpos: "∾", Mu: "Μ", mu: "μ", multimap: "⊸", mumap: "⊸", nabla: "∇", Nacute: "Ń", nacute: "ń", nang: "∠⃒", nap: "≉", napE: "⩰̸", napid: "≋̸", napos: "ʼn", napprox: "≉", natural: "♮", naturals: "ℕ", natur: "♮", nbsp: " ", nbump: "≎̸", nbumpe: "≏̸", ncap: "⩃", Ncaron: "Ň", ncaron: "ň", Ncedil: "Ņ", ncedil: "ņ", ncong: "≇", ncongdot: "⩭̸", ncup: "⩂", Ncy: "Н", ncy: "н", ndash: "–", nearhk: "⤤", nearr: "↗", neArr: "⇗", nearrow: "↗", ne: "≠", nedot: "≐̸", NegativeMediumSpace: "", NegativeThickSpace: "", NegativeThinSpace: "", NegativeVeryThinSpace: "", nequiv: "≢", nesear: "⤨", nesim: "≂̸", NestedGreaterGreater: "≫", NestedLessLess: "≪", NewLine: "\u000a", nexist: "∄", nexists: "∄", Nfr: "𝔑", nfr: "𝔫", ngE: "≧̸", nge: "≱", ngeq: "≱", ngeqq: "≧̸", ngeqslant: "⩾̸", nges: "⩾̸", nGg: "⋙̸", ngsim: "≵", nGt: "≫⃒", ngt: "≯", ngtr: "≯", nGtv: "≫̸", nharr: "↮", nhArr: "⇎", nhpar: "⫲", ni: "∋", nis: "⋼", nisd: "⋺", niv: "∋", NJcy: "Њ", njcy: "њ", nlarr: "↚", nlArr: "⇍", nldr: "‥", nlE: "≦̸", nle: "≰", nleftarrow: "↚", nLeftarrow: "⇍", nleftrightarrow: "↮", nLeftrightarrow: "⇎", nleq: "≰", nleqq: "≦̸", nleqslant: "⩽̸", nles: "⩽̸", nless: "≮", nLl: "⋘̸", nlsim: "≴", nLt: "≪⃒", nlt: "≮", nltri: "⋪", nltrie: "⋬", nLtv: "≪̸", nmid: "∤", NoBreak: "\u2060", NonBreakingSpace: " ", nopf: "𝕟", Nopf: "ℕ", Not: "⫬", not: "¬", NotCongruent: "≢", NotCupCap: "≭", NotDoubleVerticalBar: "∦", NotElement: "∉", NotEqual: "≠", NotEqualTilde: "≂̸", NotExists: "∄", NotGreater: "≯", NotGreaterEqual: "≱", NotGreaterFullEqual: "≧̸", NotGreaterGreater: "≫̸", NotGreaterLess: "≹", NotGreaterSlantEqual: "⩾̸", NotGreaterTilde: "≵", NotHumpDownHump: "≎̸", NotHumpEqual: "≏̸", notin: "∉", notindot: "⋵̸", notinE: "⋹̸", notinva: "∉", notinvb: "⋷", notinvc: "⋶", NotLeftTriangleBar: "⧏̸", NotLeftTriangle: "⋪", NotLeftTriangleEqual: "⋬", NotLess: "≮", NotLessEqual: "≰", NotLessGreater: "≸", NotLessLess: "≪̸", NotLessSlantEqual: "⩽̸", NotLessTilde: "≴", NotNestedGreaterGreater: "⪢̸", NotNestedLessLess: "⪡̸", notni: "∌", notniva: "∌", notnivb: "⋾", notnivc: "⋽", NotPrecedes: "⊀", NotPrecedesEqual: "⪯̸", NotPrecedesSlantEqual: "⋠", NotReverseElement: "∌", NotRightTriangleBar: "⧐̸", NotRightTriangle: "⋫", NotRightTriangleEqual: "⋭", NotSquareSubset: "⊏̸", NotSquareSubsetEqual: "⋢", NotSquareSuperset: "⊐̸", NotSquareSupersetEqual: "⋣", NotSubset: "⊂⃒", NotSubsetEqual: "⊈", NotSucceeds: "⊁", NotSucceedsEqual: "⪰̸", NotSucceedsSlantEqual: "⋡", NotSucceedsTilde: "≿̸", NotSuperset: "⊃⃒", NotSupersetEqual: "⊉", NotTilde: "≁", NotTildeEqual: "≄", NotTildeFullEqual: "≇", NotTildeTilde: "≉", NotVerticalBar: "∤", nparallel: "∦", npar: "∦", nparsl: "⫽⃥", npart: "∂̸", npolint: "⨔", npr: "⊀", nprcue: "⋠", nprec: "⊀", npreceq: "⪯̸", npre: "⪯̸", nrarrc: "⤳̸", nrarr: "↛", nrArr: "⇏", nrarrw: "↝̸", nrightarrow: "↛", nRightarrow: "⇏", nrtri: "⋫", nrtrie: "⋭", nsc: "⊁", nsccue: "⋡", nsce: "⪰̸", Nscr: "𝒩", nscr: "𝓃", nshortmid: "∤", nshortparallel: "∦", nsim: "≁", nsime: "≄", nsimeq: "≄", nsmid: "∤", nspar: "∦", nsqsube: "⋢", nsqsupe: "⋣", nsub: "⊄", nsubE: "⫅̸", nsube: "⊈", nsubset: "⊂⃒", nsubseteq: "⊈", nsubseteqq: "⫅̸", nsucc: "⊁", nsucceq: "⪰̸", nsup: "⊅", nsupE: "⫆̸", nsupe: "⊉", nsupset: "⊃⃒", nsupseteq: "⊉", nsupseteqq: "⫆̸", ntgl: "≹", Ntilde: "Ñ", ntilde: "ñ", ntlg: "≸", ntriangleleft: "⋪", ntrianglelefteq: "⋬", ntriangleright: "⋫", ntrianglerighteq: "⋭", Nu: "Ν", nu: "ν", num: "#", numero: "№", numsp: " ", nvap: "≍⃒", nvdash: "⊬", nvDash: "⊭", nVdash: "⊮", nVDash: "⊯", nvge: "≥⃒", nvgt: ">⃒", nvHarr: "⤄", nvinfin: "⧞", nvlArr: "⤂", nvle: "≤⃒", nvlt: "<⃒", nvltrie: "⊴⃒", nvrArr: "⤃", nvrtrie: "⊵⃒", nvsim: "∼⃒", nwarhk: "⤣", nwarr: "↖", nwArr: "⇖", nwarrow: "↖", nwnear: "⤧", Oacute: "Ó", oacute: "ó", oast: "⊛", Ocirc: "Ô", ocirc: "ô", ocir: "⊚", Ocy: "О", ocy: "о", odash: "⊝", Odblac: "Ő", odblac: "ő", odiv: "⨸", odot: "⊙", odsold: "⦼", OElig: "Œ", oelig: "œ", ofcir: "⦿", Ofr: "𝔒", ofr: "𝔬", ogon: "˛", Ograve: "Ò", ograve: "ò", ogt: "⧁", ohbar: "⦵", ohm: "Ω", oint: "∮", olarr: "↺", olcir: "⦾", olcross: "⦻", oline: "‾", olt: "⧀", Omacr: "Ō", omacr: "ō", Omega: "Ω", omega: "ω", Omicron: "Ο", omicron: "ο", omid: "⦶", ominus: "⊖", Oopf: "𝕆", oopf: "𝕠", opar: "⦷", OpenCurlyDoubleQuote: "“", OpenCurlyQuote: "‘", operp: "⦹", oplus: "⊕", orarr: "↻", Or: "⩔", or: "∨", ord: "⩝", order: "ℴ", orderof: "ℴ", ordf: "ª", ordm: "º", origof: "⊶", oror: "⩖", orslope: "⩗", orv: "⩛", oS: "Ⓢ", Oscr: "𝒪", oscr: "ℴ", Oslash: "Ø", oslash: "ø", osol: "⊘", Otilde: "Õ", otilde: "õ", otimesas: "⨶", Otimes: "⨷", otimes: "⊗", Ouml: "Ö", ouml: "ö", ovbar: "⌽", OverBar: "‾", OverBrace: "⏞", OverBracket: "⎴", OverParenthesis: "⏜", para: "¶", parallel: "∥", par: "∥", parsim: "⫳", parsl: "⫽", part: "∂", PartialD: "∂", Pcy: "П", pcy: "п", percnt: "%", period: ".", permil: "‰", perp: "⊥", pertenk: "‱", Pfr: "𝔓", pfr: "𝔭", Phi: "Φ", phi: "φ", phiv: "ϕ", phmmat: "ℳ", phone: "☎", Pi: "Π", pi: "π", pitchfork: "⋔", piv: "ϖ", planck: "ℏ", planckh: "ℎ", plankv: "ℏ", plusacir: "⨣", plusb: "⊞", pluscir: "⨢", plus: "+", plusdo: "∔", plusdu: "⨥", pluse: "⩲", PlusMinus: "±", plusmn: "±", plussim: "⨦", plustwo: "⨧", pm: "±", Poincareplane: "ℌ", pointint: "⨕", popf: "𝕡", Popf: "ℙ", pound: "£", prap: "⪷", Pr: "⪻", pr: "≺", prcue: "≼", precapprox: "⪷", prec: "≺", preccurlyeq: "≼", Precedes: "≺", PrecedesEqual: "⪯", PrecedesSlantEqual: "≼", PrecedesTilde: "≾", preceq: "⪯", precnapprox: "⪹", precneqq: "⪵", precnsim: "⋨", pre: "⪯", prE: "⪳", precsim: "≾", prime: "′", Prime: "″", primes: "ℙ", prnap: "⪹", prnE: "⪵", prnsim: "⋨", prod: "∏", Product: "∏", profalar: "⌮", profline: "⌒", profsurf: "⌓", prop: "∝", Proportional: "∝", Proportion: "∷", propto: "∝", prsim: "≾", prurel: "⊰", Pscr: "𝒫", pscr: "𝓅", Psi: "Ψ", psi: "ψ", puncsp: " ", Qfr: "𝔔", qfr: "𝔮", qint: "⨌", qopf: "𝕢", Qopf: "ℚ", qprime: "⁗", Qscr: "𝒬", qscr: "𝓆", quaternions: "ℍ", quatint: "⨖", quest: "?", questeq: "≟", quot: "\"", QUOT: "\"", rAarr: "⇛", race: "∽̱", Racute: "Ŕ", racute: "ŕ", radic: "√", raemptyv: "⦳", rang: "⟩", Rang: "⟫", rangd: "⦒", range: "⦥", rangle: "⟩", raquo: "»", rarrap: "⥵", rarrb: "⇥", rarrbfs: "⤠", rarrc: "⤳", rarr: "→", Rarr: "↠", rArr: "⇒", rarrfs: "⤞", rarrhk: "↪", rarrlp: "↬", rarrpl: "⥅", rarrsim: "⥴", Rarrtl: "⤖", rarrtl: "↣", rarrw: "↝", ratail: "⤚", rAtail: "⤜", ratio: "∶", rationals: "ℚ", rbarr: "⤍", rBarr: "⤏", RBarr: "⤐", rbbrk: "❳", rbrace: "}", rbrack: "]", rbrke: "⦌", rbrksld: "⦎", rbrkslu: "⦐", Rcaron: "Ř", rcaron: "ř", Rcedil: "Ŗ", rcedil: "ŗ", rceil: "⌉", rcub: "}", Rcy: "Р", rcy: "р", rdca: "⤷", rdldhar: "⥩", rdquo: "”", rdquor: "”", rdsh: "↳", real: "ℜ", realine: "ℛ", realpart: "ℜ", reals: "ℝ", Re: "ℜ", rect: "▭", reg: "®", REG: "®", ReverseElement: "∋", ReverseEquilibrium: "⇋", ReverseUpEquilibrium: "⥯", rfisht: "⥽", rfloor: "⌋", rfr: "𝔯", Rfr: "ℜ", rHar: "⥤", rhard: "⇁", rharu: "⇀", rharul: "⥬", Rho: "Ρ", rho: "ρ", rhov: "ϱ", RightAngleBracket: "⟩", RightArrowBar: "⇥", rightarrow: "→", RightArrow: "→", Rightarrow: "⇒", RightArrowLeftArrow: "⇄", rightarrowtail: "↣", RightCeiling: "⌉", RightDoubleBracket: "⟧", RightDownTeeVector: "⥝", RightDownVectorBar: "⥕", RightDownVector: "⇂", RightFloor: "⌋", rightharpoondown: "⇁", rightharpoonup: "⇀", rightleftarrows: "⇄", rightleftharpoons: "⇌", rightrightarrows: "⇉", rightsquigarrow: "↝", RightTeeArrow: "↦", RightTee: "⊢", RightTeeVector: "⥛", rightthreetimes: "⋌", RightTriangleBar: "⧐", RightTriangle: "⊳", RightTriangleEqual: "⊵", RightUpDownVector: "⥏", RightUpTeeVector: "⥜", RightUpVectorBar: "⥔", RightUpVector: "↾", RightVectorBar: "⥓", RightVector: "⇀", ring: "˚", risingdotseq: "≓", rlarr: "⇄", rlhar: "⇌", rlm: "\u200f", rmoustache: "⎱", rmoust: "⎱", rnmid: "⫮", roang: "⟭", roarr: "⇾", robrk: "⟧", ropar: "⦆", ropf: "𝕣", Ropf: "ℝ", roplus: "⨮", rotimes: "⨵", RoundImplies: "⥰", rpar: ")", rpargt: "⦔", rppolint: "⨒", rrarr: "⇉", Rrightarrow: "⇛", rsaquo: "›", rscr: "𝓇", Rscr: "ℛ", rsh: "↱", Rsh: "↱", rsqb: "]", rsquo: "’", rsquor: "’", rthree: "⋌", rtimes: "⋊", rtri: "▹", rtrie: "⊵", rtrif: "▸", rtriltri: "⧎", RuleDelayed: "⧴", ruluhar: "⥨", rx: "℞", Sacute: "Ś", sacute: "ś", sbquo: "‚", scap: "⪸", Scaron: "Š", scaron: "š", Sc: "⪼", sc: "≻", sccue: "≽", sce: "⪰", scE: "⪴", Scedil: "Ş", scedil: "ş", Scirc: "Ŝ", scirc: "ŝ", scnap: "⪺", scnE: "⪶", scnsim: "⋩", scpolint: "⨓", scsim: "≿", Scy: "С", scy: "с", sdotb: "⊡", sdot: "⋅", sdote: "⩦", searhk: "⤥", searr: "↘", seArr: "⇘", searrow: "↘", sect: "§", semi: ";", seswar: "⤩", setminus: "∖", setmn: "∖", sext: "✶", Sfr: "𝔖", sfr: "𝔰", sfrown: "⌢", sharp: "♯", SHCHcy: "Щ", shchcy: "щ", SHcy: "Ш", shcy: "ш", ShortDownArrow: "↓", ShortLeftArrow: "←", shortmid: "∣", shortparallel: "∥", ShortRightArrow: "→", ShortUpArrow: "↑", shy: "\u00ad", Sigma: "Σ", sigma: "σ", sigmaf: "ς", sigmav: "ς", sim: "∼", simdot: "⩪", sime: "≃", simeq: "≃", simg: "⪞", simgE: "⪠", siml: "⪝", simlE: "⪟", simne: "≆", simplus: "⨤", simrarr: "⥲", slarr: "←", SmallCircle: "∘", smallsetminus: "∖", smashp: "⨳", smeparsl: "⧤", smid: "∣", smile: "⌣", smt: "⪪", smte: "⪬", smtes: "⪬︀", SOFTcy: "Ь", softcy: "ь", solbar: "⌿", solb: "⧄", sol: "/", Sopf: "𝕊", sopf: "𝕤", spades: "♠", spadesuit: "♠", spar: "∥", sqcap: "⊓", sqcaps: "⊓︀", sqcup: "⊔", sqcups: "⊔︀", Sqrt: "√", sqsub: "⊏", sqsube: "⊑", sqsubset: "⊏", sqsubseteq: "⊑", sqsup: "⊐", sqsupe: "⊒", sqsupset: "⊐", sqsupseteq: "⊒", square: "□", Square: "□", SquareIntersection: "⊓", SquareSubset: "⊏", SquareSubsetEqual: "⊑", SquareSuperset: "⊐", SquareSupersetEqual: "⊒", SquareUnion: "⊔", squarf: "▪", squ: "□", squf: "▪", srarr: "→", Sscr: "𝒮", sscr: "𝓈", ssetmn: "∖", ssmile: "⌣", sstarf: "⋆", Star: "⋆", star: "☆", starf: "★", straightepsilon: "ϵ", straightphi: "ϕ", strns: "¯", sub: "⊂", Sub: "⋐", subdot: "⪽", subE: "⫅", sube: "⊆", subedot: "⫃", submult: "⫁", subnE: "⫋", subne: "⊊", subplus: "⪿", subrarr: "⥹", subset: "⊂", Subset: "⋐", subseteq: "⊆", subseteqq: "⫅", SubsetEqual: "⊆", subsetneq: "⊊", subsetneqq: "⫋", subsim: "⫇", subsub: "⫕", subsup: "⫓", succapprox: "⪸", succ: "≻", succcurlyeq: "≽", Succeeds: "≻", SucceedsEqual: "⪰", SucceedsSlantEqual: "≽", SucceedsTilde: "≿", succeq: "⪰", succnapprox: "⪺", succneqq: "⪶", succnsim: "⋩", succsim: "≿", SuchThat: "∋", sum: "∑", Sum: "∑", sung: "♪", sup1: "¹", sup2: "²", sup3: "³", sup: "⊃", Sup: "⋑", supdot: "⪾", supdsub: "⫘", supE: "⫆", supe: "⊇", supedot: "⫄", Superset: "⊃", SupersetEqual: "⊇", suphsol: "⟉", suphsub: "⫗", suplarr: "⥻", supmult: "⫂", supnE: "⫌", supne: "⊋", supplus: "⫀", supset: "⊃", Supset: "⋑", supseteq: "⊇", supseteqq: "⫆", supsetneq: "⊋", supsetneqq: "⫌", supsim: "⫈", supsub: "⫔", supsup: "⫖", swarhk: "⤦", swarr: "↙", swArr: "⇙", swarrow: "↙", swnwar: "⤪", szlig: "ß", Tab: "\u0009", target: "⌖", Tau: "Τ", tau: "τ", tbrk: "⎴", Tcaron: "Ť", tcaron: "ť", Tcedil: "Ţ", tcedil: "ţ", Tcy: "Т", tcy: "т", tdot: "⃛", telrec: "⌕", Tfr: "𝔗", tfr: "𝔱", there4: "∴", therefore: "∴", Therefore: "∴", Theta: "Θ", theta: "θ", thetasym: "ϑ", thetav: "ϑ", thickapprox: "≈", thicksim: "∼", ThickSpace: " ", ThinSpace: " ", thinsp: " ", thkap: "≈", thksim: "∼", THORN: "Þ", thorn: "þ", tilde: "˜", Tilde: "∼", TildeEqual: "≃", TildeFullEqual: "≅", TildeTilde: "≈", timesbar: "⨱", timesb: "⊠", times: "×", timesd: "⨰", tint: "∭", toea: "⤨", topbot: "⌶", topcir: "⫱", top: "⊤", Topf: "𝕋", topf: "𝕥", topfork: "⫚", tosa: "⤩", tprime: "‴", trade: "™", TRADE: "™", triangle: "▵", triangledown: "▿", triangleleft: "◃", trianglelefteq: "⊴", triangleq: "≜", triangleright: "▹", trianglerighteq: "⊵", tridot: "◬", trie: "≜", triminus: "⨺", TripleDot: "⃛", triplus: "⨹", trisb: "⧍", tritime: "⨻", trpezium: "⏢", Tscr: "𝒯", tscr: "𝓉", TScy: "Ц", tscy: "ц", TSHcy: "Ћ", tshcy: "ћ", Tstrok: "Ŧ", tstrok: "ŧ", twixt: "≬", twoheadleftarrow: "↞", twoheadrightarrow: "↠", Uacute: "Ú", uacute: "ú", uarr: "↑", Uarr: "↟", uArr: "⇑", Uarrocir: "⥉", Ubrcy: "Ў", ubrcy: "ў", Ubreve: "Ŭ", ubreve: "ŭ", Ucirc: "Û", ucirc: "û", Ucy: "У", ucy: "у", udarr: "⇅", Udblac: "Ű", udblac: "ű", udhar: "⥮", ufisht: "⥾", Ufr: "𝔘", ufr: "𝔲", Ugrave: "Ù", ugrave: "ù", uHar: "⥣", uharl: "↿", uharr: "↾", uhblk: "▀", ulcorn: "⌜", ulcorner: "⌜", ulcrop: "⌏", ultri: "◸", Umacr: "Ū", umacr: "ū", uml: "¨", UnderBar: "_", UnderBrace: "⏟", UnderBracket: "⎵", UnderParenthesis: "⏝", Union: "⋃", UnionPlus: "⊎", Uogon: "Ų", uogon: "ų", Uopf: "𝕌", uopf: "𝕦", UpArrowBar: "⤒", uparrow: "↑", UpArrow: "↑", Uparrow: "⇑", UpArrowDownArrow: "⇅", updownarrow: "↕", UpDownArrow: "↕", Updownarrow: "⇕", UpEquilibrium: "⥮", upharpoonleft: "↿", upharpoonright: "↾", uplus: "⊎", UpperLeftArrow: "↖", UpperRightArrow: "↗", upsi: "υ", Upsi: "ϒ", upsih: "ϒ", Upsilon: "Υ", upsilon: "υ", UpTeeArrow: "↥", UpTee: "⊥", upuparrows: "⇈", urcorn: "⌝", urcorner: "⌝", urcrop: "⌎", Uring: "Ů", uring: "ů", urtri: "◹", Uscr: "𝒰", uscr: "𝓊", utdot: "⋰", Utilde: "Ũ", utilde: "ũ", utri: "▵", utrif: "▴", uuarr: "⇈", Uuml: "Ü", uuml: "ü", uwangle: "⦧", vangrt: "⦜", varepsilon: "ϵ", varkappa: "ϰ", varnothing: "∅", varphi: "ϕ", varpi: "ϖ", varpropto: "∝", varr: "↕", vArr: "⇕", varrho: "ϱ", varsigma: "ς", varsubsetneq: "⊊︀", varsubsetneqq: "⫋︀", varsupsetneq: "⊋︀", varsupsetneqq: "⫌︀", vartheta: "ϑ", vartriangleleft: "⊲", vartriangleright: "⊳", vBar: "⫨", Vbar: "⫫", vBarv: "⫩", Vcy: "В", vcy: "в", vdash: "⊢", vDash: "⊨", Vdash: "⊩", VDash: "⊫", Vdashl: "⫦", veebar: "⊻", vee: "∨", Vee: "⋁", veeeq: "≚", vellip: "⋮", verbar: "|", Verbar: "‖", vert: "|", Vert: "‖", VerticalBar: "∣", VerticalLine: "|", VerticalSeparator: "❘", VerticalTilde: "≀", VeryThinSpace: " ", Vfr: "𝔙", vfr: "𝔳", vltri: "⊲", vnsub: "⊂⃒", vnsup: "⊃⃒", Vopf: "𝕍", vopf: "𝕧", vprop: "∝", vrtri: "⊳", Vscr: "𝒱", vscr: "𝓋", vsubnE: "⫋︀", vsubne: "⊊︀", vsupnE: "⫌︀", vsupne: "⊋︀", Vvdash: "⊪", vzigzag: "⦚", Wcirc: "Ŵ", wcirc: "ŵ", wedbar: "⩟", wedge: "∧", Wedge: "⋀", wedgeq: "≙", weierp: "℘", Wfr: "𝔚", wfr: "𝔴", Wopf: "𝕎", wopf: "𝕨", wp: "℘", wr: "≀", wreath: "≀", Wscr: "𝒲", wscr: "𝓌", xcap: "⋂", xcirc: "◯", xcup: "⋃", xdtri: "▽", Xfr: "𝔛", xfr: "𝔵", xharr: "⟷", xhArr: "⟺", Xi: "Ξ", xi: "ξ", xlarr: "⟵", xlArr: "⟸", xmap: "⟼", xnis: "⋻", xodot: "⨀", Xopf: "𝕏", xopf: "𝕩", xoplus: "⨁", xotime: "⨂", xrarr: "⟶", xrArr: "⟹", Xscr: "𝒳", xscr: "𝓍", xsqcup: "⨆", xuplus: "⨄", xutri: "△", xvee: "⋁", xwedge: "⋀", Yacute: "Ý", yacute: "ý", YAcy: "Я", yacy: "я", Ycirc: "Ŷ", ycirc: "ŷ", Ycy: "Ы", ycy: "ы", yen: "¥", Yfr: "𝔜", yfr: "𝔶", YIcy: "Ї", yicy: "ї", Yopf: "𝕐", yopf: "𝕪", Yscr: "𝒴", yscr: "𝓎", YUcy: "Ю", yucy: "ю", yuml: "ÿ", Yuml: "Ÿ", Zacute: "Ź", zacute: "ź", Zcaron: "Ž", zcaron: "ž", Zcy: "З", zcy: "з", Zdot: "Ż", zdot: "ż", zeetrf: "ℨ", ZeroWidthSpace: "", Zeta: "Ζ", zeta: "ζ", zfr: "𝔷", Zfr: "ℨ", ZHcy: "Ж", zhcy: "ж", zigrarr: "⇝", zopf: "𝕫", Zopf: "ℤ", Zscr: "𝒵", zscr: "𝓏", zwj: "\u200d", zwnj: "\u200c" |
|
8165 }; |
|
8166 |
|
8167 var HEXCHARCODE = /^#[xX]([A-Fa-f0-9]+)$/; |
|
8168 var CHARCODE = /^#([0-9]+)$/; |
|
8169 var NAMED = /^([A-Za-z0-9]+)$/; |
|
8170 var EntityParser = /** @class */ (function () { |
|
8171 function EntityParser(named) { |
|
8172 this.named = named; |
|
8173 } |
|
8174 EntityParser.prototype.parse = function (entity) { |
|
8175 if (!entity) { |
|
8176 return; |
|
8177 } |
|
8178 var matches = entity.match(HEXCHARCODE); |
|
8179 if (matches) { |
|
8180 return String.fromCharCode(parseInt(matches[1], 16)); |
|
8181 } |
|
8182 matches = entity.match(CHARCODE); |
|
8183 if (matches) { |
|
8184 return String.fromCharCode(parseInt(matches[1], 10)); |
|
8185 } |
|
8186 matches = entity.match(NAMED); |
|
8187 if (matches) { |
|
8188 return this.named[matches[1]]; |
|
8189 } |
|
8190 }; |
|
8191 return EntityParser; |
|
8192 }()); |
|
8193 |
|
7386 var WSP = /[\t\n\f ]/; |
8194 var WSP = /[\t\n\f ]/; |
7387 var ALPHA = /[A-Za-z]/; |
8195 var ALPHA = /[A-Za-z]/; |
7388 var CRLF = /\r\n?/g; |
8196 var CRLF = /\r\n?/g; |
7389 function isSpace(char) { |
8197 function isSpace(char) { |
7390 return WSP.test(char); |
8198 return WSP.test(char); |
7391 } |
8199 } |
7392 function isAlpha(char) { |
8200 function isAlpha(char) { |
7393 return ALPHA.test(char); |
8201 return ALPHA.test(char); |
7394 } |
8202 } |
7395 function preprocessInput(input) { |
8203 function preprocessInput(input) { |
7396 return input.replace(CRLF, "\n"); |
8204 return input.replace(CRLF, '\n'); |
7397 } |
8205 } |
7398 function unwrap(maybe, msg) { |
8206 |
7399 if (!maybe) |
8207 var EventedTokenizer = /** @class */ (function () { |
7400 throw new Error((msg || 'value') + " was null"); |
|
7401 return maybe; |
|
7402 } |
|
7403 function or(maybe, otherwise) { |
|
7404 return maybe || otherwise; |
|
7405 } |
|
7406 |
|
7407 // CONCATENATED MODULE: ./node_modules/simple-html-tokenizer/dist/es6/evented-tokenizer.js |
|
7408 |
|
7409 var evented_tokenizer_EventedTokenizer = /** @class */ (function () { |
|
7410 function EventedTokenizer(delegate, entityParser) { |
8208 function EventedTokenizer(delegate, entityParser) { |
7411 this.delegate = delegate; |
8209 this.delegate = delegate; |
7412 this.entityParser = entityParser; |
8210 this.entityParser = entityParser; |
7413 this.state = null; |
8211 this.state = "beforeData" /* beforeData */; |
7414 this.input = null; |
|
7415 this.index = -1; |
|
7416 this.tagLine = -1; |
|
7417 this.tagColumn = -1; |
|
7418 this.line = -1; |
8212 this.line = -1; |
7419 this.column = -1; |
8213 this.column = -1; |
8214 this.input = ''; |
|
8215 this.index = -1; |
|
8216 this.tagNameBuffer = ''; |
|
7420 this.states = { |
8217 this.states = { |
7421 beforeData: function () { |
8218 beforeData: function () { |
7422 var char = this.peek(); |
8219 var char = this.peek(); |
7423 if (char === "<") { |
8220 if (char === '<' && !this.isIgnoredEndTag()) { |
7424 this.state = 'tagOpen'; |
8221 this.transitionTo("tagOpen" /* tagOpen */); |
7425 this.markTagStart(); |
8222 this.markTagStart(); |
7426 this.consume(); |
8223 this.consume(); |
7427 } |
8224 } |
7428 else { |
8225 else { |
7429 this.state = 'data'; |
8226 if (char === '\n') { |
8227 var tag = this.tagNameBuffer.toLowerCase(); |
|
8228 if (tag === 'pre' || tag === 'textarea') { |
|
8229 this.consume(); |
|
8230 } |
|
8231 } |
|
8232 this.transitionTo("data" /* data */); |
|
7430 this.delegate.beginData(); |
8233 this.delegate.beginData(); |
7431 } |
8234 } |
7432 }, |
8235 }, |
7433 data: function () { |
8236 data: function () { |
7434 var char = this.peek(); |
8237 var char = this.peek(); |
7435 if (char === "<") { |
8238 var tag = this.tagNameBuffer; |
8239 if (char === '<' && !this.isIgnoredEndTag()) { |
|
7436 this.delegate.finishData(); |
8240 this.delegate.finishData(); |
7437 this.state = 'tagOpen'; |
8241 this.transitionTo("tagOpen" /* tagOpen */); |
7438 this.markTagStart(); |
8242 this.markTagStart(); |
7439 this.consume(); |
8243 this.consume(); |
7440 } |
8244 } |
7441 else if (char === "&") { |
8245 else if (char === '&' && tag !== 'script' && tag !== 'style') { |
7442 this.consume(); |
8246 this.consume(); |
7443 this.delegate.appendToData(this.consumeCharRef() || "&"); |
8247 this.delegate.appendToData(this.consumeCharRef() || '&'); |
7444 } |
8248 } |
7445 else { |
8249 else { |
7446 this.consume(); |
8250 this.consume(); |
7447 this.delegate.appendToData(char); |
8251 this.delegate.appendToData(char); |
7448 } |
8252 } |
7449 }, |
8253 }, |
7450 tagOpen: function () { |
8254 tagOpen: function () { |
7451 var char = this.consume(); |
8255 var char = this.consume(); |
7452 if (char === "!") { |
8256 if (char === '!') { |
7453 this.state = 'markupDeclaration'; |
8257 this.transitionTo("markupDeclarationOpen" /* markupDeclarationOpen */); |
7454 } |
8258 } |
7455 else if (char === "/") { |
8259 else if (char === '/') { |
7456 this.state = 'endTagOpen'; |
8260 this.transitionTo("endTagOpen" /* endTagOpen */); |
7457 } |
8261 } |
7458 else if (isAlpha(char)) { |
8262 else if (char === '@' || char === ':' || isAlpha(char)) { |
7459 this.state = 'tagName'; |
8263 this.transitionTo("tagName" /* tagName */); |
8264 this.tagNameBuffer = ''; |
|
7460 this.delegate.beginStartTag(); |
8265 this.delegate.beginStartTag(); |
7461 this.delegate.appendToTagName(char.toLowerCase()); |
8266 this.appendToTagName(char); |
7462 } |
8267 } |
7463 }, |
8268 }, |
7464 markupDeclaration: function () { |
8269 markupDeclarationOpen: function () { |
7465 var char = this.consume(); |
8270 var char = this.consume(); |
7466 if (char === "-" && this.input.charAt(this.index) === "-") { |
8271 if (char === '-' && this.peek() === '-') { |
7467 this.consume(); |
8272 this.consume(); |
7468 this.state = 'commentStart'; |
8273 this.transitionTo("commentStart" /* commentStart */); |
7469 this.delegate.beginComment(); |
8274 this.delegate.beginComment(); |
7470 } |
8275 } |
7471 }, |
8276 }, |
7472 commentStart: function () { |
8277 commentStart: function () { |
7473 var char = this.consume(); |
8278 var char = this.consume(); |
7474 if (char === "-") { |
8279 if (char === '-') { |
7475 this.state = 'commentStartDash'; |
8280 this.transitionTo("commentStartDash" /* commentStartDash */); |
7476 } |
8281 } |
7477 else if (char === ">") { |
8282 else if (char === '>') { |
7478 this.delegate.finishComment(); |
8283 this.delegate.finishComment(); |
7479 this.state = 'beforeData'; |
8284 this.transitionTo("beforeData" /* beforeData */); |
7480 } |
8285 } |
7481 else { |
8286 else { |
7482 this.delegate.appendToCommentData(char); |
8287 this.delegate.appendToCommentData(char); |
7483 this.state = 'comment'; |
8288 this.transitionTo("comment" /* comment */); |
7484 } |
8289 } |
7485 }, |
8290 }, |
7486 commentStartDash: function () { |
8291 commentStartDash: function () { |
7487 var char = this.consume(); |
8292 var char = this.consume(); |
7488 if (char === "-") { |
8293 if (char === '-') { |
7489 this.state = 'commentEnd'; |
8294 this.transitionTo("commentEnd" /* commentEnd */); |
7490 } |
8295 } |
7491 else if (char === ">") { |
8296 else if (char === '>') { |
7492 this.delegate.finishComment(); |
8297 this.delegate.finishComment(); |
7493 this.state = 'beforeData'; |
8298 this.transitionTo("beforeData" /* beforeData */); |
7494 } |
8299 } |
7495 else { |
8300 else { |
7496 this.delegate.appendToCommentData("-"); |
8301 this.delegate.appendToCommentData('-'); |
7497 this.state = 'comment'; |
8302 this.transitionTo("comment" /* comment */); |
7498 } |
8303 } |
7499 }, |
8304 }, |
7500 comment: function () { |
8305 comment: function () { |
7501 var char = this.consume(); |
8306 var char = this.consume(); |
7502 if (char === "-") { |
8307 if (char === '-') { |
7503 this.state = 'commentEndDash'; |
8308 this.transitionTo("commentEndDash" /* commentEndDash */); |
7504 } |
8309 } |
7505 else { |
8310 else { |
7506 this.delegate.appendToCommentData(char); |
8311 this.delegate.appendToCommentData(char); |
7507 } |
8312 } |
7508 }, |
8313 }, |
7509 commentEndDash: function () { |
8314 commentEndDash: function () { |
7510 var char = this.consume(); |
8315 var char = this.consume(); |
7511 if (char === "-") { |
8316 if (char === '-') { |
7512 this.state = 'commentEnd'; |
8317 this.transitionTo("commentEnd" /* commentEnd */); |
7513 } |
8318 } |
7514 else { |
8319 else { |
7515 this.delegate.appendToCommentData("-" + char); |
8320 this.delegate.appendToCommentData('-' + char); |
7516 this.state = 'comment'; |
8321 this.transitionTo("comment" /* comment */); |
7517 } |
8322 } |
7518 }, |
8323 }, |
7519 commentEnd: function () { |
8324 commentEnd: function () { |
7520 var char = this.consume(); |
8325 var char = this.consume(); |
7521 if (char === ">") { |
8326 if (char === '>') { |
7522 this.delegate.finishComment(); |
8327 this.delegate.finishComment(); |
7523 this.state = 'beforeData'; |
8328 this.transitionTo("beforeData" /* beforeData */); |
7524 } |
8329 } |
7525 else { |
8330 else { |
7526 this.delegate.appendToCommentData("--" + char); |
8331 this.delegate.appendToCommentData('--' + char); |
7527 this.state = 'comment'; |
8332 this.transitionTo("comment" /* comment */); |
7528 } |
8333 } |
7529 }, |
8334 }, |
7530 tagName: function () { |
8335 tagName: function () { |
7531 var char = this.consume(); |
8336 var char = this.consume(); |
7532 if (isSpace(char)) { |
8337 if (isSpace(char)) { |
7533 this.state = 'beforeAttributeName'; |
8338 this.transitionTo("beforeAttributeName" /* beforeAttributeName */); |
7534 } |
8339 } |
7535 else if (char === "/") { |
8340 else if (char === '/') { |
7536 this.state = 'selfClosingStartTag'; |
8341 this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */); |
7537 } |
8342 } |
7538 else if (char === ">") { |
8343 else if (char === '>') { |
7539 this.delegate.finishTag(); |
8344 this.delegate.finishTag(); |
7540 this.state = 'beforeData'; |
8345 this.transitionTo("beforeData" /* beforeData */); |
7541 } |
8346 } |
7542 else { |
8347 else { |
7543 this.delegate.appendToTagName(char); |
8348 this.appendToTagName(char); |
8349 } |
|
8350 }, |
|
8351 endTagName: function () { |
|
8352 var char = this.consume(); |
|
8353 if (isSpace(char)) { |
|
8354 this.transitionTo("beforeAttributeName" /* beforeAttributeName */); |
|
8355 this.tagNameBuffer = ''; |
|
8356 } |
|
8357 else if (char === '/') { |
|
8358 this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */); |
|
8359 this.tagNameBuffer = ''; |
|
8360 } |
|
8361 else if (char === '>') { |
|
8362 this.delegate.finishTag(); |
|
8363 this.transitionTo("beforeData" /* beforeData */); |
|
8364 this.tagNameBuffer = ''; |
|
8365 } |
|
8366 else { |
|
8367 this.appendToTagName(char); |
|
7544 } |
8368 } |
7545 }, |
8369 }, |
7546 beforeAttributeName: function () { |
8370 beforeAttributeName: function () { |
7547 var char = this.peek(); |
8371 var char = this.peek(); |
7548 if (isSpace(char)) { |
8372 if (isSpace(char)) { |
7549 this.consume(); |
8373 this.consume(); |
7550 return; |
8374 return; |
7551 } |
8375 } |
7552 else if (char === "/") { |
8376 else if (char === '/') { |
7553 this.state = 'selfClosingStartTag'; |
8377 this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */); |
7554 this.consume(); |
8378 this.consume(); |
7555 } |
8379 } |
7556 else if (char === ">") { |
8380 else if (char === '>') { |
7557 this.consume(); |
8381 this.consume(); |
7558 this.delegate.finishTag(); |
8382 this.delegate.finishTag(); |
7559 this.state = 'beforeData'; |
8383 this.transitionTo("beforeData" /* beforeData */); |
7560 } |
8384 } |
7561 else if (char === '=') { |
8385 else if (char === '=') { |
7562 this.delegate.reportSyntaxError("attribute name cannot start with equals sign"); |
8386 this.delegate.reportSyntaxError('attribute name cannot start with equals sign'); |
7563 this.state = 'attributeName'; |
8387 this.transitionTo("attributeName" /* attributeName */); |
7564 this.delegate.beginAttribute(); |
8388 this.delegate.beginAttribute(); |
7565 this.consume(); |
8389 this.consume(); |
7566 this.delegate.appendToAttributeName(char); |
8390 this.delegate.appendToAttributeName(char); |
7567 } |
8391 } |
7568 else { |
8392 else { |
7569 this.state = 'attributeName'; |
8393 this.transitionTo("attributeName" /* attributeName */); |
7570 this.delegate.beginAttribute(); |
8394 this.delegate.beginAttribute(); |
7571 } |
8395 } |
7572 }, |
8396 }, |
7573 attributeName: function () { |
8397 attributeName: function () { |
7574 var char = this.peek(); |
8398 var char = this.peek(); |
7575 if (isSpace(char)) { |
8399 if (isSpace(char)) { |
7576 this.state = 'afterAttributeName'; |
8400 this.transitionTo("afterAttributeName" /* afterAttributeName */); |
7577 this.consume(); |
8401 this.consume(); |
7578 } |
8402 } |
7579 else if (char === "/") { |
8403 else if (char === '/') { |
7580 this.delegate.beginAttributeValue(false); |
8404 this.delegate.beginAttributeValue(false); |
7581 this.delegate.finishAttributeValue(); |
8405 this.delegate.finishAttributeValue(); |
7582 this.consume(); |
8406 this.consume(); |
7583 this.state = 'selfClosingStartTag'; |
8407 this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */); |
7584 } |
8408 } |
7585 else if (char === "=") { |
8409 else if (char === '=') { |
7586 this.state = 'beforeAttributeValue'; |
8410 this.transitionTo("beforeAttributeValue" /* beforeAttributeValue */); |
7587 this.consume(); |
8411 this.consume(); |
7588 } |
8412 } |
7589 else if (char === ">") { |
8413 else if (char === '>') { |
7590 this.delegate.beginAttributeValue(false); |
8414 this.delegate.beginAttributeValue(false); |
7591 this.delegate.finishAttributeValue(); |
8415 this.delegate.finishAttributeValue(); |
7592 this.consume(); |
8416 this.consume(); |
7593 this.delegate.finishTag(); |
8417 this.delegate.finishTag(); |
7594 this.state = 'beforeData'; |
8418 this.transitionTo("beforeData" /* beforeData */); |
7595 } |
8419 } |
7596 else if (char === '"' || char === "'" || char === '<') { |
8420 else if (char === '"' || char === "'" || char === '<') { |
7597 this.delegate.reportSyntaxError(char + " is not a valid character within attribute names"); |
8421 this.delegate.reportSyntaxError(char + ' is not a valid character within attribute names'); |
7598 this.consume(); |
8422 this.consume(); |
7599 this.delegate.appendToAttributeName(char); |
8423 this.delegate.appendToAttributeName(char); |
7600 } |
8424 } |
7601 else { |
8425 else { |
7602 this.consume(); |
8426 this.consume(); |
7607 var char = this.peek(); |
8431 var char = this.peek(); |
7608 if (isSpace(char)) { |
8432 if (isSpace(char)) { |
7609 this.consume(); |
8433 this.consume(); |
7610 return; |
8434 return; |
7611 } |
8435 } |
7612 else if (char === "/") { |
8436 else if (char === '/') { |
7613 this.delegate.beginAttributeValue(false); |
8437 this.delegate.beginAttributeValue(false); |
7614 this.delegate.finishAttributeValue(); |
8438 this.delegate.finishAttributeValue(); |
7615 this.consume(); |
8439 this.consume(); |
7616 this.state = 'selfClosingStartTag'; |
8440 this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */); |
7617 } |
8441 } |
7618 else if (char === "=") { |
8442 else if (char === '=') { |
7619 this.consume(); |
8443 this.consume(); |
7620 this.state = 'beforeAttributeValue'; |
8444 this.transitionTo("beforeAttributeValue" /* beforeAttributeValue */); |
7621 } |
8445 } |
7622 else if (char === ">") { |
8446 else if (char === '>') { |
7623 this.delegate.beginAttributeValue(false); |
8447 this.delegate.beginAttributeValue(false); |
7624 this.delegate.finishAttributeValue(); |
8448 this.delegate.finishAttributeValue(); |
7625 this.consume(); |
8449 this.consume(); |
7626 this.delegate.finishTag(); |
8450 this.delegate.finishTag(); |
7627 this.state = 'beforeData'; |
8451 this.transitionTo("beforeData" /* beforeData */); |
7628 } |
8452 } |
7629 else { |
8453 else { |
7630 this.delegate.beginAttributeValue(false); |
8454 this.delegate.beginAttributeValue(false); |
7631 this.delegate.finishAttributeValue(); |
8455 this.delegate.finishAttributeValue(); |
8456 this.transitionTo("attributeName" /* attributeName */); |
|
8457 this.delegate.beginAttribute(); |
|
7632 this.consume(); |
8458 this.consume(); |
7633 this.state = 'attributeName'; |
|
7634 this.delegate.beginAttribute(); |
|
7635 this.delegate.appendToAttributeName(char); |
8459 this.delegate.appendToAttributeName(char); |
7636 } |
8460 } |
7637 }, |
8461 }, |
7638 beforeAttributeValue: function () { |
8462 beforeAttributeValue: function () { |
7639 var char = this.peek(); |
8463 var char = this.peek(); |
7640 if (isSpace(char)) { |
8464 if (isSpace(char)) { |
7641 this.consume(); |
8465 this.consume(); |
7642 } |
8466 } |
7643 else if (char === '"') { |
8467 else if (char === '"') { |
7644 this.state = 'attributeValueDoubleQuoted'; |
8468 this.transitionTo("attributeValueDoubleQuoted" /* attributeValueDoubleQuoted */); |
7645 this.delegate.beginAttributeValue(true); |
8469 this.delegate.beginAttributeValue(true); |
7646 this.consume(); |
8470 this.consume(); |
7647 } |
8471 } |
7648 else if (char === "'") { |
8472 else if (char === "'") { |
7649 this.state = 'attributeValueSingleQuoted'; |
8473 this.transitionTo("attributeValueSingleQuoted" /* attributeValueSingleQuoted */); |
7650 this.delegate.beginAttributeValue(true); |
8474 this.delegate.beginAttributeValue(true); |
7651 this.consume(); |
8475 this.consume(); |
7652 } |
8476 } |
7653 else if (char === ">") { |
8477 else if (char === '>') { |
7654 this.delegate.beginAttributeValue(false); |
8478 this.delegate.beginAttributeValue(false); |
7655 this.delegate.finishAttributeValue(); |
8479 this.delegate.finishAttributeValue(); |
7656 this.consume(); |
8480 this.consume(); |
7657 this.delegate.finishTag(); |
8481 this.delegate.finishTag(); |
7658 this.state = 'beforeData'; |
8482 this.transitionTo("beforeData" /* beforeData */); |
7659 } |
8483 } |
7660 else { |
8484 else { |
7661 this.state = 'attributeValueUnquoted'; |
8485 this.transitionTo("attributeValueUnquoted" /* attributeValueUnquoted */); |
7662 this.delegate.beginAttributeValue(false); |
8486 this.delegate.beginAttributeValue(false); |
7663 this.consume(); |
8487 this.consume(); |
7664 this.delegate.appendToAttributeValue(char); |
8488 this.delegate.appendToAttributeValue(char); |
7665 } |
8489 } |
7666 }, |
8490 }, |
7667 attributeValueDoubleQuoted: function () { |
8491 attributeValueDoubleQuoted: function () { |
7668 var char = this.consume(); |
8492 var char = this.consume(); |
7669 if (char === '"') { |
8493 if (char === '"') { |
7670 this.delegate.finishAttributeValue(); |
8494 this.delegate.finishAttributeValue(); |
7671 this.state = 'afterAttributeValueQuoted'; |
8495 this.transitionTo("afterAttributeValueQuoted" /* afterAttributeValueQuoted */); |
7672 } |
8496 } |
7673 else if (char === "&") { |
8497 else if (char === '&') { |
7674 this.delegate.appendToAttributeValue(this.consumeCharRef('"') || "&"); |
8498 this.delegate.appendToAttributeValue(this.consumeCharRef() || '&'); |
7675 } |
8499 } |
7676 else { |
8500 else { |
7677 this.delegate.appendToAttributeValue(char); |
8501 this.delegate.appendToAttributeValue(char); |
7678 } |
8502 } |
7679 }, |
8503 }, |
7680 attributeValueSingleQuoted: function () { |
8504 attributeValueSingleQuoted: function () { |
7681 var char = this.consume(); |
8505 var char = this.consume(); |
7682 if (char === "'") { |
8506 if (char === "'") { |
7683 this.delegate.finishAttributeValue(); |
8507 this.delegate.finishAttributeValue(); |
7684 this.state = 'afterAttributeValueQuoted'; |
8508 this.transitionTo("afterAttributeValueQuoted" /* afterAttributeValueQuoted */); |
7685 } |
8509 } |
7686 else if (char === "&") { |
8510 else if (char === '&') { |
7687 this.delegate.appendToAttributeValue(this.consumeCharRef("'") || "&"); |
8511 this.delegate.appendToAttributeValue(this.consumeCharRef() || '&'); |
7688 } |
8512 } |
7689 else { |
8513 else { |
7690 this.delegate.appendToAttributeValue(char); |
8514 this.delegate.appendToAttributeValue(char); |
7691 } |
8515 } |
7692 }, |
8516 }, |
7693 attributeValueUnquoted: function () { |
8517 attributeValueUnquoted: function () { |
7694 var char = this.peek(); |
8518 var char = this.peek(); |
7695 if (isSpace(char)) { |
8519 if (isSpace(char)) { |
7696 this.delegate.finishAttributeValue(); |
8520 this.delegate.finishAttributeValue(); |
7697 this.consume(); |
8521 this.consume(); |
7698 this.state = 'beforeAttributeName'; |
8522 this.transitionTo("beforeAttributeName" /* beforeAttributeName */); |
7699 } |
8523 } |
7700 else if (char === "&") { |
8524 else if (char === '/') { |
8525 this.delegate.finishAttributeValue(); |
|
7701 this.consume(); |
8526 this.consume(); |
7702 this.delegate.appendToAttributeValue(this.consumeCharRef(">") || "&"); |
8527 this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */); |
7703 } |
8528 } |
7704 else if (char === ">") { |
8529 else if (char === '&') { |
8530 this.consume(); |
|
8531 this.delegate.appendToAttributeValue(this.consumeCharRef() || '&'); |
|
8532 } |
|
8533 else if (char === '>') { |
|
7705 this.delegate.finishAttributeValue(); |
8534 this.delegate.finishAttributeValue(); |
7706 this.consume(); |
8535 this.consume(); |
7707 this.delegate.finishTag(); |
8536 this.delegate.finishTag(); |
7708 this.state = 'beforeData'; |
8537 this.transitionTo("beforeData" /* beforeData */); |
7709 } |
8538 } |
7710 else { |
8539 else { |
7711 this.consume(); |
8540 this.consume(); |
7712 this.delegate.appendToAttributeValue(char); |
8541 this.delegate.appendToAttributeValue(char); |
7713 } |
8542 } |
7714 }, |
8543 }, |
7715 afterAttributeValueQuoted: function () { |
8544 afterAttributeValueQuoted: function () { |
7716 var char = this.peek(); |
8545 var char = this.peek(); |
7717 if (isSpace(char)) { |
8546 if (isSpace(char)) { |
7718 this.consume(); |
8547 this.consume(); |
7719 this.state = 'beforeAttributeName'; |
8548 this.transitionTo("beforeAttributeName" /* beforeAttributeName */); |
7720 } |
8549 } |
7721 else if (char === "/") { |
8550 else if (char === '/') { |
7722 this.consume(); |
8551 this.consume(); |
7723 this.state = 'selfClosingStartTag'; |
8552 this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */); |
7724 } |
8553 } |
7725 else if (char === ">") { |
8554 else if (char === '>') { |
7726 this.consume(); |
8555 this.consume(); |
7727 this.delegate.finishTag(); |
8556 this.delegate.finishTag(); |
7728 this.state = 'beforeData'; |
8557 this.transitionTo("beforeData" /* beforeData */); |
7729 } |
8558 } |
7730 else { |
8559 else { |
7731 this.state = 'beforeAttributeName'; |
8560 this.transitionTo("beforeAttributeName" /* beforeAttributeName */); |
7732 } |
8561 } |
7733 }, |
8562 }, |
7734 selfClosingStartTag: function () { |
8563 selfClosingStartTag: function () { |
7735 var char = this.peek(); |
8564 var char = this.peek(); |
7736 if (char === ">") { |
8565 if (char === '>') { |
7737 this.consume(); |
8566 this.consume(); |
7738 this.delegate.markTagAsSelfClosing(); |
8567 this.delegate.markTagAsSelfClosing(); |
7739 this.delegate.finishTag(); |
8568 this.delegate.finishTag(); |
7740 this.state = 'beforeData'; |
8569 this.transitionTo("beforeData" /* beforeData */); |
7741 } |
8570 } |
7742 else { |
8571 else { |
7743 this.state = 'beforeAttributeName'; |
8572 this.transitionTo("beforeAttributeName" /* beforeAttributeName */); |
7744 } |
8573 } |
7745 }, |
8574 }, |
7746 endTagOpen: function () { |
8575 endTagOpen: function () { |
7747 var char = this.consume(); |
8576 var char = this.consume(); |
7748 if (isAlpha(char)) { |
8577 if (char === '@' || char === ':' || isAlpha(char)) { |
7749 this.state = 'tagName'; |
8578 this.transitionTo("endTagName" /* endTagName */); |
8579 this.tagNameBuffer = ''; |
|
7750 this.delegate.beginEndTag(); |
8580 this.delegate.beginEndTag(); |
7751 this.delegate.appendToTagName(char.toLowerCase()); |
8581 this.appendToTagName(char); |
7752 } |
8582 } |
7753 } |
8583 } |
7754 }; |
8584 }; |
7755 this.reset(); |
8585 this.reset(); |
7756 } |
8586 } |
7757 EventedTokenizer.prototype.reset = function () { |
8587 EventedTokenizer.prototype.reset = function () { |
7758 this.state = 'beforeData'; |
8588 this.transitionTo("beforeData" /* beforeData */); |
7759 this.input = ''; |
8589 this.input = ''; |
8590 this.tagNameBuffer = ''; |
|
7760 this.index = 0; |
8591 this.index = 0; |
7761 this.line = 1; |
8592 this.line = 1; |
7762 this.column = 0; |
8593 this.column = 0; |
7763 this.tagLine = -1; |
|
7764 this.tagColumn = -1; |
|
7765 this.delegate.reset(); |
8594 this.delegate.reset(); |
8595 }; |
|
8596 EventedTokenizer.prototype.transitionTo = function (state) { |
|
8597 this.state = state; |
|
7766 }; |
8598 }; |
7767 EventedTokenizer.prototype.tokenize = function (input) { |
8599 EventedTokenizer.prototype.tokenize = function (input) { |
7768 this.reset(); |
8600 this.reset(); |
7769 this.tokenizePart(input); |
8601 this.tokenizePart(input); |
7770 this.tokenizeEOF(); |
8602 this.tokenizeEOF(); |
7771 }; |
8603 }; |
7772 EventedTokenizer.prototype.tokenizePart = function (input) { |
8604 EventedTokenizer.prototype.tokenizePart = function (input) { |
7773 this.input += preprocessInput(input); |
8605 this.input += preprocessInput(input); |
7774 while (this.index < this.input.length) { |
8606 while (this.index < this.input.length) { |
7775 this.states[this.state].call(this); |
8607 var handler = this.states[this.state]; |
8608 if (handler !== undefined) { |
|
8609 handler.call(this); |
|
8610 } |
|
8611 else { |
|
8612 throw new Error("unhandled state " + this.state); |
|
8613 } |
|
7776 } |
8614 } |
7777 }; |
8615 }; |
7778 EventedTokenizer.prototype.tokenizeEOF = function () { |
8616 EventedTokenizer.prototype.tokenizeEOF = function () { |
7779 this.flushData(); |
8617 this.flushData(); |
7780 }; |
8618 }; |
7781 EventedTokenizer.prototype.flushData = function () { |
8619 EventedTokenizer.prototype.flushData = function () { |
7782 if (this.state === 'data') { |
8620 if (this.state === 'data') { |
7783 this.delegate.finishData(); |
8621 this.delegate.finishData(); |
7784 this.state = 'beforeData'; |
8622 this.transitionTo("beforeData" /* beforeData */); |
7785 } |
8623 } |
7786 }; |
8624 }; |
7787 EventedTokenizer.prototype.peek = function () { |
8625 EventedTokenizer.prototype.peek = function () { |
7788 return this.input.charAt(this.index); |
8626 return this.input.charAt(this.index); |
7789 }; |
8627 }; |
7790 EventedTokenizer.prototype.consume = function () { |
8628 EventedTokenizer.prototype.consume = function () { |
7791 var char = this.peek(); |
8629 var char = this.peek(); |
7792 this.index++; |
8630 this.index++; |
7793 if (char === "\n") { |
8631 if (char === '\n') { |
7794 this.line++; |
8632 this.line++; |
7795 this.column = 0; |
8633 this.column = 0; |
7796 } |
8634 } |
7797 else { |
8635 else { |
7798 this.column++; |
8636 this.column++; |
7817 this.consume(); |
8655 this.consume(); |
7818 return chars; |
8656 return chars; |
7819 } |
8657 } |
7820 }; |
8658 }; |
7821 EventedTokenizer.prototype.markTagStart = function () { |
8659 EventedTokenizer.prototype.markTagStart = function () { |
7822 // these properties to be removed in next major bump |
8660 this.delegate.tagOpen(); |
7823 this.tagLine = this.line; |
8661 }; |
7824 this.tagColumn = this.column; |
8662 EventedTokenizer.prototype.appendToTagName = function (char) { |
7825 if (this.delegate.tagOpen) { |
8663 this.tagNameBuffer += char; |
7826 this.delegate.tagOpen(); |
8664 this.delegate.appendToTagName(char); |
7827 } |
8665 }; |
8666 EventedTokenizer.prototype.isIgnoredEndTag = function () { |
|
8667 var tag = this.tagNameBuffer; |
|
8668 return (tag === 'title' && this.input.substring(this.index, this.index + 8) !== '</title>') || |
|
8669 (tag === 'style' && this.input.substring(this.index, this.index + 8) !== '</style>') || |
|
8670 (tag === 'script' && this.input.substring(this.index, this.index + 9) !== '</script>'); |
|
7828 }; |
8671 }; |
7829 return EventedTokenizer; |
8672 return EventedTokenizer; |
7830 }()); |
8673 }()); |
7831 /* harmony default export */ var evented_tokenizer = (evented_tokenizer_EventedTokenizer); |
8674 |
7832 |
8675 var Tokenizer = /** @class */ (function () { |
7833 // CONCATENATED MODULE: ./node_modules/simple-html-tokenizer/dist/es6/tokenizer.js |
|
7834 |
|
7835 |
|
7836 ; |
|
7837 var tokenizer_Tokenizer = /** @class */ (function () { |
|
7838 function Tokenizer(entityParser, options) { |
8676 function Tokenizer(entityParser, options) { |
7839 if (options === void 0) { options = {}; } |
8677 if (options === void 0) { options = {}; } |
7840 this.options = options; |
8678 this.options = options; |
7841 this._token = null; |
8679 this.token = null; |
7842 this.startLine = 1; |
8680 this.startLine = 1; |
7843 this.startColumn = 0; |
8681 this.startColumn = 0; |
7844 this.tokens = []; |
8682 this.tokens = []; |
7845 this.currentAttribute = null; |
8683 this.tokenizer = new EventedTokenizer(this, entityParser); |
7846 this.tokenizer = new evented_tokenizer(this, entityParser); |
8684 this._currentAttribute = undefined; |
7847 } |
8685 } |
7848 Object.defineProperty(Tokenizer.prototype, "token", { |
|
7849 get: function () { |
|
7850 return unwrap(this._token); |
|
7851 }, |
|
7852 set: function (value) { |
|
7853 this._token = value; |
|
7854 }, |
|
7855 enumerable: true, |
|
7856 configurable: true |
|
7857 }); |
|
7858 Tokenizer.prototype.tokenize = function (input) { |
8686 Tokenizer.prototype.tokenize = function (input) { |
7859 this.tokens = []; |
8687 this.tokens = []; |
7860 this.tokenizer.tokenize(input); |
8688 this.tokenizer.tokenize(input); |
7861 return this.tokens; |
8689 return this.tokens; |
7862 }; |
8690 }; |
7869 this.tokens = []; |
8697 this.tokens = []; |
7870 this.tokenizer.tokenizeEOF(); |
8698 this.tokenizer.tokenizeEOF(); |
7871 return this.tokens[0]; |
8699 return this.tokens[0]; |
7872 }; |
8700 }; |
7873 Tokenizer.prototype.reset = function () { |
8701 Tokenizer.prototype.reset = function () { |
7874 this._token = null; |
8702 this.token = null; |
7875 this.startLine = 1; |
8703 this.startLine = 1; |
7876 this.startColumn = 0; |
8704 this.startColumn = 0; |
7877 }; |
8705 }; |
8706 Tokenizer.prototype.current = function () { |
|
8707 var token = this.token; |
|
8708 if (token === null) { |
|
8709 throw new Error('token was unexpectedly null'); |
|
8710 } |
|
8711 if (arguments.length === 0) { |
|
8712 return token; |
|
8713 } |
|
8714 for (var i = 0; i < arguments.length; i++) { |
|
8715 if (token.type === arguments[i]) { |
|
8716 return token; |
|
8717 } |
|
8718 } |
|
8719 throw new Error("token type was unexpectedly " + token.type); |
|
8720 }; |
|
8721 Tokenizer.prototype.push = function (token) { |
|
8722 this.token = token; |
|
8723 this.tokens.push(token); |
|
8724 }; |
|
8725 Tokenizer.prototype.currentAttribute = function () { |
|
8726 return this._currentAttribute; |
|
8727 }; |
|
7878 Tokenizer.prototype.addLocInfo = function () { |
8728 Tokenizer.prototype.addLocInfo = function () { |
7879 if (this.options.loc) { |
8729 if (this.options.loc) { |
7880 this.token.loc = { |
8730 this.current().loc = { |
7881 start: { |
8731 start: { |
7882 line: this.startLine, |
8732 line: this.startLine, |
7883 column: this.startColumn |
8733 column: this.startColumn |
7884 }, |
8734 }, |
7885 end: { |
8735 end: { |
7891 this.startLine = this.tokenizer.line; |
8741 this.startLine = this.tokenizer.line; |
7892 this.startColumn = this.tokenizer.column; |
8742 this.startColumn = this.tokenizer.column; |
7893 }; |
8743 }; |
7894 // Data |
8744 // Data |
7895 Tokenizer.prototype.beginData = function () { |
8745 Tokenizer.prototype.beginData = function () { |
7896 this.token = { |
8746 this.push({ |
7897 type: 'Chars', |
8747 type: "Chars" /* Chars */, |
7898 chars: '' |
8748 chars: '' |
7899 }; |
8749 }); |
7900 this.tokens.push(this.token); |
|
7901 }; |
8750 }; |
7902 Tokenizer.prototype.appendToData = function (char) { |
8751 Tokenizer.prototype.appendToData = function (char) { |
7903 this.token.chars += char; |
8752 this.current("Chars" /* Chars */).chars += char; |
7904 }; |
8753 }; |
7905 Tokenizer.prototype.finishData = function () { |
8754 Tokenizer.prototype.finishData = function () { |
7906 this.addLocInfo(); |
8755 this.addLocInfo(); |
7907 }; |
8756 }; |
7908 // Comment |
8757 // Comment |
7909 Tokenizer.prototype.beginComment = function () { |
8758 Tokenizer.prototype.beginComment = function () { |
7910 this.token = { |
8759 this.push({ |
7911 type: 'Comment', |
8760 type: "Comment" /* Comment */, |
7912 chars: '' |
8761 chars: '' |
7913 }; |
8762 }); |
7914 this.tokens.push(this.token); |
|
7915 }; |
8763 }; |
7916 Tokenizer.prototype.appendToCommentData = function (char) { |
8764 Tokenizer.prototype.appendToCommentData = function (char) { |
7917 this.token.chars += char; |
8765 this.current("Comment" /* Comment */).chars += char; |
7918 }; |
8766 }; |
7919 Tokenizer.prototype.finishComment = function () { |
8767 Tokenizer.prototype.finishComment = function () { |
7920 this.addLocInfo(); |
8768 this.addLocInfo(); |
7921 }; |
8769 }; |
7922 // Tags - basic |
8770 // Tags - basic |
8771 Tokenizer.prototype.tagOpen = function () { }; |
|
7923 Tokenizer.prototype.beginStartTag = function () { |
8772 Tokenizer.prototype.beginStartTag = function () { |
7924 this.token = { |
8773 this.push({ |
7925 type: 'StartTag', |
8774 type: "StartTag" /* StartTag */, |
7926 tagName: '', |
8775 tagName: '', |
7927 attributes: [], |
8776 attributes: [], |
7928 selfClosing: false |
8777 selfClosing: false |
7929 }; |
8778 }); |
7930 this.tokens.push(this.token); |
|
7931 }; |
8779 }; |
7932 Tokenizer.prototype.beginEndTag = function () { |
8780 Tokenizer.prototype.beginEndTag = function () { |
7933 this.token = { |
8781 this.push({ |
7934 type: 'EndTag', |
8782 type: "EndTag" /* EndTag */, |
7935 tagName: '' |
8783 tagName: '' |
7936 }; |
8784 }); |
7937 this.tokens.push(this.token); |
|
7938 }; |
8785 }; |
7939 Tokenizer.prototype.finishTag = function () { |
8786 Tokenizer.prototype.finishTag = function () { |
7940 this.addLocInfo(); |
8787 this.addLocInfo(); |
7941 }; |
8788 }; |
7942 Tokenizer.prototype.markTagAsSelfClosing = function () { |
8789 Tokenizer.prototype.markTagAsSelfClosing = function () { |
7943 this.token.selfClosing = true; |
8790 this.current("StartTag" /* StartTag */).selfClosing = true; |
7944 }; |
8791 }; |
7945 // Tags - name |
8792 // Tags - name |
7946 Tokenizer.prototype.appendToTagName = function (char) { |
8793 Tokenizer.prototype.appendToTagName = function (char) { |
7947 this.token.tagName += char; |
8794 this.current("StartTag" /* StartTag */, "EndTag" /* EndTag */).tagName += char; |
7948 }; |
8795 }; |
7949 // Tags - attributes |
8796 // Tags - attributes |
7950 Tokenizer.prototype.beginAttribute = function () { |
8797 Tokenizer.prototype.beginAttribute = function () { |
7951 var attributes = unwrap(this.token.attributes, "current token's attributs"); |
8798 this._currentAttribute = ['', '', false]; |
7952 this.currentAttribute = ["", "", false]; |
|
7953 attributes.push(this.currentAttribute); |
|
7954 }; |
8799 }; |
7955 Tokenizer.prototype.appendToAttributeName = function (char) { |
8800 Tokenizer.prototype.appendToAttributeName = function (char) { |
7956 var currentAttribute = unwrap(this.currentAttribute); |
8801 this.currentAttribute()[0] += char; |
7957 currentAttribute[0] += char; |
|
7958 }; |
8802 }; |
7959 Tokenizer.prototype.beginAttributeValue = function (isQuoted) { |
8803 Tokenizer.prototype.beginAttributeValue = function (isQuoted) { |
7960 var currentAttribute = unwrap(this.currentAttribute); |
8804 this.currentAttribute()[2] = isQuoted; |
7961 currentAttribute[2] = isQuoted; |
|
7962 }; |
8805 }; |
7963 Tokenizer.prototype.appendToAttributeValue = function (char) { |
8806 Tokenizer.prototype.appendToAttributeValue = function (char) { |
7964 var currentAttribute = unwrap(this.currentAttribute); |
8807 this.currentAttribute()[1] += char; |
7965 currentAttribute[1] = currentAttribute[1] || ""; |
|
7966 currentAttribute[1] += char; |
|
7967 }; |
8808 }; |
7968 Tokenizer.prototype.finishAttributeValue = function () { |
8809 Tokenizer.prototype.finishAttributeValue = function () { |
8810 this.current("StartTag" /* StartTag */).attributes.push(this._currentAttribute); |
|
7969 }; |
8811 }; |
7970 Tokenizer.prototype.reportSyntaxError = function (message) { |
8812 Tokenizer.prototype.reportSyntaxError = function (message) { |
7971 this.token.syntaxError = message; |
8813 this.current().syntaxError = message; |
7972 }; |
8814 }; |
7973 return Tokenizer; |
8815 return Tokenizer; |
7974 }()); |
8816 }()); |
7975 /* harmony default export */ var tokenizer = (tokenizer_Tokenizer); |
8817 |
8818 function tokenize(input, options) { |
|
8819 var tokenizer = new Tokenizer(new EntityParser(namedCharRefs), options); |
|
8820 return tokenizer.tokenize(input); |
|
8821 } |
|
8822 |
|
8823 |
|
7976 |
8824 |
7977 // EXTERNAL MODULE: external {"this":["wp","htmlEntities"]} |
8825 // EXTERNAL MODULE: external {"this":["wp","htmlEntities"]} |
7978 var external_this_wp_htmlEntities_ = __webpack_require__(57); |
8826 var external_this_wp_htmlEntities_ = __webpack_require__(75); |
8827 |
|
8828 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/validation/logger.js |
|
8829 function createLogger() { |
|
8830 /** |
|
8831 * Creates a log handler with block validation prefix. |
|
8832 * |
|
8833 * @param {Function} logger Original logger function. |
|
8834 * |
|
8835 * @return {Function} Augmented logger function. |
|
8836 */ |
|
8837 function createLogHandler(logger) { |
|
8838 var log = function log(message) { |
|
8839 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { |
|
8840 args[_key - 1] = arguments[_key]; |
|
8841 } |
|
8842 |
|
8843 return logger.apply(void 0, ['Block validation: ' + message].concat(args)); |
|
8844 }; // In test environments, pre-process the sprintf message to improve |
|
8845 // readability of error messages. We'd prefer to avoid pulling in this |
|
8846 // dependency in runtime environments, and it can be dropped by a combo |
|
8847 // of Webpack env substitution + UglifyJS dead code elimination. |
|
8848 |
|
8849 |
|
8850 if (false) {} |
|
8851 |
|
8852 return log; |
|
8853 } |
|
8854 |
|
8855 return { |
|
8856 // eslint-disable-next-line no-console |
|
8857 error: createLogHandler(console.error), |
|
8858 // eslint-disable-next-line no-console |
|
8859 warning: createLogHandler(console.warn), |
|
8860 getItems: function getItems() { |
|
8861 return []; |
|
8862 } |
|
8863 }; |
|
8864 } |
|
8865 function createQueuedLogger() { |
|
8866 /** |
|
8867 * The list of enqueued log actions to print. |
|
8868 * |
|
8869 * @type {Array} |
|
8870 */ |
|
8871 var queue = []; |
|
8872 var logger = createLogger(); |
|
8873 return { |
|
8874 error: function error() { |
|
8875 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { |
|
8876 args[_key2] = arguments[_key2]; |
|
8877 } |
|
8878 |
|
8879 queue.push({ |
|
8880 log: logger.error, |
|
8881 args: args |
|
8882 }); |
|
8883 }, |
|
8884 warning: function warning() { |
|
8885 for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { |
|
8886 args[_key3] = arguments[_key3]; |
|
8887 } |
|
8888 |
|
8889 queue.push({ |
|
8890 log: logger.warning, |
|
8891 args: args |
|
8892 }); |
|
8893 }, |
|
8894 getItems: function getItems() { |
|
8895 return queue; |
|
8896 } |
|
8897 }; |
|
8898 } |
|
7979 |
8899 |
7980 // EXTERNAL MODULE: external {"this":["wp","isShallowEqual"]} |
8900 // EXTERNAL MODULE: external {"this":["wp","isShallowEqual"]} |
7981 var external_this_wp_isShallowEqual_ = __webpack_require__(42); |
8901 var external_this_wp_isShallowEqual_ = __webpack_require__(64); |
7982 var external_this_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_isShallowEqual_); |
8902 var external_this_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_isShallowEqual_); |
7983 |
8903 |
7984 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js |
8904 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js |
7985 var esm_extends = __webpack_require__(19); |
8905 var esm_extends = __webpack_require__(8); |
7986 |
8906 |
7987 // EXTERNAL MODULE: external {"this":["wp","compose"]} |
8907 // EXTERNAL MODULE: external {"this":["wp","compose"]} |
7988 var external_this_wp_compose_ = __webpack_require__(6); |
8908 var external_this_wp_compose_ = __webpack_require__(9); |
7989 |
8909 |
7990 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/block-content-provider/index.js |
8910 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/block-content-provider/index.js |
7991 |
8911 |
7992 |
8912 |
7993 |
8913 |
8018 * <BlockContentProvider innerBlocks={ innerBlocks }> |
8938 * <BlockContentProvider innerBlocks={ innerBlocks }> |
8019 * { blockSaveElement } |
8939 * { blockSaveElement } |
8020 * </BlockContentProvider> |
8940 * </BlockContentProvider> |
8021 * ``` |
8941 * ``` |
8022 * |
8942 * |
8023 * @return {WPElement} Element with BlockContent injected via context. |
8943 * @param {Object} props Component props. |
8944 * @param {WPElement} props.children Block save result. |
|
8945 * @param {Array} props.innerBlocks Block(s) to serialize. |
|
8946 * |
|
8947 * @return {WPComponent} Element with BlockContent injected via context. |
|
8024 */ |
8948 */ |
8025 |
8949 |
8026 |
8950 |
8027 var block_content_provider_BlockContentProvider = function BlockContentProvider(_ref) { |
8951 var block_content_provider_BlockContentProvider = function BlockContentProvider(_ref) { |
8028 var children = _ref.children, |
8952 var children = _ref.children, |
8029 innerBlocks = _ref.innerBlocks; |
8953 innerBlocks = _ref.innerBlocks; |
8030 |
8954 |
8031 var BlockContent = function BlockContent() { |
8955 var BlockContent = function BlockContent() { |
8032 // Value is an array of blocks, so defer to block serializer |
8956 // Value is an array of blocks, so defer to block serializer |
8033 var html = serialize(innerBlocks); // Use special-cased raw HTML tag to avoid default escaping |
8957 var html = serialize(innerBlocks, { |
8958 isInnerBlocks: true |
|
8959 }); // Use special-cased raw HTML tag to avoid default escaping |
|
8034 |
8960 |
8035 return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["RawHTML"], null, html); |
8961 return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["RawHTML"], null, html); |
8036 }; |
8962 }; |
8037 |
8963 |
8038 return Object(external_this_wp_element_["createElement"])(Provider, { |
8964 return Object(external_this_wp_element_["createElement"])(Provider, { |
8041 }; |
8967 }; |
8042 /** |
8968 /** |
8043 * A Higher Order Component used to inject BlockContent using context to the |
8969 * A Higher Order Component used to inject BlockContent using context to the |
8044 * wrapped component. |
8970 * wrapped component. |
8045 * |
8971 * |
8046 * @return {Component} Enhanced component with injected BlockContent as prop. |
8972 * @return {WPComponent} Enhanced component with injected BlockContent as prop. |
8047 */ |
8973 */ |
8048 |
8974 |
8049 |
8975 |
8050 var withBlockContentContext = Object(external_this_wp_compose_["createHigherOrderComponent"])(function (OriginalComponent) { |
8976 var withBlockContentContext = Object(external_this_wp_compose_["createHigherOrderComponent"])(function (OriginalComponent) { |
8051 return function (props) { |
8977 return function (props) { |
8060 |
8986 |
8061 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/serializer.js |
8987 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/serializer.js |
8062 |
8988 |
8063 |
8989 |
8064 |
8990 |
8991 function serializer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
|
8992 |
|
8993 function serializer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { serializer_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { serializer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
8994 |
|
8065 /** |
8995 /** |
8066 * External dependencies |
8996 * External dependencies |
8067 */ |
8997 */ |
8068 |
8998 |
8069 /** |
8999 /** |
8077 * Internal dependencies |
9007 * Internal dependencies |
8078 */ |
9008 */ |
8079 |
9009 |
8080 |
9010 |
8081 |
9011 |
9012 |
|
9013 /** |
|
9014 * @typedef {Object} WPBlockSerializationOptions Serialization Options. |
|
9015 * |
|
9016 * @property {boolean} isInnerBlocks Whether we are serializing inner blocks. |
|
9017 */ |
|
8082 |
9018 |
8083 /** |
9019 /** |
8084 * Returns the block's default classname from its name. |
9020 * Returns the block's default classname from its name. |
8085 * |
9021 * |
8086 * @param {string} blockName The block name. |
9022 * @param {string} blockName The block name. |
8136 var element = save({ |
9072 var element = save({ |
8137 attributes: attributes, |
9073 attributes: attributes, |
8138 innerBlocks: innerBlocks |
9074 innerBlocks: innerBlocks |
8139 }); |
9075 }); |
8140 |
9076 |
8141 if (Object(external_lodash_["isObject"])(element) && Object(external_this_wp_hooks_["hasFilter"])('blocks.getSaveContent.extraProps')) { |
9077 if (Object(external_this_lodash_["isObject"])(element) && Object(external_this_wp_hooks_["hasFilter"])('blocks.getSaveContent.extraProps')) { |
8142 /** |
9078 /** |
8143 * Filters the props applied to the block save result element. |
9079 * Filters the props applied to the block save result element. |
8144 * |
9080 * |
8145 * @param {Object} props Props applied to save element. |
9081 * @param {Object} props Props applied to save element. |
8146 * @param {WPBlockType} blockType Block type definition. |
9082 * @param {WPBlock} blockType Block type definition. |
8147 * @param {Object} attributes Block attributes. |
9083 * @param {Object} attributes Block attributes. |
8148 */ |
9084 */ |
8149 var props = Object(external_this_wp_hooks_["applyFilters"])('blocks.getSaveContent.extraProps', Object(objectSpread["a" /* default */])({}, element.props), blockType, attributes); |
9085 var props = Object(external_this_wp_hooks_["applyFilters"])('blocks.getSaveContent.extraProps', serializer_objectSpread({}, element.props), blockType, attributes); |
8150 |
9086 |
8151 if (!external_this_wp_isShallowEqual_default()(props, element.props)) { |
9087 if (!external_this_wp_isShallowEqual_default()(props, element.props)) { |
8152 element = Object(external_this_wp_element_["cloneElement"])(element, props); |
9088 element = Object(external_this_wp_element_["cloneElement"])(element, props); |
8153 } |
9089 } |
8154 } |
9090 } |
8155 /** |
9091 /** |
8156 * Filters the save result of a block during serialization. |
9092 * Filters the save result of a block during serialization. |
8157 * |
9093 * |
8158 * @param {WPElement} element Block save result. |
9094 * @param {WPElement} element Block save result. |
8159 * @param {WPBlockType} blockType Block type definition. |
9095 * @param {WPBlock} blockType Block type definition. |
8160 * @param {Object} attributes Block attributes. |
9096 * @param {Object} attributes Block attributes. |
8161 */ |
9097 */ |
8162 |
9098 |
8163 |
9099 |
8164 element = Object(external_this_wp_hooks_["applyFilters"])('blocks.getSaveElement', element, blockType, attributes); |
9100 element = Object(external_this_wp_hooks_["applyFilters"])('blocks.getSaveElement', element, blockType, attributes); |
8165 return Object(external_this_wp_element_["createElement"])(block_content_provider, { |
9101 return Object(external_this_wp_element_["createElement"])(block_content_provider, { |
8197 * |
9133 * |
8198 * @return {Object<string,*>} Subset of attributes for comment serialization. |
9134 * @return {Object<string,*>} Subset of attributes for comment serialization. |
8199 */ |
9135 */ |
8200 |
9136 |
8201 function getCommentAttributes(blockType, attributes) { |
9137 function getCommentAttributes(blockType, attributes) { |
8202 return Object(external_lodash_["reduce"])(blockType.attributes, function (result, attributeSchema, key) { |
9138 return Object(external_this_lodash_["reduce"])(blockType.attributes, function (accumulator, attributeSchema, key) { |
8203 var value = attributes[key]; // Ignore undefined values. |
9139 var value = attributes[key]; // Ignore undefined values. |
8204 |
9140 |
8205 if (undefined === value) { |
9141 if (undefined === value) { |
8206 return result; |
9142 return accumulator; |
8207 } // Ignore all attributes but the ones with an "undefined" source |
9143 } // Ignore all attributes but the ones with an "undefined" source |
8208 // "undefined" source refers to attributes saved in the block comment. |
9144 // "undefined" source refers to attributes saved in the block comment. |
8209 |
9145 |
8210 |
9146 |
8211 if (attributeSchema.source !== undefined) { |
9147 if (attributeSchema.source !== undefined) { |
8212 return result; |
9148 return accumulator; |
8213 } // Ignore default value. |
9149 } // Ignore default value. |
8214 |
9150 |
8215 |
9151 |
8216 if ('default' in attributeSchema && attributeSchema.default === value) { |
9152 if ('default' in attributeSchema && attributeSchema.default === value) { |
8217 return result; |
9153 return accumulator; |
8218 } // Otherwise, include in comment set. |
9154 } // Otherwise, include in comment set. |
8219 |
9155 |
8220 |
9156 |
8221 result[key] = value; |
9157 accumulator[key] = value; |
8222 return result; |
9158 return accumulator; |
8223 }, {}); |
9159 }, {}); |
8224 } |
9160 } |
8225 /** |
9161 /** |
8226 * Given an attributes object, returns a string in the serialized attributes |
9162 * Given an attributes object, returns a string in the serialized attributes |
8227 * format prepared for post content. |
9163 * format prepared for post content. |
8274 * |
9210 * |
8275 * @return {string} Comment-delimited block content. |
9211 * @return {string} Comment-delimited block content. |
8276 */ |
9212 */ |
8277 |
9213 |
8278 function getCommentDelimitedContent(rawBlockName, attributes, content) { |
9214 function getCommentDelimitedContent(rawBlockName, attributes, content) { |
8279 var serializedAttributes = !Object(external_lodash_["isEmpty"])(attributes) ? serializeAttributes(attributes) + ' ' : ''; // Strip core blocks of their namespace prefix. |
9215 var serializedAttributes = !Object(external_this_lodash_["isEmpty"])(attributes) ? serializeAttributes(attributes) + ' ' : ''; // Strip core blocks of their namespace prefix. |
8280 |
9216 |
8281 var blockName = Object(external_lodash_["startsWith"])(rawBlockName, 'core/') ? rawBlockName.slice(5) : rawBlockName; // @todo make the `wp:` prefix potentially configurable. |
9217 var blockName = Object(external_this_lodash_["startsWith"])(rawBlockName, 'core/') ? rawBlockName.slice(5) : rawBlockName; // @todo make the `wp:` prefix potentially configurable. |
8282 |
9218 |
8283 if (!content) { |
9219 if (!content) { |
8284 return "<!-- wp:".concat(blockName, " ").concat(serializedAttributes, "/-->"); |
9220 return "<!-- wp:".concat(blockName, " ").concat(serializedAttributes, "/-->"); |
8285 } |
9221 } |
8286 |
9222 |
8288 } |
9224 } |
8289 /** |
9225 /** |
8290 * Returns the content of a block, including comment delimiters, determining |
9226 * Returns the content of a block, including comment delimiters, determining |
8291 * serialized attributes and content form from the current state of the block. |
9227 * serialized attributes and content form from the current state of the block. |
8292 * |
9228 * |
8293 * @param {Object} block Block instance. |
9229 * @param {Object} block Block instance. |
9230 * @param {WPBlockSerializationOptions} options Serialization options. |
|
8294 * |
9231 * |
8295 * @return {string} Serialized block. |
9232 * @return {string} Serialized block. |
8296 */ |
9233 */ |
8297 |
9234 |
8298 function serializeBlock(block) { |
9235 function serializeBlock(block) { |
9236 var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, |
|
9237 _ref$isInnerBlocks = _ref.isInnerBlocks, |
|
9238 isInnerBlocks = _ref$isInnerBlocks === void 0 ? false : _ref$isInnerBlocks; |
|
9239 |
|
8299 var blockName = block.name; |
9240 var blockName = block.name; |
8300 var saveContent = getBlockContent(block); |
9241 var saveContent = getBlockContent(block); |
8301 |
9242 |
8302 switch (blockName) { |
9243 if (blockName === getUnregisteredTypeHandlerName() || !isInnerBlocks && blockName === getFreeformContentHandlerName()) { |
8303 case getFreeformContentHandlerName(): |
9244 return saveContent; |
8304 case getUnregisteredTypeHandlerName(): |
9245 } |
8305 return saveContent; |
9246 |
8306 |
9247 var blockType = registration_getBlockType(blockName); |
8307 default: |
9248 var saveAttributes = getCommentAttributes(blockType, block.attributes); |
8308 { |
9249 return getCommentDelimitedContent(blockName, saveAttributes, saveContent); |
8309 var blockType = registration_getBlockType(blockName); |
|
8310 var saveAttributes = getCommentAttributes(blockType, block.attributes); |
|
8311 return getCommentDelimitedContent(blockName, saveAttributes, saveContent); |
|
8312 } |
|
8313 } |
|
8314 } |
9250 } |
8315 /** |
9251 /** |
8316 * Takes a block or set of blocks and returns the serialized post content. |
9252 * Takes a block or set of blocks and returns the serialized post content. |
8317 * |
9253 * |
8318 * @param {Array} blocks Block(s) to serialize. |
9254 * @param {Array} blocks Block(s) to serialize. |
9255 * @param {WPBlockSerializationOptions} options Serialization options. |
|
8319 * |
9256 * |
8320 * @return {string} The post content. |
9257 * @return {string} The post content. |
8321 */ |
9258 */ |
8322 |
9259 |
8323 function serialize(blocks) { |
9260 function serialize(blocks, options) { |
8324 return Object(external_lodash_["castArray"])(blocks).map(serializeBlock).join('\n\n'); |
9261 return Object(external_this_lodash_["castArray"])(blocks).map(function (block) { |
8325 } |
9262 return serializeBlock(block, options); |
8326 |
9263 }).join('\n\n'); |
8327 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/validation.js |
9264 } |
8328 |
9265 |
8329 |
9266 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/validation/index.js |
8330 |
9267 |
8331 |
9268 |
8332 |
9269 |
8333 |
9270 |
9271 |
|
9272 |
|
9273 |
|
9274 function validation_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
|
9275 |
|
9276 function validation_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { validation_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { validation_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
8334 |
9277 |
8335 /** |
9278 /** |
8336 * External dependencies |
9279 * External dependencies |
8337 */ |
9280 */ |
8338 |
9281 |
8343 |
9286 |
8344 |
9287 |
8345 /** |
9288 /** |
8346 * Internal dependencies |
9289 * Internal dependencies |
8347 */ |
9290 */ |
9291 |
|
8348 |
9292 |
8349 |
9293 |
8350 |
9294 |
8351 /** |
9295 /** |
8352 * Globally matches any consecutive whitespace |
9296 * Globally matches any consecutive whitespace |
8374 * meaningful, even if only empty. |
9318 * meaningful, even if only empty. |
8375 * |
9319 * |
8376 * See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#boolean-attributes |
9320 * See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#boolean-attributes |
8377 * Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3 |
9321 * Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3 |
8378 * |
9322 * |
8379 * Object.keys( [ ...document.querySelectorAll( '#attributes-1 > tbody > tr' ) ] |
9323 * Object.keys( Array.from( document.querySelectorAll( '#attributes-1 > tbody > tr' ) ) |
8380 * .filter( ( tr ) => tr.lastChild.textContent.indexOf( 'Boolean attribute' ) !== -1 ) |
9324 * .filter( ( tr ) => tr.lastChild.textContent.indexOf( 'Boolean attribute' ) !== -1 ) |
8381 * .reduce( ( result, tr ) => Object.assign( result, { |
9325 * .reduce( ( result, tr ) => Object.assign( result, { |
8382 * [ tr.firstChild.textContent.trim() ]: true |
9326 * [ tr.firstChild.textContent.trim() ]: true |
8383 * } ), {} ) ).sort(); |
9327 * } ), {} ) ).sort(); |
8384 * |
9328 * |
8392 * valid enumerated value. |
9336 * valid enumerated value. |
8393 * |
9337 * |
8394 * See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#enumerated-attribute |
9338 * See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#enumerated-attribute |
8395 * Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3 |
9339 * Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3 |
8396 * |
9340 * |
8397 * Object.keys( [ ...document.querySelectorAll( '#attributes-1 > tbody > tr' ) ] |
9341 * Object.keys( Array.from( document.querySelectorAll( '#attributes-1 > tbody > tr' ) ) |
8398 * .filter( ( tr ) => /^("(.+?)";?\s*)+/.test( tr.lastChild.textContent.trim() ) ) |
9342 * .filter( ( tr ) => /^("(.+?)";?\s*)+/.test( tr.lastChild.textContent.trim() ) ) |
8399 * .reduce( ( result, tr ) => Object.assign( result, { |
9343 * .reduce( ( result, tr ) => Object.assign( result, { |
8400 * [ tr.firstChild.textContent.trim() ]: true |
9344 * [ tr.firstChild.textContent.trim() ]: true |
8401 * } ), {} ) ).sort(); |
9345 * } ), {} ) ).sort(); |
8402 * |
9346 * |
8418 * least-to-most expensive operations. |
9362 * least-to-most expensive operations. |
8419 * |
9363 * |
8420 * @type {Array} |
9364 * @type {Array} |
8421 */ |
9365 */ |
8422 |
9366 |
8423 var TEXT_NORMALIZATIONS = [external_lodash_["identity"], getTextWithCollapsedWhitespace]; |
9367 var TEXT_NORMALIZATIONS = [external_this_lodash_["identity"], getTextWithCollapsedWhitespace]; |
8424 /** |
9368 /** |
8425 * Regular expression matching a named character reference. In lieu of bundling |
9369 * Regular expression matching a named character reference. In lieu of bundling |
8426 * a full set of references, the pattern covers the minimal necessary to test |
9370 * a full set of references, the pattern covers the minimal necessary to test |
8427 * positively against the full set. |
9371 * positively against the full set. |
8428 * |
9372 * |
8430 * character references section, using the same case." |
9374 * character references section, using the same case." |
8431 * |
9375 * |
8432 * Tested aginst "12.5 Named character references": |
9376 * Tested aginst "12.5 Named character references": |
8433 * |
9377 * |
8434 * ``` |
9378 * ``` |
8435 * const references = [ ...document.querySelectorAll( |
9379 * const references = Array.from( document.querySelectorAll( |
8436 * '#named-character-references-table tr[id^=entity-] td:first-child' |
9380 * '#named-character-references-table tr[id^=entity-] td:first-child' |
8437 * ) ].map( ( code ) => code.textContent ) |
9381 * ) ).map( ( code ) => code.textContent ) |
8438 * references.every( ( reference ) => /^[\da-z]+$/i.test( reference ) ) |
9382 * references.every( ( reference ) => /^[\da-z]+$/i.test( reference ) ) |
8439 * ``` |
9383 * ``` |
8440 * |
9384 * |
8441 * @link https://html.spec.whatwg.org/multipage/syntax.html#character-references |
9385 * @see https://html.spec.whatwg.org/multipage/syntax.html#character-references |
8442 * @link https://html.spec.whatwg.org/multipage/named-characters.html#named-character-references |
9386 * @see https://html.spec.whatwg.org/multipage/named-characters.html#named-character-references |
8443 * |
9387 * |
8444 * @type {RegExp} |
9388 * @type {RegExp} |
8445 */ |
9389 */ |
8446 |
9390 |
8447 var REGEXP_NAMED_CHARACTER_REFERENCE = /^[\da-z]+$/i; |
9391 var REGEXP_NAMED_CHARACTER_REFERENCE = /^[\da-z]+$/i; |
8449 * Regular expression matching a decimal character reference. |
9393 * Regular expression matching a decimal character reference. |
8450 * |
9394 * |
8451 * "The ampersand must be followed by a U+0023 NUMBER SIGN character (#), |
9395 * "The ampersand must be followed by a U+0023 NUMBER SIGN character (#), |
8452 * followed by one or more ASCII digits, representing a base-ten integer" |
9396 * followed by one or more ASCII digits, representing a base-ten integer" |
8453 * |
9397 * |
8454 * @link https://html.spec.whatwg.org/multipage/syntax.html#character-references |
9398 * @see https://html.spec.whatwg.org/multipage/syntax.html#character-references |
8455 * |
9399 * |
8456 * @type {RegExp} |
9400 * @type {RegExp} |
8457 */ |
9401 */ |
8458 |
9402 |
8459 var REGEXP_DECIMAL_CHARACTER_REFERENCE = /^#\d+$/; |
9403 var REGEXP_DECIMAL_CHARACTER_REFERENCE = /^#\d+$/; |
8463 * "The ampersand must be followed by a U+0023 NUMBER SIGN character (#), which |
9407 * "The ampersand must be followed by a U+0023 NUMBER SIGN character (#), which |
8464 * must be followed by either a U+0078 LATIN SMALL LETTER X character (x) or a |
9408 * must be followed by either a U+0078 LATIN SMALL LETTER X character (x) or a |
8465 * U+0058 LATIN CAPITAL LETTER X character (X), which must then be followed by |
9409 * U+0058 LATIN CAPITAL LETTER X character (X), which must then be followed by |
8466 * one or more ASCII hex digits, representing a hexadecimal integer" |
9410 * one or more ASCII hex digits, representing a hexadecimal integer" |
8467 * |
9411 * |
8468 * @link https://html.spec.whatwg.org/multipage/syntax.html#character-references |
9412 * @see https://html.spec.whatwg.org/multipage/syntax.html#character-references |
8469 * |
9413 * |
8470 * @type {RegExp} |
9414 * @type {RegExp} |
8471 */ |
9415 */ |
8472 |
9416 |
8473 var REGEXP_HEXADECIMAL_CHARACTER_REFERENCE = /^#x[\da-f]+$/i; |
9417 var REGEXP_HEXADECIMAL_CHARACTER_REFERENCE = /^#x[\da-f]+$/i; |
8489 * bundling a massive named character reference. |
9433 * bundling a massive named character reference. |
8490 * |
9434 * |
8491 * @see https://github.com/tildeio/simple-html-tokenizer/tree/master/src/entity-parser.ts |
9435 * @see https://github.com/tildeio/simple-html-tokenizer/tree/master/src/entity-parser.ts |
8492 */ |
9436 */ |
8493 |
9437 |
8494 var validation_DecodeEntityParser = |
9438 var validation_DecodeEntityParser = /*#__PURE__*/function () { |
8495 /*#__PURE__*/ |
|
8496 function () { |
|
8497 function DecodeEntityParser() { |
9439 function DecodeEntityParser() { |
8498 Object(classCallCheck["a" /* default */])(this, DecodeEntityParser); |
9440 Object(classCallCheck["a" /* default */])(this, DecodeEntityParser); |
8499 } |
9441 } |
8500 |
9442 |
8501 Object(createClass["a" /* default */])(DecodeEntityParser, [{ |
9443 Object(createClass["a" /* default */])(DecodeEntityParser, [{ |
8517 }]); |
9459 }]); |
8518 |
9460 |
8519 return DecodeEntityParser; |
9461 return DecodeEntityParser; |
8520 }(); |
9462 }(); |
8521 /** |
9463 /** |
8522 * Object of logger functions. |
|
8523 */ |
|
8524 |
|
8525 var log = function () { |
|
8526 /** |
|
8527 * Creates a logger with block validation prefix. |
|
8528 * |
|
8529 * @param {Function} logger Original logger function. |
|
8530 * |
|
8531 * @return {Function} Augmented logger function. |
|
8532 */ |
|
8533 function createLogger(logger) { |
|
8534 // In test environments, pre-process the sprintf message to improve |
|
8535 // readability of error messages. We'd prefer to avoid pulling in this |
|
8536 // dependency in runtime environments, and it can be dropped by a combo |
|
8537 // of Webpack env substitution + UglifyJS dead code elimination. |
|
8538 if (false) {} |
|
8539 |
|
8540 return function (message) { |
|
8541 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { |
|
8542 args[_key - 1] = arguments[_key]; |
|
8543 } |
|
8544 |
|
8545 return logger.apply(void 0, ['Block validation: ' + message].concat(args)); |
|
8546 }; |
|
8547 } |
|
8548 |
|
8549 return { |
|
8550 /* eslint-disable no-console */ |
|
8551 error: createLogger(console.error), |
|
8552 warning: createLogger(console.warn) |
|
8553 /* eslint-enable no-console */ |
|
8554 |
|
8555 }; |
|
8556 }(); |
|
8557 /** |
|
8558 * Given a specified string, returns an array of strings split by consecutive |
9464 * Given a specified string, returns an array of strings split by consecutive |
8559 * whitespace, ignoring leading or trailing whitespace. |
9465 * whitespace, ignoring leading or trailing whitespace. |
8560 * |
9466 * |
8561 * @param {string} text Original text. |
9467 * @param {string} text Original text. |
8562 * |
9468 * |
8563 * @return {string[]} Text pieces split on whitespace. |
9469 * @return {string[]} Text pieces split on whitespace. |
8564 */ |
9470 */ |
8565 |
|
8566 |
9471 |
8567 function getTextPiecesSplitOnWhitespace(text) { |
9472 function getTextPiecesSplitOnWhitespace(text) { |
8568 return text.trim().split(REGEXP_WHITESPACE); |
9473 return text.trim().split(REGEXP_WHITESPACE); |
8569 } |
9474 } |
8570 /** |
9475 /** |
8599 return token.attributes.filter(function (pair) { |
9504 return token.attributes.filter(function (pair) { |
8600 var _pair = Object(slicedToArray["a" /* default */])(pair, 2), |
9505 var _pair = Object(slicedToArray["a" /* default */])(pair, 2), |
8601 key = _pair[0], |
9506 key = _pair[0], |
8602 value = _pair[1]; |
9507 value = _pair[1]; |
8603 |
9508 |
8604 return value || key.indexOf('data-') === 0 || Object(external_lodash_["includes"])(MEANINGFUL_ATTRIBUTES, key); |
9509 return value || key.indexOf('data-') === 0 || Object(external_this_lodash_["includes"])(MEANINGFUL_ATTRIBUTES, key); |
8605 }); |
9510 }); |
8606 } |
9511 } |
8607 /** |
9512 /** |
8608 * Returns true if two text tokens (with `chars` property) are equivalent, or |
9513 * Returns true if two text tokens (with `chars` property) are equivalent, or |
8609 * false otherwise. |
9514 * false otherwise. |
8610 * |
9515 * |
8611 * @param {Object} actual Actual token. |
9516 * @param {Object} actual Actual token. |
8612 * @param {Object} expected Expected token. |
9517 * @param {Object} expected Expected token. |
9518 * @param {Object} logger Validation logger object. |
|
8613 * |
9519 * |
8614 * @return {boolean} Whether two text tokens are equivalent. |
9520 * @return {boolean} Whether two text tokens are equivalent. |
8615 */ |
9521 */ |
8616 |
9522 |
8617 function isEquivalentTextTokens(actual, expected) { |
9523 function isEquivalentTextTokens(actual, expected) { |
9524 var logger = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : createLogger(); |
|
8618 // This function is intentionally written as syntactically "ugly" as a hot |
9525 // This function is intentionally written as syntactically "ugly" as a hot |
8619 // path optimization. Text is progressively normalized in order from least- |
9526 // path optimization. Text is progressively normalized in order from least- |
8620 // to-most operationally expensive, until the earliest point at which text |
9527 // to-most operationally expensive, until the earliest point at which text |
8621 // can be confidently inferred as being equal. |
9528 // can be confidently inferred as being equal. |
8622 var actualChars = actual.chars; |
9529 var actualChars = actual.chars; |
8630 if (actualChars === expectedChars) { |
9537 if (actualChars === expectedChars) { |
8631 return true; |
9538 return true; |
8632 } |
9539 } |
8633 } |
9540 } |
8634 |
9541 |
8635 log.warning('Expected text `%s`, saw `%s`.', expected.chars, actual.chars); |
9542 logger.warning('Expected text `%s`, saw `%s`.', expected.chars, actual.chars); |
8636 return false; |
9543 return false; |
8637 } |
9544 } |
8638 /** |
9545 /** |
8639 * Given a style value, returns a normalized style value for strict equality |
9546 * Given a style value, returns a normalized style value for strict equality |
8640 * comparison. |
9547 * comparison. |
8661 .replace(/;?\s*$/, '') // Split on property assignment |
9568 .replace(/;?\s*$/, '') // Split on property assignment |
8662 .split(';') // For each property assignment... |
9569 .split(';') // For each property assignment... |
8663 .map(function (style) { |
9570 .map(function (style) { |
8664 // ...split further into key-value pairs |
9571 // ...split further into key-value pairs |
8665 var _style$split = style.split(':'), |
9572 var _style$split = style.split(':'), |
8666 _style$split2 = _toArray(_style$split), |
9573 _style$split2 = Object(toArray["a" /* default */])(_style$split), |
8667 key = _style$split2[0], |
9574 key = _style$split2[0], |
8668 valueParts = _style$split2.slice(1); |
9575 valueParts = _style$split2.slice(1); |
8669 |
9576 |
8670 var value = valueParts.join(':'); |
9577 var value = valueParts.join(':'); |
8671 return [key.trim(), getNormalizedStyleValue(value.trim())]; |
9578 return [key.trim(), getNormalizedStyleValue(value.trim())]; |
8672 }); |
9579 }); |
8673 return Object(external_lodash_["fromPairs"])(pairs); |
9580 return Object(external_this_lodash_["fromPairs"])(pairs); |
8674 } |
9581 } |
8675 /** |
9582 /** |
8676 * Attribute-specific equality handlers |
9583 * Attribute-specific equality handlers |
8677 * |
9584 * |
8678 * @type {Object} |
9585 * @type {Object} |
8679 */ |
9586 */ |
8680 |
9587 |
8681 var isEqualAttributesOfName = Object(objectSpread["a" /* default */])({ |
9588 var isEqualAttributesOfName = validation_objectSpread({ |
8682 class: function _class(actual, expected) { |
9589 class: function _class(actual, expected) { |
8683 // Class matches if members are the same, even if out of order or |
9590 // Class matches if members are the same, even if out of order or |
8684 // superfluous whitespace between. |
9591 // superfluous whitespace between. |
8685 return !external_lodash_["xor"].apply(void 0, Object(toConsumableArray["a" /* default */])([actual, expected].map(getTextPiecesSplitOnWhitespace))).length; |
9592 return !external_this_lodash_["xor"].apply(void 0, Object(toConsumableArray["a" /* default */])([actual, expected].map(getTextPiecesSplitOnWhitespace))).length; |
8686 }, |
9593 }, |
8687 style: function style(actual, expected) { |
9594 style: function style(actual, expected) { |
8688 return external_lodash_["isEqual"].apply(void 0, Object(toConsumableArray["a" /* default */])([actual, expected].map(getStyleProperties))); |
9595 return external_this_lodash_["isEqual"].apply(void 0, Object(toConsumableArray["a" /* default */])([actual, expected].map(getStyleProperties))); |
8689 } |
9596 } |
8690 }, Object(external_lodash_["fromPairs"])(BOOLEAN_ATTRIBUTES.map(function (attribute) { |
9597 }, Object(external_this_lodash_["fromPairs"])(BOOLEAN_ATTRIBUTES.map(function (attribute) { |
8691 return [attribute, external_lodash_["stubTrue"]]; |
9598 return [attribute, external_this_lodash_["stubTrue"]]; |
8692 }))); |
9599 }))); |
8693 /** |
9600 /** |
8694 * Given two sets of attribute tuples, returns true if the attribute sets are |
9601 * Given two sets of attribute tuples, returns true if the attribute sets are |
8695 * equivalent. |
9602 * equivalent. |
8696 * |
9603 * |
8697 * @param {Array[]} actual Actual attributes tuples. |
9604 * @param {Array[]} actual Actual attributes tuples. |
8698 * @param {Array[]} expected Expected attributes tuples. |
9605 * @param {Array[]} expected Expected attributes tuples. |
9606 * @param {Object} logger Validation logger object. |
|
8699 * |
9607 * |
8700 * @return {boolean} Whether attributes are equivalent. |
9608 * @return {boolean} Whether attributes are equivalent. |
8701 */ |
9609 */ |
8702 |
9610 |
8703 function isEqualTagAttributePairs(actual, expected) { |
9611 function isEqualTagAttributePairs(actual, expected) { |
9612 var logger = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : createLogger(); |
|
9613 |
|
8704 // Attributes is tokenized as tuples. Their lengths should match. This also |
9614 // Attributes is tokenized as tuples. Their lengths should match. This also |
8705 // avoids us needing to check both attributes sets, since if A has any keys |
9615 // avoids us needing to check both attributes sets, since if A has any keys |
8706 // which do not exist in B, we know the sets to be different. |
9616 // which do not exist in B, we know the sets to be different. |
8707 if (actual.length !== expected.length) { |
9617 if (actual.length !== expected.length) { |
8708 log.warning('Expected attributes %o, instead saw %o.', expected, actual); |
9618 logger.warning('Expected attributes %o, instead saw %o.', expected, actual); |
8709 return false; |
9619 return false; |
8710 } // Convert tuples to object for ease of lookup |
9620 } // Attributes are not guaranteed to occur in the same order. For validating |
8711 |
9621 // actual attributes, first convert the set of expected attribute values to |
8712 |
9622 // an object, for lookup by key. |
8713 var _map = [actual, expected].map(external_lodash_["fromPairs"]), |
9623 |
8714 _map2 = Object(slicedToArray["a" /* default */])(_map, 2), |
9624 |
8715 actualAttributes = _map2[0], |
9625 var expectedAttributes = {}; |
8716 expectedAttributes = _map2[1]; |
9626 |
8717 |
9627 for (var i = 0; i < expected.length; i++) { |
8718 for (var name in actualAttributes) { |
9628 expectedAttributes[expected[i][0].toLowerCase()] = expected[i][1]; |
8719 // As noted above, if missing member in B, assume different |
9629 } |
8720 if (!expectedAttributes.hasOwnProperty(name)) { |
9630 |
8721 log.warning('Encountered unexpected attribute `%s`.', name); |
9631 for (var _i = 0; _i < actual.length; _i++) { |
9632 var _actual$_i = Object(slicedToArray["a" /* default */])(actual[_i], 2), |
|
9633 name = _actual$_i[0], |
|
9634 actualValue = _actual$_i[1]; |
|
9635 |
|
9636 var nameLower = name.toLowerCase(); // As noted above, if missing member in B, assume different |
|
9637 |
|
9638 if (!expectedAttributes.hasOwnProperty(nameLower)) { |
|
9639 logger.warning('Encountered unexpected attribute `%s`.', name); |
|
8722 return false; |
9640 return false; |
8723 } |
9641 } |
8724 |
9642 |
8725 var actualValue = actualAttributes[name]; |
9643 var expectedValue = expectedAttributes[nameLower]; |
8726 var expectedValue = expectedAttributes[name]; |
9644 var isEqualAttributes = isEqualAttributesOfName[nameLower]; |
8727 var isEqualAttributes = isEqualAttributesOfName[name]; |
|
8728 |
9645 |
8729 if (isEqualAttributes) { |
9646 if (isEqualAttributes) { |
8730 // Defer custom attribute equality handling |
9647 // Defer custom attribute equality handling |
8731 if (!isEqualAttributes(actualValue, expectedValue)) { |
9648 if (!isEqualAttributes(actualValue, expectedValue)) { |
8732 log.warning('Expected attribute `%s` of value `%s`, saw `%s`.', name, expectedValue, actualValue); |
9649 logger.warning('Expected attribute `%s` of value `%s`, saw `%s`.', name, expectedValue, actualValue); |
8733 return false; |
9650 return false; |
8734 } |
9651 } |
8735 } else if (actualValue !== expectedValue) { |
9652 } else if (actualValue !== expectedValue) { |
8736 // Otherwise strict inequality should bail |
9653 // Otherwise strict inequality should bail |
8737 log.warning('Expected attribute `%s` of value `%s`, saw `%s`.', name, expectedValue, actualValue); |
9654 logger.warning('Expected attribute `%s` of value `%s`, saw `%s`.', name, expectedValue, actualValue); |
8738 return false; |
9655 return false; |
8739 } |
9656 } |
8740 } |
9657 } |
8741 |
9658 |
8742 return true; |
9659 return true; |
8747 * @type {Object} |
9664 * @type {Object} |
8748 */ |
9665 */ |
8749 |
9666 |
8750 var isEqualTokensOfType = { |
9667 var isEqualTokensOfType = { |
8751 StartTag: function StartTag(actual, expected) { |
9668 StartTag: function StartTag(actual, expected) { |
8752 if (actual.tagName !== expected.tagName) { |
9669 var logger = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : createLogger(); |
8753 log.warning('Expected tag name `%s`, instead saw `%s`.', expected.tagName, actual.tagName); |
9670 |
9671 if (actual.tagName !== expected.tagName && // Optimization: Use short-circuit evaluation to defer case- |
|
9672 // insensitive check on the assumption that the majority case will |
|
9673 // have exactly equal tag names. |
|
9674 actual.tagName.toLowerCase() !== expected.tagName.toLowerCase()) { |
|
9675 logger.warning('Expected tag name `%s`, instead saw `%s`.', expected.tagName, actual.tagName); |
|
8754 return false; |
9676 return false; |
8755 } |
9677 } |
8756 |
9678 |
8757 return isEqualTagAttributePairs.apply(void 0, Object(toConsumableArray["a" /* default */])([actual, expected].map(getMeaningfulAttributePairs))); |
9679 return isEqualTagAttributePairs.apply(void 0, Object(toConsumableArray["a" /* default */])([actual, expected].map(getMeaningfulAttributePairs)).concat([logger])); |
8758 }, |
9680 }, |
8759 Chars: isEquivalentTextTokens, |
9681 Chars: isEquivalentTextTokens, |
8760 Comment: isEquivalentTextTokens |
9682 Comment: isEquivalentTextTokens |
8761 }; |
9683 }; |
8762 /** |
9684 /** |
8785 } |
9707 } |
8786 /** |
9708 /** |
8787 * Tokenize an HTML string, gracefully handling any errors thrown during |
9709 * Tokenize an HTML string, gracefully handling any errors thrown during |
8788 * underlying tokenization. |
9710 * underlying tokenization. |
8789 * |
9711 * |
8790 * @param {string} html HTML string to tokenize. |
9712 * @param {string} html HTML string to tokenize. |
9713 * @param {Object} logger Validation logger object. |
|
8791 * |
9714 * |
8792 * @return {Object[]|null} Array of valid tokenized HTML elements, or null on error |
9715 * @return {Object[]|null} Array of valid tokenized HTML elements, or null on error |
8793 */ |
9716 */ |
8794 |
9717 |
8795 function getHTMLTokens(html) { |
9718 function getHTMLTokens(html) { |
9719 var logger = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : createLogger(); |
|
9720 |
|
8796 try { |
9721 try { |
8797 return new tokenizer(new validation_DecodeEntityParser()).tokenize(html); |
9722 return new Tokenizer(new validation_DecodeEntityParser()).tokenize(html); |
8798 } catch (e) { |
9723 } catch (e) { |
8799 log.warning('Malformed HTML detected: %s', html); |
9724 logger.warning('Malformed HTML detected: %s', html); |
8800 } |
9725 } |
8801 |
9726 |
8802 return null; |
9727 return null; |
8803 } |
9728 } |
8804 /** |
9729 /** |
8827 /** |
9752 /** |
8828 * Returns true if the given HTML strings are effectively equivalent, or |
9753 * Returns true if the given HTML strings are effectively equivalent, or |
8829 * false otherwise. Invalid HTML is not considered equivalent, even if the |
9754 * false otherwise. Invalid HTML is not considered equivalent, even if the |
8830 * strings directly match. |
9755 * strings directly match. |
8831 * |
9756 * |
8832 * @param {string} actual Actual HTML string. |
9757 * @param {string} actual Actual HTML string. |
8833 * @param {string} expected Expected HTML string. |
9758 * @param {string} expected Expected HTML string. |
9759 * @param {Object} logger Validation logger object. |
|
8834 * |
9760 * |
8835 * @return {boolean} Whether HTML strings are equivalent. |
9761 * @return {boolean} Whether HTML strings are equivalent. |
8836 */ |
9762 */ |
8837 |
9763 |
8838 function isEquivalentHTML(actual, expected) { |
9764 function isEquivalentHTML(actual, expected) { |
8839 // Tokenize input content and reserialized save content |
9765 var logger = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : createLogger(); |
8840 var _map3 = [actual, expected].map(getHTMLTokens), |
9766 |
8841 _map4 = Object(slicedToArray["a" /* default */])(_map3, 2), |
9767 // Short-circuit if markup is identical. |
8842 actualTokens = _map4[0], |
9768 if (actual === expected) { |
8843 expectedTokens = _map4[1]; // If either is malformed then stop comparing - the strings are not equivalent |
9769 return true; |
9770 } // Tokenize input content and reserialized save content |
|
9771 |
|
9772 |
|
9773 var _map = [actual, expected].map(function (html) { |
|
9774 return getHTMLTokens(html, logger); |
|
9775 }), |
|
9776 _map2 = Object(slicedToArray["a" /* default */])(_map, 2), |
|
9777 actualTokens = _map2[0], |
|
9778 expectedTokens = _map2[1]; // If either is malformed then stop comparing - the strings are not equivalent |
|
8844 |
9779 |
8845 |
9780 |
8846 if (!actualTokens || !expectedTokens) { |
9781 if (!actualTokens || !expectedTokens) { |
8847 return false; |
9782 return false; |
8848 } |
9783 } |
8851 |
9786 |
8852 while (actualToken = getNextNonWhitespaceToken(actualTokens)) { |
9787 while (actualToken = getNextNonWhitespaceToken(actualTokens)) { |
8853 expectedToken = getNextNonWhitespaceToken(expectedTokens); // Inequal if exhausted all expected tokens |
9788 expectedToken = getNextNonWhitespaceToken(expectedTokens); // Inequal if exhausted all expected tokens |
8854 |
9789 |
8855 if (!expectedToken) { |
9790 if (!expectedToken) { |
8856 log.warning('Expected end of content, instead saw %o.', actualToken); |
9791 logger.warning('Expected end of content, instead saw %o.', actualToken); |
8857 return false; |
9792 return false; |
8858 } // Inequal if next non-whitespace token of each set are not same type |
9793 } // Inequal if next non-whitespace token of each set are not same type |
8859 |
9794 |
8860 |
9795 |
8861 if (actualToken.type !== expectedToken.type) { |
9796 if (actualToken.type !== expectedToken.type) { |
8862 log.warning('Expected token of type `%s` (%o), instead saw `%s` (%o).', expectedToken.type, expectedToken, actualToken.type, actualToken); |
9797 logger.warning('Expected token of type `%s` (%o), instead saw `%s` (%o).', expectedToken.type, expectedToken, actualToken.type, actualToken); |
8863 return false; |
9798 return false; |
8864 } // Defer custom token type equality handling, otherwise continue and |
9799 } // Defer custom token type equality handling, otherwise continue and |
8865 // assume as equal |
9800 // assume as equal |
8866 |
9801 |
8867 |
9802 |
8868 var isEqualTokens = isEqualTokensOfType[actualToken.type]; |
9803 var isEqualTokens = isEqualTokensOfType[actualToken.type]; |
8869 |
9804 |
8870 if (isEqualTokens && !isEqualTokens(actualToken, expectedToken)) { |
9805 if (isEqualTokens && !isEqualTokens(actualToken, expectedToken, logger)) { |
8871 return false; |
9806 return false; |
8872 } // Peek at the next tokens (actual and expected) to see if they close |
9807 } // Peek at the next tokens (actual and expected) to see if they close |
8873 // a self-closing tag |
9808 // a self-closing tag |
8874 |
9809 |
8875 |
9810 |
8885 } |
9820 } |
8886 |
9821 |
8887 if (expectedToken = getNextNonWhitespaceToken(expectedTokens)) { |
9822 if (expectedToken = getNextNonWhitespaceToken(expectedTokens)) { |
8888 // If any non-whitespace tokens remain in expected token set, this |
9823 // If any non-whitespace tokens remain in expected token set, this |
8889 // indicates inequality |
9824 // indicates inequality |
8890 log.warning('Expected %o, instead saw end of content.', expectedToken); |
9825 logger.warning('Expected %o, instead saw end of content.', expectedToken); |
8891 return false; |
9826 return false; |
8892 } |
9827 } |
8893 |
9828 |
8894 return true; |
9829 return true; |
9830 } |
|
9831 /** |
|
9832 * Returns an object with `isValid` property set to `true` if the parsed block |
|
9833 * is valid given the input content. A block is considered valid if, when serialized |
|
9834 * with assumed attributes, the content matches the original value. If block is |
|
9835 * invalid, this function returns all validations issues as well. |
|
9836 * |
|
9837 * @param {string|Object} blockTypeOrName Block type. |
|
9838 * @param {Object} attributes Parsed block attributes. |
|
9839 * @param {string} originalBlockContent Original block content. |
|
9840 * @param {Object} logger Validation logger object. |
|
9841 * |
|
9842 * @return {Object} Whether block is valid and contains validation messages. |
|
9843 */ |
|
9844 |
|
9845 function getBlockContentValidationResult(blockTypeOrName, attributes, originalBlockContent) { |
|
9846 var logger = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : createQueuedLogger(); |
|
9847 var blockType = normalizeBlockType(blockTypeOrName); |
|
9848 var generatedBlockContent; |
|
9849 |
|
9850 try { |
|
9851 generatedBlockContent = getSaveContent(blockType, attributes); |
|
9852 } catch (error) { |
|
9853 logger.error('Block validation failed because an error occurred while generating block content:\n\n%s', error.toString()); |
|
9854 return { |
|
9855 isValid: false, |
|
9856 validationIssues: logger.getItems() |
|
9857 }; |
|
9858 } |
|
9859 |
|
9860 var isValid = isEquivalentHTML(originalBlockContent, generatedBlockContent, logger); |
|
9861 |
|
9862 if (!isValid) { |
|
9863 logger.error('Block validation failed for `%s` (%o).\n\nContent generated by `save` function:\n\n%s\n\nContent retrieved from post body:\n\n%s', blockType.name, blockType, generatedBlockContent, originalBlockContent); |
|
9864 } |
|
9865 |
|
9866 return { |
|
9867 isValid: isValid, |
|
9868 validationIssues: logger.getItems() |
|
9869 }; |
|
8895 } |
9870 } |
8896 /** |
9871 /** |
8897 * Returns true if the parsed block is valid given the input content. A block |
9872 * Returns true if the parsed block is valid given the input content. A block |
8898 * is considered valid if, when serialized with assumed attributes, the content |
9873 * is considered valid if, when serialized with assumed attributes, the content |
8899 * matches the original value. |
9874 * matches the original value. |
8906 * |
9881 * |
8907 * @return {boolean} Whether block is valid. |
9882 * @return {boolean} Whether block is valid. |
8908 */ |
9883 */ |
8909 |
9884 |
8910 function isValidBlockContent(blockTypeOrName, attributes, originalBlockContent) { |
9885 function isValidBlockContent(blockTypeOrName, attributes, originalBlockContent) { |
8911 var blockType = normalizeBlockType(blockTypeOrName); |
9886 var _getBlockContentValid = getBlockContentValidationResult(blockTypeOrName, attributes, originalBlockContent, createLogger()), |
8912 var generatedBlockContent; |
9887 isValid = _getBlockContentValid.isValid; |
8913 |
|
8914 try { |
|
8915 generatedBlockContent = getSaveContent(blockType, attributes); |
|
8916 } catch (error) { |
|
8917 log.error('Block validation failed because an error occurred while generating block content:\n\n%s', error.toString()); |
|
8918 return false; |
|
8919 } |
|
8920 |
|
8921 var isValid = isEquivalentHTML(originalBlockContent, generatedBlockContent); |
|
8922 |
|
8923 if (!isValid) { |
|
8924 log.error('Block validation failed for `%s` (%o).\n\nContent generated by `save` function:\n\n%s\n\nContent retrieved from post body:\n\n%s', blockType.name, blockType, generatedBlockContent, originalBlockContent); |
|
8925 } |
|
8926 |
9888 |
8927 return isValid; |
9889 return isValid; |
8928 } |
9890 } |
9891 |
|
9892 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/matchers.js |
|
9893 /** |
|
9894 * External dependencies |
|
9895 */ |
|
9896 |
|
9897 /** |
|
9898 * Internal dependencies |
|
9899 */ |
|
9900 |
|
9901 |
|
9902 |
|
9903 function matchers_html(selector, multilineTag) { |
|
9904 return function (domNode) { |
|
9905 var match = domNode; |
|
9906 |
|
9907 if (selector) { |
|
9908 match = domNode.querySelector(selector); |
|
9909 } |
|
9910 |
|
9911 if (!match) { |
|
9912 return ''; |
|
9913 } |
|
9914 |
|
9915 if (multilineTag) { |
|
9916 var value = ''; |
|
9917 var length = match.children.length; |
|
9918 |
|
9919 for (var index = 0; index < length; index++) { |
|
9920 var child = match.children[index]; |
|
9921 |
|
9922 if (child.nodeName.toLowerCase() !== multilineTag) { |
|
9923 continue; |
|
9924 } |
|
9925 |
|
9926 value += child.outerHTML; |
|
9927 } |
|
9928 |
|
9929 return value; |
|
9930 } |
|
9931 |
|
9932 return match.innerHTML; |
|
9933 }; |
|
9934 } |
|
9935 |
|
9936 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/node.js |
|
9937 |
|
9938 |
|
9939 function node_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
|
9940 |
|
9941 function node_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { node_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { node_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
9942 |
|
9943 /** |
|
9944 * Internal dependencies |
|
9945 */ |
|
9946 |
|
9947 /** |
|
9948 * Browser dependencies |
|
9949 */ |
|
9950 |
|
9951 var _window$Node = window.Node, |
|
9952 TEXT_NODE = _window$Node.TEXT_NODE, |
|
9953 ELEMENT_NODE = _window$Node.ELEMENT_NODE; |
|
9954 /** |
|
9955 * A representation of a single node within a block's rich text value. If |
|
9956 * representing a text node, the value is simply a string of the node value. |
|
9957 * As representing an element node, it is an object of: |
|
9958 * |
|
9959 * 1. `type` (string): Tag name. |
|
9960 * 2. `props` (object): Attributes and children array of WPBlockNode. |
|
9961 * |
|
9962 * @typedef {string|Object} WPBlockNode |
|
9963 */ |
|
9964 |
|
9965 /** |
|
9966 * Given a single node and a node type (e.g. `'br'`), returns true if the node |
|
9967 * corresponds to that type, false otherwise. |
|
9968 * |
|
9969 * @param {WPBlockNode} node Block node to test |
|
9970 * @param {string} type Node to type to test against. |
|
9971 * |
|
9972 * @return {boolean} Whether node is of intended type. |
|
9973 */ |
|
9974 |
|
9975 function isNodeOfType(node, type) { |
|
9976 return node && node.type === type; |
|
9977 } |
|
9978 /** |
|
9979 * Given an object implementing the NamedNodeMap interface, returns a plain |
|
9980 * object equivalent value of name, value key-value pairs. |
|
9981 * |
|
9982 * @see https://dom.spec.whatwg.org/#interface-namednodemap |
|
9983 * |
|
9984 * @param {NamedNodeMap} nodeMap NamedNodeMap to convert to object. |
|
9985 * |
|
9986 * @return {Object} Object equivalent value of NamedNodeMap. |
|
9987 */ |
|
9988 |
|
9989 |
|
9990 function getNamedNodeMapAsObject(nodeMap) { |
|
9991 var result = {}; |
|
9992 |
|
9993 for (var i = 0; i < nodeMap.length; i++) { |
|
9994 var _nodeMap$i = nodeMap[i], |
|
9995 name = _nodeMap$i.name, |
|
9996 value = _nodeMap$i.value; |
|
9997 result[name] = value; |
|
9998 } |
|
9999 |
|
10000 return result; |
|
10001 } |
|
10002 /** |
|
10003 * Given a DOM Element or Text node, returns an equivalent block node. Throws |
|
10004 * if passed any node type other than element or text. |
|
10005 * |
|
10006 * @throws {TypeError} If non-element/text node is passed. |
|
10007 * |
|
10008 * @param {Node} domNode DOM node to convert. |
|
10009 * |
|
10010 * @return {WPBlockNode} Block node equivalent to DOM node. |
|
10011 */ |
|
10012 |
|
10013 function fromDOM(domNode) { |
|
10014 if (domNode.nodeType === TEXT_NODE) { |
|
10015 return domNode.nodeValue; |
|
10016 } |
|
10017 |
|
10018 if (domNode.nodeType !== ELEMENT_NODE) { |
|
10019 throw new TypeError('A block node can only be created from a node of type text or ' + 'element.'); |
|
10020 } |
|
10021 |
|
10022 return { |
|
10023 type: domNode.nodeName.toLowerCase(), |
|
10024 props: node_objectSpread({}, getNamedNodeMapAsObject(domNode.attributes), { |
|
10025 children: children_fromDOM(domNode.childNodes) |
|
10026 }) |
|
10027 }; |
|
10028 } |
|
10029 /** |
|
10030 * Given a block node, returns its HTML string representation. |
|
10031 * |
|
10032 * @param {WPBlockNode} node Block node to convert to string. |
|
10033 * |
|
10034 * @return {string} String HTML representation of block node. |
|
10035 */ |
|
10036 |
|
10037 function toHTML(node) { |
|
10038 return children_toHTML([node]); |
|
10039 } |
|
10040 /** |
|
10041 * Given a selector, returns an hpq matcher generating a WPBlockNode value |
|
10042 * matching the selector result. |
|
10043 * |
|
10044 * @param {string} selector DOM selector. |
|
10045 * |
|
10046 * @return {Function} hpq matcher. |
|
10047 */ |
|
10048 |
|
10049 function node_matcher(selector) { |
|
10050 return function (domNode) { |
|
10051 var match = domNode; |
|
10052 |
|
10053 if (selector) { |
|
10054 match = domNode.querySelector(selector); |
|
10055 } |
|
10056 |
|
10057 try { |
|
10058 return fromDOM(match); |
|
10059 } catch (error) { |
|
10060 return null; |
|
10061 } |
|
10062 }; |
|
10063 } |
|
10064 /** |
|
10065 * Object of utility functions used in managing block attribute values of |
|
10066 * source `node`. |
|
10067 * |
|
10068 * @see https://github.com/WordPress/gutenberg/pull/10439 |
|
10069 * |
|
10070 * @deprecated since 4.0. The `node` source should not be used, and can be |
|
10071 * replaced by the `html` source. |
|
10072 * |
|
10073 * @private |
|
10074 */ |
|
10075 |
|
10076 /* harmony default export */ var api_node = ({ |
|
10077 isNodeOfType: isNodeOfType, |
|
10078 fromDOM: fromDOM, |
|
10079 toHTML: toHTML, |
|
10080 matcher: node_matcher |
|
10081 }); |
|
8929 |
10082 |
8930 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/children.js |
10083 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/children.js |
8931 /** |
10084 /** |
8932 * External dependencies |
10085 * External dependencies |
8933 */ |
10086 */ |
8991 |
10144 |
8992 function concat() { |
10145 function concat() { |
8993 var result = []; |
10146 var result = []; |
8994 |
10147 |
8995 for (var i = 0; i < arguments.length; i++) { |
10148 for (var i = 0; i < arguments.length; i++) { |
8996 var blockNode = Object(external_lodash_["castArray"])(i < 0 || arguments.length <= i ? undefined : arguments[i]); |
10149 var blockNode = Object(external_this_lodash_["castArray"])(i < 0 || arguments.length <= i ? undefined : arguments[i]); |
8997 |
10150 |
8998 for (var j = 0; j < blockNode.length; j++) { |
10151 for (var j = 0; j < blockNode.length; j++) { |
8999 var child = blockNode[j]; |
10152 var child = blockNode[j]; |
9000 var canConcatToPreviousString = typeof child === 'string' && typeof result[result.length - 1] === 'string'; |
10153 var canConcatToPreviousString = typeof child === 'string' && typeof result[result.length - 1] === 'string'; |
9001 |
10154 |
9016 * @param {Iterable.<Node>} domNodes Iterable set of DOM nodes to convert. |
10169 * @param {Iterable.<Node>} domNodes Iterable set of DOM nodes to convert. |
9017 * |
10170 * |
9018 * @return {WPBlockChildren} Block children equivalent to DOM nodes. |
10171 * @return {WPBlockChildren} Block children equivalent to DOM nodes. |
9019 */ |
10172 */ |
9020 |
10173 |
9021 function fromDOM(domNodes) { |
10174 function children_fromDOM(domNodes) { |
9022 var result = []; |
10175 var result = []; |
9023 |
10176 |
9024 for (var i = 0; i < domNodes.length; i++) { |
10177 for (var i = 0; i < domNodes.length; i++) { |
9025 try { |
10178 try { |
9026 result.push(node_fromDOM(domNodes[i])); |
10179 result.push(fromDOM(domNodes[i])); |
9027 } catch (error) {// Simply ignore if DOM node could not be converted. |
10180 } catch (error) {// Simply ignore if DOM node could not be converted. |
9028 } |
10181 } |
9029 } |
10182 } |
9030 |
10183 |
9031 return result; |
10184 return result; |
9036 * @param {WPBlockChildren} children Block node(s) to convert to string. |
10189 * @param {WPBlockChildren} children Block node(s) to convert to string. |
9037 * |
10190 * |
9038 * @return {string} String HTML representation of block node. |
10191 * @return {string} String HTML representation of block node. |
9039 */ |
10192 */ |
9040 |
10193 |
9041 function toHTML(children) { |
10194 function children_toHTML(children) { |
9042 var element = getSerializeCapableElement(children); |
10195 var element = getSerializeCapableElement(children); |
9043 return Object(external_this_wp_element_["renderToString"])(element); |
10196 return Object(external_this_wp_element_["renderToString"])(element); |
9044 } |
10197 } |
9045 /** |
10198 /** |
9046 * Given a selector, returns an hpq matcher generating a WPBlockChildren value |
10199 * Given a selector, returns an hpq matcher generating a WPBlockChildren value |
9058 if (selector) { |
10211 if (selector) { |
9059 match = domNode.querySelector(selector); |
10212 match = domNode.querySelector(selector); |
9060 } |
10213 } |
9061 |
10214 |
9062 if (match) { |
10215 if (match) { |
9063 return fromDOM(match.childNodes); |
10216 return children_fromDOM(match.childNodes); |
9064 } |
10217 } |
9065 |
10218 |
9066 return []; |
10219 return []; |
9067 }; |
10220 }; |
9068 } |
10221 } |
10222 /** |
|
10223 * Object of utility functions used in managing block attribute values of |
|
10224 * source `children`. |
|
10225 * |
|
10226 * @see https://github.com/WordPress/gutenberg/pull/10439 |
|
10227 * |
|
10228 * @deprecated since 4.0. The `children` source should not be used, and can be |
|
10229 * replaced by the `html` source. |
|
10230 * |
|
10231 * @private |
|
10232 */ |
|
10233 |
|
9069 /* harmony default export */ var api_children = ({ |
10234 /* harmony default export */ var api_children = ({ |
9070 concat: concat, |
10235 concat: concat, |
9071 getChildrenArray: getChildrenArray, |
10236 getChildrenArray: getChildrenArray, |
9072 fromDOM: fromDOM, |
10237 fromDOM: children_fromDOM, |
9073 toHTML: toHTML, |
10238 toHTML: children_toHTML, |
9074 matcher: children_matcher |
10239 matcher: children_matcher |
9075 }); |
10240 }); |
9076 |
10241 |
9077 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/node.js |
10242 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/parser.js |
10243 |
|
10244 |
|
10245 |
|
10246 |
|
10247 function parser_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
|
10248 |
|
10249 function parser_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { parser_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { parser_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
10250 |
|
10251 /** |
|
10252 * External dependencies |
|
10253 */ |
|
10254 |
|
10255 |
|
10256 /** |
|
10257 * WordPress dependencies |
|
10258 */ |
|
10259 |
|
10260 |
|
9078 |
10261 |
9079 |
10262 |
9080 /** |
10263 /** |
9081 * Internal dependencies |
10264 * Internal dependencies |
9082 */ |
10265 */ |
9083 |
10266 |
9084 /** |
|
9085 * Browser dependencies |
|
9086 */ |
|
9087 |
|
9088 var _window$Node = window.Node, |
|
9089 TEXT_NODE = _window$Node.TEXT_NODE, |
|
9090 ELEMENT_NODE = _window$Node.ELEMENT_NODE; |
|
9091 /** |
|
9092 * A representation of a single node within a block's rich text value. If |
|
9093 * representing a text node, the value is simply a string of the node value. |
|
9094 * As representing an element node, it is an object of: |
|
9095 * |
|
9096 * 1. `type` (string): Tag name. |
|
9097 * 2. `props` (object): Attributes and children array of WPBlockNode. |
|
9098 * |
|
9099 * @typedef {string|Object} WPBlockNode |
|
9100 */ |
|
9101 |
|
9102 /** |
|
9103 * Given a single node and a node type (e.g. `'br'`), returns true if the node |
|
9104 * corresponds to that type, false otherwise. |
|
9105 * |
|
9106 * @param {WPBlockNode} node Block node to test |
|
9107 * @param {string} type Node to type to test against. |
|
9108 * |
|
9109 * @return {boolean} Whether node is of intended type. |
|
9110 */ |
|
9111 |
|
9112 function isNodeOfType(node, type) { |
|
9113 return node && node.type === type; |
|
9114 } |
|
9115 /** |
|
9116 * Given an object implementing the NamedNodeMap interface, returns a plain |
|
9117 * object equivalent value of name, value key-value pairs. |
|
9118 * |
|
9119 * @see https://dom.spec.whatwg.org/#interface-namednodemap |
|
9120 * |
|
9121 * @param {NamedNodeMap} nodeMap NamedNodeMap to convert to object. |
|
9122 * |
|
9123 * @return {Object} Object equivalent value of NamedNodeMap. |
|
9124 */ |
|
9125 |
|
9126 |
|
9127 function getNamedNodeMapAsObject(nodeMap) { |
|
9128 var result = {}; |
|
9129 |
|
9130 for (var i = 0; i < nodeMap.length; i++) { |
|
9131 var _nodeMap$i = nodeMap[i], |
|
9132 name = _nodeMap$i.name, |
|
9133 value = _nodeMap$i.value; |
|
9134 result[name] = value; |
|
9135 } |
|
9136 |
|
9137 return result; |
|
9138 } |
|
9139 /** |
|
9140 * Given a DOM Element or Text node, returns an equivalent block node. Throws |
|
9141 * if passed any node type other than element or text. |
|
9142 * |
|
9143 * @throws {TypeError} If non-element/text node is passed. |
|
9144 * |
|
9145 * @param {Node} domNode DOM node to convert. |
|
9146 * |
|
9147 * @return {WPBlockNode} Block node equivalent to DOM node. |
|
9148 */ |
|
9149 |
|
9150 function node_fromDOM(domNode) { |
|
9151 if (domNode.nodeType === TEXT_NODE) { |
|
9152 return domNode.nodeValue; |
|
9153 } |
|
9154 |
|
9155 if (domNode.nodeType !== ELEMENT_NODE) { |
|
9156 throw new TypeError('A block node can only be created from a node of type text or ' + 'element.'); |
|
9157 } |
|
9158 |
|
9159 return { |
|
9160 type: domNode.nodeName.toLowerCase(), |
|
9161 props: Object(objectSpread["a" /* default */])({}, getNamedNodeMapAsObject(domNode.attributes), { |
|
9162 children: fromDOM(domNode.childNodes) |
|
9163 }) |
|
9164 }; |
|
9165 } |
|
9166 /** |
|
9167 * Given a block node, returns its HTML string representation. |
|
9168 * |
|
9169 * @param {WPBlockNode} node Block node to convert to string. |
|
9170 * |
|
9171 * @return {string} String HTML representation of block node. |
|
9172 */ |
|
9173 |
|
9174 function node_toHTML(node) { |
|
9175 return toHTML([node]); |
|
9176 } |
|
9177 /** |
|
9178 * Given a selector, returns an hpq matcher generating a WPBlockNode value |
|
9179 * matching the selector result. |
|
9180 * |
|
9181 * @param {string} selector DOM selector. |
|
9182 * |
|
9183 * @return {Function} hpq matcher. |
|
9184 */ |
|
9185 |
|
9186 function node_matcher(selector) { |
|
9187 return function (domNode) { |
|
9188 var match = domNode; |
|
9189 |
|
9190 if (selector) { |
|
9191 match = domNode.querySelector(selector); |
|
9192 } |
|
9193 |
|
9194 try { |
|
9195 return node_fromDOM(match); |
|
9196 } catch (error) { |
|
9197 return null; |
|
9198 } |
|
9199 }; |
|
9200 } |
|
9201 /* harmony default export */ var api_node = ({ |
|
9202 isNodeOfType: isNodeOfType, |
|
9203 fromDOM: node_fromDOM, |
|
9204 toHTML: node_toHTML, |
|
9205 matcher: node_matcher |
|
9206 }); |
|
9207 |
|
9208 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/matchers.js |
|
9209 /** |
|
9210 * External dependencies |
|
9211 */ |
|
9212 |
|
9213 /** |
|
9214 * Internal dependencies |
|
9215 */ |
|
9216 |
|
9217 |
|
9218 |
|
9219 function matchers_html(selector, multilineTag) { |
|
9220 return function (domNode) { |
|
9221 var match = domNode; |
|
9222 |
|
9223 if (selector) { |
|
9224 match = domNode.querySelector(selector); |
|
9225 } |
|
9226 |
|
9227 if (!match) { |
|
9228 return ''; |
|
9229 } |
|
9230 |
|
9231 if (multilineTag) { |
|
9232 var value = ''; |
|
9233 var length = match.children.length; |
|
9234 |
|
9235 for (var index = 0; index < length; index++) { |
|
9236 var child = match.children[index]; |
|
9237 |
|
9238 if (child.nodeName.toLowerCase() !== multilineTag) { |
|
9239 continue; |
|
9240 } |
|
9241 |
|
9242 value += child.outerHTML; |
|
9243 } |
|
9244 |
|
9245 return value; |
|
9246 } |
|
9247 |
|
9248 return match.innerHTML; |
|
9249 }; |
|
9250 } |
|
9251 |
|
9252 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/parser.js |
|
9253 |
|
9254 |
|
9255 |
|
9256 /** |
|
9257 * External dependencies |
|
9258 */ |
|
9259 |
|
9260 |
|
9261 /** |
|
9262 * WordPress dependencies |
|
9263 */ |
|
9264 |
|
9265 |
|
9266 |
|
9267 |
|
9268 /** |
|
9269 * Internal dependencies |
|
9270 */ |
|
9271 |
10267 |
9272 |
10268 |
9273 |
10269 |
9274 |
10270 |
9275 |
10271 |
9293 * |
10289 * |
9294 * @return {Function} Enhanced hpq matcher. |
10290 * @return {Function} Enhanced hpq matcher. |
9295 */ |
10291 */ |
9296 |
10292 |
9297 var parser_toBooleanAttributeMatcher = function toBooleanAttributeMatcher(matcher) { |
10293 var parser_toBooleanAttributeMatcher = function toBooleanAttributeMatcher(matcher) { |
9298 return Object(external_lodash_["flow"])([matcher, // Expected values from `attr( 'disabled' )`: |
10294 return Object(external_this_lodash_["flow"])([matcher, // Expected values from `attr( 'disabled' )`: |
9299 // |
10295 // |
9300 // <input> |
10296 // <input> |
9301 // - Value: `undefined` |
10297 // - Value: `undefined` |
9302 // - Transformed: `false` |
10298 // - Transformed: `false` |
9303 // |
10299 // |
9363 return types.some(function (type) { |
10359 return types.some(function (type) { |
9364 return isOfType(value, type); |
10360 return isOfType(value, type); |
9365 }); |
10361 }); |
9366 } |
10362 } |
9367 /** |
10363 /** |
10364 * Returns true if value is valid per the given block attribute schema type |
|
10365 * definition, or false otherwise. |
|
10366 * |
|
10367 * @see https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.1 |
|
10368 * |
|
10369 * @param {*} value Value to test. |
|
10370 * @param {?(Array<string>|string)} type Block attribute schema type. |
|
10371 * |
|
10372 * @return {boolean} Whether value is valid. |
|
10373 */ |
|
10374 |
|
10375 function isValidByType(value, type) { |
|
10376 return type === undefined || isOfTypes(value, Object(external_this_lodash_["castArray"])(type)); |
|
10377 } |
|
10378 /** |
|
10379 * Returns true if value is valid per the given block attribute schema enum |
|
10380 * definition, or false otherwise. |
|
10381 * |
|
10382 * @see https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.2 |
|
10383 * |
|
10384 * @param {*} value Value to test. |
|
10385 * @param {?Array} enumSet Block attribute schema enum. |
|
10386 * |
|
10387 * @return {boolean} Whether value is valid. |
|
10388 */ |
|
10389 |
|
10390 function isValidByEnum(value, enumSet) { |
|
10391 return !Array.isArray(enumSet) || enumSet.includes(value); |
|
10392 } |
|
10393 /** |
|
9368 * Returns true if the given attribute schema describes a value which may be |
10394 * Returns true if the given attribute schema describes a value which may be |
9369 * an ambiguous string. |
10395 * an ambiguous string. |
9370 * |
10396 * |
9371 * Some sources are ambiguously serialized as strings, for which value casting |
10397 * Some sources are ambiguously serialized as strings, for which value casting |
9372 * is enabled. This is only possible when a singular type is assigned to the |
10398 * is enabled. This is only possible when a singular type is assigned to the |
9385 var isStringSource = STRING_SOURCES.has(source); |
10411 var isStringSource = STRING_SOURCES.has(source); |
9386 var isSingleType = typeof type === 'string'; |
10412 var isSingleType = typeof type === 'string'; |
9387 return isStringSource && isSingleType; |
10413 return isStringSource && isSingleType; |
9388 } |
10414 } |
9389 /** |
10415 /** |
9390 * Returns value coerced to the specified JSON schema type string. |
|
9391 * |
|
9392 * @see http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.25 |
|
9393 * |
|
9394 * @param {*} value Original value. |
|
9395 * @param {string} type Type to coerce. |
|
9396 * |
|
9397 * @return {*} Coerced value. |
|
9398 */ |
|
9399 |
|
9400 function asType(value, type) { |
|
9401 switch (type) { |
|
9402 case 'string': |
|
9403 return String(value); |
|
9404 |
|
9405 case 'boolean': |
|
9406 return Boolean(value); |
|
9407 |
|
9408 case 'object': |
|
9409 return Object(value); |
|
9410 |
|
9411 case 'null': |
|
9412 return null; |
|
9413 |
|
9414 case 'array': |
|
9415 if (Array.isArray(value)) { |
|
9416 return value; |
|
9417 } |
|
9418 |
|
9419 return Array.from(value); |
|
9420 |
|
9421 case 'integer': |
|
9422 case 'number': |
|
9423 return Number(value); |
|
9424 } |
|
9425 |
|
9426 return value; |
|
9427 } |
|
9428 /** |
|
9429 * Returns an hpq matcher given a source object. |
10416 * Returns an hpq matcher given a source object. |
9430 * |
10417 * |
9431 * @param {Object} sourceConfig Attribute Source object. |
10418 * @param {Object} sourceConfig Attribute Source object. |
9432 * |
10419 * |
9433 * @return {Function} A hpq Matcher. |
10420 * @return {Function} A hpq Matcher. |
9455 |
10442 |
9456 case 'node': |
10443 case 'node': |
9457 return node_matcher(sourceConfig.selector); |
10444 return node_matcher(sourceConfig.selector); |
9458 |
10445 |
9459 case 'query': |
10446 case 'query': |
9460 var subMatchers = Object(external_lodash_["mapValues"])(sourceConfig.query, matcherFromSource); |
10447 var subMatchers = Object(external_this_lodash_["mapValues"])(sourceConfig.query, matcherFromSource); |
9461 return query(sourceConfig.selector, subMatchers); |
10448 return query(sourceConfig.selector, subMatchers); |
9462 |
10449 |
9463 case 'tag': |
10450 case 'tag': |
9464 return Object(external_lodash_["flow"])([prop(sourceConfig.selector, 'nodeName'), function (value) { |
10451 return Object(external_this_lodash_["flow"])([prop(sourceConfig.selector, 'nodeName'), function (nodeName) { |
9465 return value.toLowerCase(); |
10452 return nodeName ? nodeName.toLowerCase() : undefined; |
9466 }]); |
10453 }]); |
9467 |
10454 |
9468 default: |
10455 default: |
9469 // eslint-disable-next-line no-console |
10456 // eslint-disable-next-line no-console |
9470 console.error("Unknown source type \"".concat(sourceConfig.source, "\"")); |
10457 console.error("Unknown source type \"".concat(sourceConfig.source, "\"")); |
9495 * |
10482 * |
9496 * @return {*} Attribute value. |
10483 * @return {*} Attribute value. |
9497 */ |
10484 */ |
9498 |
10485 |
9499 function getBlockAttribute(attributeKey, attributeSchema, innerHTML, commentAttributes) { |
10486 function getBlockAttribute(attributeKey, attributeSchema, innerHTML, commentAttributes) { |
9500 var type = attributeSchema.type; |
10487 var type = attributeSchema.type, |
10488 enumSet = attributeSchema.enum; |
|
9501 var value; |
10489 var value; |
9502 |
10490 |
9503 switch (attributeSchema.source) { |
10491 switch (attributeSchema.source) { |
9504 // undefined source means that it's an attribute serialized to the block's "comment" |
10492 // undefined source means that it's an attribute serialized to the block's "comment" |
9505 case undefined: |
10493 case undefined: |
9516 case 'tag': |
10504 case 'tag': |
9517 value = parseWithAttributeSchema(innerHTML, attributeSchema); |
10505 value = parseWithAttributeSchema(innerHTML, attributeSchema); |
9518 break; |
10506 break; |
9519 } |
10507 } |
9520 |
10508 |
9521 if (type !== undefined && !isOfTypes(value, Object(external_lodash_["castArray"])(type))) { |
10509 if (!isValidByType(value, type) || !isValidByEnum(value, enumSet)) { |
9522 // Reject the value if it is not valid of type. Reverting to the |
10510 // Reject the value if it is not valid. Reverting to the undefined |
9523 // undefined value ensures the default is restored, if applicable. |
10511 // value ensures the default is respected, if applicable. |
9524 value = undefined; |
10512 value = undefined; |
9525 } |
10513 } |
9526 |
10514 |
9527 if (value === undefined) { |
10515 if (value === undefined) { |
9528 return attributeSchema.default; |
10516 return attributeSchema.default; |
9541 */ |
10529 */ |
9542 |
10530 |
9543 function getBlockAttributes(blockTypeOrName, innerHTML) { |
10531 function getBlockAttributes(blockTypeOrName, innerHTML) { |
9544 var attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; |
10532 var attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; |
9545 var blockType = normalizeBlockType(blockTypeOrName); |
10533 var blockType = normalizeBlockType(blockTypeOrName); |
9546 var blockAttributes = Object(external_lodash_["mapValues"])(blockType.attributes, function (attributeSchema, attributeKey) { |
10534 var blockAttributes = Object(external_this_lodash_["mapValues"])(blockType.attributes, function (attributeSchema, attributeKey) { |
9547 return getBlockAttribute(attributeKey, attributeSchema, innerHTML, attributes); |
10535 return getBlockAttribute(attributeKey, attributeSchema, innerHTML, attributes); |
9548 }); |
10536 }); |
9549 return Object(external_this_wp_hooks_["applyFilters"])('blocks.getBlockAttributes', blockAttributes, blockType, innerHTML, attributes); |
10537 return Object(external_this_wp_hooks_["applyFilters"])('blocks.getBlockAttributes', blockAttributes, blockType, innerHTML, attributes); |
9550 } |
10538 } |
9551 /** |
10539 /** |
9575 for (var i = 0; i < deprecatedDefinitions.length; i++) { |
10563 for (var i = 0; i < deprecatedDefinitions.length; i++) { |
9576 // A block can opt into a migration even if the block is valid by |
10564 // A block can opt into a migration even if the block is valid by |
9577 // defining isEligible on its deprecation. If the block is both valid |
10565 // defining isEligible on its deprecation. If the block is both valid |
9578 // and does not opt to migrate, skip. |
10566 // and does not opt to migrate, skip. |
9579 var _deprecatedDefinition = deprecatedDefinitions[i].isEligible, |
10567 var _deprecatedDefinition = deprecatedDefinitions[i].isEligible, |
9580 isEligible = _deprecatedDefinition === void 0 ? external_lodash_["stubFalse"] : _deprecatedDefinition; |
10568 isEligible = _deprecatedDefinition === void 0 ? external_this_lodash_["stubFalse"] : _deprecatedDefinition; |
9581 |
10569 |
9582 if (block.isValid && !isEligible(parsedAttributes, innerBlocks)) { |
10570 if (block.isValid && !isEligible(parsedAttributes, innerBlocks)) { |
9583 continue; |
10571 continue; |
9584 } // Block type properties which could impact either serialization or |
10572 } // Block type properties which could impact either serialization or |
9585 // parsing are not considered in the deprecated block type by default, |
10573 // parsing are not considered in the deprecated block type by default, |
9586 // and must be explicitly provided. |
10574 // and must be explicitly provided. |
9587 |
10575 |
9588 |
10576 |
9589 var deprecatedBlockType = Object.assign(Object(external_lodash_["omit"])(blockType, ['attributes', 'save', 'supports']), deprecatedDefinitions[i]); |
10577 var deprecatedBlockType = Object.assign(Object(external_this_lodash_["omit"])(blockType, DEPRECATED_ENTRY_KEYS), deprecatedDefinitions[i]); |
9590 var migratedAttributes = getBlockAttributes(deprecatedBlockType, originalContent, parsedAttributes); // Ignore the deprecation if it produces a block which is not valid. |
10578 var migratedAttributes = getBlockAttributes(deprecatedBlockType, originalContent, parsedAttributes); // Ignore the deprecation if it produces a block which is not valid. |
9591 |
10579 |
9592 var isValid = isValidBlockContent(deprecatedBlockType, migratedAttributes, originalContent); |
10580 var _getBlockContentValid = getBlockContentValidationResult(deprecatedBlockType, migratedAttributes, originalContent), |
10581 isValid = _getBlockContentValid.isValid, |
|
10582 validationIssues = _getBlockContentValid.validationIssues; |
|
9593 |
10583 |
9594 if (!isValid) { |
10584 if (!isValid) { |
10585 block = parser_objectSpread({}, block, { |
|
10586 validationIssues: [].concat(Object(toConsumableArray["a" /* default */])(Object(external_this_lodash_["get"])(block, 'validationIssues', [])), Object(toConsumableArray["a" /* default */])(validationIssues)) |
|
10587 }); |
|
9595 continue; |
10588 continue; |
9596 } |
10589 } |
9597 |
10590 |
9598 block = Object(objectSpread["a" /* default */])({}, block, { |
|
9599 isValid: true |
|
9600 }); |
|
9601 var migratedInnerBlocks = innerBlocks; // A block may provide custom behavior to assign new attributes and/or |
10591 var migratedInnerBlocks = innerBlocks; // A block may provide custom behavior to assign new attributes and/or |
9602 // inner blocks. |
10592 // inner blocks. |
9603 |
10593 |
9604 var migrate = deprecatedBlockType.migrate; |
10594 var migrate = deprecatedBlockType.migrate; |
9605 |
10595 |
9606 if (migrate) { |
10596 if (migrate) { |
9607 var _castArray = Object(external_lodash_["castArray"])(migrate(migratedAttributes, innerBlocks)); |
10597 var _castArray = Object(external_this_lodash_["castArray"])(migrate(migratedAttributes, innerBlocks)); |
9608 |
10598 |
9609 var _castArray2 = Object(slicedToArray["a" /* default */])(_castArray, 2); |
10599 var _castArray2 = Object(slicedToArray["a" /* default */])(_castArray, 2); |
9610 |
10600 |
9611 var _castArray2$ = _castArray2[0]; |
10601 var _castArray2$ = _castArray2[0]; |
9612 migratedAttributes = _castArray2$ === void 0 ? parsedAttributes : _castArray2$; |
10602 migratedAttributes = _castArray2$ === void 0 ? parsedAttributes : _castArray2$; |
9613 var _castArray2$2 = _castArray2[1]; |
10603 var _castArray2$2 = _castArray2[1]; |
9614 migratedInnerBlocks = _castArray2$2 === void 0 ? innerBlocks : _castArray2$2; |
10604 migratedInnerBlocks = _castArray2$2 === void 0 ? innerBlocks : _castArray2$2; |
9615 } |
10605 } |
9616 |
10606 |
9617 block.attributes = migratedAttributes; |
10607 block = parser_objectSpread({}, block, { |
9618 block.innerBlocks = migratedInnerBlocks; |
10608 attributes: migratedAttributes, |
10609 innerBlocks: migratedInnerBlocks, |
|
10610 isValid: true |
|
10611 }); |
|
9619 } |
10612 } |
9620 |
10613 |
9621 return block; |
10614 return block; |
9622 } |
10615 } |
9623 /** |
10616 /** |
9632 var originalName = blockNode.blockName; |
10625 var originalName = blockNode.blockName; |
9633 var attributes = blockNode.attrs, |
10626 var attributes = blockNode.attrs, |
9634 _blockNode$innerBlock = blockNode.innerBlocks, |
10627 _blockNode$innerBlock = blockNode.innerBlocks, |
9635 innerBlocks = _blockNode$innerBlock === void 0 ? [] : _blockNode$innerBlock, |
10628 innerBlocks = _blockNode$innerBlock === void 0 ? [] : _blockNode$innerBlock, |
9636 innerHTML = blockNode.innerHTML; |
10629 innerHTML = blockNode.innerHTML; |
10630 var innerContent = blockNode.innerContent; |
|
9637 var freeformContentFallbackBlock = getFreeformContentHandlerName(); |
10631 var freeformContentFallbackBlock = getFreeformContentHandlerName(); |
9638 var unregisteredFallbackBlock = getUnregisteredTypeHandlerName() || freeformContentFallbackBlock; |
10632 var unregisteredFallbackBlock = getUnregisteredTypeHandlerName() || freeformContentFallbackBlock; |
9639 attributes = attributes || {}; // Trim content to avoid creation of intermediary freeform segments. |
10633 attributes = attributes || {}; // Trim content to avoid creation of intermediary freeform segments. |
9640 |
10634 |
9641 innerHTML = innerHTML.trim(); // Use type from block content if available. Otherwise, default to the |
10635 innerHTML = innerHTML.trim(); // Use type from block content if available. Otherwise, default to the |
9648 } // Convert 'core/text' blocks in existing content to 'core/paragraph'. |
10642 } // Convert 'core/text' blocks in existing content to 'core/paragraph'. |
9649 |
10643 |
9650 |
10644 |
9651 if ('core/text' === name || 'core/cover-text' === name) { |
10645 if ('core/text' === name || 'core/cover-text' === name) { |
9652 name = 'core/paragraph'; |
10646 name = 'core/paragraph'; |
10647 } // Convert derivative blocks such as 'core/social-link-wordpress' to the |
|
10648 // canonical form 'core/social-link'. |
|
10649 |
|
10650 |
|
10651 if (name && name.indexOf('core/social-link-') === 0) { |
|
10652 // Capture `social-link-wordpress` into `{"service":"wordpress"}` |
|
10653 attributes.service = name.substring(17); |
|
10654 name = 'core/social-link'; |
|
9653 } // Fallback content may be upgraded from classic editor expecting implicit |
10655 } // Fallback content may be upgraded from classic editor expecting implicit |
9654 // automatic paragraphs, so preserve them. Assumes wpautop is idempotent, |
10656 // automatic paragraphs, so preserve them. Assumes wpautop is idempotent, |
9655 // meaning there are no negative consequences to repeated autop calls. |
10657 // meaning there are no negative consequences to repeated autop calls. |
9656 |
10658 |
9657 |
10659 |
9661 |
10663 |
9662 |
10664 |
9663 var blockType = registration_getBlockType(name); |
10665 var blockType = registration_getBlockType(name); |
9664 |
10666 |
9665 if (!blockType) { |
10667 if (!blockType) { |
9666 // Preserve undelimited content for use by the unregistered type handler. |
10668 // Since the constituents of the block node are extracted at the start |
9667 var originalUndelimitedContent = innerHTML; // If detected as a block which is not registered, preserve comment |
10669 // of the present function, construct a new object rather than reuse |
10670 // `blockNode`. |
|
10671 var reconstitutedBlockNode = { |
|
10672 attrs: attributes, |
|
10673 blockName: originalName, |
|
10674 innerBlocks: innerBlocks, |
|
10675 innerContent: innerContent |
|
10676 }; // Preserve undelimited content for use by the unregistered type |
|
10677 // handler. A block node's `innerHTML` isn't enough, as that field only |
|
10678 // carries the block's own HTML and not its nested blocks'. |
|
10679 |
|
10680 var originalUndelimitedContent = serializeBlockNode(reconstitutedBlockNode, { |
|
10681 isCommentDelimited: false |
|
10682 }); // Preserve full block content for use by the unregistered type |
|
10683 // handler, block boundaries included. |
|
10684 |
|
10685 var originalContent = serializeBlockNode(reconstitutedBlockNode, { |
|
10686 isCommentDelimited: true |
|
10687 }); // If detected as a block which is not registered, preserve comment |
|
9668 // delimiters in content of unregistered type handler. |
10688 // delimiters in content of unregistered type handler. |
9669 |
10689 |
9670 if (name) { |
10690 if (name) { |
9671 innerHTML = getCommentDelimitedContent(name, attributes, innerHTML); |
10691 innerHTML = originalContent; |
9672 } |
10692 } |
9673 |
10693 |
9674 name = unregisteredFallbackBlock; |
10694 name = unregisteredFallbackBlock; |
9675 attributes = { |
10695 attributes = { |
9676 originalName: originalName, |
10696 originalName: originalName, |
10697 originalContent: originalContent, |
|
9677 originalUndelimitedContent: originalUndelimitedContent |
10698 originalUndelimitedContent: originalUndelimitedContent |
9678 }; |
10699 }; |
9679 blockType = registration_getBlockType(name); |
10700 blockType = registration_getBlockType(name); |
9680 } // Coerce inner blocks from parsed form to canonical form. |
10701 } // Coerce inner blocks from parsed form to canonical form. |
9681 |
10702 |
9682 |
10703 |
9683 innerBlocks = innerBlocks.map(createBlockWithFallback); |
10704 innerBlocks = innerBlocks.map(createBlockWithFallback); // Remove `undefined` innerBlocks. |
10705 // |
|
10706 // This is a temporary fix to prevent unrecoverable TypeErrors when handling unexpectedly |
|
10707 // empty freeform block nodes. See https://github.com/WordPress/gutenberg/pull/17164. |
|
10708 |
|
10709 innerBlocks = innerBlocks.filter(function (innerBlock) { |
|
10710 return innerBlock; |
|
10711 }); |
|
9684 var isFallbackBlock = name === freeformContentFallbackBlock || name === unregisteredFallbackBlock; // Include in set only if type was determined. |
10712 var isFallbackBlock = name === freeformContentFallbackBlock || name === unregisteredFallbackBlock; // Include in set only if type was determined. |
9685 |
10713 |
9686 if (!blockType || !innerHTML && isFallbackBlock) { |
10714 if (!blockType || !innerHTML && isFallbackBlock) { |
9687 return; |
10715 return; |
9688 } |
10716 } |
9691 // provided there are no changes in attributes. The validation procedure thus compares the |
10719 // provided there are no changes in attributes. The validation procedure thus compares the |
9692 // provided source value with the serialized output before there are any modifications to |
10720 // provided source value with the serialized output before there are any modifications to |
9693 // the block. When both match, the block is marked as valid. |
10721 // the block. When both match, the block is marked as valid. |
9694 |
10722 |
9695 if (!isFallbackBlock) { |
10723 if (!isFallbackBlock) { |
9696 block.isValid = isValidBlockContent(blockType, block.attributes, innerHTML); |
10724 var _getBlockContentValid2 = getBlockContentValidationResult(blockType, block.attributes, innerHTML), |
9697 } // Preserve original content for future use in case the block is parsed as |
10725 isValid = _getBlockContentValid2.isValid, |
9698 // invalid, or future serialization attempt results in an error. |
10726 validationIssues = _getBlockContentValid2.validationIssues; |
9699 |
10727 |
9700 |
10728 block.isValid = isValid; |
9701 block.originalContent = innerHTML; |
10729 block.validationIssues = validationIssues; |
10730 } // Preserve original content for future use in case the block is parsed |
|
10731 // as invalid, or future serialization attempt results in an error. |
|
10732 |
|
10733 |
|
10734 block.originalContent = block.originalContent || innerHTML; |
|
9702 block = getMigratedBlock(block, attributes); |
10735 block = getMigratedBlock(block, attributes); |
10736 |
|
10737 if (block.validationIssues && block.validationIssues.length > 0) { |
|
10738 if (block.isValid) { |
|
10739 // eslint-disable-next-line no-console |
|
10740 console.info('Block successfully updated for `%s` (%o).\n\nNew content generated by `save` function:\n\n%s\n\nContent retrieved from post body:\n\n%s', blockType.name, blockType, getSaveContent(blockType, block.attributes), block.originalContent); |
|
10741 } else { |
|
10742 block.validationIssues.forEach(function (_ref) { |
|
10743 var log = _ref.log, |
|
10744 args = _ref.args; |
|
10745 return log.apply(void 0, Object(toConsumableArray["a" /* default */])(args)); |
|
10746 }); |
|
10747 } |
|
10748 } |
|
10749 |
|
9703 return block; |
10750 return block; |
10751 } |
|
10752 /** |
|
10753 * Serializes a block node into the native HTML-comment-powered block format. |
|
10754 * CAVEAT: This function is intended for reserializing blocks as parsed by |
|
10755 * valid parsers and skips any validation steps. This is NOT a generic |
|
10756 * serialization function for in-memory blocks. For most purposes, see the |
|
10757 * following functions available in the `@wordpress/blocks` package: |
|
10758 * |
|
10759 * @see serializeBlock |
|
10760 * @see serialize |
|
10761 * |
|
10762 * For more on the format of block nodes as returned by valid parsers: |
|
10763 * |
|
10764 * @see `@wordpress/block-serialization-default-parser` package |
|
10765 * @see `@wordpress/block-serialization-spec-parser` package |
|
10766 * |
|
10767 * @param {Object} blockNode A block node as returned by a valid parser. |
|
10768 * @param {?Object} options Serialization options. |
|
10769 * @param {?boolean} options.isCommentDelimited Whether to output HTML comments around blocks. |
|
10770 * |
|
10771 * @return {string} An HTML string representing a block. |
|
10772 */ |
|
10773 |
|
10774 function serializeBlockNode(blockNode) { |
|
10775 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; |
|
10776 var _options$isCommentDel = options.isCommentDelimited, |
|
10777 isCommentDelimited = _options$isCommentDel === void 0 ? true : _options$isCommentDel; |
|
10778 var blockName = blockNode.blockName, |
|
10779 _blockNode$attrs = blockNode.attrs, |
|
10780 attrs = _blockNode$attrs === void 0 ? {} : _blockNode$attrs, |
|
10781 _blockNode$innerBlock2 = blockNode.innerBlocks, |
|
10782 innerBlocks = _blockNode$innerBlock2 === void 0 ? [] : _blockNode$innerBlock2, |
|
10783 _blockNode$innerConte = blockNode.innerContent, |
|
10784 innerContent = _blockNode$innerConte === void 0 ? [] : _blockNode$innerConte; |
|
10785 var childIndex = 0; |
|
10786 var content = innerContent.map(function (item) { |
|
10787 return (// `null` denotes a nested block, otherwise we have an HTML fragment |
|
10788 item !== null ? item : serializeBlockNode(innerBlocks[childIndex++], options) |
|
10789 ); |
|
10790 }).join('\n').replace(/\n+/g, '\n').trim(); |
|
10791 return isCommentDelimited ? getCommentDelimitedContent(blockName, attrs, content) : content; |
|
9704 } |
10792 } |
9705 /** |
10793 /** |
9706 * Creates a parse implementation for the post content which returns a list of blocks. |
10794 * Creates a parse implementation for the post content which returns a list of blocks. |
9707 * |
10795 * |
9708 * @param {Function} parseImplementation Parse implementation. |
10796 * @param {Function} parseImplementation Parse implementation. |
9710 * @return {Function} An implementation which parses the post content. |
10798 * @return {Function} An implementation which parses the post content. |
9711 */ |
10799 */ |
9712 |
10800 |
9713 var createParse = function createParse(parseImplementation) { |
10801 var createParse = function createParse(parseImplementation) { |
9714 return function (content) { |
10802 return function (content) { |
9715 return parseImplementation(content).reduce(function (memo, blockNode) { |
10803 return parseImplementation(content).reduce(function (accumulator, blockNode) { |
9716 var block = createBlockWithFallback(blockNode); |
10804 var block = createBlockWithFallback(blockNode); |
9717 |
10805 |
9718 if (block) { |
10806 if (block) { |
9719 memo.push(block); |
10807 accumulator.push(block); |
9720 } |
10808 } |
9721 |
10809 |
9722 return memo; |
10810 return accumulator; |
9723 }, []); |
10811 }, []); |
9724 }; |
10812 }; |
9725 }; |
10813 }; |
9726 /** |
10814 /** |
9727 * Parses the post content with a PegJS grammar and returns a list of blocks. |
10815 * Parses the post content with a PegJS grammar and returns a list of blocks. |
9733 |
10821 |
9734 |
10822 |
9735 var parseWithGrammar = createParse(external_this_wp_blockSerializationDefaultParser_["parse"]); |
10823 var parseWithGrammar = createParse(external_this_wp_blockSerializationDefaultParser_["parse"]); |
9736 /* harmony default export */ var parser = (parseWithGrammar); |
10824 /* harmony default export */ var parser = (parseWithGrammar); |
9737 |
10825 |
9738 // EXTERNAL MODULE: external {"this":["wp","dom"]} |
|
9739 var external_this_wp_dom_ = __webpack_require__(24); |
|
9740 |
|
9741 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/phrasing-content.js |
10826 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/phrasing-content.js |
10827 |
|
10828 |
|
10829 function phrasing_content_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
|
10830 |
|
10831 function phrasing_content_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { phrasing_content_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { phrasing_content_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
10832 |
|
9742 /** |
10833 /** |
9743 * External dependencies |
10834 * External dependencies |
9744 */ |
10835 */ |
9745 |
10836 |
9746 var phrasing_content_phrasingContentSchema = { |
10837 /** |
10838 * All phrasing content elements. |
|
10839 * |
|
10840 * @see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#phrasing-content-0 |
|
10841 */ |
|
10842 |
|
10843 /** |
|
10844 * All text-level semantic elements. |
|
10845 * |
|
10846 * @see https://html.spec.whatwg.org/multipage/text-level-semantics.html |
|
10847 */ |
|
10848 |
|
10849 var textContentSchema = { |
|
9747 strong: {}, |
10850 strong: {}, |
9748 em: {}, |
10851 em: {}, |
9749 s: {}, |
10852 s: {}, |
9750 del: {}, |
10853 del: {}, |
9751 ins: {}, |
10854 ins: {}, |
9757 attributes: ['title'] |
10860 attributes: ['title'] |
9758 }, |
10861 }, |
9759 sub: {}, |
10862 sub: {}, |
9760 sup: {}, |
10863 sup: {}, |
9761 br: {}, |
10864 br: {}, |
10865 small: {}, |
|
10866 // To do: fix blockquote. |
|
10867 // cite: {}, |
|
10868 q: { |
|
10869 attributes: ['cite'] |
|
10870 }, |
|
10871 dfn: { |
|
10872 attributes: ['title'] |
|
10873 }, |
|
10874 data: { |
|
10875 attributes: ['value'] |
|
10876 }, |
|
10877 time: { |
|
10878 attributes: ['datetime'] |
|
10879 }, |
|
10880 var: {}, |
|
10881 samp: {}, |
|
10882 kbd: {}, |
|
10883 i: {}, |
|
10884 b: {}, |
|
10885 u: {}, |
|
10886 mark: {}, |
|
10887 ruby: {}, |
|
10888 rt: {}, |
|
10889 rp: {}, |
|
10890 bdi: { |
|
10891 attributes: ['dir'] |
|
10892 }, |
|
10893 bdo: { |
|
10894 attributes: ['dir'] |
|
10895 }, |
|
10896 wbr: {}, |
|
9762 '#text': {} |
10897 '#text': {} |
9763 }; // Recursion is needed. |
10898 }; // Recursion is needed. |
9764 // Possible: strong > em > strong. |
10899 // Possible: strong > em > strong. |
9765 // Impossible: strong > strong. |
10900 // Impossible: strong > strong. |
9766 |
10901 |
9767 ['strong', 'em', 's', 'del', 'ins', 'a', 'code', 'abbr', 'sub', 'sup'].forEach(function (tag) { |
10902 Object(external_this_lodash_["without"])(Object.keys(textContentSchema), '#text', 'br').forEach(function (tag) { |
9768 phrasing_content_phrasingContentSchema[tag].children = Object(external_lodash_["omit"])(phrasing_content_phrasingContentSchema, tag); |
10903 textContentSchema[tag].children = Object(external_this_lodash_["omit"])(textContentSchema, tag); |
9769 }); |
10904 }); |
9770 /** |
10905 /** |
10906 * Embedded content elements. |
|
10907 * |
|
10908 * @see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#embedded-content-0 |
|
10909 */ |
|
10910 |
|
10911 var embeddedContentSchema = { |
|
10912 audio: { |
|
10913 attributes: ['src', 'preload', 'autoplay', 'mediagroup', 'loop', 'muted'] |
|
10914 }, |
|
10915 canvas: { |
|
10916 attributes: ['width', 'height'] |
|
10917 }, |
|
10918 embed: { |
|
10919 attributes: ['src', 'type', 'width', 'height'] |
|
10920 }, |
|
10921 img: { |
|
10922 attributes: ['alt', 'src', 'srcset', 'usemap', 'ismap', 'width', 'height'] |
|
10923 }, |
|
10924 object: { |
|
10925 attributes: ['data', 'type', 'name', 'usemap', 'form', 'width', 'height'] |
|
10926 }, |
|
10927 video: { |
|
10928 attributes: ['src', 'poster', 'preload', 'autoplay', 'mediagroup', 'loop', 'muted', 'controls', 'width', 'height'] |
|
10929 } |
|
10930 }; |
|
10931 /** |
|
10932 * Phrasing content elements. |
|
10933 * |
|
10934 * @see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#phrasing-content-0 |
|
10935 */ |
|
10936 |
|
10937 var phrasing_content_phrasingContentSchema = phrasing_content_objectSpread({}, textContentSchema, {}, embeddedContentSchema); |
|
10938 /** |
|
9771 * Get schema of possible paths for phrasing content. |
10939 * Get schema of possible paths for phrasing content. |
9772 * |
10940 * |
9773 * @see https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content |
10941 * @see https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content |
9774 * |
10942 * |
10943 * @param {string} context Set to "paste" to exclude invisible elements and |
|
10944 * sensitive data. |
|
10945 * |
|
9775 * @return {Object} Schema. |
10946 * @return {Object} Schema. |
9776 */ |
10947 */ |
9777 |
10948 |
9778 function getPhrasingContentSchema() { |
10949 |
9779 return phrasing_content_phrasingContentSchema; |
10950 function getPhrasingContentSchema(context) { |
10951 if (context !== 'paste') { |
|
10952 return phrasing_content_phrasingContentSchema; |
|
10953 } |
|
10954 |
|
10955 return Object(external_this_lodash_["omit"])(phrasing_content_objectSpread({}, phrasing_content_phrasingContentSchema, { |
|
10956 // We shouldn't paste potentially sensitive information which is not |
|
10957 // visible to the user when pasted, so strip the attributes. |
|
10958 ins: { |
|
10959 children: phrasing_content_phrasingContentSchema.ins.children |
|
10960 }, |
|
10961 del: { |
|
10962 children: phrasing_content_phrasingContentSchema.del.children |
|
10963 } |
|
10964 }), ['u', // Used to mark misspelling. Shouldn't be pasted. |
|
10965 'abbr', // Invisible. |
|
10966 'data', // Invisible. |
|
10967 'time', // Invisible. |
|
10968 'wbr', // Invisible. |
|
10969 'bdi', // Invisible. |
|
10970 'bdo' // Invisible. |
|
10971 ]); |
|
9780 } |
10972 } |
9781 /** |
10973 /** |
9782 * Find out whether or not the given node is phrasing content. |
10974 * Find out whether or not the given node is phrasing content. |
9783 * |
10975 * |
9784 * @see https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content |
10976 * @see https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content |
9790 |
10982 |
9791 function isPhrasingContent(node) { |
10983 function isPhrasingContent(node) { |
9792 var tag = node.nodeName.toLowerCase(); |
10984 var tag = node.nodeName.toLowerCase(); |
9793 return getPhrasingContentSchema().hasOwnProperty(tag) || tag === 'span'; |
10985 return getPhrasingContentSchema().hasOwnProperty(tag) || tag === 'span'; |
9794 } |
10986 } |
10987 function isTextContent(node) { |
|
10988 var tag = node.nodeName.toLowerCase(); |
|
10989 return textContentSchema.hasOwnProperty(tag) || tag === 'span'; |
|
10990 } |
|
9795 |
10991 |
9796 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/utils.js |
10992 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/utils.js |
9797 |
10993 |
9798 |
10994 |
10995 |
|
10996 function raw_handling_utils_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
|
10997 |
|
10998 function raw_handling_utils_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { raw_handling_utils_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { raw_handling_utils_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
9799 |
10999 |
9800 /** |
11000 /** |
9801 * External dependencies |
11001 * External dependencies |
9802 */ |
11002 */ |
9803 |
11003 |
9820 utils_ELEMENT_NODE = utils_window$Node.ELEMENT_NODE, |
11020 utils_ELEMENT_NODE = utils_window$Node.ELEMENT_NODE, |
9821 utils_TEXT_NODE = utils_window$Node.TEXT_NODE; |
11021 utils_TEXT_NODE = utils_window$Node.TEXT_NODE; |
9822 /** |
11022 /** |
9823 * Given raw transforms from blocks, merges all schemas into one. |
11023 * Given raw transforms from blocks, merges all schemas into one. |
9824 * |
11024 * |
9825 * @param {Array} transforms Block transforms, of the `raw` type. |
11025 * @param {Array} transforms Block transforms, of the `raw` type. |
11026 * @param {Object} phrasingContentSchema The phrasing content schema. |
|
11027 * @param {Object} isPaste Whether the context is pasting or not. |
|
9826 * |
11028 * |
9827 * @return {Object} A complete block content schema. |
11029 * @return {Object} A complete block content schema. |
9828 */ |
11030 */ |
9829 |
11031 |
9830 function getBlockContentSchema(transforms) { |
11032 function getBlockContentSchema(transforms, phrasingContentSchema, isPaste) { |
9831 var schemas = transforms.map(function (_ref) { |
11033 var schemas = transforms.map(function (_ref) { |
9832 var isMatch = _ref.isMatch, |
11034 var isMatch = _ref.isMatch, |
9833 blockName = _ref.blockName, |
11035 blockName = _ref.blockName, |
9834 schema = _ref.schema; |
11036 schema = _ref.schema; |
9835 var hasAnchorSupport = registration_hasBlockSupport(blockName, 'anchor'); // If the block does not has anchor support and the transform does not |
11037 var hasAnchorSupport = registration_hasBlockSupport(blockName, 'anchor'); |
11038 schema = Object(external_this_lodash_["isFunction"])(schema) ? schema({ |
|
11039 phrasingContentSchema: phrasingContentSchema, |
|
11040 isPaste: isPaste |
|
11041 }) : schema; // If the block does not has anchor support and the transform does not |
|
9836 // provides an isMatch we can return the schema right away. |
11042 // provides an isMatch we can return the schema right away. |
9837 |
11043 |
9838 if (!hasAnchorSupport && !isMatch) { |
11044 if (!hasAnchorSupport && !isMatch) { |
9839 return schema; |
11045 return schema; |
9840 } |
11046 } |
9841 |
11047 |
9842 return Object(external_lodash_["mapValues"])(schema, function (value) { |
11048 return Object(external_this_lodash_["mapValues"])(schema, function (value) { |
9843 var attributes = value.attributes || []; // If the block supports the "anchor" functionality, it needs to keep its ID attribute. |
11049 var attributes = value.attributes || []; // If the block supports the "anchor" functionality, it needs to keep its ID attribute. |
9844 |
11050 |
9845 if (hasAnchorSupport) { |
11051 if (hasAnchorSupport) { |
9846 attributes = [].concat(Object(toConsumableArray["a" /* default */])(attributes), ['id']); |
11052 attributes = [].concat(Object(toConsumableArray["a" /* default */])(attributes), ['id']); |
9847 } |
11053 } |
9848 |
11054 |
9849 return Object(objectSpread["a" /* default */])({}, value, { |
11055 return raw_handling_utils_objectSpread({}, value, { |
9850 attributes: attributes, |
11056 attributes: attributes, |
9851 isMatch: isMatch ? isMatch : undefined |
11057 isMatch: isMatch ? isMatch : undefined |
9852 }); |
11058 }); |
9853 }); |
11059 }); |
9854 }); |
11060 }); |
9855 return external_lodash_["mergeWith"].apply(void 0, [{}].concat(Object(toConsumableArray["a" /* default */])(schemas), [function (objValue, srcValue, key) { |
11061 return external_this_lodash_["mergeWith"].apply(void 0, [{}].concat(Object(toConsumableArray["a" /* default */])(schemas), [function (objValue, srcValue, key) { |
9856 switch (key) { |
11062 switch (key) { |
9857 case 'children': |
11063 case 'children': |
9858 { |
11064 { |
9859 if (objValue === '*' || srcValue === '*') { |
11065 if (objValue === '*' || srcValue === '*') { |
9860 return '*'; |
11066 return '*'; |
9861 } |
11067 } |
9862 |
11068 |
9863 return Object(objectSpread["a" /* default */])({}, objValue, srcValue); |
11069 return raw_handling_utils_objectSpread({}, objValue, {}, srcValue); |
9864 } |
11070 } |
9865 |
11071 |
9866 case 'attributes': |
11072 case 'attributes': |
9867 case 'require': |
11073 case 'require': |
9868 { |
11074 { |
10008 if (node.hasAttributes()) { |
11214 if (node.hasAttributes()) { |
10009 // Strip invalid attributes. |
11215 // Strip invalid attributes. |
10010 Array.from(node.attributes).forEach(function (_ref2) { |
11216 Array.from(node.attributes).forEach(function (_ref2) { |
10011 var name = _ref2.name; |
11217 var name = _ref2.name; |
10012 |
11218 |
10013 if (name !== 'class' && !Object(external_lodash_["includes"])(attributes, name)) { |
11219 if (name !== 'class' && !Object(external_this_lodash_["includes"])(attributes, name)) { |
10014 node.removeAttribute(name); |
11220 node.removeAttribute(name); |
10015 } |
11221 } |
10016 }); // Strip invalid classes. |
11222 }); // Strip invalid classes. |
10017 // In jsdom-jscore, 'node.classList' can be undefined. |
11223 // In jsdom-jscore, 'node.classList' can be undefined. |
10018 // TODO: Explore patching this in jsdom-jscore. |
11224 // TODO: Explore patching this in jsdom-jscore. |
10027 return function (className) { |
11233 return function (className) { |
10028 return item.test(className); |
11234 return item.test(className); |
10029 }; |
11235 }; |
10030 } |
11236 } |
10031 |
11237 |
10032 return external_lodash_["noop"]; |
11238 return external_this_lodash_["noop"]; |
10033 }); |
11239 }); |
10034 Array.from(node.classList).forEach(function (name) { |
11240 Array.from(node.classList).forEach(function (name) { |
10035 if (!mattchers.some(function (isMatch) { |
11241 if (!mattchers.some(function (isMatch) { |
10036 return isMatch(name); |
11242 return isMatch(name); |
10037 })) { |
11243 })) { |
10107 var doc = document.implementation.createHTMLDocument(''); |
11313 var doc = document.implementation.createHTMLDocument(''); |
10108 doc.body.innerHTML = HTML; |
11314 doc.body.innerHTML = HTML; |
10109 cleanNodeList(doc.body.childNodes, doc, schema, inline); |
11315 cleanNodeList(doc.body.childNodes, doc, schema, inline); |
10110 return doc.body.innerHTML; |
11316 return doc.body.innerHTML; |
10111 } |
11317 } |
11318 /** |
|
11319 * Gets a sibling within text-level context. |
|
11320 * |
|
11321 * @param {Element} node The subject node. |
|
11322 * @param {string} which "next" or "previous". |
|
11323 */ |
|
11324 |
|
11325 function getSibling(node, which) { |
|
11326 var sibling = node["".concat(which, "Sibling")]; |
|
11327 |
|
11328 if (sibling && isPhrasingContent(sibling)) { |
|
11329 return sibling; |
|
11330 } |
|
11331 |
|
11332 var parentNode = node.parentNode; |
|
11333 |
|
11334 if (!parentNode || !isPhrasingContent(parentNode)) { |
|
11335 return; |
|
11336 } |
|
11337 |
|
11338 return getSibling(parentNode, which); |
|
11339 } |
|
10112 |
11340 |
10113 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/normalise-blocks.js |
11341 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/normalise-blocks.js |
10114 /** |
11342 /** |
10115 * Internal dependencies |
11343 * Internal dependencies |
10116 */ |
11344 */ |
10121 */ |
11349 */ |
10122 |
11350 |
10123 var normalise_blocks_window$Node = window.Node, |
11351 var normalise_blocks_window$Node = window.Node, |
10124 normalise_blocks_ELEMENT_NODE = normalise_blocks_window$Node.ELEMENT_NODE, |
11352 normalise_blocks_ELEMENT_NODE = normalise_blocks_window$Node.ELEMENT_NODE, |
10125 normalise_blocks_TEXT_NODE = normalise_blocks_window$Node.TEXT_NODE; |
11353 normalise_blocks_TEXT_NODE = normalise_blocks_window$Node.TEXT_NODE; |
10126 /* harmony default export */ var normalise_blocks = (function (HTML) { |
11354 function normaliseBlocks(HTML) { |
10127 var decuDoc = document.implementation.createHTMLDocument(''); |
11355 var decuDoc = document.implementation.createHTMLDocument(''); |
10128 var accuDoc = document.implementation.createHTMLDocument(''); |
11356 var accuDoc = document.implementation.createHTMLDocument(''); |
10129 var decu = decuDoc.body; |
11357 var decu = decuDoc.body; |
10130 var accu = accuDoc.body; |
11358 var accu = accuDoc.body; |
10131 decu.innerHTML = HTML; |
11359 decu.innerHTML = HTML; |
10178 decu.removeChild(node); |
11406 decu.removeChild(node); |
10179 } |
11407 } |
10180 } |
11408 } |
10181 |
11409 |
10182 return accu.innerHTML; |
11410 return accu.innerHTML; |
10183 }); |
11411 } |
10184 |
11412 |
10185 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/special-comment-converter.js |
11413 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/special-comment-converter.js |
10186 /** |
11414 /** |
10187 * WordPress dependencies |
11415 * WordPress dependencies |
10188 */ |
11416 */ |
10207 * @param {Node} node The node to be processed. |
11435 * @param {Node} node The node to be processed. |
10208 * @param {Document} doc The document of the node. |
11436 * @param {Document} doc The document of the node. |
10209 * @return {void} |
11437 * @return {void} |
10210 */ |
11438 */ |
10211 |
11439 |
10212 /* harmony default export */ var special_comment_converter = (function (node, doc) { |
11440 function specialCommentConverter(node, doc) { |
10213 if (node.nodeType !== COMMENT_NODE) { |
11441 if (node.nodeType !== COMMENT_NODE) { |
10214 return; |
11442 return; |
10215 } |
11443 } |
10216 |
11444 |
10217 if (node.nodeValue === 'nextpage') { |
11445 if (node.nodeValue === 'nextpage') { |
10239 } |
11467 } |
10240 } |
11468 } |
10241 |
11469 |
10242 Object(external_this_wp_dom_["replace"])(node, createMore(customText, noTeaser, doc)); |
11470 Object(external_this_wp_dom_["replace"])(node, createMore(customText, noTeaser, doc)); |
10243 } |
11471 } |
10244 }); |
11472 } |
10245 |
11473 |
10246 function createMore(customText, noTeaser, doc) { |
11474 function createMore(customText, noTeaser, doc) { |
10247 var node = doc.createElement('wp-block'); |
11475 var node = doc.createElement('wp-block'); |
10248 node.dataset.block = 'core/more'; |
11476 node.dataset.block = 'core/more'; |
10249 |
11477 |
10263 var node = doc.createElement('wp-block'); |
11491 var node = doc.createElement('wp-block'); |
10264 node.dataset.block = 'core/nextpage'; |
11492 node.dataset.block = 'core/nextpage'; |
10265 return node; |
11493 return node; |
10266 } |
11494 } |
10267 |
11495 |
10268 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/list-reducer.js |
|
10269 |
|
10270 |
|
10271 /** |
|
10272 * WordPress dependencies |
|
10273 */ |
|
10274 |
|
10275 |
|
10276 function isList(node) { |
|
10277 return node.nodeName === 'OL' || node.nodeName === 'UL'; |
|
10278 } |
|
10279 |
|
10280 function shallowTextContent(element) { |
|
10281 return Object(toConsumableArray["a" /* default */])(element.childNodes).map(function (_ref) { |
|
10282 var _ref$nodeValue = _ref.nodeValue, |
|
10283 nodeValue = _ref$nodeValue === void 0 ? '' : _ref$nodeValue; |
|
10284 return nodeValue; |
|
10285 }).join(''); |
|
10286 } |
|
10287 |
|
10288 /* harmony default export */ var list_reducer = (function (node) { |
|
10289 if (!isList(node)) { |
|
10290 return; |
|
10291 } |
|
10292 |
|
10293 var list = node; |
|
10294 var prevElement = node.previousElementSibling; // Merge with previous list if: |
|
10295 // * There is a previous list of the same type. |
|
10296 // * There is only one list item. |
|
10297 |
|
10298 if (prevElement && prevElement.nodeName === node.nodeName && list.children.length === 1) { |
|
10299 // Move all child nodes, including any text nodes, if any. |
|
10300 while (list.firstChild) { |
|
10301 prevElement.appendChild(list.firstChild); |
|
10302 } |
|
10303 |
|
10304 list.parentNode.removeChild(list); |
|
10305 } |
|
10306 |
|
10307 var parentElement = node.parentNode; // Nested list with empty parent item. |
|
10308 |
|
10309 if (parentElement && parentElement.nodeName === 'LI' && parentElement.children.length === 1 && !/\S/.test(shallowTextContent(parentElement))) { |
|
10310 var parentListItem = parentElement; |
|
10311 var prevListItem = parentListItem.previousElementSibling; |
|
10312 var parentList = parentListItem.parentNode; |
|
10313 |
|
10314 if (prevListItem) { |
|
10315 prevListItem.appendChild(list); |
|
10316 parentList.removeChild(parentListItem); |
|
10317 } else { |
|
10318 parentList.parentNode.insertBefore(list, parentList); |
|
10319 parentList.parentNode.removeChild(parentList); |
|
10320 } |
|
10321 } // Invalid: OL/UL > OL/UL. |
|
10322 |
|
10323 |
|
10324 if (parentElement && isList(parentElement)) { |
|
10325 var _prevListItem = node.previousElementSibling; |
|
10326 |
|
10327 if (_prevListItem) { |
|
10328 _prevListItem.appendChild(node); |
|
10329 } else { |
|
10330 Object(external_this_wp_dom_["unwrap"])(node); |
|
10331 } |
|
10332 } |
|
10333 }); |
|
10334 |
|
10335 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/blockquote-normaliser.js |
|
10336 /** |
|
10337 * Internal dependencies |
|
10338 */ |
|
10339 |
|
10340 /* harmony default export */ var blockquote_normaliser = (function (node) { |
|
10341 if (node.nodeName !== 'BLOCKQUOTE') { |
|
10342 return; |
|
10343 } |
|
10344 |
|
10345 node.innerHTML = normalise_blocks(node.innerHTML); |
|
10346 }); |
|
10347 |
|
10348 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/figure-content-reducer.js |
|
10349 /** |
|
10350 * External dependencies |
|
10351 */ |
|
10352 |
|
10353 /** |
|
10354 * Internal dependencies |
|
10355 */ |
|
10356 |
|
10357 |
|
10358 /** |
|
10359 * Whether or not the given node is figure content. |
|
10360 * |
|
10361 * @param {Node} node The node to check. |
|
10362 * @param {Object} schema The schema to use. |
|
10363 * |
|
10364 * @return {boolean} True if figure content, false if not. |
|
10365 */ |
|
10366 |
|
10367 function isFigureContent(node, schema) { |
|
10368 var tag = node.nodeName.toLowerCase(); // We are looking for tags that can be a child of the figure tag, excluding |
|
10369 // `figcaption` and any phrasing content. |
|
10370 |
|
10371 if (tag === 'figcaption' || isPhrasingContent(node)) { |
|
10372 return false; |
|
10373 } |
|
10374 |
|
10375 return Object(external_lodash_["has"])(schema, ['figure', 'children', tag]); |
|
10376 } |
|
10377 /** |
|
10378 * Whether or not the given node can have an anchor. |
|
10379 * |
|
10380 * @param {Node} node The node to check. |
|
10381 * @param {Object} schema The schema to use. |
|
10382 * |
|
10383 * @return {boolean} True if it can, false if not. |
|
10384 */ |
|
10385 |
|
10386 |
|
10387 function canHaveAnchor(node, schema) { |
|
10388 var tag = node.nodeName.toLowerCase(); |
|
10389 return Object(external_lodash_["has"])(schema, ['figure', 'children', 'a', 'children', tag]); |
|
10390 } |
|
10391 /** |
|
10392 * This filter takes figure content out of paragraphs, wraps it in a figure |
|
10393 * element, and moves any anchors with it if needed. |
|
10394 * |
|
10395 * @param {Node} node The node to filter. |
|
10396 * @param {Document} doc The document of the node. |
|
10397 * @param {Object} schema The schema to use. |
|
10398 * |
|
10399 * @return {void} |
|
10400 */ |
|
10401 |
|
10402 |
|
10403 /* harmony default export */ var figure_content_reducer = (function (node, doc, schema) { |
|
10404 if (!isFigureContent(node, schema)) { |
|
10405 return; |
|
10406 } |
|
10407 |
|
10408 var nodeToInsert = node; |
|
10409 var parentNode = node.parentNode; // If the figure content can have an anchor and its parent is an anchor with |
|
10410 // only the figure content, take the anchor out instead of just the content. |
|
10411 |
|
10412 if (canHaveAnchor(node, schema) && parentNode.nodeName === 'A' && parentNode.childNodes.length === 1) { |
|
10413 nodeToInsert = node.parentNode; |
|
10414 } |
|
10415 |
|
10416 var wrapper = nodeToInsert; |
|
10417 |
|
10418 while (wrapper && wrapper.nodeName !== 'P') { |
|
10419 wrapper = wrapper.parentElement; |
|
10420 } |
|
10421 |
|
10422 var figure = doc.createElement('figure'); |
|
10423 |
|
10424 if (wrapper) { |
|
10425 wrapper.parentNode.insertBefore(figure, wrapper); |
|
10426 } else { |
|
10427 nodeToInsert.parentNode.insertBefore(figure, nodeToInsert); |
|
10428 } |
|
10429 |
|
10430 figure.appendChild(nodeToInsert); |
|
10431 }); |
|
10432 |
|
10433 // EXTERNAL MODULE: external {"this":["wp","shortcode"]} |
|
10434 var external_this_wp_shortcode_ = __webpack_require__(134); |
|
10435 |
|
10436 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/shortcode-converter.js |
|
10437 |
|
10438 |
|
10439 |
|
10440 /** |
|
10441 * External dependencies |
|
10442 */ |
|
10443 |
|
10444 /** |
|
10445 * WordPress dependencies |
|
10446 */ |
|
10447 |
|
10448 |
|
10449 /** |
|
10450 * Internal dependencies |
|
10451 */ |
|
10452 |
|
10453 |
|
10454 |
|
10455 |
|
10456 |
|
10457 function segmentHTMLToShortcodeBlock(HTML) { |
|
10458 var lastIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; |
|
10459 // Get all matches. |
|
10460 var transformsFrom = getBlockTransforms('from'); |
|
10461 var transformation = findTransform(transformsFrom, function (transform) { |
|
10462 return transform.type === 'shortcode' && Object(external_lodash_["some"])(Object(external_lodash_["castArray"])(transform.tag), function (tag) { |
|
10463 return Object(external_this_wp_shortcode_["regexp"])(tag).test(HTML); |
|
10464 }); |
|
10465 }); |
|
10466 |
|
10467 if (!transformation) { |
|
10468 return [HTML]; |
|
10469 } |
|
10470 |
|
10471 var transformTags = Object(external_lodash_["castArray"])(transformation.tag); |
|
10472 var transformTag = Object(external_lodash_["first"])(transformTags); |
|
10473 var match; |
|
10474 |
|
10475 if (match = Object(external_this_wp_shortcode_["next"])(transformTag, HTML, lastIndex)) { |
|
10476 var beforeHTML = HTML.substr(0, match.index); |
|
10477 lastIndex = match.index + match.content.length; // If the shortcode content does not contain HTML and the shortcode is |
|
10478 // not on a new line (or in paragraph from Markdown converter), |
|
10479 // consider the shortcode as inline text, and thus skip conversion for |
|
10480 // this segment. |
|
10481 |
|
10482 if (!Object(external_lodash_["includes"])(match.shortcode.content || '', '<') && !/(\n|<p>)\s*$/.test(beforeHTML)) { |
|
10483 return segmentHTMLToShortcodeBlock(HTML, lastIndex); |
|
10484 } |
|
10485 |
|
10486 var attributes = Object(external_lodash_["mapValues"])(Object(external_lodash_["pickBy"])(transformation.attributes, function (schema) { |
|
10487 return schema.shortcode; |
|
10488 }), // Passing all of `match` as second argument is intentionally broad |
|
10489 // but shouldn't be too relied upon. |
|
10490 // |
|
10491 // See: https://github.com/WordPress/gutenberg/pull/3610#discussion_r152546926 |
|
10492 function (schema) { |
|
10493 return schema.shortcode(match.shortcode.attrs, match); |
|
10494 }); |
|
10495 var block = createBlock(transformation.blockName, getBlockAttributes(Object(objectSpread["a" /* default */])({}, registration_getBlockType(transformation.blockName), { |
|
10496 attributes: transformation.attributes |
|
10497 }), match.shortcode.content, attributes)); |
|
10498 return [beforeHTML, block].concat(Object(toConsumableArray["a" /* default */])(segmentHTMLToShortcodeBlock(HTML.substr(lastIndex)))); |
|
10499 } |
|
10500 |
|
10501 return [HTML]; |
|
10502 } |
|
10503 |
|
10504 /* harmony default export */ var shortcode_converter = (segmentHTMLToShortcodeBlock); |
|
10505 |
|
10506 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/comment-remover.js |
11496 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/comment-remover.js |
10507 /** |
11497 /** |
10508 * WordPress dependencies |
11498 * WordPress dependencies |
10509 */ |
11499 */ |
10510 |
11500 |
10518 * |
11508 * |
10519 * @param {Node} node The node to be processed. |
11509 * @param {Node} node The node to be processed. |
10520 * @return {void} |
11510 * @return {void} |
10521 */ |
11511 */ |
10522 |
11512 |
10523 /* harmony default export */ var comment_remover = (function (node) { |
11513 function commentRemover(node) { |
10524 if (node.nodeType === comment_remover_COMMENT_NODE) { |
11514 if (node.nodeType === comment_remover_COMMENT_NODE) { |
10525 Object(external_this_wp_dom_["remove"])(node); |
11515 Object(external_this_wp_dom_["remove"])(node); |
10526 } |
11516 } |
10527 }); |
11517 } |
10528 |
11518 |
10529 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/is-inline-content.js |
11519 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/is-inline-content.js |
10530 /** |
11520 /** |
10531 * External dependencies |
11521 * External dependencies |
10532 */ |
11522 */ |
10545 * |
11535 * |
10546 * @return {boolean} True if the node is inline content, false if nohe. |
11536 * @return {boolean} True if the node is inline content, false if nohe. |
10547 */ |
11537 */ |
10548 |
11538 |
10549 function isInline(node, contextTag) { |
11539 function isInline(node, contextTag) { |
10550 if (isPhrasingContent(node)) { |
11540 if (isTextContent(node)) { |
10551 return true; |
11541 return true; |
10552 } |
11542 } |
10553 |
11543 |
10554 if (!contextTag) { |
11544 if (!contextTag) { |
10555 return false; |
11545 return false; |
10556 } |
11546 } |
10557 |
11547 |
10558 var tag = node.nodeName.toLowerCase(); |
11548 var tag = node.nodeName.toLowerCase(); |
10559 var inlineWhitelistTagGroups = [['ul', 'li', 'ol'], ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']]; |
11549 var inlineWhitelistTagGroups = [['ul', 'li', 'ol'], ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']]; |
10560 return inlineWhitelistTagGroups.some(function (tagGroup) { |
11550 return inlineWhitelistTagGroups.some(function (tagGroup) { |
10561 return Object(external_lodash_["difference"])([tag, contextTag], tagGroup).length === 0; |
11551 return Object(external_this_lodash_["difference"])([tag, contextTag], tagGroup).length === 0; |
10562 }); |
11552 }); |
10563 } |
11553 } |
10564 |
11554 |
10565 function deepCheck(nodes, contextTag) { |
11555 function deepCheck(nodes, contextTag) { |
10566 return nodes.every(function (node) { |
11556 return nodes.every(function (node) { |
10570 |
11560 |
10571 function isDoubleBR(node) { |
11561 function isDoubleBR(node) { |
10572 return node.nodeName === 'BR' && node.previousSibling && node.previousSibling.nodeName === 'BR'; |
11562 return node.nodeName === 'BR' && node.previousSibling && node.previousSibling.nodeName === 'BR'; |
10573 } |
11563 } |
10574 |
11564 |
10575 /* harmony default export */ var is_inline_content = (function (HTML, contextTag) { |
11565 function isInlineContent(HTML, contextTag) { |
10576 var doc = document.implementation.createHTMLDocument(''); |
11566 var doc = document.implementation.createHTMLDocument(''); |
10577 doc.body.innerHTML = HTML; |
11567 doc.body.innerHTML = HTML; |
10578 var nodes = Array.from(doc.body.children); |
11568 var nodes = Array.from(doc.body.children); |
10579 return !nodes.some(isDoubleBR) && deepCheck(nodes, contextTag); |
11569 return !nodes.some(isDoubleBR) && deepCheck(nodes, contextTag); |
10580 }); |
11570 } |
10581 |
11571 |
10582 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/phrasing-content-reducer.js |
11572 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/phrasing-content-reducer.js |
10583 /** |
11573 /** |
11574 * External dependencies |
|
11575 */ |
|
11576 |
|
11577 /** |
|
10584 * WordPress dependencies |
11578 * WordPress dependencies |
10585 */ |
11579 */ |
10586 |
11580 |
10587 /* harmony default export */ var phrasing_content_reducer = (function (node, doc) { |
11581 |
11582 function phrasingContentReducer(node, doc) { |
|
10588 // In jsdom-jscore, 'node.style' can be null. |
11583 // In jsdom-jscore, 'node.style' can be null. |
10589 // TODO: Explore fixing this by patching jsdom-jscore. |
11584 // TODO: Explore fixing this by patching jsdom-jscore. |
10590 if (node.nodeName === 'SPAN' && node.style) { |
11585 if (node.nodeName === 'SPAN' && node.style) { |
10591 var _node$style = node.style, |
11586 var _node$style = node.style, |
10592 fontWeight = _node$style.fontWeight, |
11587 fontWeight = _node$style.fontWeight, |
10593 fontStyle = _node$style.fontStyle, |
11588 fontStyle = _node$style.fontStyle, |
10594 textDecorationLine = _node$style.textDecorationLine, |
11589 textDecorationLine = _node$style.textDecorationLine, |
11590 textDecoration = _node$style.textDecoration, |
|
10595 verticalAlign = _node$style.verticalAlign; |
11591 verticalAlign = _node$style.verticalAlign; |
10596 |
11592 |
10597 if (fontWeight === 'bold' || fontWeight === '700') { |
11593 if (fontWeight === 'bold' || fontWeight === '700') { |
10598 Object(external_this_wp_dom_["wrap"])(doc.createElement('strong'), node); |
11594 Object(external_this_wp_dom_["wrap"])(doc.createElement('strong'), node); |
10599 } |
11595 } |
10600 |
11596 |
10601 if (fontStyle === 'italic') { |
11597 if (fontStyle === 'italic') { |
10602 Object(external_this_wp_dom_["wrap"])(doc.createElement('em'), node); |
11598 Object(external_this_wp_dom_["wrap"])(doc.createElement('em'), node); |
10603 } |
11599 } // Some DOM implementations (Safari, JSDom) don't support |
10604 |
11600 // style.textDecorationLine, so we check style.textDecoration as a |
10605 if (textDecorationLine === 'line-through') { |
11601 // fallback. |
11602 |
|
11603 |
|
11604 if (textDecorationLine === 'line-through' || Object(external_this_lodash_["includes"])(textDecoration, 'line-through')) { |
|
10606 Object(external_this_wp_dom_["wrap"])(doc.createElement('s'), node); |
11605 Object(external_this_wp_dom_["wrap"])(doc.createElement('s'), node); |
10607 } |
11606 } |
10608 |
11607 |
10609 if (verticalAlign === 'super') { |
11608 if (verticalAlign === 'super') { |
10610 Object(external_this_wp_dom_["wrap"])(doc.createElement('sup'), node); |
11609 Object(external_this_wp_dom_["wrap"])(doc.createElement('sup'), node); |
10623 } else { |
11622 } else { |
10624 node.removeAttribute('target'); |
11623 node.removeAttribute('target'); |
10625 node.removeAttribute('rel'); |
11624 node.removeAttribute('rel'); |
10626 } |
11625 } |
10627 } |
11626 } |
10628 }); |
11627 } |
10629 |
11628 |
10630 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/head-remover.js |
11629 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/head-remover.js |
10631 /* harmony default export */ var head_remover = (function (node) { |
11630 function headRemover(node) { |
10632 if (node.nodeName !== 'SCRIPT' && node.nodeName !== 'NOSCRIPT' && node.nodeName !== 'TEMPLATE' && node.nodeName !== 'STYLE') { |
11631 if (node.nodeName !== 'SCRIPT' && node.nodeName !== 'NOSCRIPT' && node.nodeName !== 'TEMPLATE' && node.nodeName !== 'STYLE') { |
10633 return; |
11632 return; |
10634 } |
11633 } |
10635 |
11634 |
10636 node.parentNode.removeChild(node); |
11635 node.parentNode.removeChild(node); |
10637 }); |
11636 } |
10638 |
11637 |
10639 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/ms-list-converter.js |
11638 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/ms-list-converter.js |
10640 /** |
11639 /** |
10641 * Browser dependencies |
11640 * Browser dependencies |
10642 */ |
11641 */ |
10643 var _window = window, |
11642 var _window = window, |
10644 ms_list_converter_parseInt = _window.parseInt; |
11643 ms_list_converter_parseInt = _window.parseInt; |
10645 |
11644 |
10646 function ms_list_converter_isList(node) { |
11645 function isList(node) { |
10647 return node.nodeName === 'OL' || node.nodeName === 'UL'; |
11646 return node.nodeName === 'OL' || node.nodeName === 'UL'; |
10648 } |
11647 } |
10649 |
11648 |
10650 /* harmony default export */ var ms_list_converter = (function (node, doc) { |
11649 function msListConverter(node, doc) { |
10651 if (node.nodeName !== 'P') { |
11650 if (node.nodeName !== 'P') { |
10652 return; |
11651 return; |
10653 } |
11652 } |
10654 |
11653 |
10655 var style = node.getAttribute('style'); |
11654 var style = node.getAttribute('style'); |
10670 } |
11669 } |
10671 |
11670 |
10672 var level = ms_list_converter_parseInt(matches[1], 10) - 1 || 0; |
11671 var level = ms_list_converter_parseInt(matches[1], 10) - 1 || 0; |
10673 var prevNode = node.previousElementSibling; // Add new list if no previous. |
11672 var prevNode = node.previousElementSibling; // Add new list if no previous. |
10674 |
11673 |
10675 if (!prevNode || !ms_list_converter_isList(prevNode)) { |
11674 if (!prevNode || !isList(prevNode)) { |
10676 // See https://html.spec.whatwg.org/multipage/grouping-content.html#attr-ol-type. |
11675 // See https://html.spec.whatwg.org/multipage/grouping-content.html#attr-ol-type. |
10677 var type = node.textContent.trim().slice(0, 1); |
11676 var type = node.textContent.trim().slice(0, 1); |
10678 var isNumeric = /[1iIaA]/.test(type); |
11677 var isNumeric = /[1iIaA]/.test(type); |
10679 var newListNode = doc.createElement(isNumeric ? 'ol' : 'ul'); |
11678 var newListNode = doc.createElement(isNumeric ? 'ol' : 'ul'); |
10680 |
11679 |
10698 |
11697 |
10699 |
11698 |
10700 while (level--) { |
11699 while (level--) { |
10701 receivingNode = receivingNode.lastElementChild || receivingNode; // If it's a list, move pointer to the last item. |
11700 receivingNode = receivingNode.lastElementChild || receivingNode; // If it's a list, move pointer to the last item. |
10702 |
11701 |
10703 if (ms_list_converter_isList(receivingNode)) { |
11702 if (isList(receivingNode)) { |
10704 receivingNode = receivingNode.lastElementChild || receivingNode; |
11703 receivingNode = receivingNode.lastElementChild || receivingNode; |
10705 } |
11704 } |
10706 } // Make sure we append to a list. |
11705 } // Make sure we append to a list. |
10707 |
11706 |
10708 |
11707 |
10709 if (!ms_list_converter_isList(receivingNode)) { |
11708 if (!isList(receivingNode)) { |
10710 receivingNode = receivingNode.appendChild(doc.createElement(listType)); |
11709 receivingNode = receivingNode.appendChild(doc.createElement(listType)); |
10711 } // Append the list item to the list. |
11710 } // Append the list item to the list. |
10712 |
11711 |
10713 |
11712 |
10714 receivingNode.appendChild(listItem); // Remove the wrapper paragraph. |
11713 receivingNode.appendChild(listItem); // Remove the wrapper paragraph. |
10715 |
11714 |
10716 node.parentNode.removeChild(node); |
11715 node.parentNode.removeChild(node); |
10717 }); |
11716 } |
11717 |
|
11718 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/list-reducer.js |
|
11719 /** |
|
11720 * WordPress dependencies |
|
11721 */ |
|
11722 |
|
11723 |
|
11724 function list_reducer_isList(node) { |
|
11725 return node.nodeName === 'OL' || node.nodeName === 'UL'; |
|
11726 } |
|
11727 |
|
11728 function shallowTextContent(element) { |
|
11729 return Array.from(element.childNodes).map(function (_ref) { |
|
11730 var _ref$nodeValue = _ref.nodeValue, |
|
11731 nodeValue = _ref$nodeValue === void 0 ? '' : _ref$nodeValue; |
|
11732 return nodeValue; |
|
11733 }).join(''); |
|
11734 } |
|
11735 |
|
11736 function listReducer(node) { |
|
11737 if (!list_reducer_isList(node)) { |
|
11738 return; |
|
11739 } |
|
11740 |
|
11741 var list = node; |
|
11742 var prevElement = node.previousElementSibling; // Merge with previous list if: |
|
11743 // * There is a previous list of the same type. |
|
11744 // * There is only one list item. |
|
11745 |
|
11746 if (prevElement && prevElement.nodeName === node.nodeName && list.children.length === 1) { |
|
11747 // Move all child nodes, including any text nodes, if any. |
|
11748 while (list.firstChild) { |
|
11749 prevElement.appendChild(list.firstChild); |
|
11750 } |
|
11751 |
|
11752 list.parentNode.removeChild(list); |
|
11753 } |
|
11754 |
|
11755 var parentElement = node.parentNode; // Nested list with empty parent item. |
|
11756 |
|
11757 if (parentElement && parentElement.nodeName === 'LI' && parentElement.children.length === 1 && !/\S/.test(shallowTextContent(parentElement))) { |
|
11758 var parentListItem = parentElement; |
|
11759 var prevListItem = parentListItem.previousElementSibling; |
|
11760 var parentList = parentListItem.parentNode; |
|
11761 |
|
11762 if (prevListItem) { |
|
11763 prevListItem.appendChild(list); |
|
11764 parentList.removeChild(parentListItem); |
|
11765 } else { |
|
11766 parentList.parentNode.insertBefore(list, parentList); |
|
11767 parentList.parentNode.removeChild(parentList); |
|
11768 } |
|
11769 } // Invalid: OL/UL > OL/UL. |
|
11770 |
|
11771 |
|
11772 if (parentElement && list_reducer_isList(parentElement)) { |
|
11773 var _prevListItem = node.previousElementSibling; |
|
11774 |
|
11775 if (_prevListItem) { |
|
11776 _prevListItem.appendChild(node); |
|
11777 } else { |
|
11778 Object(external_this_wp_dom_["unwrap"])(node); |
|
11779 } |
|
11780 } |
|
11781 } |
|
10718 |
11782 |
10719 // EXTERNAL MODULE: external {"this":["wp","blob"]} |
11783 // EXTERNAL MODULE: external {"this":["wp","blob"]} |
10720 var external_this_wp_blob_ = __webpack_require__(35); |
11784 var external_this_wp_blob_ = __webpack_require__(44); |
10721 |
11785 |
10722 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/image-corrector.js |
11786 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/image-corrector.js |
10723 |
11787 |
10724 |
11788 |
10725 /** |
11789 /** |
10731 */ |
11795 */ |
10732 |
11796 |
10733 var image_corrector_window = window, |
11797 var image_corrector_window = window, |
10734 atob = image_corrector_window.atob, |
11798 atob = image_corrector_window.atob, |
10735 File = image_corrector_window.File; |
11799 File = image_corrector_window.File; |
10736 /* harmony default export */ var image_corrector = (function (node) { |
11800 function imageCorrector(node) { |
10737 if (node.nodeName !== 'IMG') { |
11801 if (node.nodeName !== 'IMG') { |
10738 return; |
11802 return; |
10739 } |
11803 } |
10740 |
11804 |
10741 if (node.src.indexOf('file:') === 0) { |
11805 if (node.src.indexOf('file:') === 0) { |
10782 |
11846 |
10783 |
11847 |
10784 if (node.height === 1 || node.width === 1) { |
11848 if (node.height === 1 || node.width === 1) { |
10785 node.parentNode.removeChild(node); |
11849 node.parentNode.removeChild(node); |
10786 } |
11850 } |
10787 }); |
11851 } |
11852 |
|
11853 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/blockquote-normaliser.js |
|
11854 /** |
|
11855 * Internal dependencies |
|
11856 */ |
|
11857 |
|
11858 function blockquoteNormaliser(node) { |
|
11859 if (node.nodeName !== 'BLOCKQUOTE') { |
|
11860 return; |
|
11861 } |
|
11862 |
|
11863 node.innerHTML = normaliseBlocks(node.innerHTML); |
|
11864 } |
|
11865 |
|
11866 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/figure-content-reducer.js |
|
11867 /** |
|
11868 * External dependencies |
|
11869 */ |
|
11870 |
|
11871 /** |
|
11872 * Internal dependencies |
|
11873 */ |
|
11874 |
|
11875 |
|
11876 /** |
|
11877 * Whether or not the given node is figure content. |
|
11878 * |
|
11879 * @param {Node} node The node to check. |
|
11880 * @param {Object} schema The schema to use. |
|
11881 * |
|
11882 * @return {boolean} True if figure content, false if not. |
|
11883 */ |
|
11884 |
|
11885 function isFigureContent(node, schema) { |
|
11886 var tag = node.nodeName.toLowerCase(); // We are looking for tags that can be a child of the figure tag, excluding |
|
11887 // `figcaption` and any phrasing content. |
|
11888 |
|
11889 if (tag === 'figcaption' || isTextContent(node)) { |
|
11890 return false; |
|
11891 } |
|
11892 |
|
11893 return Object(external_this_lodash_["has"])(schema, ['figure', 'children', tag]); |
|
11894 } |
|
11895 /** |
|
11896 * Whether or not the given node can have an anchor. |
|
11897 * |
|
11898 * @param {Node} node The node to check. |
|
11899 * @param {Object} schema The schema to use. |
|
11900 * |
|
11901 * @return {boolean} True if it can, false if not. |
|
11902 */ |
|
11903 |
|
11904 |
|
11905 function canHaveAnchor(node, schema) { |
|
11906 var tag = node.nodeName.toLowerCase(); |
|
11907 return Object(external_this_lodash_["has"])(schema, ['figure', 'children', 'a', 'children', tag]); |
|
11908 } |
|
11909 /** |
|
11910 * Wraps the given element in a figure element. |
|
11911 * |
|
11912 * @param {Element} element The element to wrap. |
|
11913 * @param {Element} beforeElement The element before which to place the figure. |
|
11914 */ |
|
11915 |
|
11916 |
|
11917 function wrapFigureContent(element) { |
|
11918 var beforeElement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : element; |
|
11919 var figure = element.ownerDocument.createElement('figure'); |
|
11920 beforeElement.parentNode.insertBefore(figure, beforeElement); |
|
11921 figure.appendChild(element); |
|
11922 } |
|
11923 /** |
|
11924 * This filter takes figure content out of paragraphs, wraps it in a figure |
|
11925 * element, and moves any anchors with it if needed. |
|
11926 * |
|
11927 * @param {Node} node The node to filter. |
|
11928 * @param {Document} doc The document of the node. |
|
11929 * @param {Object} schema The schema to use. |
|
11930 * |
|
11931 * @return {void} |
|
11932 */ |
|
11933 |
|
11934 |
|
11935 function figureContentReducer(node, doc, schema) { |
|
11936 if (!isFigureContent(node, schema)) { |
|
11937 return; |
|
11938 } |
|
11939 |
|
11940 var nodeToInsert = node; |
|
11941 var parentNode = node.parentNode; // If the figure content can have an anchor and its parent is an anchor with |
|
11942 // only the figure content, take the anchor out instead of just the content. |
|
11943 |
|
11944 if (canHaveAnchor(node, schema) && parentNode.nodeName === 'A' && parentNode.childNodes.length === 1) { |
|
11945 nodeToInsert = node.parentNode; |
|
11946 } |
|
11947 |
|
11948 var wrapper = nodeToInsert.closest('p,div'); // If wrapped in a paragraph or div, only extract if it's aligned or if |
|
11949 // there is no text content. |
|
11950 // Otherwise, if directly at the root, wrap in a figure element. |
|
11951 |
|
11952 if (wrapper) { |
|
11953 // In jsdom-jscore, 'node.classList' can be undefined. |
|
11954 // In this case, default to extract as it offers a better UI experience on mobile. |
|
11955 if (!node.classList) { |
|
11956 wrapFigureContent(nodeToInsert, wrapper); |
|
11957 } else if (node.classList.contains('alignright') || node.classList.contains('alignleft') || node.classList.contains('aligncenter') || !wrapper.textContent.trim()) { |
|
11958 wrapFigureContent(nodeToInsert, wrapper); |
|
11959 } |
|
11960 } else if (nodeToInsert.parentNode.nodeName === 'BODY') { |
|
11961 wrapFigureContent(nodeToInsert); |
|
11962 } |
|
11963 } |
|
11964 |
|
11965 // EXTERNAL MODULE: external {"this":["wp","shortcode"]} |
|
11966 var external_this_wp_shortcode_ = __webpack_require__(125); |
|
11967 |
|
11968 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/shortcode-converter.js |
|
11969 |
|
11970 |
|
11971 |
|
11972 function shortcode_converter_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
|
11973 |
|
11974 function shortcode_converter_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { shortcode_converter_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { shortcode_converter_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
11975 |
|
11976 /** |
|
11977 * External dependencies |
|
11978 */ |
|
11979 |
|
11980 /** |
|
11981 * WordPress dependencies |
|
11982 */ |
|
11983 |
|
11984 |
|
11985 /** |
|
11986 * Internal dependencies |
|
11987 */ |
|
11988 |
|
11989 |
|
11990 |
|
11991 |
|
11992 |
|
11993 function segmentHTMLToShortcodeBlock(HTML) { |
|
11994 var lastIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; |
|
11995 var excludedBlockNames = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; |
|
11996 // Get all matches. |
|
11997 var transformsFrom = getBlockTransforms('from'); |
|
11998 var transformation = findTransform(transformsFrom, function (transform) { |
|
11999 return excludedBlockNames.indexOf(transform.blockName) === -1 && transform.type === 'shortcode' && Object(external_this_lodash_["some"])(Object(external_this_lodash_["castArray"])(transform.tag), function (tag) { |
|
12000 return Object(external_this_wp_shortcode_["regexp"])(tag).test(HTML); |
|
12001 }); |
|
12002 }); |
|
12003 |
|
12004 if (!transformation) { |
|
12005 return [HTML]; |
|
12006 } |
|
12007 |
|
12008 var transformTags = Object(external_this_lodash_["castArray"])(transformation.tag); |
|
12009 var transformTag = Object(external_this_lodash_["find"])(transformTags, function (tag) { |
|
12010 return Object(external_this_wp_shortcode_["regexp"])(tag).test(HTML); |
|
12011 }); |
|
12012 var match; |
|
12013 var previousIndex = lastIndex; |
|
12014 |
|
12015 if (match = Object(external_this_wp_shortcode_["next"])(transformTag, HTML, lastIndex)) { |
|
12016 lastIndex = match.index + match.content.length; |
|
12017 var beforeHTML = HTML.substr(0, match.index); |
|
12018 var afterHTML = HTML.substr(lastIndex); // If the shortcode content does not contain HTML and the shortcode is |
|
12019 // not on a new line (or in paragraph from Markdown converter), |
|
12020 // consider the shortcode as inline text, and thus skip conversion for |
|
12021 // this segment. |
|
12022 |
|
12023 if (!Object(external_this_lodash_["includes"])(match.shortcode.content || '', '<') && !(/(\n|<p>)\s*$/.test(beforeHTML) && /^\s*(\n|<\/p>)/.test(afterHTML))) { |
|
12024 return segmentHTMLToShortcodeBlock(HTML, lastIndex); |
|
12025 } // If a transformation's `isMatch` predicate fails for the inbound |
|
12026 // shortcode, try again by excluding the current block type. |
|
12027 // |
|
12028 // This is the only call to `segmentHTMLToShortcodeBlock` that should |
|
12029 // ever carry over `excludedBlockNames`. Other calls in the module |
|
12030 // should skip that argument as a way to reset the exclusion state, so |
|
12031 // that one `isMatch` fail in an HTML fragment doesn't prevent any |
|
12032 // valid matches in subsequent fragments. |
|
12033 |
|
12034 |
|
12035 if (transformation.isMatch && !transformation.isMatch(match.shortcode.attrs)) { |
|
12036 return segmentHTMLToShortcodeBlock(HTML, previousIndex, [].concat(Object(toConsumableArray["a" /* default */])(excludedBlockNames), [transformation.blockName])); |
|
12037 } |
|
12038 |
|
12039 var attributes = Object(external_this_lodash_["mapValues"])(Object(external_this_lodash_["pickBy"])(transformation.attributes, function (schema) { |
|
12040 return schema.shortcode; |
|
12041 }), // Passing all of `match` as second argument is intentionally broad |
|
12042 // but shouldn't be too relied upon. |
|
12043 // |
|
12044 // See: https://github.com/WordPress/gutenberg/pull/3610#discussion_r152546926 |
|
12045 function (schema) { |
|
12046 return schema.shortcode(match.shortcode.attrs, match); |
|
12047 }); |
|
12048 var block = createBlock(transformation.blockName, getBlockAttributes(shortcode_converter_objectSpread({}, registration_getBlockType(transformation.blockName), { |
|
12049 attributes: transformation.attributes |
|
12050 }), match.shortcode.content, attributes)); |
|
12051 return [beforeHTML, block].concat(Object(toConsumableArray["a" /* default */])(segmentHTMLToShortcodeBlock(HTML.substr(lastIndex)))); |
|
12052 } |
|
12053 |
|
12054 return [HTML]; |
|
12055 } |
|
12056 |
|
12057 /* harmony default export */ var shortcode_converter = (segmentHTMLToShortcodeBlock); |
|
10788 |
12058 |
10789 // EXTERNAL MODULE: ./node_modules/showdown/dist/showdown.js |
12059 // EXTERNAL MODULE: ./node_modules/showdown/dist/showdown.js |
10790 var showdown = __webpack_require__(206); |
12060 var showdown = __webpack_require__(269); |
10791 var showdown_default = /*#__PURE__*/__webpack_require__.n(showdown); |
12061 var showdown_default = /*#__PURE__*/__webpack_require__.n(showdown); |
10792 |
12062 |
10793 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/markdown-converter.js |
12063 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/markdown-converter.js |
10794 /** |
12064 /** |
10795 * External dependencies |
12065 * External dependencies |
10828 * |
12098 * |
10829 * @return {string} HTML. |
12099 * @return {string} HTML. |
10830 */ |
12100 */ |
10831 |
12101 |
10832 |
12102 |
10833 /* harmony default export */ var markdown_converter = (function (text) { |
12103 function markdownConverter(text) { |
10834 return converter.makeHtml(slackMarkdownVariantCorrector(text)); |
12104 return converter.makeHtml(slackMarkdownVariantCorrector(text)); |
10835 }); |
12105 } |
10836 |
12106 |
10837 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/iframe-remover.js |
12107 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/iframe-remover.js |
10838 /** |
12108 /** |
12109 * Removes iframes. |
|
12110 * |
|
12111 * @param {Node} node The node to check. |
|
12112 * |
|
12113 * @return {void} |
|
12114 */ |
|
12115 function iframeRemover(node) { |
|
12116 if (node.nodeName === 'IFRAME') { |
|
12117 var text = node.ownerDocument.createTextNode(node.src); |
|
12118 node.parentNode.replaceChild(text, node); |
|
12119 } |
|
12120 } |
|
12121 |
|
12122 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/google-docs-uid-remover.js |
|
12123 /** |
|
10839 * WordPress dependencies |
12124 * WordPress dependencies |
10840 */ |
12125 */ |
10841 |
12126 |
10842 /** |
12127 function googleDocsUIdRemover(node) { |
10843 * Removes iframes. |
|
10844 * |
|
10845 * @param {Node} node The node to check. |
|
10846 * |
|
10847 * @return {void} |
|
10848 */ |
|
10849 |
|
10850 /* harmony default export */ var iframe_remover = (function (node) { |
|
10851 if (node.nodeName === 'IFRAME') { |
|
10852 Object(external_this_wp_dom_["remove"])(node); |
|
10853 } |
|
10854 }); |
|
10855 |
|
10856 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/google-docs-uid-remover.js |
|
10857 /** |
|
10858 * WordPress dependencies |
|
10859 */ |
|
10860 |
|
10861 /* harmony default export */ var google_docs_uid_remover = (function (node) { |
|
10862 if (!node.id || node.id.indexOf('docs-internal-guid-') !== 0) { |
12128 if (!node.id || node.id.indexOf('docs-internal-guid-') !== 0) { |
10863 return; |
12129 return; |
10864 } |
12130 } |
10865 |
12131 |
10866 Object(external_this_wp_dom_["unwrap"])(node); |
12132 Object(external_this_wp_dom_["unwrap"])(node); |
10867 }); |
12133 } |
12134 |
|
12135 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/html-formatting-remover.js |
|
12136 /** |
|
12137 * Internal dependencies |
|
12138 */ |
|
12139 |
|
12140 |
|
12141 function isFormattingSpace(character) { |
|
12142 return character === ' ' || character === '\r' || character === '\n' || character === '\t'; |
|
12143 } |
|
12144 /** |
|
12145 * Removes spacing that formats HTML. |
|
12146 * |
|
12147 * @see https://www.w3.org/TR/css-text-3/#white-space-processing |
|
12148 * |
|
12149 * @param {Node} node The node to be processed. |
|
12150 * @return {void} |
|
12151 */ |
|
12152 |
|
12153 |
|
12154 function htmlFormattingRemover(node) { |
|
12155 if (node.nodeType !== node.TEXT_NODE) { |
|
12156 return; |
|
12157 } // Ignore pre content. Note that this does not use Element#closest due to |
|
12158 // a combination of (a) node may not be Element and (b) node.parentElement |
|
12159 // does not have full support in all browsers (Internet Exporer). |
|
12160 // |
|
12161 // See: https://developer.mozilla.org/en-US/docs/Web/API/Node/parentElement#Browser_compatibility |
|
12162 |
|
12163 /** @type {Node?} */ |
|
12164 |
|
12165 |
|
12166 var parent = node; |
|
12167 |
|
12168 while (parent = parent.parentNode) { |
|
12169 if (parent.nodeType === window.Node.ELEMENT_NODE && parent.nodeName === 'PRE') { |
|
12170 return; |
|
12171 } |
|
12172 } // First, replace any sequence of HTML formatting space with a single space. |
|
12173 |
|
12174 |
|
12175 var newData = node.data.replace(/[ \r\n\t]+/g, ' '); // Remove the leading space if the text element is at the start of a block, |
|
12176 // is preceded by a line break element, or has a space in the previous |
|
12177 // node. |
|
12178 |
|
12179 if (newData[0] === ' ') { |
|
12180 var previousSibling = getSibling(node, 'previous'); |
|
12181 |
|
12182 if (!previousSibling || previousSibling.nodeName === 'BR' || previousSibling.textContent.slice(-1) === ' ') { |
|
12183 newData = newData.slice(1); |
|
12184 } |
|
12185 } // Remove the trailing space if the text element is at the end of a block, |
|
12186 // is succeded by a line break element, or has a space in the next text |
|
12187 // node. |
|
12188 |
|
12189 |
|
12190 if (newData[newData.length - 1] === ' ') { |
|
12191 var nextSibling = getSibling(node, 'next'); |
|
12192 |
|
12193 if (!nextSibling || nextSibling.nodeName === 'BR' || nextSibling.nodeType === nextSibling.TEXT_NODE && isFormattingSpace(nextSibling.textContent[0])) { |
|
12194 newData = newData.slice(0, -1); |
|
12195 } |
|
12196 } // If there's no data left, remove the node, so `previousSibling` stays |
|
12197 // accurate. Otherwise, update the node data. |
|
12198 |
|
12199 |
|
12200 if (!newData) { |
|
12201 node.parentNode.removeChild(node); |
|
12202 } else { |
|
12203 node.data = newData; |
|
12204 } |
|
12205 } |
|
12206 |
|
12207 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/br-remover.js |
|
12208 /** |
|
12209 * Internal dependencies |
|
12210 */ |
|
12211 |
|
12212 /** |
|
12213 * Removes trailing br elements from text-level content. |
|
12214 * |
|
12215 * @param {Element} node Node to check. |
|
12216 */ |
|
12217 |
|
12218 function brRemover(node) { |
|
12219 if (node.nodeName !== 'BR') { |
|
12220 return; |
|
12221 } |
|
12222 |
|
12223 if (getSibling(node, 'next')) { |
|
12224 return; |
|
12225 } |
|
12226 |
|
12227 node.parentNode.removeChild(node); |
|
12228 } |
|
12229 |
|
12230 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/empty-paragraph-remover.js |
|
12231 /** |
|
12232 * Removes empty paragraph elements. |
|
12233 * |
|
12234 * @param {Element} node Node to check. |
|
12235 */ |
|
12236 function emptyParagraphRemover(node) { |
|
12237 if (node.nodeName !== 'P') { |
|
12238 return; |
|
12239 } |
|
12240 |
|
12241 if (node.hasChildNodes()) { |
|
12242 return; |
|
12243 } |
|
12244 |
|
12245 node.parentNode.removeChild(node); |
|
12246 } |
|
10868 |
12247 |
10869 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/paste-handler.js |
12248 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/paste-handler.js |
10870 |
12249 |
10871 |
12250 |
12251 function paste_handler_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
|
12252 |
|
12253 function paste_handler_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { paste_handler_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { paste_handler_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
12254 |
|
10872 /** |
12255 /** |
10873 * External dependencies |
12256 * External dependencies |
10874 */ |
12257 */ |
10875 |
12258 |
10876 /** |
12259 /** |
10877 * Internal dependencies |
12260 * Internal dependencies |
10878 */ |
12261 */ |
12262 |
|
12263 |
|
12264 |
|
12265 |
|
10879 |
12266 |
10880 |
12267 |
10881 |
12268 |
10882 |
12269 |
10883 |
12270 |
10910 * |
12297 * |
10911 * @return {string} HTML only containing phrasing content. |
12298 * @return {string} HTML only containing phrasing content. |
10912 */ |
12299 */ |
10913 |
12300 |
10914 function filterInlineHTML(HTML) { |
12301 function filterInlineHTML(HTML) { |
10915 HTML = deepFilterHTML(HTML, [google_docs_uid_remover, phrasing_content_reducer, comment_remover]); |
12302 HTML = deepFilterHTML(HTML, [googleDocsUIdRemover, phrasingContentReducer, commentRemover]); |
10916 HTML = removeInvalidHTML(HTML, getPhrasingContentSchema(), { |
12303 HTML = removeInvalidHTML(HTML, getPhrasingContentSchema('paste'), { |
10917 inline: true |
12304 inline: true |
10918 }); // Allows us to ask for this information when we get a report. |
12305 }); |
12306 HTML = deepFilterHTML(HTML, [htmlFormattingRemover, brRemover]); // Allows us to ask for this information when we get a report. |
|
10919 |
12307 |
10920 paste_handler_console.log('Processed inline HTML:\n\n', HTML); |
12308 paste_handler_console.log('Processed inline HTML:\n\n', HTML); |
10921 return HTML; |
12309 return HTML; |
10922 } |
12310 } |
10923 |
12311 |
10924 function getRawTransformations() { |
12312 function getRawTransformations() { |
10925 return Object(external_lodash_["filter"])(getBlockTransforms('from'), { |
12313 return Object(external_this_lodash_["filter"])(getBlockTransforms('from'), { |
10926 type: 'raw' |
12314 type: 'raw' |
10927 }).map(function (transform) { |
12315 }).map(function (transform) { |
10928 return transform.isMatch ? transform : Object(objectSpread["a" /* default */])({}, transform, { |
12316 return transform.isMatch ? transform : paste_handler_objectSpread({}, transform, { |
10929 isMatch: function isMatch(node) { |
12317 isMatch: function isMatch(node) { |
10930 return transform.selector && node.matches(transform.selector); |
12318 return transform.selector && node.matches(transform.selector); |
10931 } |
12319 } |
10932 }); |
12320 }); |
10933 }); |
12321 }); |
10972 }); |
12360 }); |
10973 } |
12361 } |
10974 /** |
12362 /** |
10975 * Converts an HTML string to known blocks. Strips everything else. |
12363 * Converts an HTML string to known blocks. Strips everything else. |
10976 * |
12364 * |
10977 * @param {string} [options.HTML] The HTML to convert. |
12365 * @param {Object} options |
10978 * @param {string} [options.plainText] Plain text version. |
12366 * @param {string} [options.HTML] The HTML to convert. |
10979 * @param {string} [options.mode] Handle content as blocks or inline content. |
12367 * @param {string} [options.plainText] Plain text version. |
10980 * * 'AUTO': Decide based on the content passed. |
12368 * @param {string} [options.mode] Handle content as blocks or inline content. |
10981 * * 'INLINE': Always handle as inline content, and return string. |
12369 * * 'AUTO': Decide based on the content passed. |
10982 * * 'BLOCKS': Always handle as blocks, and return array of blocks. |
12370 * * 'INLINE': Always handle as inline content, and return string. |
10983 * @param {Array} [options.tagName] The tag into which content will be inserted. |
12371 * * 'BLOCKS': Always handle as blocks, and return array of blocks. |
10984 * @param {boolean} [options.canUserUseUnfilteredHTML] Whether or not the user can use unfiltered HTML. |
12372 * @param {Array} [options.tagName] The tag into which content will be inserted. |
10985 * |
12373 * |
10986 * @return {Array|string} A list of blocks or a string, depending on `handlerMode`. |
12374 * @return {Array|string} A list of blocks or a string, depending on `handlerMode`. |
10987 */ |
12375 */ |
10988 |
12376 |
10989 |
12377 |
10992 HTML = _ref3$HTML === void 0 ? '' : _ref3$HTML, |
12380 HTML = _ref3$HTML === void 0 ? '' : _ref3$HTML, |
10993 _ref3$plainText = _ref3.plainText, |
12381 _ref3$plainText = _ref3.plainText, |
10994 plainText = _ref3$plainText === void 0 ? '' : _ref3$plainText, |
12382 plainText = _ref3$plainText === void 0 ? '' : _ref3$plainText, |
10995 _ref3$mode = _ref3.mode, |
12383 _ref3$mode = _ref3.mode, |
10996 mode = _ref3$mode === void 0 ? 'AUTO' : _ref3$mode, |
12384 mode = _ref3$mode === void 0 ? 'AUTO' : _ref3$mode, |
10997 tagName = _ref3.tagName, |
12385 tagName = _ref3.tagName; |
10998 _ref3$canUserUseUnfil = _ref3.canUserUseUnfilteredHTML, |
|
10999 canUserUseUnfilteredHTML = _ref3$canUserUseUnfil === void 0 ? false : _ref3$canUserUseUnfil; |
|
11000 // First of all, strip any meta tags. |
12386 // First of all, strip any meta tags. |
11001 HTML = HTML.replace(/<meta[^>]+>/, ''); // If we detect block delimiters in HTML, parse entirely as blocks. |
12387 HTML = HTML.replace(/<meta[^>]+>/g, ''); // Strip Windows markers. |
12388 |
|
12389 HTML = HTML.replace(/^\s*<html[^>]*>\s*<body[^>]*>(?:\s*<!--\s*StartFragment\s*-->)?/i, ''); |
|
12390 HTML = HTML.replace(/(?:<!--\s*EndFragment\s*-->\s*)?<\/body>\s*<\/html>\s*$/i, ''); // If we detect block delimiters in HTML, parse entirely as blocks. |
|
11002 |
12391 |
11003 if (mode !== 'INLINE') { |
12392 if (mode !== 'INLINE') { |
11004 // Check plain text if there is no HTML. |
12393 // Check plain text if there is no HTML. |
11005 var content = HTML ? HTML : plainText; |
12394 var content = HTML ? HTML : plainText; |
11006 |
12395 |
11022 // * There is a plain text version. |
12411 // * There is a plain text version. |
11023 // * There is no HTML version, or it has no formatting. |
12412 // * There is no HTML version, or it has no formatting. |
11024 |
12413 |
11025 |
12414 |
11026 if (plainText && (!HTML || isPlain(HTML))) { |
12415 if (plainText && (!HTML || isPlain(HTML))) { |
11027 HTML = markdown_converter(plainText); // Switch to inline mode if: |
12416 HTML = markdownConverter(plainText); // Switch to inline mode if: |
11028 // * The current mode is AUTO. |
12417 // * The current mode is AUTO. |
11029 // * The original plain text had no line breaks. |
12418 // * The original plain text had no line breaks. |
11030 // * The original plain text was not an HTML paragraph. |
12419 // * The original plain text was not an HTML paragraph. |
11031 // * The converted text is just a paragraph. |
12420 // * The converted text is just a paragraph. |
11032 |
12421 |
11045 // if shortcodes are matched. The reason is when shortcodes are matched |
12434 // if shortcodes are matched. The reason is when shortcodes are matched |
11046 // empty HTML strings are included. |
12435 // empty HTML strings are included. |
11047 |
12436 |
11048 var hasShortcodes = pieces.length > 1; |
12437 var hasShortcodes = pieces.length > 1; |
11049 |
12438 |
11050 if (mode === 'AUTO' && !hasShortcodes && is_inline_content(HTML, tagName)) { |
12439 if (mode === 'AUTO' && !hasShortcodes && isInlineContent(HTML, tagName)) { |
11051 return filterInlineHTML(HTML); |
12440 return filterInlineHTML(HTML); |
11052 } |
12441 } |
11053 |
12442 |
11054 var rawTransforms = getRawTransformations(); |
12443 var rawTransforms = getRawTransformations(); |
11055 var phrasingContentSchema = getPhrasingContentSchema(); |
12444 var phrasingContentSchema = getPhrasingContentSchema('paste'); |
11056 var blockContentSchema = getBlockContentSchema(rawTransforms); |
12445 var blockContentSchema = getBlockContentSchema(rawTransforms, phrasingContentSchema, true); |
11057 var blocks = Object(external_lodash_["compact"])(Object(external_lodash_["flatMap"])(pieces, function (piece) { |
12446 var blocks = Object(external_this_lodash_["compact"])(Object(external_this_lodash_["flatMap"])(pieces, function (piece) { |
11058 // Already a block from shortcode. |
12447 // Already a block from shortcode. |
11059 if (typeof piece !== 'string') { |
12448 if (typeof piece !== 'string') { |
11060 return piece; |
12449 return piece; |
11061 } |
12450 } |
11062 |
12451 |
11063 var filters = [google_docs_uid_remover, ms_list_converter, head_remover, list_reducer, image_corrector, phrasing_content_reducer, special_comment_converter, comment_remover, figure_content_reducer, blockquote_normaliser]; |
12452 var filters = [googleDocsUIdRemover, msListConverter, headRemover, listReducer, imageCorrector, phrasingContentReducer, specialCommentConverter, commentRemover, iframeRemover, figureContentReducer, blockquoteNormaliser]; |
11064 |
12453 |
11065 if (!canUserUseUnfilteredHTML) { |
12454 var schema = paste_handler_objectSpread({}, blockContentSchema, {}, phrasingContentSchema); |
11066 // Should run before `figureContentReducer`. |
|
11067 filters.unshift(iframe_remover); |
|
11068 } |
|
11069 |
|
11070 var schema = Object(objectSpread["a" /* default */])({}, blockContentSchema, phrasingContentSchema); |
|
11071 |
12455 |
11072 piece = deepFilterHTML(piece, filters, blockContentSchema); |
12456 piece = deepFilterHTML(piece, filters, blockContentSchema); |
11073 piece = removeInvalidHTML(piece, schema); |
12457 piece = removeInvalidHTML(piece, schema); |
11074 piece = normalise_blocks(piece); // Allows us to ask for this information when we get a report. |
12458 piece = normaliseBlocks(piece); |
12459 piece = deepFilterHTML(piece, [htmlFormattingRemover, brRemover, emptyParagraphRemover], blockContentSchema); // Allows us to ask for this information when we get a report. |
|
11075 |
12460 |
11076 paste_handler_console.log('Processed HTML piece:\n\n', piece); |
12461 paste_handler_console.log('Processed HTML piece:\n\n', piece); |
11077 return htmlToBlocks({ |
12462 return htmlToBlocks({ |
11078 html: piece, |
12463 html: piece, |
11079 rawTransforms: rawTransforms |
12464 rawTransforms: rawTransforms |
11080 }); |
12465 }); |
11081 })); // If we're allowed to return inline content and there is only one block |
12466 })); // If we're allowed to return inline content, and there is only one inlineable block, |
11082 // and the original plain text content does not have any line breaks, then |
12467 // and the original plain text content does not have any line breaks, then |
11083 // treat it as inline paste. |
12468 // treat it as inline paste. |
11084 |
12469 |
11085 if (mode === 'AUTO' && blocks.length === 1) { |
12470 if (mode === 'AUTO' && blocks.length === 1 && registration_hasBlockSupport(blocks[0].name, '__unstablePasteTextInline', false)) { |
11086 var trimmedPlainText = plainText.trim(); |
12471 var trimmedPlainText = plainText.trim(); |
11087 |
12472 |
11088 if (trimmedPlainText !== '' && trimmedPlainText.indexOf('\n') === -1) { |
12473 if (trimmedPlainText !== '' && trimmedPlainText.indexOf('\n') === -1) { |
11089 return removeInvalidHTML(getBlockContent(blocks[0]), phrasingContentSchema); |
12474 return removeInvalidHTML(getBlockContent(blocks[0]), phrasingContentSchema); |
11090 } |
12475 } |
11094 } |
12479 } |
11095 |
12480 |
11096 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/index.js |
12481 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/index.js |
11097 |
12482 |
11098 |
12483 |
12484 function raw_handling_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
|
12485 |
|
12486 function raw_handling_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { raw_handling_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { raw_handling_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
12487 |
|
11099 /** |
12488 /** |
11100 * External dependencies |
12489 * External dependencies |
11101 */ |
12490 */ |
11102 |
12491 |
11103 /** |
12492 /** |
11114 |
12503 |
11115 |
12504 |
11116 |
12505 |
11117 |
12506 |
11118 |
12507 |
12508 |
|
11119 function raw_handling_getRawTransformations() { |
12509 function raw_handling_getRawTransformations() { |
11120 return Object(external_lodash_["filter"])(getBlockTransforms('from'), { |
12510 return Object(external_this_lodash_["filter"])(getBlockTransforms('from'), { |
11121 type: 'raw' |
12511 type: 'raw' |
11122 }).map(function (transform) { |
12512 }).map(function (transform) { |
11123 return transform.isMatch ? transform : Object(objectSpread["a" /* default */])({}, transform, { |
12513 return transform.isMatch ? transform : raw_handling_objectSpread({}, transform, { |
11124 isMatch: function isMatch(node) { |
12514 isMatch: function isMatch(node) { |
11125 return transform.selector && node.matches(transform.selector); |
12515 return transform.selector && node.matches(transform.selector); |
11126 } |
12516 } |
11127 }); |
12517 }); |
11128 }); |
12518 }); |
11167 }); |
12557 }); |
11168 } |
12558 } |
11169 /** |
12559 /** |
11170 * Converts an HTML string to known blocks. |
12560 * Converts an HTML string to known blocks. |
11171 * |
12561 * |
12562 * @param {Object} $1 |
|
11172 * @param {string} $1.HTML The HTML to convert. |
12563 * @param {string} $1.HTML The HTML to convert. |
11173 * |
12564 * |
11174 * @return {Array} A list of blocks. |
12565 * @return {Array} A list of blocks. |
11175 */ |
12566 */ |
11176 |
12567 |
11186 // shortcodes. |
12577 // shortcodes. |
11187 |
12578 |
11188 |
12579 |
11189 var pieces = shortcode_converter(HTML); |
12580 var pieces = shortcode_converter(HTML); |
11190 var rawTransforms = raw_handling_getRawTransformations(); |
12581 var rawTransforms = raw_handling_getRawTransformations(); |
11191 var blockContentSchema = getBlockContentSchema(rawTransforms); |
12582 var phrasingContentSchema = getPhrasingContentSchema(); |
11192 return Object(external_lodash_["compact"])(Object(external_lodash_["flatMap"])(pieces, function (piece) { |
12583 var blockContentSchema = getBlockContentSchema(rawTransforms, phrasingContentSchema); |
12584 return Object(external_this_lodash_["compact"])(Object(external_this_lodash_["flatMap"])(pieces, function (piece) { |
|
11193 // Already a block from shortcode. |
12585 // Already a block from shortcode. |
11194 if (typeof piece !== 'string') { |
12586 if (typeof piece !== 'string') { |
11195 return piece; |
12587 return piece; |
11196 } // These filters are essential for some blocks to be able to transform |
12588 } // These filters are essential for some blocks to be able to transform |
11197 // from raw HTML. These filters move around some content or add |
12589 // from raw HTML. These filters move around some content or add |
11198 // additional tags, they do not remove any content. |
12590 // additional tags, they do not remove any content. |
11199 |
12591 |
11200 |
12592 |
11201 var filters = [// Needed to adjust invalid lists. |
12593 var filters = [// Needed to adjust invalid lists. |
11202 list_reducer, // Needed to create more and nextpage blocks. |
12594 listReducer, // Needed to create more and nextpage blocks. |
11203 special_comment_converter, // Needed to create media blocks. |
12595 specialCommentConverter, // Needed to create media blocks. |
11204 figure_content_reducer, // Needed to create the quote block, which cannot handle text |
12596 figureContentReducer, // Needed to create the quote block, which cannot handle text |
11205 // without wrapper paragraphs. |
12597 // without wrapper paragraphs. |
11206 blockquote_normaliser]; |
12598 blockquoteNormaliser]; |
11207 piece = deepFilterHTML(piece, filters, blockContentSchema); |
12599 piece = deepFilterHTML(piece, filters, blockContentSchema); |
11208 piece = normalise_blocks(piece); |
12600 piece = normaliseBlocks(piece); |
11209 return raw_handling_htmlToBlocks({ |
12601 return raw_handling_htmlToBlocks({ |
11210 html: piece, |
12602 html: piece, |
11211 rawTransforms: rawTransforms |
12603 rawTransforms: rawTransforms |
11212 }); |
12604 }); |
11213 })); |
12605 })); |
11216 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/categories.js |
12608 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/categories.js |
11217 /** |
12609 /** |
11218 * WordPress dependencies |
12610 * WordPress dependencies |
11219 */ |
12611 */ |
11220 |
12612 |
12613 /** @typedef {import('../store/reducer').WPBlockCategory} WPBlockCategory */ |
|
12614 |
|
11221 /** |
12615 /** |
11222 * Returns all the block categories. |
12616 * Returns all the block categories. |
11223 * |
12617 * |
11224 * @return {Object[]} Block categories. |
12618 * @return {WPBlockCategory[]} Block categories. |
11225 */ |
12619 */ |
11226 |
12620 |
11227 function categories_getCategories() { |
12621 function categories_getCategories() { |
11228 return Object(external_this_wp_data_["select"])('core/blocks').getCategories(); |
12622 return Object(external_this_wp_data_["select"])('core/blocks').getCategories(); |
11229 } |
12623 } |
11230 /** |
12624 /** |
11231 * Sets the block categories. |
12625 * Sets the block categories. |
11232 * |
12626 * |
11233 * @param {Object[]} categories Block categories. |
12627 * @param {WPBlockCategory[]} categories Block categories. |
11234 */ |
12628 */ |
11235 |
12629 |
11236 function categories_setCategories(categories) { |
12630 function categories_setCategories(categories) { |
11237 Object(external_this_wp_data_["dispatch"])('core/blocks').setCategories(categories); |
12631 Object(external_this_wp_data_["dispatch"])('core/blocks').setCategories(categories); |
11238 } |
12632 } |
11239 /** |
12633 /** |
11240 * Updates a category. |
12634 * Updates a category. |
11241 * |
12635 * |
11242 * @param {string} slug Block category slug. |
12636 * @param {string} slug Block category slug. |
11243 * @param {Object} category Object containing the category properties that should be updated. |
12637 * @param {WPBlockCategory} category Object containing the category properties |
12638 * that should be updated. |
|
11244 */ |
12639 */ |
11245 |
12640 |
11246 function categories_updateCategory(slug, category) { |
12641 function categories_updateCategory(slug, category) { |
11247 Object(external_this_wp_data_["dispatch"])('core/blocks').updateCategory(slug, category); |
12642 Object(external_this_wp_data_["dispatch"])('core/blocks').updateCategory(slug, category); |
11248 } |
12643 } |
11249 |
12644 |
11250 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/templates.js |
12645 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/templates.js |
11251 |
12646 |
11252 |
12647 |
12648 |
|
12649 function templates_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
|
12650 |
|
12651 function templates_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { templates_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { templates_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
11253 |
12652 |
11254 /** |
12653 /** |
11255 * External dependencies |
12654 * External dependencies |
11256 */ |
12655 */ |
11257 |
12656 |
11276 */ |
12675 */ |
11277 |
12676 |
11278 function doBlocksMatchTemplate() { |
12677 function doBlocksMatchTemplate() { |
11279 var blocks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; |
12678 var blocks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; |
11280 var template = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; |
12679 var template = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; |
11281 return blocks.length === template.length && Object(external_lodash_["every"])(template, function (_ref, index) { |
12680 return blocks.length === template.length && Object(external_this_lodash_["every"])(template, function (_ref, index) { |
11282 var _ref2 = Object(slicedToArray["a" /* default */])(_ref, 3), |
12681 var _ref2 = Object(slicedToArray["a" /* default */])(_ref, 3), |
11283 name = _ref2[0], |
12682 name = _ref2[0], |
11284 innerBlocksTemplate = _ref2[2]; |
12683 innerBlocksTemplate = _ref2[2]; |
11285 |
12684 |
11286 var block = blocks[index]; |
12685 var block = blocks[index]; |
11308 // If no template is provided, return blocks unmodified. |
12707 // If no template is provided, return blocks unmodified. |
11309 if (!template) { |
12708 if (!template) { |
11310 return blocks; |
12709 return blocks; |
11311 } |
12710 } |
11312 |
12711 |
11313 return Object(external_lodash_["map"])(template, function (_ref3, index) { |
12712 return Object(external_this_lodash_["map"])(template, function (_ref3, index) { |
11314 var _ref4 = Object(slicedToArray["a" /* default */])(_ref3, 3), |
12713 var _ref4 = Object(slicedToArray["a" /* default */])(_ref3, 3), |
11315 name = _ref4[0], |
12714 name = _ref4[0], |
11316 attributes = _ref4[1], |
12715 attributes = _ref4[1], |
11317 innerBlocksTemplate = _ref4[2]; |
12716 innerBlocksTemplate = _ref4[2]; |
11318 |
12717 |
11319 var block = blocks[index]; |
12718 var block = blocks[index]; |
11320 |
12719 |
11321 if (block && block.name === name) { |
12720 if (block && block.name === name) { |
11322 var innerBlocks = synchronizeBlocksWithTemplate(block.innerBlocks, innerBlocksTemplate); |
12721 var innerBlocks = synchronizeBlocksWithTemplate(block.innerBlocks, innerBlocksTemplate); |
11323 return Object(objectSpread["a" /* default */])({}, block, { |
12722 return templates_objectSpread({}, block, { |
11324 innerBlocks: innerBlocks |
12723 innerBlocks: innerBlocks |
11325 }); |
12724 }); |
11326 } // To support old templates that were using the "children" format |
12725 } // To support old templates that were using the "children" format |
11327 // for the attributes using "html" strings now, we normalize the template attributes |
12726 // for the attributes using "html" strings now, we normalize the template attributes |
11328 // before creating the blocks. |
12727 // before creating the blocks. |
11329 |
12728 |
11330 |
12729 |
11331 var blockType = registration_getBlockType(name); |
12730 var blockType = registration_getBlockType(name); |
11332 |
12731 |
11333 var isHTMLAttribute = function isHTMLAttribute(attributeDefinition) { |
12732 var isHTMLAttribute = function isHTMLAttribute(attributeDefinition) { |
11334 return Object(external_lodash_["get"])(attributeDefinition, ['source']) === 'html'; |
12733 return Object(external_this_lodash_["get"])(attributeDefinition, ['source']) === 'html'; |
11335 }; |
12734 }; |
11336 |
12735 |
11337 var isQueryAttribute = function isQueryAttribute(attributeDefinition) { |
12736 var isQueryAttribute = function isQueryAttribute(attributeDefinition) { |
11338 return Object(external_lodash_["get"])(attributeDefinition, ['source']) === 'query'; |
12737 return Object(external_this_lodash_["get"])(attributeDefinition, ['source']) === 'query'; |
11339 }; |
12738 }; |
11340 |
12739 |
11341 var normalizeAttributes = function normalizeAttributes(schema, values) { |
12740 var normalizeAttributes = function normalizeAttributes(schema, values) { |
11342 return Object(external_lodash_["mapValues"])(values, function (value, key) { |
12741 return Object(external_this_lodash_["mapValues"])(values, function (value, key) { |
11343 return normalizeAttribute(schema[key], value); |
12742 return normalizeAttribute(schema[key], value); |
11344 }); |
12743 }); |
11345 }; |
12744 }; |
11346 |
12745 |
11347 var normalizeAttribute = function normalizeAttribute(definition, value) { |
12746 var normalizeAttribute = function normalizeAttribute(definition, value) { |
11348 if (isHTMLAttribute(definition) && Object(external_lodash_["isArray"])(value)) { |
12747 if (isHTMLAttribute(definition) && Object(external_this_lodash_["isArray"])(value)) { |
11349 // Introduce a deprecated call at this point |
12748 // Introduce a deprecated call at this point |
11350 // When we're confident that "children" format should be removed from the templates. |
12749 // When we're confident that "children" format should be removed from the templates. |
11351 return Object(external_this_wp_element_["renderToString"])(value); |
12750 return Object(external_this_wp_element_["renderToString"])(value); |
11352 } |
12751 } |
11353 |
12752 |
11358 } |
12757 } |
11359 |
12758 |
11360 return value; |
12759 return value; |
11361 }; |
12760 }; |
11362 |
12761 |
11363 var normalizedAttributes = normalizeAttributes(Object(external_lodash_["get"])(blockType, ['attributes'], {}), attributes); |
12762 var normalizedAttributes = normalizeAttributes(Object(external_this_lodash_["get"])(blockType, ['attributes'], {}), attributes); |
11364 return createBlock(name, normalizedAttributes, synchronizeBlocksWithTemplate([], innerBlocksTemplate)); |
12763 return createBlock(name, normalizedAttributes, synchronizeBlocksWithTemplate([], innerBlocksTemplate)); |
11365 }); |
12764 }); |
11366 } |
12765 } |
11367 |
12766 |
11368 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/index.js |
12767 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/index.js |
11377 |
12776 |
11378 |
12777 |
11379 |
12778 |
11380 |
12779 |
11381 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/index.js |
12780 // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/index.js |
11382 /* concated harmony reexport createBlock */__webpack_require__.d(__webpack_exports__, "createBlock", function() { return createBlock; }); |
|
11383 /* concated harmony reexport cloneBlock */__webpack_require__.d(__webpack_exports__, "cloneBlock", function() { return cloneBlock; }); |
|
11384 /* concated harmony reexport getPossibleBlockTransformations */__webpack_require__.d(__webpack_exports__, "getPossibleBlockTransformations", function() { return getPossibleBlockTransformations; }); |
|
11385 /* concated harmony reexport switchToBlockType */__webpack_require__.d(__webpack_exports__, "switchToBlockType", function() { return switchToBlockType; }); |
|
11386 /* concated harmony reexport getBlockTransforms */__webpack_require__.d(__webpack_exports__, "getBlockTransforms", function() { return getBlockTransforms; }); |
|
11387 /* concated harmony reexport findTransform */__webpack_require__.d(__webpack_exports__, "findTransform", function() { return findTransform; }); |
|
11388 /* concated harmony reexport parse */__webpack_require__.d(__webpack_exports__, "parse", function() { return parser; }); |
|
11389 /* concated harmony reexport getBlockAttributes */__webpack_require__.d(__webpack_exports__, "getBlockAttributes", function() { return getBlockAttributes; }); |
|
11390 /* concated harmony reexport parseWithAttributeSchema */__webpack_require__.d(__webpack_exports__, "parseWithAttributeSchema", function() { return parseWithAttributeSchema; }); |
|
11391 /* concated harmony reexport pasteHandler */__webpack_require__.d(__webpack_exports__, "pasteHandler", function() { return pasteHandler; }); |
|
11392 /* concated harmony reexport rawHandler */__webpack_require__.d(__webpack_exports__, "rawHandler", function() { return rawHandler; }); |
|
11393 /* concated harmony reexport getPhrasingContentSchema */__webpack_require__.d(__webpack_exports__, "getPhrasingContentSchema", function() { return getPhrasingContentSchema; }); |
|
11394 /* concated harmony reexport serialize */__webpack_require__.d(__webpack_exports__, "serialize", function() { return serialize; }); |
|
11395 /* concated harmony reexport getBlockContent */__webpack_require__.d(__webpack_exports__, "getBlockContent", function() { return getBlockContent; }); |
|
11396 /* concated harmony reexport getBlockDefaultClassName */__webpack_require__.d(__webpack_exports__, "getBlockDefaultClassName", function() { return getBlockDefaultClassName; }); |
|
11397 /* concated harmony reexport getBlockMenuDefaultClassName */__webpack_require__.d(__webpack_exports__, "getBlockMenuDefaultClassName", function() { return getBlockMenuDefaultClassName; }); |
|
11398 /* concated harmony reexport getSaveElement */__webpack_require__.d(__webpack_exports__, "getSaveElement", function() { return getSaveElement; }); |
|
11399 /* concated harmony reexport getSaveContent */__webpack_require__.d(__webpack_exports__, "getSaveContent", function() { return getSaveContent; }); |
|
11400 /* concated harmony reexport isValidBlockContent */__webpack_require__.d(__webpack_exports__, "isValidBlockContent", function() { return isValidBlockContent; }); |
|
11401 /* concated harmony reexport getCategories */__webpack_require__.d(__webpack_exports__, "getCategories", function() { return categories_getCategories; }); |
|
11402 /* concated harmony reexport setCategories */__webpack_require__.d(__webpack_exports__, "setCategories", function() { return categories_setCategories; }); |
|
11403 /* concated harmony reexport updateCategory */__webpack_require__.d(__webpack_exports__, "updateCategory", function() { return categories_updateCategory; }); |
|
11404 /* concated harmony reexport registerBlockType */__webpack_require__.d(__webpack_exports__, "registerBlockType", function() { return registerBlockType; }); |
|
11405 /* concated harmony reexport unregisterBlockType */__webpack_require__.d(__webpack_exports__, "unregisterBlockType", function() { return unregisterBlockType; }); |
|
11406 /* concated harmony reexport setFreeformContentHandlerName */__webpack_require__.d(__webpack_exports__, "setFreeformContentHandlerName", function() { return setFreeformContentHandlerName; }); |
|
11407 /* concated harmony reexport getFreeformContentHandlerName */__webpack_require__.d(__webpack_exports__, "getFreeformContentHandlerName", function() { return getFreeformContentHandlerName; }); |
|
11408 /* concated harmony reexport setUnregisteredTypeHandlerName */__webpack_require__.d(__webpack_exports__, "setUnregisteredTypeHandlerName", function() { return setUnregisteredTypeHandlerName; }); |
|
11409 /* concated harmony reexport getUnregisteredTypeHandlerName */__webpack_require__.d(__webpack_exports__, "getUnregisteredTypeHandlerName", function() { return getUnregisteredTypeHandlerName; }); |
|
11410 /* concated harmony reexport setDefaultBlockName */__webpack_require__.d(__webpack_exports__, "setDefaultBlockName", function() { return registration_setDefaultBlockName; }); |
|
11411 /* concated harmony reexport getDefaultBlockName */__webpack_require__.d(__webpack_exports__, "getDefaultBlockName", function() { return registration_getDefaultBlockName; }); |
|
11412 /* concated harmony reexport getBlockType */__webpack_require__.d(__webpack_exports__, "getBlockType", function() { return registration_getBlockType; }); |
|
11413 /* concated harmony reexport getBlockTypes */__webpack_require__.d(__webpack_exports__, "getBlockTypes", function() { return registration_getBlockTypes; }); |
|
11414 /* concated harmony reexport getBlockSupport */__webpack_require__.d(__webpack_exports__, "getBlockSupport", function() { return registration_getBlockSupport; }); |
|
11415 /* concated harmony reexport hasBlockSupport */__webpack_require__.d(__webpack_exports__, "hasBlockSupport", function() { return registration_hasBlockSupport; }); |
|
11416 /* concated harmony reexport isReusableBlock */__webpack_require__.d(__webpack_exports__, "isReusableBlock", function() { return isReusableBlock; }); |
|
11417 /* concated harmony reexport getChildBlockNames */__webpack_require__.d(__webpack_exports__, "getChildBlockNames", function() { return registration_getChildBlockNames; }); |
|
11418 /* concated harmony reexport hasChildBlocks */__webpack_require__.d(__webpack_exports__, "hasChildBlocks", function() { return registration_hasChildBlocks; }); |
|
11419 /* concated harmony reexport hasChildBlocksWithInserterSupport */__webpack_require__.d(__webpack_exports__, "hasChildBlocksWithInserterSupport", function() { return registration_hasChildBlocksWithInserterSupport; }); |
|
11420 /* concated harmony reexport unstable__bootstrapServerSideBlockDefinitions */__webpack_require__.d(__webpack_exports__, "unstable__bootstrapServerSideBlockDefinitions", function() { return unstable__bootstrapServerSideBlockDefinitions; }); |
|
11421 /* concated harmony reexport registerBlockStyle */__webpack_require__.d(__webpack_exports__, "registerBlockStyle", function() { return registration_registerBlockStyle; }); |
|
11422 /* concated harmony reexport unregisterBlockStyle */__webpack_require__.d(__webpack_exports__, "unregisterBlockStyle", function() { return registration_unregisterBlockStyle; }); |
|
11423 /* concated harmony reexport isUnmodifiedDefaultBlock */__webpack_require__.d(__webpack_exports__, "isUnmodifiedDefaultBlock", function() { return isUnmodifiedDefaultBlock; }); |
|
11424 /* concated harmony reexport normalizeIconObject */__webpack_require__.d(__webpack_exports__, "normalizeIconObject", function() { return normalizeIconObject; }); |
|
11425 /* concated harmony reexport isValidIcon */__webpack_require__.d(__webpack_exports__, "isValidIcon", function() { return isValidIcon; }); |
|
11426 /* concated harmony reexport doBlocksMatchTemplate */__webpack_require__.d(__webpack_exports__, "doBlocksMatchTemplate", function() { return doBlocksMatchTemplate; }); |
|
11427 /* concated harmony reexport synchronizeBlocksWithTemplate */__webpack_require__.d(__webpack_exports__, "synchronizeBlocksWithTemplate", function() { return synchronizeBlocksWithTemplate; }); |
|
11428 /* concated harmony reexport children */__webpack_require__.d(__webpack_exports__, "children", function() { return api_children; }); |
|
11429 /* concated harmony reexport node */__webpack_require__.d(__webpack_exports__, "node", function() { return api_node; }); |
|
11430 /* concated harmony reexport withBlockContentContext */__webpack_require__.d(__webpack_exports__, "withBlockContentContext", function() { return withBlockContentContext; }); |
|
11431 // A "block" is the abstract term used to describe units of markup that, |
12781 // A "block" is the abstract term used to describe units of markup that, |
11432 // when composed together, form the content or layout of a page. |
12782 // when composed together, form the content or layout of a page. |
11433 // The API for blocks is exposed via `wp.blocks`. |
12783 // The API for blocks is exposed via `wp.blocks`. |
11434 // |
12784 // |
11435 // Supported blocks are registered by calling `registerBlockType`. Once registered, |
12785 // Supported blocks are registered by calling `registerBlockType`. Once registered, |
11446 |
12796 |
11447 |
12797 |
11448 |
12798 |
11449 /***/ }), |
12799 /***/ }), |
11450 |
12800 |
11451 /***/ 37: |
12801 /***/ 5: |
11452 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
12802 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
11453 |
12803 |
11454 "use strict"; |
12804 "use strict"; |
11455 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; }); |
12805 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; }); |
11456 function _arrayWithHoles(arr) { |
12806 function _defineProperty(obj, key, value) { |
11457 if (Array.isArray(arr)) return arr; |
12807 if (key in obj) { |
12808 Object.defineProperty(obj, key, { |
|
12809 value: value, |
|
12810 enumerable: true, |
|
12811 configurable: true, |
|
12812 writable: true |
|
12813 }); |
|
12814 } else { |
|
12815 obj[key] = value; |
|
12816 } |
|
12817 |
|
12818 return obj; |
|
11458 } |
12819 } |
11459 |
12820 |
11460 /***/ }), |
12821 /***/ }), |
11461 |
12822 |
11462 /***/ 38: |
12823 /***/ 6: |
11463 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
12824 /***/ (function(module, exports) { |
11464 |
12825 |
11465 "use strict"; |
12826 (function() { module.exports = this["wp"]["primitives"]; }()); |
11466 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; }); |
|
11467 function _nonIterableRest() { |
|
11468 throw new TypeError("Invalid attempt to destructure non-iterable instance"); |
|
11469 } |
|
11470 |
12827 |
11471 /***/ }), |
12828 /***/ }), |
11472 |
12829 |
11473 /***/ 42: |
12830 /***/ 64: |
11474 /***/ (function(module, exports) { |
12831 /***/ (function(module, exports) { |
11475 |
12832 |
11476 (function() { module.exports = this["wp"]["isShallowEqual"]; }()); |
12833 (function() { module.exports = this["wp"]["isShallowEqual"]; }()); |
11477 |
12834 |
11478 /***/ }), |
12835 /***/ }), |
11479 |
12836 |
11480 /***/ 45: |
12837 /***/ 66: |
11481 /***/ (function(module, exports, __webpack_require__) { |
12838 /***/ (function(module, exports, __webpack_require__) { |
11482 |
12839 |
11483 var __WEBPACK_AMD_DEFINE_RESULT__;// TinyColor v1.4.1 |
12840 var __WEBPACK_AMD_DEFINE_RESULT__;// TinyColor v1.4.1 |
11484 // https://github.com/bgrins/TinyColor |
12841 // https://github.com/bgrins/TinyColor |
11485 // Brian Grinstead, MIT License |
12842 // Brian Grinstead, MIT License |
12676 })(Math); |
14033 })(Math); |
12677 |
14034 |
12678 |
14035 |
12679 /***/ }), |
14036 /***/ }), |
12680 |
14037 |
12681 /***/ 5: |
14038 /***/ 75: |
12682 /***/ (function(module, exports) { |
14039 /***/ (function(module, exports) { |
12683 |
14040 |
12684 (function() { module.exports = this["wp"]["data"]; }()); |
14041 (function() { module.exports = this["wp"]["htmlEntities"]; }()); |
12685 |
14042 |
12686 /***/ }), |
14043 /***/ }), |
12687 |
14044 |
12688 /***/ 57: |
14045 /***/ 8: |
14046 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
14047 |
|
14048 "use strict"; |
|
14049 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; }); |
|
14050 function _extends() { |
|
14051 _extends = Object.assign || function (target) { |
|
14052 for (var i = 1; i < arguments.length; i++) { |
|
14053 var source = arguments[i]; |
|
14054 |
|
14055 for (var key in source) { |
|
14056 if (Object.prototype.hasOwnProperty.call(source, key)) { |
|
14057 target[key] = source[key]; |
|
14058 } |
|
14059 } |
|
14060 } |
|
14061 |
|
14062 return target; |
|
14063 }; |
|
14064 |
|
14065 return _extends.apply(this, arguments); |
|
14066 } |
|
14067 |
|
14068 /***/ }), |
|
14069 |
|
14070 /***/ 9: |
|
12689 /***/ (function(module, exports) { |
14071 /***/ (function(module, exports) { |
12690 |
14072 |
12691 (function() { module.exports = this["wp"]["htmlEntities"]; }()); |
|
12692 |
|
12693 /***/ }), |
|
12694 |
|
12695 /***/ 6: |
|
12696 /***/ (function(module, exports) { |
|
12697 |
|
12698 (function() { module.exports = this["wp"]["compose"]; }()); |
14073 (function() { module.exports = this["wp"]["compose"]; }()); |
12699 |
14074 |
12700 /***/ }), |
|
12701 |
|
12702 /***/ 65: |
|
12703 /***/ (function(module, exports, __webpack_require__) { |
|
12704 |
|
12705 var rng = __webpack_require__(87); |
|
12706 var bytesToUuid = __webpack_require__(88); |
|
12707 |
|
12708 function v4(options, buf, offset) { |
|
12709 var i = buf && offset || 0; |
|
12710 |
|
12711 if (typeof(options) == 'string') { |
|
12712 buf = options === 'binary' ? new Array(16) : null; |
|
12713 options = null; |
|
12714 } |
|
12715 options = options || {}; |
|
12716 |
|
12717 var rnds = options.random || (options.rng || rng)(); |
|
12718 |
|
12719 // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` |
|
12720 rnds[6] = (rnds[6] & 0x0f) | 0x40; |
|
12721 rnds[8] = (rnds[8] & 0x3f) | 0x80; |
|
12722 |
|
12723 // Copy bytes to buffer, if provided |
|
12724 if (buf) { |
|
12725 for (var ii = 0; ii < 16; ++ii) { |
|
12726 buf[i + ii] = rnds[ii]; |
|
12727 } |
|
12728 } |
|
12729 |
|
12730 return buf || bytesToUuid(rnds); |
|
12731 } |
|
12732 |
|
12733 module.exports = v4; |
|
12734 |
|
12735 |
|
12736 /***/ }), |
|
12737 |
|
12738 /***/ 66: |
|
12739 /***/ (function(module, exports) { |
|
12740 |
|
12741 (function() { module.exports = this["wp"]["autop"]; }()); |
|
12742 |
|
12743 /***/ }), |
|
12744 |
|
12745 /***/ 7: |
|
12746 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
12747 |
|
12748 "use strict"; |
|
12749 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectSpread; }); |
|
12750 /* harmony import */ var _defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15); |
|
12751 |
|
12752 function _objectSpread(target) { |
|
12753 for (var i = 1; i < arguments.length; i++) { |
|
12754 var source = arguments[i] != null ? arguments[i] : {}; |
|
12755 var ownKeys = Object.keys(source); |
|
12756 |
|
12757 if (typeof Object.getOwnPropertySymbols === 'function') { |
|
12758 ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { |
|
12759 return Object.getOwnPropertyDescriptor(source, sym).enumerable; |
|
12760 })); |
|
12761 } |
|
12762 |
|
12763 ownKeys.forEach(function (key) { |
|
12764 Object(_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]); |
|
12765 }); |
|
12766 } |
|
12767 |
|
12768 return target; |
|
12769 } |
|
12770 |
|
12771 /***/ }), |
|
12772 |
|
12773 /***/ 87: |
|
12774 /***/ (function(module, exports) { |
|
12775 |
|
12776 // Unique ID creation requires a high quality random # generator. In the |
|
12777 // browser this is a little complicated due to unknown quality of Math.random() |
|
12778 // and inconsistent support for the `crypto` API. We do the best we can via |
|
12779 // feature-detection |
|
12780 |
|
12781 // getRandomValues needs to be invoked in a context where "this" is a Crypto |
|
12782 // implementation. Also, find the complete implementation of crypto on IE11. |
|
12783 var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) || |
|
12784 (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto)); |
|
12785 |
|
12786 if (getRandomValues) { |
|
12787 // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto |
|
12788 var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef |
|
12789 |
|
12790 module.exports = function whatwgRNG() { |
|
12791 getRandomValues(rnds8); |
|
12792 return rnds8; |
|
12793 }; |
|
12794 } else { |
|
12795 // Math.random()-based (RNG) |
|
12796 // |
|
12797 // If all else fails, use Math.random(). It's fast, but is of unspecified |
|
12798 // quality. |
|
12799 var rnds = new Array(16); |
|
12800 |
|
12801 module.exports = function mathRNG() { |
|
12802 for (var i = 0, r; i < 16; i++) { |
|
12803 if ((i & 0x03) === 0) r = Math.random() * 0x100000000; |
|
12804 rnds[i] = r >>> ((i & 0x03) << 3) & 0xff; |
|
12805 } |
|
12806 |
|
12807 return rnds; |
|
12808 }; |
|
12809 } |
|
12810 |
|
12811 |
|
12812 /***/ }), |
|
12813 |
|
12814 /***/ 88: |
|
12815 /***/ (function(module, exports) { |
|
12816 |
|
12817 /** |
|
12818 * Convert array of 16 byte values to UUID string format of the form: |
|
12819 * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX |
|
12820 */ |
|
12821 var byteToHex = []; |
|
12822 for (var i = 0; i < 256; ++i) { |
|
12823 byteToHex[i] = (i + 0x100).toString(16).substr(1); |
|
12824 } |
|
12825 |
|
12826 function bytesToUuid(buf, offset) { |
|
12827 var i = offset || 0; |
|
12828 var bth = byteToHex; |
|
12829 // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 |
|
12830 return ([bth[buf[i++]], bth[buf[i++]], |
|
12831 bth[buf[i++]], bth[buf[i++]], '-', |
|
12832 bth[buf[i++]], bth[buf[i++]], '-', |
|
12833 bth[buf[i++]], bth[buf[i++]], '-', |
|
12834 bth[buf[i++]], bth[buf[i++]], '-', |
|
12835 bth[buf[i++]], bth[buf[i++]], |
|
12836 bth[buf[i++]], bth[buf[i++]], |
|
12837 bth[buf[i++]], bth[buf[i++]]]).join(''); |
|
12838 } |
|
12839 |
|
12840 module.exports = bytesToUuid; |
|
12841 |
|
12842 |
|
12843 /***/ }), |
|
12844 |
|
12845 /***/ 9: |
|
12846 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
12847 |
|
12848 "use strict"; |
|
12849 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _createClass; }); |
|
12850 function _defineProperties(target, props) { |
|
12851 for (var i = 0; i < props.length; i++) { |
|
12852 var descriptor = props[i]; |
|
12853 descriptor.enumerable = descriptor.enumerable || false; |
|
12854 descriptor.configurable = true; |
|
12855 if ("value" in descriptor) descriptor.writable = true; |
|
12856 Object.defineProperty(target, descriptor.key, descriptor); |
|
12857 } |
|
12858 } |
|
12859 |
|
12860 function _createClass(Constructor, protoProps, staticProps) { |
|
12861 if (protoProps) _defineProperties(Constructor.prototype, protoProps); |
|
12862 if (staticProps) _defineProperties(Constructor, staticProps); |
|
12863 return Constructor; |
|
12864 } |
|
12865 |
|
12866 /***/ }) |
14075 /***/ }) |
12867 |
14076 |
12868 /******/ }); |
14077 /******/ }); |