useblocks 1.3.11-dev.2 → 1.3.11-dev.3
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.
- package/README.md +1 -1
- package/iframe/.vite/manifest.json +4 -4
- package/iframe/{iframe-eblock.fd4347fc.html → iframe-eblock.5751e42b.html} +2 -2
- package/iframe/{iframe.fd4347fc.html → iframe.5751e42b.html} +2 -2
- package/iframe/js/elMarkupHelper.BpDXO-hq.js +279 -0
- package/iframe/js/{iframe-eblock.body.fd4347fc.js → iframe-eblock.body.5751e42b.js} +1 -1
- package/iframe/js/iframe-eblock.js +2 -2
- package/iframe/js/{iframe.body.fd4347fc.js → iframe.body.5751e42b.js} +1 -1
- package/iframe/js/iframe.js +2 -2
- package/package.json +1 -1
- package/runtime/react/index.js +1 -1
- package/static/core/{6ec347ff.js → 11009bdf.js} +1 -1
- package/static/core/{846cd365.js → 11dadbc0.js} +1 -1
- package/static/core/{31d22827.js → 1c06cdb7.js} +1 -1
- package/static/core/{31da6da0.js → 1c3a16fc.js} +1 -1
- package/static/core/{d48488c4.js → 1c7a6d45.js} +1 -1
- package/static/core/{ab741434.js → 257745eb.js} +1 -1
- package/static/core/{939d4a62.js → 261a3a42.js} +1 -1
- package/static/core/2bed6a18.js +7 -0
- package/static/core/347b0a0b.js +1 -0
- package/static/core/{2865f716.js → 3b65bc50.js} +1 -1
- package/static/core/{bbf48eb9.js → 3d8e2478.js} +1 -1
- package/static/core/{5fd45688.js → 3eeb4445.js} +1 -1
- package/static/core/{17c8ebc4.js → 467344d4.js} +1 -1
- package/static/core/{c5128299.js → 513e36bd.js} +1 -1
- package/static/core/{579d4466.js → 516f59e7.js} +1 -1
- package/static/core/{9d57053a.js → 58dca22f.js} +1 -1
- package/static/core/{9438888a.js → 5da33486.js} +1 -1
- package/static/core/{752288e6.js → 6172f09a.js} +1 -1
- package/static/core/{12963ed5.js → 62855b97.js} +1 -1
- package/static/core/{1fcc0627.js → 66113a18.js} +1 -1
- package/static/core/{7934ed7e.js → 71727873.js} +1 -1
- package/static/core/{c33a9c36.js → 76543cb2.js} +1 -1
- package/static/core/{e9281a4c.js → 7e329493.js} +1 -1
- package/static/core/{70749936.js → 8406bab5.js} +1 -1
- package/static/core/{925b75fb.js → 8845436d.js} +2 -2
- package/static/core/{e37da9a7.js → 94f9492b.js} +1 -1
- package/static/core/{153a5a27.js → aee84e3d.js} +1 -1
- package/static/core/{78500214.js → b55ae539.js} +1 -1
- package/static/core/{8d0796c1.js → b59c63d2.js} +1 -1
- package/static/core/{37bf0f7a.js → b9f553d7.js} +1 -1
- package/static/core/{b0edd3a1.js → bda2d9d5.js} +1 -1
- package/static/core/{9916b298.js → c0a3f7d0.js} +2 -2
- package/static/core/{4181d334.js → c13b3d4f.js} +1 -1
- package/static/core/{2d58a94b.js → d2cf6b4b.js} +1 -1
- package/static/core/{983a408d.js → d343e46e.js} +1 -1
- package/static/core/{3a5bea82.js → d9d5b376.js} +1 -1
- package/static/core/{cc4657d9.js → dd008ec2.js} +1 -1
- package/static/core/{3ca0af3d.js → e037a420.js} +1 -1
- package/static/core/{f8f52e6d.js → e698ec22.js} +1 -1
- package/static/core/{13a6a2d3.js → e7e888c1.js} +1 -1
- package/static/core/ed65b5c3.js +19 -0
- package/static/core/{66b856ca.js → ef035f6b.js} +1 -1
- package/static/core/{dda98b73.js → f1b8515a.js} +1 -1
- package/static/core/{ae251a52.js → f8585ce6.js} +1 -1
- package/static/esm/{f97f42d1.js → c5372168.js} +1 -1
- package/static/umd-runtime/{runtime.CQCs2kHH.js → runtime.Lgfb59e0.js} +1 -1
- package/useblocks-core.5751e42b.js +875 -0
- package/useblocks-esm.js +6 -6
- package/{useblocks-po.fd4347fc.js → useblocks-po.5751e42b.js} +1 -1
- package/useblocks.d.ts +2 -2
- package/useblocks.js +12 -12
- package/vendor/useblocks-ui-kit/package.json +1 -1
- package/iframe/js/elMarkupHelper.DLCHSWwj.js +0 -279
- package/static/core/4f5add14.js +0 -1
- package/static/core/68e393e4.js +0 -19
- package/static/core/f126c14c.js +0 -7
- package/useblocks-core.fd4347fc.js +0 -875
package/static/core/4f5add14.js
DELETED
|
@@ -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}})});
|