File manager - Edit - /home/verseaumee/middletvnew26/wp-content/plugins/shopbuild/build/596.js
Back
"use strict";(globalThis.webpackChunkstorebuild=globalThis.webpackChunkstorebuild||[]).push([[596],{7596(e,t,l){l.r(t),l.d(t,{default:()=>c});var a=l(1609),n=l(6087),o=l(7723),s=l(1455),i=l.n(s),u=l(6427),r=l(7143),d=l(692);const c=()=>{const[e,t]=(0,n.useState)([]),[l,s]=(0,n.useState)(!0),[c,m]=(0,n.useState)({name:"",weight:"normal",style:"normal",url:""}),{createSuccessNotice:p,createErrorNotice:h}=(0,r.useDispatch)(d.store);return(0,n.useEffect)(()=>{i()({path:"/wp/v2/settings"}).then(e=>{e.storebuild_custom_fonts&&t(e.storebuild_custom_fonts),s(!1)})},[]),l?(0,a.createElement)("div",null,(0,o.__)("Loading...","shopbuild")):(0,a.createElement)("div",{className:"storebuild-custom-fonts-wrapper",style:{padding:"20px",background:"#fff"}},(0,a.createElement)("h2",null,(0,o.__)("Custom Fonts","shopbuild")),(0,a.createElement)("div",{className:"add-new-font-section",style:{marginBottom:"30px",border:"1px solid #ddd",padding:"20px"}},(0,a.createElement)("h3",null,(0,o.__)("Add New Font","shopbuild")),(0,a.createElement)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"20px"}},(0,a.createElement)(u.TextControl,{label:(0,o.__)("Font Name","shopbuild"),value:c.name,onChange:e=>m({...c,name:e}),help:(0,o.__)("Enter the font family name (e.g. My Custom Font)","shopbuild")}),(0,a.createElement)("div",{className:"font-upload-control"},(0,a.createElement)("label",{className:"components-base-control__label"},(0,o.__)("Font File","shopbuild")),(0,a.createElement)("div",{style:{display:"flex",gap:"10px",marginTop:"8px"}},(0,a.createElement)(u.Button,{isSecondary:!0,onClick:()=>{if("undefined"==typeof wp||!wp.media)return void console.error("wp.media is not defined");const e=wp.media({title:(0,o.__)("Upload Font File","shopbuild"),button:{text:(0,o.__)("Use this font","shopbuild")},multiple:!1});e.on("select",()=>{const t=e.state().get("selection").first().toJSON();m({...c,url:t.url,id:t.id,type:t.subtype})}),e.open()}},(0,o.__)("Upload Font","shopbuild")),c.url&&(0,a.createElement)("span",{style:{alignSelf:"center",fontSize:"12px"}},c.url.split("/").pop()))),(0,a.createElement)(u.SelectControl,{label:(0,o.__)("Font Weight","shopbuild"),value:c.weight,options:[{label:"Normal",value:"normal"},{label:"Bold",value:"bold"},{label:"100",value:"100"},{label:"200",value:"200"},{label:"300",value:"300"},{label:"400",value:"400"},{label:"500",value:"500"},{label:"600",value:"600"},{label:"700",value:"700"},{label:"800",value:"800"},{label:"900",value:"900"}],onChange:e=>m({...c,weight:e})}),(0,a.createElement)(u.SelectControl,{label:(0,o.__)("Font Style","shopbuild"),value:c.style,options:[{label:"Normal",value:"normal"},{label:"Italic",value:"italic"},{label:"Oblique",value:"oblique"}],onChange:e=>m({...c,style:e})})),(0,a.createElement)("div",{style:{marginTop:"20px"}},(0,a.createElement)(u.Button,{isPrimary:!0,onClick:()=>{if(!c.name||!c.url)return void h((0,o.__)("Please provide a font name and upload a file.","shopbuild"));const l=[...e,c];s(!0),i()({path:"/wp/v2/settings",method:"POST",data:{storebuild_custom_fonts:l}}).then(()=>{t(l),m({name:"",weight:"normal",style:"normal",url:""}),p((0,o.__)("Font added successfully.","shopbuild")),s(!1)}).catch(e=>{h(e.message),s(!1)})}},(0,o.__)("Add Font","shopbuild")))),(0,a.createElement)("div",{className:"existing-fonts-list"},(0,a.createElement)("h3",null,(0,o.__)("Existing Fonts","shopbuild")),0===e.length?(0,a.createElement)("p",null,(0,o.__)("No custom fonts added yet.","shopbuild")):(0,a.createElement)("table",{className:"wp-list-table widefat fixed striped"},(0,a.createElement)("thead",null,(0,a.createElement)("tr",null,(0,a.createElement)("th",null,(0,o.__)("Name","shopbuild")),(0,a.createElement)("th",null,(0,o.__)("Weight","shopbuild")),(0,a.createElement)("th",null,(0,o.__)("Style","shopbuild")),(0,a.createElement)("th",null,(0,o.__)("Preview","shopbuild")),(0,a.createElement)("th",null,(0,o.__)("Actions","shopbuild")))),(0,a.createElement)("tbody",null,e.map((l,n)=>(0,a.createElement)("tr",{key:n},(0,a.createElement)("td",null,l.name),(0,a.createElement)("td",null,l.weight),(0,a.createElement)("td",null,l.style),(0,a.createElement)("td",{style:{fontFamily:l.name,fontWeight:l.weight,fontStyle:l.style,fontSize:"18px"}},"The quick brown fox jumps over the lazy dog"),(0,a.createElement)("td",null,(0,a.createElement)(u.Button,{isDestructive:!0,isSmall:!0,onClick:()=>(l=>{const a=e.filter((e,t)=>t!==l);s(!0),i()({path:"/wp/v2/settings",method:"POST",data:{storebuild_custom_fonts:a}}).then(()=>{t(a),p((0,o.__)("Font deleted successfully.","shopbuild")),s(!1)}).catch(e=>{h(e.message),s(!1)})})(n)},(0,o.__)("Delete","shopbuild")))))))))}}}]);
| ver. 1.4 |
Github
|
.
| PHP 8.5.7 | Generation time: 0 |
proxy
|
phpinfo
|
Settings