diff --git a/blocks/ai-block/edit.js b/blocks/ai-block/edit.js index 0e5388d02b012b2e7143f8a1ae9b0da20c031dd6..6203c8573e7ef576f6540ccac3219fe967f5bdbc 100644 --- a/blocks/ai-block/edit.js +++ b/blocks/ai-block/edit.js @@ -25,6 +25,27 @@ import parseAIResponse from './parser'; const ALLOWED_BLOCKS = ['core/heading', 'core/paragraph', 'core/quote']; +const checkIfHTMLString = (string) => { + const regexForHTML = /<([A-Za-z][A-Za-z0-9]*)\b[^>]*>(.*?)<\/\1>/; + + string = JSON.parse(string); + + const isValid = regexForHTML.test(string); + + if (isValid) { + return true; + } +}; + +const htmlEntities = (str) => { + return String(str) + .replace(/&/g, '&') + .replace(/</g, '<') + .replace(/>/g, '>') + .replace(/"/g, '"') + .replace(/\n/g, '<br />'); +}; + function Edit({ attributes, setAttributes }) { const { title, blockTitle, aiAnswer } = attributes; const [token, setToken] = useState({ token: '' }); @@ -57,7 +78,7 @@ function Edit({ attributes, setAttributes }) { setIsDisabled(true); setProcessingMessage('Processing....'); - /* TODO: these fetch chains look ugly as hell, consider using async/await instead. */ + /* @TODO: these fetch chains look ugly as hell, consider using async/await instead. */ fetch('/session/token') .then((response) => response.text()) .then((csrfToken) => { @@ -71,8 +92,20 @@ function Edit({ attributes, setAttributes }) { }) .then((response) => response.text()) .then((data) => { - console.log(data); - const parsedData = parseAIResponse(data); + let parsedData = ''; + + const regex = /\\u([\d\w]{4})/gi; + const found = data.match(regex); + + if (found !== null && found.length > 0 && checkIfHTMLString(data)) { + /* eslint-disable-next-line prefer-template */ + parsedData = `<code>${htmlEntities( + JSON.parse(data), + )}</code><br /><br />`; + } else { + parsedData = parseAIResponse(data); + } + setToken({ token: parsedData }); setAttributes({ aiAnswer: parsedData }); setIsDisabled(false); diff --git a/blocks/ai-block/parser.js b/blocks/ai-block/parser.js index ded156b6332cdfd78977695fd10dc5b6abffb6c7..dc0ac86206a3bc886099fe5824b2e26ac277f80a 100644 --- a/blocks/ai-block/parser.js +++ b/blocks/ai-block/parser.js @@ -1,16 +1,57 @@ /* Utility class */ -function unicodeToChar(text) { +const checkForSampleCode = (text) => { + let regex = /```[A-Za-z0-9]+/g; + let found = text.match(regex); + let finalCode = ''; + + /* A Snippet of code was found, wrap it around <code> */ + if (found !== null && found.length > 0) { + const beginCode = found[0]; + finalCode = text.replace(beginCode, '<code>'); + finalCode = finalCode.replace('```', '</code>'); + } else { + return text; + } + + // Check for more ``` elements inside the text + regex = /```/g; + found = finalCode.match(regex); + + if (found !== null && found.length > 0) { + found.forEach((element, index) => { + if (index % 2 === 0) { + finalCode = finalCode.replace('```', '<code>'); + } else { + finalCode = finalCode.replace('```', '</code>'); + } + }); + } + + return finalCode; +}; + +const unicodeToChar = (text) => { return text.replace(/\\u[\dA-F]{4}/gi, (match) => { return String.fromCharCode(parseInt(match.replace(/\\u/g, ''), 16)); }); -} +}; -function parseAIResponse(AIResponse) { +const cleanUpSlashes = (text) => { + let parsedData = ''; + parsedData = text.replace(/\\/g, ''); + + return parsedData; +}; + +const parseAIResponse = (AIResponse) => { let parsedData = AIResponse.substring(1, AIResponse.length - 1); parsedData = unicodeToChar(parsedData.replace(/\\n/g, '<br />')); + parsedData = checkForSampleCode(parsedData); + parsedData = cleanUpSlashes(parsedData); - return parsedData; -} + /* eslint-disable-next-line prefer-template */ + return parsedData + '<br /><br />'; +}; export default parseAIResponse; diff --git a/blocks/ai-block/style.scss b/blocks/ai-block/style.scss index 7a38ec9926161bbe5639807dd16e4e6ff6fe7306..fabdf799fbe284dc1906aa1dda5f26cb016bf66f 100644 --- a/blocks/ai-block/style.scss +++ b/blocks/ai-block/style.scss @@ -1,20 +1,10 @@ -.ai-block-content { - display: flex; - gap: 20px; - width: 100%; - - img { - width: 100%; - object-fit: cover; - } - - &.is-style-image-right { - flex-direction: row-reverse; - } - - &.is-style-pet { - h2 + p { - display: none; - } - } - } \ No newline at end of file +/* Styles for the AI Block */ + +img { + width: 100%; + object-fit: cover; +} + +code { + background-color: white !important; +} \ No newline at end of file diff --git a/dist/blocks.asset.php b/dist/blocks.asset.php index 54ec9b3fe113a989ed039cf6f51517e6b5dfd76f..ede81280e59e46923d6d4833320e3d77b0db8c91 100644 --- a/dist/blocks.asset.php +++ b/dist/blocks.asset.php @@ -1 +1 @@ -<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components'), 'version' => 'd50091a699194596645f'); +<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components'), 'version' => 'f023058c5136e39e83cf'); diff --git a/dist/blocks.js b/dist/blocks.js index df866e44a797161f62ae3dd65ac529a63d11ae12..6781a51dcf7f7910fea8db34c4b6e1c4ff6b7d14 100644 --- a/dist/blocks.js +++ b/dist/blocks.js @@ -1 +1 @@ -(()=>{"use strict";var e,t={93:(e,t,n)=>{const l=window.wp.blocks,r=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"gutenberg-ai-tools/ai-block","title":"AI Block","description":"A block that displays content pulled from AI Services based on the input and parameters sent to it.","textdomain":"default","category":"design","icon":"businessman","attributes":{"title":{"type":"string","source":"text","selector":"h2"},"aiAnswer":{"type":"string"},"blockTitle":{"type":"string"}},"supports":{"align":false,"anchor":true,"color":{"background":true,"text":true}},"styles":[{"name":"default","label":"Default","isDefault":true}],"variations":[]}'),a=window.React;var o=n.n(a);const c=window.wp.components,s=window.wp.blockEditor,i=Drupal;class u extends o().Component{render(){return(0,a.createElement)("div",null,(0,a.createElement)("h3",null,this.props.blockTitle),(0,a.createElement)("p",{dangerouslySetInnerHTML:{__html:this.props.answer}}))}}const h=u,p=["core/heading","core/paragraph","core/quote"],v={...r,...r,icon:function(){return(0,a.createElement)("svg",{id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 512 512",style:{enableBackground:"new 0 0 512 512"},xmlSpace:"preserve"},(0,a.createElement)("g",null,(0,a.createElement)("g",null,(0,a.createElement)("path",{d:"M434.863,126.093V77.137h-48.956V0h-33.391v77.137h-42.083V0h-33.391v77.137h-42.083V0h-33.391v77.137h-42.083V0h-33.391 v77.137H77.137v48.956H0v33.391h77.137v42.083H0v33.391h77.137v42.083H0v33.391h77.137v42.083H0v33.391h77.137v48.956h48.956V512 h33.391v-77.137h42.083V512h33.391v-77.137h42.083V512h33.391v-77.137h42.083V512h33.391v-77.137h48.956v-48.956H512v-33.391 h-77.137v-42.083H512v-33.391h-77.137v-42.083H512v-33.391h-77.137v-42.083H512v-33.39H434.863z M401.473,401.471h-0.001H110.529 V110.529h290.944V401.471z"}))),(0,a.createElement)("g",null,(0,a.createElement)("g",null,(0,a.createElement)("path",{d:"M375.773,229.532c0-22.913-14.194-42.903-34.426-51.239c-1.374-26.935-23.718-48.426-50.987-48.426 c-13.221,0-25.283,5.052-34.36,13.325c-9.077-8.273-21.139-13.325-34.36-13.325c-27.27,0-49.615,21.491-50.987,48.426 c-20.234,8.336-34.426,28.326-34.426,51.239c0,9.577,2.445,18.593,6.742,26.459c-4.391,8.051-6.742,17.113-6.742,26.478 c-0.001,23.125,14.25,42.974,34.428,51.253c1.381,26.928,23.722,48.411,50.986,48.411c13.221,0,25.283-5.052,34.36-13.325 c9.077,8.273,21.139,13.325,34.36,13.325c27.265,0,49.606-21.483,50.986-48.411c20.176-8.28,34.428-28.129,34.428-51.253 c0-9.366-2.351-18.428-6.742-26.478C373.328,248.124,375.773,239.108,375.773,229.532z M239.304,331.078 c0,9.74-7.924,17.664-17.664,17.664c-7.943,0-14.674-5.271-16.889-12.497c10.656-2.612,20.43-8.341,27.914-16.604l-24.749-22.417 c-4.226,4.667-10.018,7.237-16.308,7.237c-12.127,0-21.992-9.866-21.992-21.992c0-0.697,0.033-1.389,0.098-2.076 c6.719,2.904,14.12,4.521,21.895,4.521v-33.391c-12.127,0-21.992-9.866-21.992-21.993c-0.001-7.907,4.25-14.938,10.63-18.817 c5.774,8.031,13.85,14.415,23.463,18.021l11.727-31.264c-6.855-2.571-11.461-9.222-11.461-16.549 c0-9.74,7.924-17.664,17.664-17.664c9.74,0,17.664,7.924,17.664,17.664V331.078z M342.285,280.393 c0.065,0.687,0.098,1.379,0.098,2.076c0,12.127-9.866,21.992-21.993,21.992c-6.289,0-12.081-2.57-16.307-7.237l-24.748,22.417 c7.485,8.263,17.258,13.993,27.914,16.604c-2.215,7.227-8.947,12.497-16.889,12.497c-9.74,0-17.664-7.924-17.664-17.664V180.922 c0-9.74,7.924-17.664,17.664-17.664c9.739,0,17.664,7.924,17.664,17.664c0,7.327-4.606,13.978-11.461,16.549l11.727,31.264 c9.613-3.606,17.688-9.991,23.463-18.021c6.38,3.879,10.631,10.911,10.631,18.817c0,12.127-9.866,21.993-21.993,21.993v33.391 C328.164,284.915,335.566,283.297,342.285,280.393z"}))))},edit:function({attributes:e,setAttributes:t}){const{title:n,blockTitle:l,aiAnswer:r}=e,[o,u]=(0,a.useState)({token:""}),[v,d]=(0,a.useState)(!1),[g,m]=(0,a.useState)(""),[b,w]=(0,a.useState)("");return(0,a.createElement)("div",{...(0,s.useBlockProps)()},(0,a.createElement)(s.BlockControls,null),(0,a.createElement)(s.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,i.t)("Block settings"),initialOpen:!0},(0,a.createElement)(c.PanelRow,null),(0,a.createElement)(c.PanelRow,null,(0,a.createElement)(c.TextareaControl,{label:(0,i.t)("Block Title"),help:(0,i.t)("Use this field if you want to put a question title above the answer"),value:l,onChange:e=>t({blockTitle:e})})),(0,a.createElement)(c.PanelRow,null,(0,a.createElement)(c.TextareaControl,{label:(0,i.t)("AI Answer"),help:(0,i.t)("AI answer generated by the engine. You can change the answer here"),value:r,onChange:e=>(e=>{t({aiAnswer:e}),d(!1),m(""),w(n)})(e)})))),(0,a.createElement)("div",null,(0,a.createElement)(s.RichText,{tagName:"h2",placeholder:(0,i.t)("Start typing your question here:"),value:n,onChange:e=>t({title:e})}),(0,a.createElement)("button",{onClick:()=>{if(void 0===n)return m("Please enter a valid question."),!1;if(b===n)return m("You are asking the same question, please ask another question...."),!1;const e={ai_prompt:n};d(!0),m("Processing...."),fetch("/session/token").then((e=>e.text())).then((l=>{fetch("/gutenberg-ai-tools/ai-rest?_format=json",{body:JSON.stringify(e),headers:{"Content-Type":"application/json","X-Csrf-Token":l},method:"POST"}).then((e=>e.text())).then((e=>{console.log(e);const l=function(e){let t=e.substring(1,e.length-1);var n;return n=t.replace(/\\n/g,"<br />"),t=n.replace(/\\u[\dA-F]{4}/gi,(e=>String.fromCharCode(parseInt(e.replace(/\\u/g,""),16)))),t}(e);u({token:l}),t({aiAnswer:l}),d(!1),m(""),w(n)})).catch((e=>console.error(e)))}))},disabled:v},(0,i.t)("Ask AI")),(0,a.createElement)("span",null," ",g),(0,a.createElement)("div",null,(0,a.createElement)("h3",null,l),(0,a.createElement)(h,{question:n,block_title:l,answer:r}),(0,a.createElement)(s.InnerBlocks,{allowedBlocks:p}))))},save:function({attributes:e}){const{title:t,blockTitle:n,aiAnswer:l}=e;return(0,a.createElement)("div",{...s.useBlockProps.save()},(0,a.createElement)("div",null,(0,a.createElement)("div",null,(0,a.createElement)("h3",null,n),(0,a.createElement)(h,{question:t,block_title:n,answer:l}),(0,a.createElement)(s.InnerBlocks.Content,null))))},render:h};(0,l.registerBlockType)("gutenberg-ai-tools/ai-block",v)}},n={};function l(e){var r=n[e];if(void 0!==r)return r.exports;var a=n[e]={exports:{}};return t[e](a,a.exports,l),a.exports}l.m=t,e=[],l.O=(t,n,r,a)=>{if(!n){var o=1/0;for(u=0;u<e.length;u++){for(var[n,r,a]=e[u],c=!0,s=0;s<n.length;s++)(!1&a||o>=a)&&Object.keys(l.O).every((e=>l.O[e](n[s])))?n.splice(s--,1):(c=!1,a<o&&(o=a));if(c){e.splice(u--,1);var i=r();void 0!==i&&(t=i)}}return t}a=a||0;for(var u=e.length;u>0&&e[u-1][2]>a;u--)e[u]=e[u-1];e[u]=[n,r,a]},l.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return l.d(t,{a:t}),t},l.d=(e,t)=>{for(var n in t)l.o(t,n)&&!l.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={617:0,232:0};l.O.j=t=>0===e[t];var t=(t,n)=>{var r,a,[o,c,s]=n,i=0;if(o.some((t=>0!==e[t]))){for(r in c)l.o(c,r)&&(l.m[r]=c[r]);if(s)var u=s(l)}for(t&&t(n);i<o.length;i++)a=o[i],l.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return l.O(u)},n=globalThis.webpackChunkgutenberg_ai_tools=globalThis.webpackChunkgutenberg_ai_tools||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var r=l.O(void 0,[232],(()=>l(93)));r=l.O(r)})(); \ No newline at end of file +(()=>{"use strict";var e,t={93:(e,t,n)=>{const r=window.wp.blocks,l=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"gutenberg-ai-tools/ai-block","title":"AI Block","description":"A block that displays content pulled from AI Services based on the input and parameters sent to it.","textdomain":"default","category":"design","icon":"businessman","attributes":{"title":{"type":"string","source":"text","selector":"h2"},"aiAnswer":{"type":"string"},"blockTitle":{"type":"string"}},"supports":{"align":false,"anchor":true,"color":{"background":true,"text":true}},"styles":[{"name":"default","label":"Default","isDefault":true}],"variations":[]}'),a=window.React;var o=n.n(a);const c=window.wp.components,s=window.wp.blockEditor,i=Drupal;class u extends o().Component{render(){return(0,a.createElement)("div",null,(0,a.createElement)("h3",null,this.props.blockTitle),(0,a.createElement)("p",{dangerouslySetInnerHTML:{__html:this.props.answer}}))}}const h=u,p=["core/heading","core/paragraph","core/quote"],g={...l,...l,icon:function(){return(0,a.createElement)("svg",{id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 512 512",style:{enableBackground:"new 0 0 512 512"},xmlSpace:"preserve"},(0,a.createElement)("g",null,(0,a.createElement)("g",null,(0,a.createElement)("path",{d:"M434.863,126.093V77.137h-48.956V0h-33.391v77.137h-42.083V0h-33.391v77.137h-42.083V0h-33.391v77.137h-42.083V0h-33.391 v77.137H77.137v48.956H0v33.391h77.137v42.083H0v33.391h77.137v42.083H0v33.391h77.137v42.083H0v33.391h77.137v48.956h48.956V512 h33.391v-77.137h42.083V512h33.391v-77.137h42.083V512h33.391v-77.137h42.083V512h33.391v-77.137h48.956v-48.956H512v-33.391 h-77.137v-42.083H512v-33.391h-77.137v-42.083H512v-33.391h-77.137v-42.083H512v-33.39H434.863z M401.473,401.471h-0.001H110.529 V110.529h290.944V401.471z"}))),(0,a.createElement)("g",null,(0,a.createElement)("g",null,(0,a.createElement)("path",{d:"M375.773,229.532c0-22.913-14.194-42.903-34.426-51.239c-1.374-26.935-23.718-48.426-50.987-48.426 c-13.221,0-25.283,5.052-34.36,13.325c-9.077-8.273-21.139-13.325-34.36-13.325c-27.27,0-49.615,21.491-50.987,48.426 c-20.234,8.336-34.426,28.326-34.426,51.239c0,9.577,2.445,18.593,6.742,26.459c-4.391,8.051-6.742,17.113-6.742,26.478 c-0.001,23.125,14.25,42.974,34.428,51.253c1.381,26.928,23.722,48.411,50.986,48.411c13.221,0,25.283-5.052,34.36-13.325 c9.077,8.273,21.139,13.325,34.36,13.325c27.265,0,49.606-21.483,50.986-48.411c20.176-8.28,34.428-28.129,34.428-51.253 c0-9.366-2.351-18.428-6.742-26.478C373.328,248.124,375.773,239.108,375.773,229.532z M239.304,331.078 c0,9.74-7.924,17.664-17.664,17.664c-7.943,0-14.674-5.271-16.889-12.497c10.656-2.612,20.43-8.341,27.914-16.604l-24.749-22.417 c-4.226,4.667-10.018,7.237-16.308,7.237c-12.127,0-21.992-9.866-21.992-21.992c0-0.697,0.033-1.389,0.098-2.076 c6.719,2.904,14.12,4.521,21.895,4.521v-33.391c-12.127,0-21.992-9.866-21.992-21.993c-0.001-7.907,4.25-14.938,10.63-18.817 c5.774,8.031,13.85,14.415,23.463,18.021l11.727-31.264c-6.855-2.571-11.461-9.222-11.461-16.549 c0-9.74,7.924-17.664,17.664-17.664c9.74,0,17.664,7.924,17.664,17.664V331.078z M342.285,280.393 c0.065,0.687,0.098,1.379,0.098,2.076c0,12.127-9.866,21.992-21.993,21.992c-6.289,0-12.081-2.57-16.307-7.237l-24.748,22.417 c7.485,8.263,17.258,13.993,27.914,16.604c-2.215,7.227-8.947,12.497-16.889,12.497c-9.74,0-17.664-7.924-17.664-17.664V180.922 c0-9.74,7.924-17.664,17.664-17.664c9.739,0,17.664,7.924,17.664,17.664c0,7.327-4.606,13.978-11.461,16.549l11.727,31.264 c9.613-3.606,17.688-9.991,23.463-18.021c6.38,3.879,10.631,10.911,10.631,18.817c0,12.127-9.866,21.993-21.993,21.993v33.391 C328.164,284.915,335.566,283.297,342.285,280.393z"}))))},edit:function({attributes:e,setAttributes:t}){const{title:n,blockTitle:r,aiAnswer:l}=e,[o,u]=(0,a.useState)({token:""}),[g,v]=(0,a.useState)(!1),[d,m]=(0,a.useState)(""),[b,w]=(0,a.useState)("");return(0,a.createElement)("div",{...(0,s.useBlockProps)()},(0,a.createElement)(s.BlockControls,null),(0,a.createElement)(s.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,i.t)("Block settings"),initialOpen:!0},(0,a.createElement)(c.PanelRow,null),(0,a.createElement)(c.PanelRow,null,(0,a.createElement)(c.TextareaControl,{label:(0,i.t)("Block Title"),help:(0,i.t)("Use this field if you want to put a question title above the answer"),value:r,onChange:e=>t({blockTitle:e})})),(0,a.createElement)(c.PanelRow,null,(0,a.createElement)(c.TextareaControl,{label:(0,i.t)("AI Answer"),help:(0,i.t)("AI answer generated by the engine. You can change the answer here"),value:l,onChange:e=>(e=>{t({aiAnswer:e}),v(!1),m(""),w(n)})(e)})))),(0,a.createElement)("div",null,(0,a.createElement)(s.RichText,{tagName:"h2",placeholder:(0,i.t)("Start typing your question here:"),value:n,onChange:e=>t({title:e})}),(0,a.createElement)("button",{onClick:()=>{if(void 0===n)return m("Please enter a valid question."),!1;if(b===n)return m("You are asking the same question, please ask another question...."),!1;const e={ai_prompt:n};v(!0),m("Processing...."),fetch("/session/token").then((e=>e.text())).then((r=>{fetch("/gutenberg-ai-tools/ai-rest?_format=json",{body:JSON.stringify(e),headers:{"Content-Type":"application/json","X-Csrf-Token":r},method:"POST"}).then((e=>e.text())).then((e=>{let r="";const l=e.match(/\\u([\d\w]{4})/gi);var a;r=null!==l&&l.length>0&&(e=>{if(e=JSON.parse(e),/<([A-Za-z][A-Za-z0-9]*)\b[^>]*>(.*?)<\/\1>/.test(e))return!0})(e)?`<code>${a=JSON.parse(e),String(a).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/\n/g,"<br />")}</code><br /><br />`:(e=>{let t=e.substring(1,e.length-1);var n;return n=t.replace(/\\n/g,"<br />"),t=n.replace(/\\u[\dA-F]{4}/gi,(e=>String.fromCharCode(parseInt(e.replace(/\\u/g,""),16)))),t=(e=>{let t=/```[A-Za-z0-9]+/g,n=e.match(t),r="";if(!(null!==n&&n.length>0))return e;{const t=n[0];r=e.replace(t,"<code>"),r=r.replace("```","</code>")}return t=/```/g,n=r.match(t),null!==n&&n.length>0&&n.forEach(((e,t)=>{r=t%2==0?r.replace("```","<code>"):r.replace("```","</code>")})),r})(t),t=(e=>{let t="";return t=e.replace(/\\/g,""),t})(t),t+"<br /><br />"})(e),u({token:r}),t({aiAnswer:r}),v(!1),m(""),w(n)})).catch((e=>console.error(e)))}))},disabled:g},(0,i.t)("Ask AI")),(0,a.createElement)("span",null," ",d),(0,a.createElement)("div",null,(0,a.createElement)("h3",null,r),(0,a.createElement)(h,{question:n,block_title:r,answer:l}),(0,a.createElement)(s.InnerBlocks,{allowedBlocks:p}))))},save:function({attributes:e}){const{title:t,blockTitle:n,aiAnswer:r}=e;return(0,a.createElement)("div",{...s.useBlockProps.save()},(0,a.createElement)("div",null,(0,a.createElement)("div",null,(0,a.createElement)("h3",null,n),(0,a.createElement)(h,{question:t,block_title:n,answer:r}),(0,a.createElement)(s.InnerBlocks.Content,null))))},render:h};(0,r.registerBlockType)("gutenberg-ai-tools/ai-block",g)}},n={};function r(e){var l=n[e];if(void 0!==l)return l.exports;var a=n[e]={exports:{}};return t[e](a,a.exports,r),a.exports}r.m=t,e=[],r.O=(t,n,l,a)=>{if(!n){var o=1/0;for(u=0;u<e.length;u++){for(var[n,l,a]=e[u],c=!0,s=0;s<n.length;s++)(!1&a||o>=a)&&Object.keys(r.O).every((e=>r.O[e](n[s])))?n.splice(s--,1):(c=!1,a<o&&(o=a));if(c){e.splice(u--,1);var i=l();void 0!==i&&(t=i)}}return t}a=a||0;for(var u=e.length;u>0&&e[u-1][2]>a;u--)e[u]=e[u-1];e[u]=[n,l,a]},r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={617:0,232:0};r.O.j=t=>0===e[t];var t=(t,n)=>{var l,a,[o,c,s]=n,i=0;if(o.some((t=>0!==e[t]))){for(l in c)r.o(c,l)&&(r.m[l]=c[l]);if(s)var u=s(r)}for(t&&t(n);i<o.length;i++)a=o[i],r.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return r.O(u)},n=globalThis.webpackChunkgutenberg_ai_tools=globalThis.webpackChunkgutenberg_ai_tools||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var l=r.O(void 0,[232],(()=>r(93)));l=r.O(l)})(); \ No newline at end of file diff --git a/dist/style-blocks-rtl.css b/dist/style-blocks-rtl.css index a1ca4db5b2c73d49db0dd9e63e4804007093271a..04feb3cd912d61e47d8a5d1b63a0f6e03c395ad0 100644 --- a/dist/style-blocks-rtl.css +++ b/dist/style-blocks-rtl.css @@ -1 +1 @@ -.ai-block-content{display:flex;gap:20px;width:100%}.ai-block-content img{-o-object-fit:cover;object-fit:cover;width:100%}.ai-block-content.is-style-image-right{flex-direction:row-reverse}.ai-block-content.is-style-pet h2+p{display:none} +img{-o-object-fit:cover;object-fit:cover;width:100%}code{background-color:#fff!important} diff --git a/dist/style-blocks.css b/dist/style-blocks.css index a1ca4db5b2c73d49db0dd9e63e4804007093271a..04feb3cd912d61e47d8a5d1b63a0f6e03c395ad0 100644 --- a/dist/style-blocks.css +++ b/dist/style-blocks.css @@ -1 +1 @@ -.ai-block-content{display:flex;gap:20px;width:100%}.ai-block-content img{-o-object-fit:cover;object-fit:cover;width:100%}.ai-block-content.is-style-image-right{flex-direction:row-reverse}.ai-block-content.is-style-pet h2+p{display:none} +img{-o-object-fit:cover;object-fit:cover;width:100%}code{background-color:#fff!important}