useblocks 1.3.11-dev.2 → 1.3.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/README.md +2 -2
  2. package/compat-globals.js +1 -1
  3. package/iframe/.vite/manifest.json +4 -4
  4. package/iframe/css/sandbox-dark.css +1 -1
  5. package/iframe/css/sandbox-light.css +1 -1
  6. package/iframe/css/sandbox.css +47 -17
  7. package/iframe/{iframe-eblock.fd4347fc.html → iframe-eblock.cd84d2b9.html} +2 -2
  8. package/iframe/{iframe.fd4347fc.html → iframe.cd84d2b9.html} +2 -2
  9. package/iframe/js/elMarkupHelper.CgToMPJX.js +278 -0
  10. package/iframe/js/{iframe-eblock.body.fd4347fc.js → iframe-eblock.body.cd84d2b9.js} +1 -1
  11. package/iframe/js/iframe-eblock.js +2 -2
  12. package/iframe/js/{iframe.body.fd4347fc.js → iframe.body.cd84d2b9.js} +2 -2
  13. package/iframe/js/iframe.js +2 -2
  14. package/package.json +1 -1
  15. package/runtime/react/index.js +1 -1
  16. package/static/core/{3ca0af3d.js → 18b86617.js} +1 -1
  17. package/static/core/{d48488c4.js → 1a17438d.js} +1 -1
  18. package/static/core/{846cd365.js → 1c9acdf4.js} +1 -1
  19. package/static/core/{31d22827.js → 1dfb486f.js} +1 -1
  20. package/static/core/{78500214.js → 209e2686.js} +1 -1
  21. package/static/core/{7934ed7e.js → 2209544a.js} +1 -1
  22. package/static/core/243ff5f9.js +19 -0
  23. package/static/core/{579d4466.js → 33588588.js} +1 -1
  24. package/static/core/{1fcc0627.js → 36ffa6e4.js} +1 -1
  25. package/static/core/{bbf48eb9.js → 39d9efa2.js} +1 -1
  26. package/static/core/{4181d334.js → 3a605273.js} +1 -1
  27. package/static/core/{13a6a2d3.js → 4224aefb.js} +1 -1
  28. package/static/core/{2865f716.js → 4bfd6086.js} +1 -1
  29. package/static/core/{3a5bea82.js → 550803ff.js} +1 -1
  30. package/static/core/{8d0796c1.js → 555c0dda.js} +1 -1
  31. package/static/core/5661be7c.js +7 -0
  32. package/static/core/{b0edd3a1.js → 57948058.js} +1 -1
  33. package/static/core/{66b856ca.js → 58c51568.js} +1 -1
  34. package/static/core/{5fd45688.js → 5a21c667.js} +1 -1
  35. package/static/core/{c33a9c36.js → 5cac7517.js} +1 -1
  36. package/static/core/{c5128299.js → 5d315649.js} +1 -1
  37. package/static/core/{12963ed5.js → 5f0554d8.js} +1 -1
  38. package/static/core/605267a0.js +1 -0
  39. package/static/core/{153a5a27.js → 6100ddd2.js} +1 -1
  40. package/static/core/{e37da9a7.js → 6c59da82.js} +1 -1
  41. package/static/core/{9d57053a.js → 87edea39.js} +1 -1
  42. package/static/core/{31da6da0.js → 8f57829b.js} +1 -1
  43. package/static/core/{925b75fb.js → 91d46f38.js} +2 -2
  44. package/static/core/{2d58a94b.js → 92fb4e07.js} +1 -1
  45. package/static/core/{17c8ebc4.js → 9d0b4233.js} +1 -1
  46. package/static/core/{cc4657d9.js → a8634edd.js} +1 -1
  47. package/static/core/{939d4a62.js → b4e4af36.js} +1 -1
  48. package/static/core/{9916b298.js → bff175af.js} +2 -2
  49. package/static/core/{f8f52e6d.js → c571b1dd.js} +1 -1
  50. package/static/core/{37bf0f7a.js → c6114314.js} +1 -1
  51. package/static/core/{ae251a52.js → ce93456f.js} +1 -1
  52. package/static/core/{dda98b73.js → d4513bf2.js} +1 -1
  53. package/static/core/{983a408d.js → de3f9bdc.js} +1 -1
  54. package/static/core/{70749936.js → e0282a25.js} +1 -1
  55. package/static/core/{e9281a4c.js → e35eca7d.js} +1 -1
  56. package/static/core/{6ec347ff.js → e37ba502.js} +1 -1
  57. package/static/core/{ab741434.js → f4b9148a.js} +1 -1
  58. package/static/core/{752288e6.js → f4e70f7f.js} +1 -1
  59. package/static/core/{9438888a.js → f9238279.js} +1 -1
  60. package/static/esm/{f97f42d1.js → c5372168.js} +1 -1
  61. package/static/esm/delivery-libs.js +1 -1
  62. package/static/umd-runtime/{Cvm7BS4_.js → CyULsN57.js} +31 -31
  63. package/static/umd-runtime/DdK5piwW.js +1 -0
  64. package/static/umd-runtime/delivery-libs.BJHA1QD4.js +1 -0
  65. package/static/umd-runtime/runtime.DAdCc3rx.js +1 -0
  66. package/static/umd-runtime/{ui-kit.CoVNet0I.js → ui-kit.BZ4Y4jr2.js} +2 -2
  67. package/useblocks-core.cd84d2b9.js +875 -0
  68. package/useblocks-esm.js +12 -12
  69. package/{useblocks-po.fd4347fc.js → useblocks-po.cd84d2b9.js} +1 -1
  70. package/useblocks.d.ts +3 -3
  71. package/useblocks.js +13 -13
  72. package/vendor/useblocks-ui-kit/es/components/Custom/FormBackgroundSettings/index.js +3 -3
  73. package/vendor/useblocks-ui-kit/es/components/Custom/FormBorderRadiusInputs/index.js +6 -6
  74. package/vendor/useblocks-ui-kit/es/components/Custom/FormBoxShadowInputs/index.js +5 -5
  75. package/vendor/useblocks-ui-kit/es/components/Custom/FormPanel/FormPaddingInputs/index.js +69 -64
  76. package/vendor/useblocks-ui-kit/es/components/Custom/FormPanel/FormSizeInputs/index.js +5 -5
  77. package/vendor/useblocks-ui-kit/es/components/Custom/FormPanel/FormTypographyFields/index.js +5 -5
  78. package/vendor/useblocks-ui-kit/es/components/Custom/Inputs/DraggableInputNumber/index.js +41 -35
  79. package/vendor/useblocks-ui-kit/es/components/Layout/Splitter/index.js +5 -0
  80. package/vendor/useblocks-ui-kit/index.js +12 -11
  81. package/vendor/useblocks-ui-kit/package.json +1 -1
  82. package/iframe/js/elMarkupHelper.DLCHSWwj.js +0 -279
  83. package/static/core/4f5add14.js +0 -1
  84. package/static/core/68e393e4.js +0 -19
  85. package/static/core/f126c14c.js +0 -7
  86. package/static/umd-runtime/B7h7P1Np.js +0 -1
  87. package/static/umd-runtime/delivery-libs.BymXnePv.js +0 -1
  88. package/static/umd-runtime/runtime.CQCs2kHH.js +0 -1
  89. package/useblocks-core.fd4347fc.js +0 -875
@@ -1 +0,0 @@
1
- __useblocks__.define("static/core/4f5add14.js",["require","exports","module","static/core/2ff39ddf.js","static/core/cf7d1dd7.js","static/core/83a2a45e.js","react","react/jsx-runtime","__delivery__/libs"],function(C,ve,Me){const F=C("./2ff39ddf.js"),he=C("./cf7d1dd7.js"),e=C("./83a2a45e.js");let o=C("react");o=F.__toESM(o);let A=C("react/jsx-runtime"),P=C("__delivery__/libs");var d=F.__toESM(e.require_prop_types()),Q=t=>t?.message??t?.data?.message??"The block was not saved.",X=({block:t=null,isEditableRights:z,rightCol:D,autoSaveBlockResult:ke,disabled:Ee,ownsDocument:O=!1})=>{const{__:m}=e.useI18n(),{blockId:J}=e.useRouteParams(),j=e.useEditorProjectId();let Be=e.useSelector(e.selectIsCodeMode$1),Se=e.useSelector(e.selectIsCodeMode$1);e.useDispatch();const c=e.useNotification(),B=e.useContentReader(),{document:K}=e.useDocumentSessionContext(),W=e.useStore(),Z=e.useSendPostMessage(),[ee,te]=(0,o.useState)(!1),[Te,ye]=(0,o.useState)(null),[Ie,g]=(0,o.useState)(!1),[M,Ce]=(0,o.useState)(0),[G,Oe]=(0,o.useState)(0),S=M!==G,T=(0,o.useCallback)(()=>Ce(s=>s+1),[]),Re=e.usePushToDataLayer(),se=e.useEventEmitter(he.events.ON_BLOCK_SAVEBUTTON_CLICK_ID),b=e.useAppConfig().saveHotkeyEnabled!==!1,x=e.useContainer(),H=(0,o.useRef)([]),V=(0,o.useRef)(!0);(0,o.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&ye(!0)},[]);const{data:w,refetch:oe}=e.useGetProjectQuery(+j,{skip:!+j}),[ae]=e.useAddTermMutation(),[q,$]=e.useEditBlockMutation(),[ne,U]=e.useAddBlockMutation(),[ie]=e.useEditProjectMutation(),{data:re}=e.useGetTermsQuery({project:w,kind:e.BLOCK_TAGS},{skip:!w?.id}),N=(0,o.useCallback)((s,r)=>{g(!0);let R=!1;const i=y=>{R||(R=!0,r?.(y))};if(!z&&t.lock&&S){i({ok:!1,reason:"locked",message:"No access to edit the block.",notified:!0}),c.error({id:"BLOCK_ACCESS_TO_LOCKED_ERROR",title:m("No access to edit the block."),data:e.getBlockDesc(t)}),g(!1);return}if((t.tags?.length||t.blocktags?.length)>10&&S){i({ok:!1,reason:"failed",message:"Maximum 10 tags available.",notified:!0,refusal:"The block has more tags than allowed (10 at most), so nothing was saved."}),c.error({id:"BLOCK_TOO_MANY_TAGS_ERROR",title:m("Maximum 10 tags available."),data:e.getBlockDesc(t)}),g(!1);return}if(t.type===""){i({ok:!1,reason:"failed",message:"The block type is not set.",notified:!0,refusal:"The block type is not set, so nothing was saved; ask the user to set it in the block settings."}),c.error({title:m("Set the type"),description:m("Please set the 'Type' field in the Settings section.")}),g(!1);return}const u=y=>{const le=t.tags?.map(n=>{const _=re?.find(p=>p.name===n);return _?_.id:ae({project:w,kind:e.BLOCK_TAGS,name:n,parent:y}).then(({error:p,data:L})=>{if(p?.status===400)return e.existingTermIdFromError(p);if(L)return L.id;p&&(c.fromError("TAG_CREATING_ERROR",n,p),g(!1))})}),f=O&&K?K:void 0,de=(n=null)=>{let _=null;const p=f?.get().version,L=f?f.get().serverId==null:!!t?.isNew,me=f?.get().serverId??t?.id,ge=a=>{const v=a?.id;if(f&&p!==void 0){f.markSaved(p,L&&v!=null?String(v):void 0);const E=a;e.writeSourceReport(f,e.fromServerFacts(E&&{wpId:E.wpId,secretHash:E.secretHash}))}i({ok:!0}),W.dispatch(e.taxonomiesApi.endpoints.getTerms.initiate({project:w,kind:e.BLOCK_TAGS})),oe();const l=a,k=l.global_block?e.globalBlockMark(l):void 0;k&&Z({operation:e.EVENT_TYPES.SANDBOX_EBLOCK_SET_EM_BLOCK_ID,settings:{emBlockId:k,..._?{emBlockVersion:_}:{}}}),S&&(c.success({id:"BLOCK_EDITING_SUCCESS",title:m("The block was successfully saved."),data:e.getBlockDesc(t)}),g(!1));const I=e.wpEmailTarget(l,j),h=I?.emailId??(e.isBlocksV2Enabled()?void 0:l.id);h!=null&&fetch(e.blockPreviewHref(e.BLOCK,I?.projectId??j,h,l.modified),{mode:"no-cors"}).then(()=>{})},_e=a=>i({ok:!1,reason:"failed",message:Q(a),notified:!0}),pe=e.getTaxonomy(t,e.EMAIL_TAGS).filter(a=>(n||t.blocktags).includes(a.id)).map(a=>a.name);if(L){if(f||U.status!=="pending")return ne({source:s,title:t.title===null?m("New block title"):t.title,project:t.project,type:t.type?t.type:"Other",description:t.description,html:B(),blocktags:n?n.join(","):t.blocktags,tags:pe,...e.hasOwnMeta(t)?{meta:t.meta}:{}}).then(async({data:a,error:v})=>{if(v)c.fromError("BLOCK_CREATING_ERROR",{title:t.title,html:B()},v),g(!1),_e(v);else{let l=a;const k=B();if(a?.global_block&&a?.id&&e.globalBlockMark(a)&&k){const I=new Date,h=e.injectEmBlockIdIntoBlockHtml(k,e.globalBlockMark(a),I);if(_=e.formatEmBlockVersion(I),h!==k){const E=await q({blockId:a.id,html:h});E.error?c.fromError("BLOCK_EDITING_ERROR",e.getBlockDesc(t),E.error):E.data&&(l=E.data)}}ge(l)}})}else if(f||$.status!=="pending"){const a=B(),v=new Date,l=t.global_block?e.globalBlockMark({...t,id:me}):void 0,k=l?e.injectEmBlockIdIntoBlockHtml(a,l,v):a;return l&&(_=e.formatEmBlockVersion(v)),q({blockId:me,source:s,title:t.title,project:t.project,type:t.type?t.type:"Other",description:t.description,html:k,...n||Array.isArray(t.tags)?{blocktags:n||t.blocktags,tags:pe}:{},...e.hasOwnMeta(t)?{meta:t.meta}:{}}).then(({data:I,error:h})=>{h&&S?(c.fromError("BLOCK_EDITING_ERROR",e.getBlockDesc(t),h),g(!1),_e(h)):ge(I)})}return i({ok:!1,reason:"failed",message:"Another block save is in progress."}),Promise.resolve()},ue=n=>{try{return f?e.runBlockSave(f,()=>de(n)):de(n)}catch(_){return Promise.reject(_)}},fe=n=>{c.fromError("BLOCK_EDITING_ERROR",e.getBlockDesc(t),n),g(!1),i({ok:!1,reason:"failed",message:Q(n),notified:!0})};le?Promise.all(le).then(n=>ue(n)).catch(fe):ue(null).catch(fe)};g(!0),u(void 0)},[U.status,ne,$.status,q,t,z,ae,ie,j,m,S,B,c,re,oe,W,Z,O,K]);(0,o.useEffect)(()=>{if(S){const s=N,r=H.current.splice(0),R=M-G>r.filter(({settle:i})=>i).length;se.fire({...t,html:B()}).then(i=>{i.some(u=>u===!1)?r.forEach(({settle:u})=>u?.({ok:!1,reason:"aborted",message:"The save was cancelled by the host."})):V.current?r.length?s(void 0,u=>r.forEach(({settle:y})=>y?.(u))):s():(r.forEach(({settle:u})=>u?.({ok:!1,reason:"failed",message:"The save button was removed."})),R&&s())}).catch(i=>{c.fromError("SAVE_BUTTON_CLICK_EVENT_ERROR",e.getBlockDesc(t),i,!0);const u=i instanceof Error?i.message:"The save button handler failed.";r.forEach(({settle:y})=>y?.({ok:!1,reason:"failed",message:u,notified:!0}))}),Oe(M)}},[S,M,G,N,se,t,B,c]),(0,o.useEffect)(()=>{V.current=!0;const s=H.current;return()=>{V.current=!1,s.splice(0).forEach(({settle:r})=>r?.({ok:!1,reason:"failed",message:"The save button was removed."}))}},[]),e.useCommand(e.SAVE_BLOCK_COMMAND_ID,(0,o.useCallback)(s=>{O&&(H.current.push(e.isSaveRequest(s)?s:{}),T())},[O,T])),(0,o.useEffect)(()=>O&&x?e.registerSaveListener(x,"block"):void 0,[O,x]);const Y=(0,o.useCallback)(s=>{(s.ctrlKey||s.metaKey)&&s.keyCode===83&&(s.preventDefault(),b&&T())},[b,T]);(0,o.useEffect)(()=>(document.addEventListener("keydown",Y),()=>{document.removeEventListener("keydown",Y)}),[Y]);const je=(0,o.useCallback)(s=>{const r=s.data.operation,R=s.data.action;r===e.EVENT_TYPES.APPLICATION_ACTION&&R==="save_email"&&b&&T()},[b,T]);e.useListenPostMessage(je),(0,o.useEffect)(()=>{const s=setTimeout(()=>{te(!0)},1e4);return()=>{clearTimeout(s)}},[]),(0,o.useEffect)(()=>{t.isNew&&!J&&ee&&(N(),te(!1))},[ee,t,N,J]);const Le=$.isLoading||ie.isLoading||U.isLoading||Ie,ce=!!ke?.isLoading,Ae=Le||ce;return(0,A.jsx)(P.ui_kit$Tooltip,{title:m(Te?"Save by ⌘S":"Save by Ctrl+S"),placement:D?"right":"bottomRight",children:(0,A.jsx)("span",{className:"em-analytics__block-save-tooltip-target",children:(0,A.jsx)(P.ui_kit$Button,{type:"primary",block:D,disabled:Ee||ce,className:"em-analytics__block-save",icon:(0,A.jsx)(e.EmIcons,{icon:"SaveOutlined",component:P.icons$SaveOutlined}),onClick:s=>{const r=s.currentTarget;Re({event:"click",action:"save_block"}),T();try{r?.blur?.()}catch{}},loading:Ae,children:D||Be||Se?"":m("Save")})})})};X.propTypes={block:d.default.shape({id:d.default.string,isNew:d.default.bool,lock:d.default.bool,type:d.default.string,html:d.default.string,description:d.default.string,project:d.default.number,title:d.default.string}),isEditableRights:d.default.bool.isRequired,ownsDocument:d.default.bool},Object.defineProperty(ve,"SaveBlockBtn",{enumerable:!0,get:function(){return X}})});