Plugin Directory

Changeset 3020918


Ignore:
Timestamp:
01/12/2024 11:03:34 AM (2 years ago)
Author:
EdwardBock
Message:

release 2.1.1

Location:
headless
Files:
2 added
3 deleted
7 edited
60 copied

Legend:

Unmodified
Added
Removed
  • headless/tags/2.1.1/README.txt

    r2995106 r3020918  
    44Tags: gutenberg, block, developer, utils
    55Requires at least: 5.0
    6 Tested up to: 6.4.1
     6Tested up to: 6.4.2
    77Requires PHP: 8.0
    8 Stable tag: 1.9.3
     8Stable tag: 2.1.0
    99License: GPLv3
    1010License URI: http://www.gnu.org/licenses/gpl
     
    2727
    2828== Changelog ==
     29
     30= 2.1.0 =
     31* Feature: smaller response sizes with headless_variant=teasers
     32
     33= 2.0.0 =
     34* BREAKING CHANGES
     35* Moves from @palasthotel/wp-fetch to @palasthotel/wp-rest
    2936
    3037= 1.9.3 =
  • headless/tags/2.1.1/classes/Extensions/ContentBlocks.php

    r2752593 r3020918  
    2424        $data = $response->get_data();
    2525
    26         if ( has_blocks( $post ) ) {
     26        if(Plugin::instance()->security->isHeadlessRequestVariant(HEADLESS_REST_VARIANT_TEASERS_VALUE)){
     27            unset($data["content"]["rendered"]);
     28            unset($data["content"]["headless_blocks"]);
     29            unset($data["yoast_head"]);
     30            unset($data["yoast_head_json"]);
     31        } else if ( has_blocks( $post ) ) {
    2732            $data["content"]["headless_blocks"] = $this->parse( $post->post_content );
    2833        } else {
  • headless/tags/2.1.1/classes/Security.php

    r2791162 r3020918  
    1414    public function isHeadlessRequest(): bool {
    1515        return isset( $_GET[ HEADLESS_REST_PARAM ] ) && HEADLESS_REST_VALUE == $_GET[ HEADLESS_REST_PARAM ];
     16    }
     17
     18    public function isHeadlessRequestVariant(string $variant): bool {
     19        return isset( $_GET[ HEADLESS_REST_VARIANT_PARAM ] ) && $variant == $_GET[ HEADLESS_REST_VARIANT_PARAM ];
    1620    }
    1721
  • headless/tags/2.1.1/dist/gutenberg.asset.php

    r2995106 r3020918  
    1 <?php return array('dependencies' => array('react', 'wp-components', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-plugins'), 'version' => '8aa8f84ae703afb34cae');
     1<?php return array('dependencies' => array('react', 'wp-components', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-plugins'), 'version' => '5b547f4c4cc23f7700c1');
  • headless/tags/2.1.1/dist/gutenberg.js

    r2995106 r3020918  
    1 !function(){"use strict";var t=window.wp.plugins,e=window.React,n=window.wp.editPost,s=window.wp.components;var a=window.wp.data,i=window.wp.element;const o=()=>(0,a.useSelect)((t=>t("core/editor").getCurrentPost()),[]),r=({index:t,baseUrl:n,controller:s,onStateChanged:a})=>{const{state:r,reload:l}=(t=>{const[e,n]=(0,i.useState)("idle"),s=o(),a=(0,i.useMemo)((()=>s?.link?new URL(s?.link).pathname:""),[s.link]);return{state:e,reload:()=>{n("loading"),(async()=>{try{const e=await fetch(((t,e)=>window.Headless.ajax+`?action=${window.Headless.actions.revalidate}&frontend=${t}&path=${e}`)(t,a)),s=await e.json();s.success?n("success"):(console.error(s),n("error"))}catch(t){n("error")}})()}}})(t),c=o(),d=(0,i.useMemo)((()=>{const t=c.link,e=new URL(t);return n.replace(/^\/|\/$/g,"")+e.pathname}),[c.link]);return(0,i.useEffect)((()=>{s.add(t,l)}),[t]),(0,i.useEffect)((()=>{a(t,r)}),[r]),(0,e.createElement)("div",{title:d},(0,e.createElement)("a",{href:d,target:"_blank"},"Frontend ",t),"loading"==r&&(0,e.createElement)(e.Fragment,null," 🧹"),"success"==r&&(0,e.createElement)(e.Fragment,null," ✅"),"error"==r&&(0,e.createElement)(e.Fragment,null," 🚨"))};(0,t.registerPlugin)("headless-plugin",{icon:()=>null,render:function(){const t=window.Headless.frontends,a=(0,i.useMemo)((()=>(()=>{const t=new Map;return{add:(e,n)=>{t.set(e,n)},run:()=>{t.forEach((t=>{t()}))}}})()),[]),[l,c]=(0,i.useState)({}),d="publish"==o().status,p=Object.values(l).find((t=>1==t));return(0,e.createElement)(n.PluginDocumentSettingPanel,{title:"Headless"},d?(0,e.createElement)(e.Fragment,null,(0,e.createElement)("ol",null,t.map(((t,n)=>(0,e.createElement)("li",{key:n},(0,e.createElement)(r,{baseUrl:t,index:n,controller:a,onStateChanged:(t,e)=>{c((n=>{const s={...n};return s[t]="loading"==e,s}))}}))))),(0,e.createElement)(s.Button,{variant:"secondary",disabled:p||!d,onClick:()=>{a.run()}},"Revalidate cache")):(0,e.createElement)("p",{className:"description"},"Only published contents can be revalidated."))}}),document.addEventListener("DOMContentLoaded",(function(){const t=(0,a.select)("core/editor"),e=t.getCurrentPostId,n=t.isSavingPost,s=(0,a.dispatch)("core/editor"),i=s.autosave,o=s.savePost;console.debug("loaded",{autosave:i,savePost:o});const r=document.createElement("a");r.className="components-button",r.addEventListener("click",(e=>{if(e.preventDefault(),n())return;const s=window.open("about:blank",r.target);!function(t){let e="";e+='\n\t\t<style>\n\t\t\tbody {\n\t\t\t\tmargin: 0;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message {\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\theight: 100vh;\n\t\t\t\twidth: 100vw;\n\t\t\t}\n\t\t\t@-webkit-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-moz-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-o-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg {\n\t\t\t\twidth: 192px;\n\t\t\t\theight: 192px;\n\t\t\t\tstroke: #555d66;\n\t\t\t\tstroke-width: 0.75;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg .outer,\n\t\t\t.editor-post-preview-button__interstitial-message svg .inner {\n\t\t\t\tstroke-dasharray: 280;\n\t\t\t\tstroke-dashoffset: 280;\n\t\t\t\t-webkit-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-moz-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-o-animation: paint 1.5s ease infinite alternate;\n\t\t\t\tanimation: paint 1.5s ease infinite alternate;\n\t\t\t}\n\t\t\tp {\n\t\t\t\ttext-align: center;\n\t\t\t\tfont-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;\n\t\t\t}\n\t\t</style>\n\t',e+='\n        <div class="editor-post-preview-button__interstitial-message">\n            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 96">\n                <path class="outer" d="M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36" fill="none" />\n                <path class="inner" d="M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z" fill="none" />\n            </svg>\n            <p>Generating preview…</p>\n        </div>\n    ',t.write('\n\t\t<style>\n\t\t\tbody {\n\t\t\t\tmargin: 0;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message {\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\theight: 100vh;\n\t\t\t\twidth: 100vw;\n\t\t\t}\n\t\t\t@-webkit-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-moz-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-o-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg {\n\t\t\t\twidth: 192px;\n\t\t\t\theight: 192px;\n\t\t\t\tstroke: #555d66;\n\t\t\t\tstroke-width: 0.75;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg .outer,\n\t\t\t.editor-post-preview-button__interstitial-message svg .inner {\n\t\t\t\tstroke-dasharray: 280;\n\t\t\t\tstroke-dashoffset: 280;\n\t\t\t\t-webkit-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-moz-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-o-animation: paint 1.5s ease infinite alternate;\n\t\t\t\tanimation: paint 1.5s ease infinite alternate;\n\t\t\t}\n\t\t\tp {\n\t\t\t\ttext-align: center;\n\t\t\t\tfont-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;\n\t\t\t}\n\t\t</style>\n\t\n        <div class="editor-post-preview-button__interstitial-message">\n            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 96">\n                <path class="outer" d="M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36" fill="none" />\n                <path class="inner" d="M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z" fill="none" />\n            </svg>\n            <p>Generating preview…</p>\n        </div>\n    '),t.close()}(s.document),((()=>{const e=t.getCurrentPost().status;return"draft"==e||"auto-draft"==e})()?o:i)().then((()=>{s.location=r.href}))})),(0,a.subscribe)((()=>{n()?r.classList.add("is-disabled"):r.classList.remove("is-disabled")})),setInterval((function(){const t=e(),n=(t=>window.Headless.preview_url.replace(window.Headless.post_id_placeholder,`${t}`))(t),s=document.querySelectorAll("[target^=wp-preview-]");s&&s.length&&s.forEach((t=>{t.setAttribute("href",n)})),document.querySelectorAll(".components-snackbar-list .components-snackbar__content a.components-button").forEach((e=>{(e.href.includes("?post="+t)||e.href.includes("?page_id="+t)||e.href.includes("?p="+t))&&(e.href=n,e.target="wp-preview-"+t)}));const a=document.querySelectorAll(".edit-post-post-preview-dropdown .components-menu-group");let i=null;if(a.forEach((t=>{t.querySelector(".edit-post-header-preview__grouping-external")&&(i=t)})),!i)return;const o="headless-preview-link";if(i.querySelector("#"+o))return;const l=i.querySelector(".edit-post-header-preview__grouping-external a"),c=l.getAttribute("target");r.text=l.textContent;const d=document.createElement("span");d.className="dashicons dashicons-external",r.append(d),r.target=c,r.href=n,r.id=o,i.querySelector('[role="group"]').append(r)}),300)}))}();
     1!function(){"use strict";var t=window.wp.plugins,e=window.React,n=window.wp.editPost,s=window.wp.components;var a=window.wp.data,i=window.wp.element;const r=()=>(0,a.useSelect)((t=>t("core/editor").getCurrentPost()),[]),o=({index:t,baseUrl:n,controller:s,onStateChanged:a})=>{const{state:o,reload:l}=(t=>{const[e,n]=(0,i.useState)("idle"),s=r(),a=(0,i.useMemo)((()=>s?.link?new URL(s?.link).pathname:""),[s.link]);return{state:e,reload:()=>{n("loading"),(async()=>{try{const e=await fetch(((t,e)=>window.Headless.ajax+`?action=${window.Headless.actions.revalidate}&frontend=${t}&path=${e}`)(t,a)),s=await e.json();s.success?n("success"):(console.error(s),n("error"))}catch(t){n("error")}})()}}})(t),c=r(),d=(0,i.useMemo)((()=>{const t=c.link,e=new URL(t);return n.replace(/^\/|\/$/g,"")+e.pathname}),[c.link]);return(0,i.useEffect)((()=>{s.add(t,l)}),[t]),(0,i.useEffect)((()=>{a(t,o)}),[o]),(0,e.createElement)("div",{title:d},(0,e.createElement)("a",{href:d,target:"_blank"},"Frontend ",t),"loading"==o&&(0,e.createElement)(e.Fragment,null," 🧹"),"success"==o&&(0,e.createElement)(e.Fragment,null," ✅"),"error"==o&&(0,e.createElement)(e.Fragment,null," 🚨"))};(0,t.registerPlugin)("headless-plugin",{icon:()=>null,render:function(){const t=window.Headless.frontends,a=(0,i.useMemo)((()=>(()=>{const t=new Map;return{add:(e,n)=>{t.set(e,n)},run:()=>{t.forEach((t=>{t()}))}}})()),[]),[l,c]=(0,i.useState)({}),d="publish"==r().status,p=Object.values(l).find((t=>1==t));return(0,e.createElement)(n.PluginDocumentSettingPanel,{title:"Headless"},d?(0,e.createElement)(e.Fragment,null,(0,e.createElement)("ol",null,t.map(((t,n)=>(0,e.createElement)("li",{key:n},(0,e.createElement)(o,{baseUrl:t,index:n,controller:a,onStateChanged:(t,e)=>{c((n=>{const s={...n};return s[t]="loading"==e,s}))}}))))),(0,e.createElement)(s.Button,{variant:"secondary",disabled:p||!d,onClick:()=>{a.run()}},"Revalidate cache")):(0,e.createElement)("p",{className:"description"},"Only published contents can be revalidated."))}}),document.addEventListener("DOMContentLoaded",(function(){const t=(0,a.select)("core/editor"),e=t.getCurrentPostId,n=t.isSavingPost,s=(0,a.dispatch)("core/editor"),i=s.autosave,r=s.savePost,o=document.createElement("a");o.className="components-button",o.addEventListener("click",(e=>{if(e.preventDefault(),n())return;const s=window.open("about:blank",o.target);!function(t){let e="";e+='\n\t\t<style>\n\t\t\tbody {\n\t\t\t\tmargin: 0;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message {\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\theight: 100vh;\n\t\t\t\twidth: 100vw;\n\t\t\t}\n\t\t\t@-webkit-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-moz-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-o-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg {\n\t\t\t\twidth: 192px;\n\t\t\t\theight: 192px;\n\t\t\t\tstroke: #555d66;\n\t\t\t\tstroke-width: 0.75;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg .outer,\n\t\t\t.editor-post-preview-button__interstitial-message svg .inner {\n\t\t\t\tstroke-dasharray: 280;\n\t\t\t\tstroke-dashoffset: 280;\n\t\t\t\t-webkit-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-moz-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-o-animation: paint 1.5s ease infinite alternate;\n\t\t\t\tanimation: paint 1.5s ease infinite alternate;\n\t\t\t}\n\t\t\tp {\n\t\t\t\ttext-align: center;\n\t\t\t\tfont-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;\n\t\t\t}\n\t\t</style>\n\t',e+='\n        <div class="editor-post-preview-button__interstitial-message">\n            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 96">\n                <path class="outer" d="M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36" fill="none" />\n                <path class="inner" d="M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z" fill="none" />\n            </svg>\n            <p>Generating preview…</p>\n        </div>\n    ',t.write('\n\t\t<style>\n\t\t\tbody {\n\t\t\t\tmargin: 0;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message {\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\theight: 100vh;\n\t\t\t\twidth: 100vw;\n\t\t\t}\n\t\t\t@-webkit-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-moz-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-o-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg {\n\t\t\t\twidth: 192px;\n\t\t\t\theight: 192px;\n\t\t\t\tstroke: #555d66;\n\t\t\t\tstroke-width: 0.75;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg .outer,\n\t\t\t.editor-post-preview-button__interstitial-message svg .inner {\n\t\t\t\tstroke-dasharray: 280;\n\t\t\t\tstroke-dashoffset: 280;\n\t\t\t\t-webkit-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-moz-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-o-animation: paint 1.5s ease infinite alternate;\n\t\t\t\tanimation: paint 1.5s ease infinite alternate;\n\t\t\t}\n\t\t\tp {\n\t\t\t\ttext-align: center;\n\t\t\t\tfont-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;\n\t\t\t}\n\t\t</style>\n\t\n        <div class="editor-post-preview-button__interstitial-message">\n            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 96">\n                <path class="outer" d="M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36" fill="none" />\n                <path class="inner" d="M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z" fill="none" />\n            </svg>\n            <p>Generating preview…</p>\n        </div>\n    '),t.close()}(s.document),((()=>{const e=t.getCurrentPost().status;return"draft"==e||"auto-draft"==e})()?r:i)().then((()=>{s.location=o.href}))})),(0,a.subscribe)((()=>{n()?o.classList.add("is-disabled"):o.classList.remove("is-disabled")})),setInterval((function(){const t=e(),n=(t=>window.Headless.preview_url.replace(window.Headless.post_id_placeholder,`${t}`))(t),s=document.querySelectorAll("[target^=wp-preview-]");s&&s.length&&s.forEach((t=>{t.setAttribute("href",n)})),document.querySelectorAll(".components-snackbar-list .components-snackbar__content a.components-button").forEach((e=>{(e.href.includes("?post="+t)||e.href.includes("?page_id="+t)||e.href.includes("?p="+t))&&(e.href=n,e.target="wp-preview-"+t)}));const a=document.querySelectorAll(".edit-post-post-preview-dropdown .components-menu-group");let i=null;if(a.forEach((t=>{t.querySelector(".edit-post-header-preview__grouping-external")&&(i=t)})),!i)return;const r="headless-preview-link";if(i.querySelector("#"+r))return;const l=i.querySelector(".edit-post-header-preview__grouping-external a"),c=l.getAttribute("target");o.text=l.textContent;const d=document.createElement("span");d.className="dashicons dashicons-external",o.append(d),o.target=c,o.href=n,o.id=r,i.querySelector('[role="group"]').append(o)}),300)}))}();
  • headless/tags/2.1.1/headless.php

    r2995106 r3020918  
    55 * Plugin URI: https://github.com/palasthotel/headless
    66 * Description: Adds features to use WordPress as headless CMS
    7  * Version: 1.9.3
     7 * Version: 2.0.1
    88 * Author: Palasthotel (Edward Bock) <edward.bock@palasthotel.de>
    99 * Author URI: http://www.palasthotel.de
    1010 * Requires at least: 5.0
    11  * Tested up to: 6.4.1
     11 * Tested up to: 6.4.2
    1212 * Requires PHP: 8.0
    1313 * Text Domain: headless
     
    3535if ( ! defined( 'HEADLESS_REST_VALUE' ) ) {
    3636    define( 'HEADLESS_REST_VALUE', 'true' );
     37}
     38
     39if ( ! defined( 'HEADLESS_REST_VARIANT_PARAM' ) ) {
     40    define( 'HEADLESS_REST_VARIANT_PARAM', "headless_variant" );
     41}
     42if ( ! defined( 'HEADLESS_REST_VARIANT_TEASERS_VALUE' ) ) {
     43    define( 'HEADLESS_REST_VARIANT_TEASERS_VALUE', 'teasers' );
    3744}
    3845
  • headless/tags/2.1.1/vendor/composer/installed.php

    r2995106 r3020918  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => 'b82ba4a3f711b11aa67de3f0c502783f30b4fb29',
     6        'reference' => 'd45e02e9c69ce448180d23ef8931450d764a3b58',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-main',
    1515            'version' => 'dev-main',
    16             'reference' => 'b82ba4a3f711b11aa67de3f0c502783f30b4fb29',
     16            'reference' => 'd45e02e9c69ce448180d23ef8931450d764a3b58',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
  • headless/trunk/README.txt

    r2995106 r3020918  
    44Tags: gutenberg, block, developer, utils
    55Requires at least: 5.0
    6 Tested up to: 6.4.1
     6Tested up to: 6.4.2
    77Requires PHP: 8.0
    8 Stable tag: 1.9.3
     8Stable tag: 2.1.0
    99License: GPLv3
    1010License URI: http://www.gnu.org/licenses/gpl
     
    2727
    2828== Changelog ==
     29
     30= 2.1.0 =
     31* Feature: smaller response sizes with headless_variant=teasers
     32
     33= 2.0.0 =
     34* BREAKING CHANGES
     35* Moves from @palasthotel/wp-fetch to @palasthotel/wp-rest
    2936
    3037= 1.9.3 =
  • headless/trunk/classes/Extensions/ContentBlocks.php

    r2752593 r3020918  
    2424        $data = $response->get_data();
    2525
    26         if ( has_blocks( $post ) ) {
     26        if(Plugin::instance()->security->isHeadlessRequestVariant(HEADLESS_REST_VARIANT_TEASERS_VALUE)){
     27            unset($data["content"]["rendered"]);
     28            unset($data["content"]["headless_blocks"]);
     29            unset($data["yoast_head"]);
     30            unset($data["yoast_head_json"]);
     31        } else if ( has_blocks( $post ) ) {
    2732            $data["content"]["headless_blocks"] = $this->parse( $post->post_content );
    2833        } else {
  • headless/trunk/classes/Security.php

    r2791162 r3020918  
    1414    public function isHeadlessRequest(): bool {
    1515        return isset( $_GET[ HEADLESS_REST_PARAM ] ) && HEADLESS_REST_VALUE == $_GET[ HEADLESS_REST_PARAM ];
     16    }
     17
     18    public function isHeadlessRequestVariant(string $variant): bool {
     19        return isset( $_GET[ HEADLESS_REST_VARIANT_PARAM ] ) && $variant == $_GET[ HEADLESS_REST_VARIANT_PARAM ];
    1620    }
    1721
  • headless/trunk/dist/gutenberg.asset.php

    r2995106 r3020918  
    1 <?php return array('dependencies' => array('react', 'wp-components', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-plugins'), 'version' => '8aa8f84ae703afb34cae');
     1<?php return array('dependencies' => array('react', 'wp-components', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-plugins'), 'version' => '5b547f4c4cc23f7700c1');
  • headless/trunk/dist/gutenberg.js

    r2995106 r3020918  
    1 !function(){"use strict";var t=window.wp.plugins,e=window.React,n=window.wp.editPost,s=window.wp.components;var a=window.wp.data,i=window.wp.element;const o=()=>(0,a.useSelect)((t=>t("core/editor").getCurrentPost()),[]),r=({index:t,baseUrl:n,controller:s,onStateChanged:a})=>{const{state:r,reload:l}=(t=>{const[e,n]=(0,i.useState)("idle"),s=o(),a=(0,i.useMemo)((()=>s?.link?new URL(s?.link).pathname:""),[s.link]);return{state:e,reload:()=>{n("loading"),(async()=>{try{const e=await fetch(((t,e)=>window.Headless.ajax+`?action=${window.Headless.actions.revalidate}&frontend=${t}&path=${e}`)(t,a)),s=await e.json();s.success?n("success"):(console.error(s),n("error"))}catch(t){n("error")}})()}}})(t),c=o(),d=(0,i.useMemo)((()=>{const t=c.link,e=new URL(t);return n.replace(/^\/|\/$/g,"")+e.pathname}),[c.link]);return(0,i.useEffect)((()=>{s.add(t,l)}),[t]),(0,i.useEffect)((()=>{a(t,r)}),[r]),(0,e.createElement)("div",{title:d},(0,e.createElement)("a",{href:d,target:"_blank"},"Frontend ",t),"loading"==r&&(0,e.createElement)(e.Fragment,null," 🧹"),"success"==r&&(0,e.createElement)(e.Fragment,null," ✅"),"error"==r&&(0,e.createElement)(e.Fragment,null," 🚨"))};(0,t.registerPlugin)("headless-plugin",{icon:()=>null,render:function(){const t=window.Headless.frontends,a=(0,i.useMemo)((()=>(()=>{const t=new Map;return{add:(e,n)=>{t.set(e,n)},run:()=>{t.forEach((t=>{t()}))}}})()),[]),[l,c]=(0,i.useState)({}),d="publish"==o().status,p=Object.values(l).find((t=>1==t));return(0,e.createElement)(n.PluginDocumentSettingPanel,{title:"Headless"},d?(0,e.createElement)(e.Fragment,null,(0,e.createElement)("ol",null,t.map(((t,n)=>(0,e.createElement)("li",{key:n},(0,e.createElement)(r,{baseUrl:t,index:n,controller:a,onStateChanged:(t,e)=>{c((n=>{const s={...n};return s[t]="loading"==e,s}))}}))))),(0,e.createElement)(s.Button,{variant:"secondary",disabled:p||!d,onClick:()=>{a.run()}},"Revalidate cache")):(0,e.createElement)("p",{className:"description"},"Only published contents can be revalidated."))}}),document.addEventListener("DOMContentLoaded",(function(){const t=(0,a.select)("core/editor"),e=t.getCurrentPostId,n=t.isSavingPost,s=(0,a.dispatch)("core/editor"),i=s.autosave,o=s.savePost;console.debug("loaded",{autosave:i,savePost:o});const r=document.createElement("a");r.className="components-button",r.addEventListener("click",(e=>{if(e.preventDefault(),n())return;const s=window.open("about:blank",r.target);!function(t){let e="";e+='\n\t\t<style>\n\t\t\tbody {\n\t\t\t\tmargin: 0;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message {\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\theight: 100vh;\n\t\t\t\twidth: 100vw;\n\t\t\t}\n\t\t\t@-webkit-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-moz-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-o-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg {\n\t\t\t\twidth: 192px;\n\t\t\t\theight: 192px;\n\t\t\t\tstroke: #555d66;\n\t\t\t\tstroke-width: 0.75;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg .outer,\n\t\t\t.editor-post-preview-button__interstitial-message svg .inner {\n\t\t\t\tstroke-dasharray: 280;\n\t\t\t\tstroke-dashoffset: 280;\n\t\t\t\t-webkit-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-moz-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-o-animation: paint 1.5s ease infinite alternate;\n\t\t\t\tanimation: paint 1.5s ease infinite alternate;\n\t\t\t}\n\t\t\tp {\n\t\t\t\ttext-align: center;\n\t\t\t\tfont-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;\n\t\t\t}\n\t\t</style>\n\t',e+='\n        <div class="editor-post-preview-button__interstitial-message">\n            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 96">\n                <path class="outer" d="M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36" fill="none" />\n                <path class="inner" d="M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z" fill="none" />\n            </svg>\n            <p>Generating preview…</p>\n        </div>\n    ',t.write('\n\t\t<style>\n\t\t\tbody {\n\t\t\t\tmargin: 0;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message {\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\theight: 100vh;\n\t\t\t\twidth: 100vw;\n\t\t\t}\n\t\t\t@-webkit-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-moz-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-o-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg {\n\t\t\t\twidth: 192px;\n\t\t\t\theight: 192px;\n\t\t\t\tstroke: #555d66;\n\t\t\t\tstroke-width: 0.75;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg .outer,\n\t\t\t.editor-post-preview-button__interstitial-message svg .inner {\n\t\t\t\tstroke-dasharray: 280;\n\t\t\t\tstroke-dashoffset: 280;\n\t\t\t\t-webkit-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-moz-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-o-animation: paint 1.5s ease infinite alternate;\n\t\t\t\tanimation: paint 1.5s ease infinite alternate;\n\t\t\t}\n\t\t\tp {\n\t\t\t\ttext-align: center;\n\t\t\t\tfont-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;\n\t\t\t}\n\t\t</style>\n\t\n        <div class="editor-post-preview-button__interstitial-message">\n            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 96">\n                <path class="outer" d="M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36" fill="none" />\n                <path class="inner" d="M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z" fill="none" />\n            </svg>\n            <p>Generating preview…</p>\n        </div>\n    '),t.close()}(s.document),((()=>{const e=t.getCurrentPost().status;return"draft"==e||"auto-draft"==e})()?o:i)().then((()=>{s.location=r.href}))})),(0,a.subscribe)((()=>{n()?r.classList.add("is-disabled"):r.classList.remove("is-disabled")})),setInterval((function(){const t=e(),n=(t=>window.Headless.preview_url.replace(window.Headless.post_id_placeholder,`${t}`))(t),s=document.querySelectorAll("[target^=wp-preview-]");s&&s.length&&s.forEach((t=>{t.setAttribute("href",n)})),document.querySelectorAll(".components-snackbar-list .components-snackbar__content a.components-button").forEach((e=>{(e.href.includes("?post="+t)||e.href.includes("?page_id="+t)||e.href.includes("?p="+t))&&(e.href=n,e.target="wp-preview-"+t)}));const a=document.querySelectorAll(".edit-post-post-preview-dropdown .components-menu-group");let i=null;if(a.forEach((t=>{t.querySelector(".edit-post-header-preview__grouping-external")&&(i=t)})),!i)return;const o="headless-preview-link";if(i.querySelector("#"+o))return;const l=i.querySelector(".edit-post-header-preview__grouping-external a"),c=l.getAttribute("target");r.text=l.textContent;const d=document.createElement("span");d.className="dashicons dashicons-external",r.append(d),r.target=c,r.href=n,r.id=o,i.querySelector('[role="group"]').append(r)}),300)}))}();
     1!function(){"use strict";var t=window.wp.plugins,e=window.React,n=window.wp.editPost,s=window.wp.components;var a=window.wp.data,i=window.wp.element;const r=()=>(0,a.useSelect)((t=>t("core/editor").getCurrentPost()),[]),o=({index:t,baseUrl:n,controller:s,onStateChanged:a})=>{const{state:o,reload:l}=(t=>{const[e,n]=(0,i.useState)("idle"),s=r(),a=(0,i.useMemo)((()=>s?.link?new URL(s?.link).pathname:""),[s.link]);return{state:e,reload:()=>{n("loading"),(async()=>{try{const e=await fetch(((t,e)=>window.Headless.ajax+`?action=${window.Headless.actions.revalidate}&frontend=${t}&path=${e}`)(t,a)),s=await e.json();s.success?n("success"):(console.error(s),n("error"))}catch(t){n("error")}})()}}})(t),c=r(),d=(0,i.useMemo)((()=>{const t=c.link,e=new URL(t);return n.replace(/^\/|\/$/g,"")+e.pathname}),[c.link]);return(0,i.useEffect)((()=>{s.add(t,l)}),[t]),(0,i.useEffect)((()=>{a(t,o)}),[o]),(0,e.createElement)("div",{title:d},(0,e.createElement)("a",{href:d,target:"_blank"},"Frontend ",t),"loading"==o&&(0,e.createElement)(e.Fragment,null," 🧹"),"success"==o&&(0,e.createElement)(e.Fragment,null," ✅"),"error"==o&&(0,e.createElement)(e.Fragment,null," 🚨"))};(0,t.registerPlugin)("headless-plugin",{icon:()=>null,render:function(){const t=window.Headless.frontends,a=(0,i.useMemo)((()=>(()=>{const t=new Map;return{add:(e,n)=>{t.set(e,n)},run:()=>{t.forEach((t=>{t()}))}}})()),[]),[l,c]=(0,i.useState)({}),d="publish"==r().status,p=Object.values(l).find((t=>1==t));return(0,e.createElement)(n.PluginDocumentSettingPanel,{title:"Headless"},d?(0,e.createElement)(e.Fragment,null,(0,e.createElement)("ol",null,t.map(((t,n)=>(0,e.createElement)("li",{key:n},(0,e.createElement)(o,{baseUrl:t,index:n,controller:a,onStateChanged:(t,e)=>{c((n=>{const s={...n};return s[t]="loading"==e,s}))}}))))),(0,e.createElement)(s.Button,{variant:"secondary",disabled:p||!d,onClick:()=>{a.run()}},"Revalidate cache")):(0,e.createElement)("p",{className:"description"},"Only published contents can be revalidated."))}}),document.addEventListener("DOMContentLoaded",(function(){const t=(0,a.select)("core/editor"),e=t.getCurrentPostId,n=t.isSavingPost,s=(0,a.dispatch)("core/editor"),i=s.autosave,r=s.savePost,o=document.createElement("a");o.className="components-button",o.addEventListener("click",(e=>{if(e.preventDefault(),n())return;const s=window.open("about:blank",o.target);!function(t){let e="";e+='\n\t\t<style>\n\t\t\tbody {\n\t\t\t\tmargin: 0;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message {\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\theight: 100vh;\n\t\t\t\twidth: 100vw;\n\t\t\t}\n\t\t\t@-webkit-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-moz-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-o-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg {\n\t\t\t\twidth: 192px;\n\t\t\t\theight: 192px;\n\t\t\t\tstroke: #555d66;\n\t\t\t\tstroke-width: 0.75;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg .outer,\n\t\t\t.editor-post-preview-button__interstitial-message svg .inner {\n\t\t\t\tstroke-dasharray: 280;\n\t\t\t\tstroke-dashoffset: 280;\n\t\t\t\t-webkit-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-moz-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-o-animation: paint 1.5s ease infinite alternate;\n\t\t\t\tanimation: paint 1.5s ease infinite alternate;\n\t\t\t}\n\t\t\tp {\n\t\t\t\ttext-align: center;\n\t\t\t\tfont-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;\n\t\t\t}\n\t\t</style>\n\t',e+='\n        <div class="editor-post-preview-button__interstitial-message">\n            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 96">\n                <path class="outer" d="M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36" fill="none" />\n                <path class="inner" d="M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z" fill="none" />\n            </svg>\n            <p>Generating preview…</p>\n        </div>\n    ',t.write('\n\t\t<style>\n\t\t\tbody {\n\t\t\t\tmargin: 0;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message {\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\theight: 100vh;\n\t\t\t\twidth: 100vw;\n\t\t\t}\n\t\t\t@-webkit-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-moz-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-o-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg {\n\t\t\t\twidth: 192px;\n\t\t\t\theight: 192px;\n\t\t\t\tstroke: #555d66;\n\t\t\t\tstroke-width: 0.75;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg .outer,\n\t\t\t.editor-post-preview-button__interstitial-message svg .inner {\n\t\t\t\tstroke-dasharray: 280;\n\t\t\t\tstroke-dashoffset: 280;\n\t\t\t\t-webkit-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-moz-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-o-animation: paint 1.5s ease infinite alternate;\n\t\t\t\tanimation: paint 1.5s ease infinite alternate;\n\t\t\t}\n\t\t\tp {\n\t\t\t\ttext-align: center;\n\t\t\t\tfont-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;\n\t\t\t}\n\t\t</style>\n\t\n        <div class="editor-post-preview-button__interstitial-message">\n            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 96">\n                <path class="outer" d="M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36" fill="none" />\n                <path class="inner" d="M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z" fill="none" />\n            </svg>\n            <p>Generating preview…</p>\n        </div>\n    '),t.close()}(s.document),((()=>{const e=t.getCurrentPost().status;return"draft"==e||"auto-draft"==e})()?r:i)().then((()=>{s.location=o.href}))})),(0,a.subscribe)((()=>{n()?o.classList.add("is-disabled"):o.classList.remove("is-disabled")})),setInterval((function(){const t=e(),n=(t=>window.Headless.preview_url.replace(window.Headless.post_id_placeholder,`${t}`))(t),s=document.querySelectorAll("[target^=wp-preview-]");s&&s.length&&s.forEach((t=>{t.setAttribute("href",n)})),document.querySelectorAll(".components-snackbar-list .components-snackbar__content a.components-button").forEach((e=>{(e.href.includes("?post="+t)||e.href.includes("?page_id="+t)||e.href.includes("?p="+t))&&(e.href=n,e.target="wp-preview-"+t)}));const a=document.querySelectorAll(".edit-post-post-preview-dropdown .components-menu-group");let i=null;if(a.forEach((t=>{t.querySelector(".edit-post-header-preview__grouping-external")&&(i=t)})),!i)return;const r="headless-preview-link";if(i.querySelector("#"+r))return;const l=i.querySelector(".edit-post-header-preview__grouping-external a"),c=l.getAttribute("target");o.text=l.textContent;const d=document.createElement("span");d.className="dashicons dashicons-external",o.append(d),o.target=c,o.href=n,o.id=r,i.querySelector('[role="group"]').append(o)}),300)}))}();
  • headless/trunk/headless.php

    r2995106 r3020918  
    55 * Plugin URI: https://github.com/palasthotel/headless
    66 * Description: Adds features to use WordPress as headless CMS
    7  * Version: 1.9.3
     7 * Version: 2.0.1
    88 * Author: Palasthotel (Edward Bock) <edward.bock@palasthotel.de>
    99 * Author URI: http://www.palasthotel.de
    1010 * Requires at least: 5.0
    11  * Tested up to: 6.4.1
     11 * Tested up to: 6.4.2
    1212 * Requires PHP: 8.0
    1313 * Text Domain: headless
     
    3535if ( ! defined( 'HEADLESS_REST_VALUE' ) ) {
    3636    define( 'HEADLESS_REST_VALUE', 'true' );
     37}
     38
     39if ( ! defined( 'HEADLESS_REST_VARIANT_PARAM' ) ) {
     40    define( 'HEADLESS_REST_VARIANT_PARAM', "headless_variant" );
     41}
     42if ( ! defined( 'HEADLESS_REST_VARIANT_TEASERS_VALUE' ) ) {
     43    define( 'HEADLESS_REST_VARIANT_TEASERS_VALUE', 'teasers' );
    3744}
    3845
  • headless/trunk/vendor/composer/installed.php

    r2995106 r3020918  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => 'b82ba4a3f711b11aa67de3f0c502783f30b4fb29',
     6        'reference' => 'd45e02e9c69ce448180d23ef8931450d764a3b58',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-main',
    1515            'version' => 'dev-main',
    16             'reference' => 'b82ba4a3f711b11aa67de3f0c502783f30b4fb29',
     16            'reference' => 'd45e02e9c69ce448180d23ef8931450d764a3b58',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.