WordPress/wp-includes/js/dist/annotations.min.js

2 lines
7.9 KiB
JavaScript
Raw Normal View History

/*! This file is auto-generated */
this.wp=this.wp||{},this.wp.annotations=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s="23Y4")}({"1ZqX":function(t,e){t.exports=window.wp.data},"23Y4":function(t,e,n){"use strict";n.r(e),n.d(e,"store",(function(){return j}));var r={};n.r(r),n.d(r,"__experimentalGetAnnotationsForBlock",(function(){return h})),n.d(r,"__experimentalGetAllAnnotationsForBlock",(function(){return x})),n.d(r,"__experimentalGetAnnotationsForRichText",(function(){return _})),n.d(r,"__experimentalGetAnnotations",(function(){return A}));var o={};n.r(o),n.d(o,"__experimentalAddAnnotation",(function(){return y})),n.d(o,"__experimentalRemoveAnnotation",(function(){return N})),n.d(o,"__experimentalUpdateAnnotationRange",(function(){return T})),n.d(o,"__experimentalRemoveAnnotationsBySource",(function(){return w}));var a=n("qRz9"),i=n("l3Sj");const u="core/annotations";const l={name:"core/annotation",title:Object(i.__)("Annotation"),tagName:"mark",className:"annotation-text",attributes:{className:"class",id:"id"},edit:()=>null,__experimentalGetPropsForEditableTreePreparation:(t,{richTextIdentifier:e,blockClientId:n})=>({annotations:t(u).__experimentalGetAnnotationsForRichText(n,e)}),__experimentalCreatePrepareEditableTree:({annotations:t})=>(e,n)=>{if(0===t.length)return e;let r={formats:e,text:n};return r=function(t,e=[]){return e.forEach(e=>{let{start:n,end:r}=e;n>t.text.length&&(n=t.text.length),r>t.text.length&&(r=t.text.length);const o="annotation-text-"+e.source,i="annotation-text-"+e.id;t=Object(a.applyFormat)(t,{type:"core/annotation",attributes:{className:o,id:i}},n,r)}),t}(r,t),r.formats},__experimentalGetPropsForEditableTreeChangeHandler:t=>({removeAnnotation:t(u).__experimentalRemoveAnnotation,updateAnnotationRange:t(u).__experimentalUpdateAnnotationRange}),__experimentalCreateOnChangeEditableValue:t=>e=>{const n=function(t){const e={};return t.forEach((t,n)=>{(t=(t=t||[]).filter(t=>"core/annotation"===t.type)).forEach(t=>{let{id:r}=t.attributes;r=r.replace("annotation-text-",""),e.hasOwnProperty(r)||(e[r]={start:n}),e[r].end=n+1})}),e}(e),{removeAnnotation:r,updateAnnotationRange:o,annotations:a}=t;!function(t,e,{removeAnnotation:n,updateAnnotationRange:r}){t.forEach(t=>{const o=e[t.id];if(!o)return void n(t.id);const{start:a,end:i}=t;a===o.start&&i===o.end||r(t.id,o.start,o.end)})}(a,n,{removeAnnotation:r,updateAnnotationRange:o})}},{name:c,...s}=l;Object(a.registerFormatType)(c,s);var d=n("g56x"),f=n("1ZqX");Object(d.addFilter)("editor.BlockListBlock","core/annotations",t=>Object(f.withSelect)((t,{clientId:e,className:n})=>({className:t(u).__experimentalGetAnnotationsForBlock(e).map(t=>"is-annotated-by-"+t.source).concat(n).filter(Boolean).join(" ")}))(t));var p=n("YLtl");function v(t,e){const n=t.filter(e);return t.length===n.length?t:n}var m=function(t={},e){var n,r;switch(e.type){case"ANNOTATION_ADD":const o=e.blockClientId,a={id:e.id,blockClientId:o,richTextIdentifier:e.richTextIdentifier,source:e.source,selector:e.selector,range:e.range};if("range"===a.selector&&(r=a.range,!(Object(p.isNumber)(r.start)&&Object(p.isNumber)(r.end)&&r.start<=r.end)))return t;const i=null!==(n=null==t?void 0:t[o])&&void 0!==n?n:[];return{...t,[o]:[...i,a]};case"ANNOTATION_REMOVE":return Object(p.mapValue