Changeset 2995106
- Timestamp:
- 11/13/2023 11:32:42 AM (2 years ago)
- Location:
- headless
- Files:
-
- 3 deleted
- 5 edited
- 60 copied
-
tags/1.9.3 (copied) (copied from headless/trunk)
-
tags/1.9.3/README.txt (copied) (copied from headless/trunk/README.txt) (2 diffs)
-
tags/1.9.3/classes (copied) (copied from headless/trunk/classes)
-
tags/1.9.3/classes/Ajax.php (copied) (copied from headless/trunk/classes/Ajax.php)
-
tags/1.9.3/classes/BlockPreparations/CoreEmbedBlockPreparation.php (copied) (copied from headless/trunk/classes/BlockPreparations/CoreEmbedBlockPreparation.php)
-
tags/1.9.3/classes/BlockPreparations/EmbedBlockPreparation.php (copied) (copied from headless/trunk/classes/BlockPreparations/EmbedBlockPreparation.php)
-
tags/1.9.3/classes/BlockPreparations/FreeFormBlockPreparation.php (copied) (copied from headless/trunk/classes/BlockPreparations/FreeFormBlockPreparation.php)
-
tags/1.9.3/classes/BlockPreparations/GalleryBlockPreparation.php (copied) (copied from headless/trunk/classes/BlockPreparations/GalleryBlockPreparation.php)
-
tags/1.9.3/classes/BlockPreparations/ImageBlockPreparation.php (copied) (copied from headless/trunk/classes/BlockPreparations/ImageBlockPreparation.php)
-
tags/1.9.3/classes/BlockPreparations/ParagraphBlockPreparation.php (copied) (copied from headless/trunk/classes/BlockPreparations/ParagraphBlockPreparation.php)
-
tags/1.9.3/classes/BlockPreparations/ReferenceBlockPreparation.php (copied) (copied from headless/trunk/classes/BlockPreparations/ReferenceBlockPreparation.php)
-
tags/1.9.3/classes/BlockPreparations/TagCloudPreparation.php (copied) (copied from headless/trunk/classes/BlockPreparations/TagCloudPreparation.php)
-
tags/1.9.3/classes/Components/Assets.php (copied) (copied from headless/trunk/classes/Components/Assets.php)
-
tags/1.9.3/classes/Components/Database.php (copied) (copied from headless/trunk/classes/Components/Database.php)
-
tags/1.9.3/classes/Dashboard.php (copied) (copied from headless/trunk/classes/Dashboard.php)
-
tags/1.9.3/classes/Extensions.php (copied) (copied from headless/trunk/classes/Extensions.php)
-
tags/1.9.3/classes/Extensions/CommentAuthorUser.php (copied) (copied from headless/trunk/classes/Extensions/CommentAuthorUser.php)
-
tags/1.9.3/classes/Extensions/ContentBlocks.php (copied) (copied from headless/trunk/classes/Extensions/ContentBlocks.php)
-
tags/1.9.3/classes/Extensions/FeaturedMedia.php (copied) (copied from headless/trunk/classes/Extensions/FeaturedMedia.php)
-
tags/1.9.3/classes/Extensions/Taxonomies.php (copied) (copied from headless/trunk/classes/Extensions/Taxonomies.php)
-
tags/1.9.3/classes/Headers.php (copied) (copied from headless/trunk/classes/Headers.php)
-
tags/1.9.3/classes/Headquarter.php (copied) (copied from headless/trunk/classes/Headquarter.php)
-
tags/1.9.3/classes/Interfaces/IBlockPreparation.php (copied) (copied from headless/trunk/classes/Interfaces/IBlockPreparation.php)
-
tags/1.9.3/classes/Interfaces/ICommentRouteExtension.php (copied) (copied from headless/trunk/classes/Interfaces/ICommentRouteExtension.php)
-
tags/1.9.3/classes/Interfaces/ITermRouteExtension.php (copied) (copied from headless/trunk/classes/Interfaces/ITermRouteExtension.php)
-
tags/1.9.3/classes/Interfaces/IUserRouteExtension.php (copied) (copied from headless/trunk/classes/Interfaces/IUserRouteExtension.php)
-
tags/1.9.3/classes/Links.php (deleted)
-
tags/1.9.3/classes/Log.php (copied) (copied from headless/trunk/classes/Log.php)
-
tags/1.9.3/classes/Migration.php (copied) (copied from headless/trunk/classes/Migration.php)
-
tags/1.9.3/classes/Model/CommentRouteExtensions.php (copied) (copied from headless/trunk/classes/Model/CommentRouteExtensions.php)
-
tags/1.9.3/classes/Model/Frontend.php (copied) (copied from headless/trunk/classes/Model/Frontend.php)
-
tags/1.9.3/classes/Model/TermRouteExtensions.php (copied) (copied from headless/trunk/classes/Model/TermRouteExtensions.php)
-
tags/1.9.3/classes/Model/UserRouteExtensions.php (copied) (copied from headless/trunk/classes/Model/UserRouteExtensions.php)
-
tags/1.9.3/classes/PluginAssets.php (copied) (copied from headless/trunk/classes/PluginAssets.php)
-
tags/1.9.3/classes/Post.php (copied) (copied from headless/trunk/classes/Post.php)
-
tags/1.9.3/classes/Preview.php (copied) (copied from headless/trunk/classes/Preview.php)
-
tags/1.9.3/classes/Query.php (copied) (copied from headless/trunk/classes/Query.php)
-
tags/1.9.3/classes/Revalidate.php (copied) (copied from headless/trunk/classes/Revalidate.php)
-
tags/1.9.3/classes/Schedule.php (copied) (copied from headless/trunk/classes/Schedule.php)
-
tags/1.9.3/classes/Security.php (copied) (copied from headless/trunk/classes/Security.php)
-
tags/1.9.3/classes/Store (copied) (copied from headless/trunk/classes/Store)
-
tags/1.9.3/classes/Store/RevalidationDatabase.php (copied) (copied from headless/trunk/classes/Store/RevalidationDatabase.php)
-
tags/1.9.3/dist (copied) (copied from headless/trunk/dist)
-
tags/1.9.3/dist/admin.asset.php (copied) (copied from headless/trunk/dist/admin.asset.php)
-
tags/1.9.3/dist/admin.js (copied) (copied from headless/trunk/dist/admin.js)
-
tags/1.9.3/dist/gutenberg.asset.php (copied) (copied from headless/trunk/dist/gutenberg.asset.php) (1 diff)
-
tags/1.9.3/dist/gutenberg.css (copied) (copied from headless/trunk/dist/gutenberg.css)
-
tags/1.9.3/dist/gutenberg.js (copied) (copied from headless/trunk/dist/gutenberg.js) (1 diff)
-
tags/1.9.3/dist/gutenberg.ts.asset.php (deleted)
-
tags/1.9.3/dist/gutenberg.ts.js (deleted)
-
tags/1.9.3/headless.php (copied) (copied from headless/trunk/headless.php) (1 diff)
-
tags/1.9.3/public-functions.php (copied) (copied from headless/trunk/public-functions.php)
-
tags/1.9.3/vendor (copied) (copied from headless/trunk/vendor)
-
tags/1.9.3/vendor/autoload.php (copied) (copied from headless/trunk/vendor/autoload.php)
-
tags/1.9.3/vendor/composer/ClassLoader.php (copied) (copied from headless/trunk/vendor/composer/ClassLoader.php)
-
tags/1.9.3/vendor/composer/InstalledVersions.php (copied) (copied from headless/trunk/vendor/composer/InstalledVersions.php)
-
tags/1.9.3/vendor/composer/autoload_classmap.php (copied) (copied from headless/trunk/vendor/composer/autoload_classmap.php)
-
tags/1.9.3/vendor/composer/autoload_namespaces.php (copied) (copied from headless/trunk/vendor/composer/autoload_namespaces.php)
-
tags/1.9.3/vendor/composer/autoload_psr4.php (copied) (copied from headless/trunk/vendor/composer/autoload_psr4.php)
-
tags/1.9.3/vendor/composer/autoload_real.php (copied) (copied from headless/trunk/vendor/composer/autoload_real.php)
-
tags/1.9.3/vendor/composer/autoload_static.php (copied) (copied from headless/trunk/vendor/composer/autoload_static.php)
-
tags/1.9.3/vendor/composer/installed.json (copied) (copied from headless/trunk/vendor/composer/installed.json)
-
tags/1.9.3/vendor/composer/installed.php (copied) (copied from headless/trunk/vendor/composer/installed.php) (2 diffs)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/dist/gutenberg.asset.php (modified) (1 diff)
-
trunk/dist/gutenberg.js (modified) (1 diff)
-
trunk/headless.php (modified) (1 diff)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
headless/tags/1.9.3/README.txt
r2977228 r2995106 4 4 Tags: gutenberg, block, developer, utils 5 5 Requires at least: 5.0 6 Tested up to: 6. 3.16 Tested up to: 6.4.1 7 7 Requires PHP: 8.0 8 Stable tag: 1.9. 28 Stable tag: 1.9.3 9 9 License: GPLv3 10 10 License URI: http://www.gnu.org/licenses/gpl … … 27 27 28 28 == Changelog == 29 30 = 1.9.3 = 31 * Bugfix: post preview with wordpress 6.4.x fixed 29 32 30 33 = 1.9.2 = -
headless/tags/1.9.3/dist/gutenberg.asset.php
r2901812 r2995106 1 <?php return array('dependencies' => array(' wp-components', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-plugins'), 'version' => 'a1d4e0ade9ae4f058d51');1 <?php return array('dependencies' => array('react', 'wp-components', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-plugins'), 'version' => '8aa8f84ae703afb34cae'); -
headless/tags/1.9.3/dist/gutenberg.js
r2901812 r2995106 1 !function(){"use strict";var t=window.wp.plugins,e=window. wp.element,n=window.wp.editPost,s=window.wp.components;var a=window.wp.data;const i=()=>(0,a.useSelect)((t=>t("core/editor").getCurrentPost()),[]),r=t=>{let{index:n,baseUrl:s,controller:a,onStateChanged:r}=t;const{state:o,reload:l}=(t=>{const[n,s]=(0,e.useState)("idle"),a=i(),r=(0,e.useMemo)((()=>null!=a&&a.link?new URL(null==a?void 0:a.link).pathname:""),[a.link]);return{state:n,reload:()=>{s("loading"),(async()=>{try{const e=await fetch(((t,e)=>window.Headless.ajax+`?action=${window.Headless.actions.revalidate}&frontend=${t}&path=${e}`)(t,r)),n=await e.json();n.success?s("success"):(console.error(n),s("error"))}catch(t){s("error")}})()}}})(n),c=i(),d=(0,e.useMemo)((()=>{const t=c.link,e=new URL(t);return s.replace(/^\/|\/$/g,"")+e.pathname}),[c.link]);return(0,e.useEffect)((()=>{a.add(n,l)}),[n]),(0,e.useEffect)((()=>{r(n,o)}),[o]),(0,e.createElement)("div",{title:d},(0,e.createElement)("a",{href:d,target:"_blank"},"Frontend ",n),"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,e.useMemo)((()=>(()=>{const t=new Map;return{add:(e,n)=>{t.set(e,n)},run:()=>{t.forEach((t=>{t()}))}}})()),[]),[o,l]=(0,e.useState)({}),c="publish"==i().status;console.debug(c,o);const d=Object.values(o).find((t=>1==t));return(0,e.createElement)(n.PluginDocumentSettingPanel,{title:"Headless"},c?(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)=>{l((n=>{const s={...n};return s[t]="loading"==e,s}))}}))))),(0,e.createElement)(s.Button,{variant:"secondary",disabled:d||!c,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)})),l.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=l.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 c=i.querySelector(".edit-post-header-preview__grouping-external a"),d=c.getAttribute("target");o.text=c.textContent;const p=document.createElement("span");p.className="dashicons dashicons-external",o.append(p),o.target=d,o.href=n,o.id=r,i.querySelector('[role="group"]').append(o)}),300);const l=document.querySelector("#editor")}))}();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)}))}(); -
headless/tags/1.9.3/headless.php
r2977228 r2995106 5 5 * Plugin URI: https://github.com/palasthotel/headless 6 6 * Description: Adds features to use WordPress as headless CMS 7 * Version: 1.9. 27 * Version: 1.9.3 8 8 * Author: Palasthotel (Edward Bock) <edward.bock@palasthotel.de> 9 9 * Author URI: http://www.palasthotel.de 10 10 * Requires at least: 5.0 11 * Tested up to: 6. 3.111 * Tested up to: 6.4.1 12 12 * Requires PHP: 8.0 13 13 * Text Domain: headless -
headless/tags/1.9.3/vendor/composer/installed.php
r2977228 r2995106 4 4 'pretty_version' => 'dev-main', 5 5 'version' => 'dev-main', 6 'reference' => ' 7a36a6a3806e8755340222f1ea38fcf3f824c187',6 'reference' => 'b82ba4a3f711b11aa67de3f0c502783f30b4fb29', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-main', 15 15 'version' => 'dev-main', 16 'reference' => ' 7a36a6a3806e8755340222f1ea38fcf3f824c187',16 'reference' => 'b82ba4a3f711b11aa67de3f0c502783f30b4fb29', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../', -
headless/trunk/README.txt
r2977228 r2995106 4 4 Tags: gutenberg, block, developer, utils 5 5 Requires at least: 5.0 6 Tested up to: 6. 3.16 Tested up to: 6.4.1 7 7 Requires PHP: 8.0 8 Stable tag: 1.9. 28 Stable tag: 1.9.3 9 9 License: GPLv3 10 10 License URI: http://www.gnu.org/licenses/gpl … … 27 27 28 28 == Changelog == 29 30 = 1.9.3 = 31 * Bugfix: post preview with wordpress 6.4.x fixed 29 32 30 33 = 1.9.2 = -
headless/trunk/dist/gutenberg.asset.php
r2901812 r2995106 1 <?php return array('dependencies' => array(' wp-components', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-plugins'), 'version' => 'a1d4e0ade9ae4f058d51');1 <?php return array('dependencies' => array('react', 'wp-components', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-plugins'), 'version' => '8aa8f84ae703afb34cae'); -
headless/trunk/dist/gutenberg.js
r2901812 r2995106 1 !function(){"use strict";var t=window.wp.plugins,e=window. wp.element,n=window.wp.editPost,s=window.wp.components;var a=window.wp.data;const i=()=>(0,a.useSelect)((t=>t("core/editor").getCurrentPost()),[]),r=t=>{let{index:n,baseUrl:s,controller:a,onStateChanged:r}=t;const{state:o,reload:l}=(t=>{const[n,s]=(0,e.useState)("idle"),a=i(),r=(0,e.useMemo)((()=>null!=a&&a.link?new URL(null==a?void 0:a.link).pathname:""),[a.link]);return{state:n,reload:()=>{s("loading"),(async()=>{try{const e=await fetch(((t,e)=>window.Headless.ajax+`?action=${window.Headless.actions.revalidate}&frontend=${t}&path=${e}`)(t,r)),n=await e.json();n.success?s("success"):(console.error(n),s("error"))}catch(t){s("error")}})()}}})(n),c=i(),d=(0,e.useMemo)((()=>{const t=c.link,e=new URL(t);return s.replace(/^\/|\/$/g,"")+e.pathname}),[c.link]);return(0,e.useEffect)((()=>{a.add(n,l)}),[n]),(0,e.useEffect)((()=>{r(n,o)}),[o]),(0,e.createElement)("div",{title:d},(0,e.createElement)("a",{href:d,target:"_blank"},"Frontend ",n),"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,e.useMemo)((()=>(()=>{const t=new Map;return{add:(e,n)=>{t.set(e,n)},run:()=>{t.forEach((t=>{t()}))}}})()),[]),[o,l]=(0,e.useState)({}),c="publish"==i().status;console.debug(c,o);const d=Object.values(o).find((t=>1==t));return(0,e.createElement)(n.PluginDocumentSettingPanel,{title:"Headless"},c?(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)=>{l((n=>{const s={...n};return s[t]="loading"==e,s}))}}))))),(0,e.createElement)(s.Button,{variant:"secondary",disabled:d||!c,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)})),l.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=l.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 c=i.querySelector(".edit-post-header-preview__grouping-external a"),d=c.getAttribute("target");o.text=c.textContent;const p=document.createElement("span");p.className="dashicons dashicons-external",o.append(p),o.target=d,o.href=n,o.id=r,i.querySelector('[role="group"]').append(o)}),300);const l=document.querySelector("#editor")}))}();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)}))}(); -
headless/trunk/headless.php
r2977228 r2995106 5 5 * Plugin URI: https://github.com/palasthotel/headless 6 6 * Description: Adds features to use WordPress as headless CMS 7 * Version: 1.9. 27 * Version: 1.9.3 8 8 * Author: Palasthotel (Edward Bock) <edward.bock@palasthotel.de> 9 9 * Author URI: http://www.palasthotel.de 10 10 * Requires at least: 5.0 11 * Tested up to: 6. 3.111 * Tested up to: 6.4.1 12 12 * Requires PHP: 8.0 13 13 * Text Domain: headless -
headless/trunk/vendor/composer/installed.php
r2977228 r2995106 4 4 'pretty_version' => 'dev-main', 5 5 'version' => 'dev-main', 6 'reference' => ' 7a36a6a3806e8755340222f1ea38fcf3f824c187',6 'reference' => 'b82ba4a3f711b11aa67de3f0c502783f30b4fb29', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-main', 15 15 'version' => 'dev-main', 16 'reference' => ' 7a36a6a3806e8755340222f1ea38fcf3f824c187',16 'reference' => 'b82ba4a3f711b11aa67de3f0c502783f30b4fb29', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../',
Note: See TracChangeset
for help on using the changeset viewer.