← Back
Editing: product-title.js
(globalThis.webpackChunkwebpackWcBlocksMainJsonp=globalThis.webpackChunkwebpackWcBlocksMainJsonp||[]).push([[2105],{72598:(e,t,o)=>{"use strict";o.d(t,{A:()=>n});var r=o(4921),s=(o(40959),o(10790));const n=({className:e="",disabled:t=!1,name:o,permalink:n="",target:c,rel:a,style:l,onClick:i,disabledTagName:u="span",...p})=>{const d=(0,r.A)("wc-block-components-product-name",e),m=u;if(t){const e=p;return(0,s.jsx)(m,{className:d,...e,dangerouslySetInnerHTML:{__html:o}})}return(0,s.jsx)("a",{className:d,href:n,target:c,...p,dangerouslySetInnerHTML:{__html:o},style:l})}},7147:(e,t,o)=>{"use strict";o.d(t,{y:()=>c});var r=o(52619),s=o(47143),n=o(86087);const c=()=>({dispatchStoreEvent:(0,n.useCallback)((e,t={})=>{try{(0,r.doAction)(`experimental__woocommerce_blocks-${e}`,t)}catch(e){console.error(e)}},[]),dispatchCheckoutEvent:(0,n.useCallback)((e,t={})=>{try{(0,r.doAction)(`experimental__woocommerce_blocks-checkout-${e}`,{...t,storeCart:(0,s.select)("wc/store/cart").getCartData()})}catch(e){console.error(e)}},[])})},2374:(e,t,o)=>{"use strict";o.d(t,{p:()=>a});var r=o(4921),s=o(73993),n=o(25028),c=o(63512);const a=e=>{const t=(e=>{const t=(0,s.isObject)(e)?e:{style:{}};let o=t.style;return(0,s.isString)(o)&&(o=JSON.parse(o)||{}),(0,s.isObject)(o)||(o={}),{...t,style:o}})(e),o=(0,c.BK)(t),a=(0,c.aR)(t),l=(0,c.fo)(t),i=(0,n.x)(t);return{className:(0,r.A)(i.className,o.className,a.className,l.className),style:{...i.style,...o.style,...a.style,...l.style}}}},25028:(e,t,o)=>{"use strict";o.d(t,{x:()=>s});var r=o(73993);const s=e=>{const t=(0,r.isObject)(e.style.typography)?e.style.typography:{},o=(0,r.isString)(t.fontFamily)?t.fontFamily:"";return{className:e.fontFamily?`has-${e.fontFamily}-font-family`:o,style:{fontSize:e.fontSize?`var(--wp--preset--font-size--${e.fontSize})`:t.fontSize,fontStyle:t.fontStyle,fontWeight:t.fontWeight,letterSpacing:t.letterSpacing,lineHeight:t.lineHeight,textDecoration:t.textDecoration,textTransform:t.textTransform}}}},63512:(e,t,o)=>{"use strict";o.d(t,{BK:()=>i,aR:()=>u,fo:()=>p});var r=o(4921),s=o(67356),n=o(49786),c=o(73993);function a(e={}){const t={};return(0,n.getCSSRules)(e,{selector:""}).forEach(e=>{t[e.key]=e.value}),t}function l(e,t){return e&&t?`has-${(0,s.c)(t)}-${e}`:""}function i(e){const{backgroundColor:t,textColor:o,gradient:s,style:n}=e,i=l("background-color",t),u=l("color",o),p=function(e){if(e)return`has-${e}-gradient-background`}(s),d=p||n?.color?.gradient;return{className:(0,r.A)(u,p,{[i]:!d&&!!i,"has-text-color":o||n?.color?.text,"has-background":t||n?.color?.background||s||n?.color?.gradient,"has-link-color":(0,c.isObject)(n?.elements?.link)?n?.elements?.link?.color:void 0}),style:a({color:n?.color||{}})}}function u(e){const t=e.style?.border||{};return{className:function(e){const{borderColor:t,style:o}=e,s=t?l("border-color",t):"";return(0,r.A)({"has-border-color":!!t||!!o?.border?.color,[s]:!!s})}(e),style:a({border:t})}}function p(e){return{className:void 0,style:a({spacing:e.style?.spacing||{}})}}},36843:(e,t,o)=>{"use strict";o.d(t,{A:()=>p});var r=o(4921),s=o(62796),n=o(41616),c=o(72598),a=o(7147),l=o(2374),i=(o(16833),o(10790));const u=({children:e,headingLevel:t,elementType:o=`h${t}`,...r})=>(0,i.jsx)(o,{...r,children:e}),p=(0,n.withProductDataContext)(e=>{const{className:t,headingLevel:o=2,showProductLink:n=!0,linkTarget:p,align:d}=e,m=(0,l.p)(e),{parentClassName:y}=(0,s.useInnerBlockLayoutContext)(),{product:g}=(0,s.useProductDataContext)(),{dispatchStoreEvent:h}=(0,a.y)();return g.id?(0,i.jsx)(u,{headingLevel:o,className:(0,r.A)(t,m.className,"wc-block-components-product-title",{[`${y}__product-title`]:y,[`wc-block-components-product-title--align-${d}`]:d}),style:m.style,children:(0,i.jsx)(c.A,{disabled:!n,name:g.name,permalink:g.permalink,target:p,onClick:()=>{h("product-view-link",{product:g})}})}):(0,i.jsx)(u,{headingLevel:o,className:(0,r.A)(t,m.className,"wc-block-components-product-title",{[`${y}__product-title`]:y,[`wc-block-components-product-title--align-${d}`]:d}),style:m.style})})},10266:(e,t,o)=>{"use strict";o.r(t),o.d(t,{default:()=>c});var r=o(41616),s=o(36843),n=o(85866);const c=(0,r.withFilteredAttributes)(n.attributes)(s.A)},40959:()=>{},16833:()=>{},85866:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"woocommerce/product-title","title":"Product Title","category":"woocommerce-product-elements","description":"Display the title of a product.","supports":{"html":false,"interactivity":{"clientNavigation":false},"typography":{"fontSize":true,"lineHeight":true,"__experimentalFontWeight":true,"__experimentalTextTransform":true,"__experimentalFontFamily":true},"color":{"text":true,"background":true,"link":false,"gradients":true,"__experimentalSkipSerialization":true},"spacing":{"margin":true,"__experimentalSkipSerialization":true}},"selectors":{"root":".wp-block-woocommerce-product-title .wc-block-components-product-title"},"textdomain":"woocommerce","attributes":{"headingLevel":{"type":"number","default":2},"showProductLink":{"type":"boolean","default":true},"linkTarget":{"type":"string"},"productId":{"type":"number","default":0},"align":{"type":"string"}},"ancestor":["woocommerce/all-products"]}')}}]);
Save File
Cancel