← Back
Editing: category-description.js
(()=>{"use strict";var e,t,r,o={26724:(e,t,r)=>{const o=window.wp.blocks;var n=r(73448);const i=JSON.parse('{"name":"woocommerce/category-description","title":"Product Category Description","description":"Displays the current category description.","category":"woocommerce","apiVersion":3,"textdomain":"woocommerce","attributes":{"textAlign":{"type":"string"}},"supports":{"align":false,"color":{"background":true,"text":true,"gradients":true,"link":true},"html":false,"spacing":{"margin":true,"padding":true},"typography":{"fontSize":true,"lineHeight":true,"__experimentalFontFamily":true,"__experimentalFontWeight":true,"__experimentalFontStyle":true,"__experimentalTextTransform":true,"__experimentalTextDecoration":true,"__experimentalLetterSpacing":true},"__experimentalBorder":{"color":true,"radius":true,"style":true,"width":true}},"usesContext":["termId","termTaxonomy","taxonomy"]}');var a=r(4921),s=r(27723);const c=window.wp.data,l=window.wp.coreData,d=window.wp.blockEditor,p=window.wc.wcSettings,u=window.wc.wcTypes,g=(0,p.getSetting)("wcBlocksConfig",{pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),m=g.pluginUrl+"assets/images/",y=(g.pluginUrl,p.STORE_PAGES.shop,p.STORE_PAGES.checkout,p.STORE_PAGES.checkout,p.STORE_PAGES.privacy,p.STORE_PAGES.privacy,p.STORE_PAGES.terms,p.STORE_PAGES.terms,p.STORE_PAGES.cart,p.STORE_PAGES.cart,p.STORE_PAGES.myaccount?.permalink?p.STORE_PAGES.myaccount.permalink:(0,p.getSetting)("wpLoginUrl","/wp-login.php"),(0,p.getSetting)("localPickupEnabled",!1),(0,p.getSetting)("shippingMethodsExist",!1),(0,p.getSetting)("shippingEnabled",!0),(0,p.getSettingWithCoercion)("countries",{},u.isObject)),f=(0,p.getSetting)("countryData",{}),w={...Object.fromEntries(Object.keys(f).filter(e=>!0===f[e].allowBilling).map(e=>{const t=y[e];return[e,(0,u.isString)(t)?t:""]})),...Object.fromEntries(Object.keys(f).filter(e=>!0===f[e].allowShipping).map(e=>{const t=y[e];return[e,(0,u.isString)(t)?t:""]}))},_=(Object.fromEntries(Object.keys(w).map(e=>[e,f[e].states||{}])),Object.fromEntries(Object.keys(w).map(e=>[e,f[e].locale||{}])),{address:["first_name","last_name","company","address_1","address_2","city","postcode","country","state","phone"],contact:["email"],order:[]}),S=((0,p.getSetting)("addressFieldsLocations",_).address,(0,p.getSetting)("addressFieldsLocations",_).contact,(0,p.getSetting)("addressFieldsLocations",_).order,(0,p.getSetting)("additionalOrderFields",{}),(0,p.getSetting)("additionalContactFields",{}),(0,p.getSetting)("additionalAddressFields",{}),[{id:1,name:(0,s.__)("Clothing","woocommerce"),slug:"clothing",parent:0,count:10,description:`<p>${(0,s.__)("Branded t-shirts, jumpers, pants and more!","woocommerce")}</p>\n`,image:{id:1,date_created:"2019-07-15T17:05:04",date_created_gmt:"2019-07-15T17:05:04",date_modified:"2019-07-15T17:05:04",date_modified_gmt:"2019-07-15T17:05:04",src:m+"previews/collection.jpg",name:"",alt:""},permalink:"#"}]);var h=r(10790);(0,o.registerBlockType)(i,{edit:function({attributes:e,setAttributes:t,context:r}){const{textAlign:o}=e,{termId:n,termTaxonomy:i,taxonomy:p}=r,u=i||p||"product_cat",g=(0,c.useSelect)(e=>!!n&&e(l.store).canUser("update",{kind:"taxonomy",name:u,id:n}),[n,u]),[m="",y,f]=(0,l.useEntityProp)("taxonomy",u,"description",n?String(n):void 0),w=(0,c.useSelect)(e=>{const{getSettings:t}=e(d.store);return Boolean(t()?.isPreviewMode??!1)},[])&&!n;let _="";w?_=S[0].description:"string"==typeof m&&(_=m);let b="";w?b=S[0].description:"string"==typeof f?b=f:"object"==typeof f&&null!==f&&"rendered"in f&&"string"==typeof f.rendered&&(b=f.rendered);const O=(0,d.useBlockProps)({className:(0,a.A)({[`has-text-align-${o}`]:o})});let x=(0,h.jsx)("div",{...O,children:(0,h.jsx)("p",{children:(0,s.__)("Category description","woocommerce")})});return(n||w)&&(x=g?(0,h.jsx)("div",{...O,children:(0,h.jsx)(d.PlainText,{tagName:"p",placeholder:(0,s.__)("No description","woocommerce"),value:_,onChange:e=>y(e),__experimentalVersion:2})}):(0,h.jsx)("div",{...O,dangerouslySetInnerHTML:{__html:b}})),(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(d.BlockControls,{group:"block",children:(0,h.jsx)(d.AlignmentControl,{value:o,onChange:e=>t({textAlign:e||""})})}),x]})},icon:n.A,save:()=>null})},10790:e=>{e.exports=window.ReactJSXRuntime},27723:e=>{e.exports=window.wp.i18n},5573:e=>{e.exports=window.wp.primitives}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[e]={exports:{}};return o[e](r,r.exports,i),r.exports}i.m=o,e=[],i.O=(t,r,o,n)=>{if(!r){var a=1/0;for(d=0;d<e.length;d++){for(var[r,o,n]=e[d],s=!0,c=0;c<r.length;c++)(!1&n||a>=n)&&Object.keys(i.O).every(e=>i.O[e](r[c]))?r.splice(c--,1):(s=!1,n<a&&(a=n));if(s){e.splice(d--,1);var l=o();void 0!==l&&(t=l)}}return t}n=n||0;for(var d=e.length;d>0&&e[d-1][2]>n;d--)e[d]=e[d-1];e[d]=[r,o,n]},i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(e,o){if(1&o&&(e=this(e)),8&o)return e;if("object"==typeof e&&e){if(4&o&&e.__esModule)return e;if(16&o&&"function"==typeof e.then)return e}var n=Object.create(null);i.r(n);var a={};t=t||[null,r({}),r([]),r(r)];for(var s=2&o&&e;"object"==typeof s&&!~t.indexOf(s);s=r(s))Object.getOwnPropertyNames(s).forEach(t=>a[t]=()=>e[t]);return a.default=()=>e,i.d(n,a),n},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.j=2474,(()=>{var e={2474:0};i.O.j=t=>0===e[t];var t=(t,r)=>{var o,n,[a,s,c]=r,l=0;if(a.some(t=>0!==e[t])){for(o in s)i.o(s,o)&&(i.m[o]=s[o]);if(c)var d=c(i)}for(t&&t(r);l<a.length;l++)n=a[l],i.o(e,n)&&e[n]&&e[n][0](),e[n]=0;return i.O(d)},r=globalThis.webpackChunkwebpackWcBlocksMainJsonp=globalThis.webpackChunkwebpackWcBlocksMainJsonp||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var a=i.O(void 0,[94],()=>i(26724));a=i.O(a),((this.wc=this.wc||{}).blocks=this.wc.blocks||{})["category-description"]=a})();
Save File
Cancel