WordPress/wp-includes/js/dist/rich-text.min.js

2 lines
31 KiB
JavaScript
Raw Normal View History

/*! This file is auto-generated */
!function(){"use strict";var e={n:function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,{a:n}),n},d:function(t,n){for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{RichTextData:function(){return z},__experimentalRichText:function(){return Ge},__unstableCreateElement:function(){return b},__unstableToDom:function(){return we},__unstableUseRichText:function(){return Ye},applyFormat:function(){return E},concat:function(){return J},create:function(){return W},getActiveFormat:function(){return Q},getActiveFormats:function(){return N},getActiveObject:function(){return ee},getTextContent:function(){return V},insert:function(){return ie},insertObject:function(){return le},isCollapsed:function(){return te},isEmpty:function(){return ne},join:function(){return re},registerFormatType:function(){return oe},remove:function(){return ce},removeFormat:function(){return ae},replace:function(){return ue},slice:function(){return fe},split:function(){return de},store:function(){return g},toHTMLString:function(){return O},toggleFormat:function(){return Fe},unregisterFormatType:function(){return Re},useAnchor:function(){return ke},useAnchorRef:function(){return Se}});var n={};e.r(n),e.d(n,{getFormatType:function(){return l},getFormatTypeForBareElement:function(){return f},getFormatTypeForClassName:function(){return d},getFormatTypes:function(){return u}});var r={};e.r(r),e.d(r,{addFormatTypes:function(){return m},removeFormatTypes:function(){return p}});var o=window.wp.data;var a=(0,o.combineReducers)({formatTypes:function(e={},t){switch(t.type){case"ADD_FORMAT_TYPES":return{...e,...t.formatTypes.reduce(((e,t)=>({...e,[t.name]:t})),{})};case"REMOVE_FORMAT_TYPES":return Object.fromEntries(Object.entries(e).filter((([e])=>!t.names.includes(e))))}return e}}),s={};function i(e){return[e]}function c(e,t,n){var r;if(e.length!==t.length)return!1;for(r=n;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}const u=function(e,t){var n,r=t||i;function o(){n=new WeakMap}function a(){var t,o,a,i,u,l=arguments.length;for(i=new Array(l),a=0;a<l;a++)i[a]=arguments[a];for(t=function(e){var t,r,o,a,i,c=n,u=!0;for(t=0;t<e.length;t++){if(!(i=r=e[t])||"object"!=typeof i){u=!1;break}c.has(r)?c=c.get(r):(o=new WeakMap,c.set(r,o),c=o)}return c.has(s)||((a=function(){var e={clear:function(){e.head=null}};return e}()).isUniqueByDependants=u,c.set(s,a)),c.get(s)}(u=r.apply(null,i)),t.isUniqueByDependants||(t.lastDependants&&!c(u,t.lastDependants,0)&&t.clear(),t.lastDependants=u),o=t.head;o;){if(c(o.args,i,1))return o!==t.head&&(o.prev.next=o.next,o.next&&(o.next.prev=o.prev),o.next=t.head,o.prev=null,t.head.prev=o,t.head=o),o.val;o=o.next}return o={val:e.apply(null,i)},i[0]=null,o.args=i,t.head&&(t.head.prev=o,o.next=t.head),t.head=o,o.val}return a.getDependants=r,a.clear=o,o(),a}((e=>Object.values(e.formatTypes)),(e=>[e.formatTypes]));function l(e,t){return e.formatTypes[t]}function f(e,t){const n=u(e);return n.find((({className:e,tagName:n})=>null===e&&t===n))||n.find((({className:e,tagName:t})=>null===e&&"*"===t))}function d(e,t){return u(e).find((({className:e})=>null!==e&&` ${t} `.indexOf(` ${e} `)>=0))}function m(e){return{type:"ADD_FORMAT_TYPES",formatTypes:Array.isArray(e)?e:[e]}}function p(e){return{type:"REMOVE_FORMAT_TYPES",names:Array.isArray(e)?e:[e]}}const g=(0,o.createReduxStore)("core/rich-text",{reducer:a,selectors:n,actions:r});function h(e,t){if(e===t)return!0;if(!e||!t)return!1;if(e.type!==t.type)return!1;const n=e.attributes,r=t.attributes;if(n===r)return!0;if(!n||!r)return!1;const o=Object.keys(n),a=Object.keys(r);if(o.length!==a.length)return!1;const s=o.length;for(let e=0;e<s;e++){const t=o[e];if(n[t]!==r[t])return!1}return!0}function y(e){const t=e.formats.slice();return t.forEach(((e,n)=>{const r=t[n-1];if(r){cons