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

2 lines
8.3 KiB
JavaScript
Raw Normal View History

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