diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d8a5b429..299dfb4f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ All notable changes to this project will be documented in this file, per [the Ke ## [2.0.0] - TBD **Note that Distributor now requires PHP 7.4 or later and WordPress 5.7 or later.** -_This entry was generated for the 2.0.0-beta2 release and will be updated during the Beta and Release Candidate processes._ +_This entry was generated for the 2.0.0-rc1 release and will be updated during the Beta and Release Candidate processes._ ### Added - Migration guide for version 1 to version 2 (props [@peterwilsoncc](https://github.com/peterwilsoncc), [@faisal-alvi](https://github.com/faisal-alvi), [@jeffpaul](https://github.com/jeffpaul) via [#996](https://github.com/10up/distributor/pull/996)). @@ -27,7 +27,7 @@ _This entry was generated for the 2.0.0-beta2 release and will be updated during - Now requires PHP 7.4 or later and WordPress 5.7 or later (props [@peterwilsoncc](https://github.com/peterwilsoncc), [@vikrampm1](https://github.com/vikrampm1), [@iamdharmesh](https://github.com/iamdharmesh), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter) via [#917](https://github.com/10up/distributor/pull/917)). - Descriptive warning message copy on remote, distributed posts (props [@jeffpaul](https://github.com/jeffpaul), [@peterwilsoncc](https://github.com/peterwilsoncc), [@cadic](https://github.com/cadic) via [#1006](https://github.com/10up/distributor/pull/1006)). - Indicate if the origin post has been deleted in Distributor push interface (props [@peterwilsoncc](https://github.com/peterwilsoncc), [@cadic](https://github.com/cadic), [@jeffpaul](https://github.com/jeffpaul), [@faisal-alvi](https://github.com/faisal-alvi) via [#1067](https://github.com/10up/distributor/pull/1067)). -- Toggles the Distributor admin bar element in Gutenberg based on the post status (props [@ggutenberg](https://github.com/ggutenberg), [@jeffpaul](https://github.com/jeffpaul), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#1022](https://github.com/10up/distributor/pull/1022)). +- Toggles the Distributor admin bar element in Gutenberg based on the post status (props [@ggutenberg](https://github.com/ggutenberg), [@jeffpaul](https://github.com/jeffpaul), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#1022](https://github.com/10up/distributor/pull/1022), [#1114](https://github.com/10up/distributor/pull/1114)). - Reduced duplicate code pushing posts to connections (props [@peterwilsoncc](https://github.com/peterwilsoncc), [@cadic](https://github.com/cadic), [@jeffpaul](https://github.com/jeffpaul), [@faisal-alvi](https://github.com/faisal-alvi), [@aaronware](https://github.com/aaronware) via [#999](https://github.com/10up/distributor/pull/999)). - Unified translator comments (props [@peterwilsoncc](https://github.com/peterwilsoncc), [@cadic](https://github.com/cadic) via [#949](https://github.com/10up/distributor/pull/949)). - WordPress "tested up to" version 6.2 (props [@jayedul](https://github.com/jayedul), [@faisal-alvi](https://github.com/faisal-alvi), [@jeffpaul](https://github.com/jeffpaul) via [#1047](https://github.com/10up/distributor/pull/1047)). @@ -61,6 +61,7 @@ _This entry was generated for the 2.0.0-beta2 release and will be updated during - Bump `loader-utils` from 2.0.2 to 2.0.4 (props [@dependabot[bot]](https://github.com/apps/dependabot), [@jeffpaul](https://github.com/jeffpaul), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#963](https://github.com/10up/distributor/pull/963), [#970](https://github.com/10up/distributor/pull/970)). - Bump `simple-git` from 3.11.0 to 3.15.1 (props [@dependabot[bot]](https://github.com/apps/dependabot), [@jeffpaul](https://github.com/jeffpaul), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#983](https://github.com/10up/distributor/pull/983)). - Bump `webpack` from 5.74.0 to 5.76.2 (props [@dependabot[bot]](https://github.com/apps/dependabot), [@jeffpaul](https://github.com/jeffpaul), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#1029](https://github.com/10up/distributor/pull/1029), [#1032](https://github.com/10up/distributor/pull/1032)). +- Bump `word-wrap` from 1.2.3 to 1.2.4 (props [@dependabot[bot]](https://github.com/apps/dependabot), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#1116](https://github.com/10up/distributor/pull/1116)). ## [1.9.1] - 2023-03-15 ### Security diff --git a/dist/js/gutenberg-plugin.min.asset.php b/dist/js/gutenberg-plugin.min.asset.php index d6f0ae08a..94711e3cd 100644 --- a/dist/js/gutenberg-plugin.min.asset.php +++ b/dist/js/gutenberg-plugin.min.asset.php @@ -1 +1 @@ - array('wp-components', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-plugins', 'wp-polyfill', 'wp-primitives'), 'version' => 'cb036bce1fae95a29788'); + array('wp-components', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-plugins', 'wp-polyfill', 'wp-primitives'), 'version' => '715f53eabc2b98948590'); diff --git a/dist/js/gutenberg-plugin.min.js b/dist/js/gutenberg-plugin.min.js index f0bc8412b..6553fe680 100644 --- a/dist/js/gutenberg-plugin.min.js +++ b/dist/js/gutenberg-plugin.min.js @@ -1 +1 @@ -(()=>{"use strict";const t=window.wp.element,e=window.wp.primitives,i=(0,t.createElement)(e.SVG,{width:"36",height:"39",viewBox:"0 0 36 39",xmlns:"http://www.w3.org/2000/svg"},(0,t.createElement)(e.Path,{d:"M7.938 23.11c-.93 0-1.646.794-1.646 1.826 0 .953.715 1.826 1.575 1.826a12.226 12.226 0 0 0 4.152 3.968 10.2 10.2 0 0 0 4.94 1.27c4.152 0 8.161-2.54 10.166-6.984 1.36-3.016 1.503-6.35.573-9.524-1.003-3.175-3.007-5.715-5.728-7.223-5.584-3.016-12.314-.476-15.106 5.714l-.215.397h.072c-.286.635-.501 1.508.072 1.826l5.942 2.54c0 .238-.072.476-.072.714 0 2.619 1.933 4.762 4.296 4.762 2.362 0 4.295-2.143 4.295-4.762 0-2.62-1.933-4.762-4.295-4.762-1.432 0-2.72.793-3.508 1.984l-4.869-2.064c1.146-2.38 3.007-4.206 5.298-5.08 2.363-.872 4.94-.713 7.231.477 4.654 2.54 6.587 8.81 4.296 13.969-1.074 2.54-3.007 4.365-5.441 5.317-2.363.873-4.94.715-7.231-.476-1.36-.714-2.506-1.825-3.437-3.174.072-.238.144-.477.144-.715.143-.952-.645-1.825-1.504-1.825Z"}),(0,t.createElement)(e.Path,{fillRule:"evenodd",d:"M12.019 30.73a12.226 12.226 0 0 1-4.152-3.968c-.86 0-1.575-.873-1.575-1.826 0-1.032.715-1.825 1.646-1.825.86 0 1.647.873 1.504 1.825 0 .238-.072.477-.144.715.931 1.349 2.077 2.46 3.437 3.174 2.29 1.19 4.868 1.35 7.23.477 2.435-.953 4.368-2.778 5.442-5.318 2.29-5.16.358-11.43-4.296-13.969-2.29-1.19-4.868-1.35-7.23-.476-2.204.84-4.01 2.56-5.165 4.81-.045.09-.09.179-.134.27l4.869 2.063c.787-1.19 2.076-1.984 3.508-1.984 2.362 0 4.295 2.143 4.295 4.762 0 2.619-1.933 4.762-4.295 4.762-2.363 0-4.296-2.143-4.296-4.762 0-.12.018-.238.036-.357.018-.12.036-.238.036-.358l-5.942-2.54c-.487-.269-.405-.94-.194-1.525a4.051 4.051 0 0 1 .122-.3H6.65l.215-.397c2.792-6.19 9.522-8.73 15.106-5.714 2.72 1.508 4.725 4.048 5.728 7.223.93 3.174.787 6.508-.573 9.524C25.12 29.46 21.111 32 16.959 32a10.2 10.2 0 0 1-4.94-1.27ZM6.595 13.85c2.858-6.323 9.765-8.952 15.518-5.845l.003.002c2.793 1.548 4.844 4.153 5.868 7.394l.002.006c.94 3.223.791 6.662-.588 9.732-2.05 4.544-6.16 7.161-10.44 7.161a10.631 10.631 0 0 1-5.085-1.307l-.004-.003a12.653 12.653 0 0 1-4.17-3.937c-.985-.103-1.708-1.103-1.708-2.117 0-1.167.822-2.125 1.947-2.125 1.04 0 1.96 1.028 1.803 2.15-.006.22-.058.439-.114.636.896 1.271 1.962 2.29 3.246 2.962 2.216 1.152 4.704 1.304 6.986.462 2.359-.924 4.23-2.69 5.271-5.154l.003-.005c2.233-5.03.338-11.123-4.163-13.582-2.215-1.15-4.703-1.303-6.984-.46-2.12.808-3.868 2.465-4.993 4.647l4.35 1.844c.845-1.149 2.155-1.913 3.616-1.913 2.556 0 4.595 2.307 4.595 5.062 0 2.755-2.039 5.062-4.595 5.062-2.557 0-4.596-2.307-4.596-5.062.001-.142.021-.283.04-.402l.002-.017.015-.104-5.76-2.461-.013-.008c-.43-.238-.533-.68-.512-1.072.014-.23.072-.48.149-.716h-.138l.45-.83Z"}),(0,t.createElement)(e.Path,{d:"M32.128 10.017c0-1.01-.733-1.788-1.685-1.788-.952 0-1.685.777-1.685 1.788 0 .933.733 1.71 1.612 1.788 2.49 4.586 2.71 10.26.513 15.08-1.832 3.886-4.909 6.762-8.718 8.083-3.81 1.4-7.912 1.089-11.502-.777C3.191 30.305.113 20.666 3.777 12.737c2.197-4.741 6.52-8.006 11.355-8.783.293.388.732.622 1.245.622.953 0 1.685-.778 1.685-1.788S17.33 1 16.377 1c-.659 0-1.172.389-1.465.933-5.494.855-10.403 4.586-12.894 9.95a19.201 19.201 0 0 0-.805 13.835c1.465 4.587 4.542 8.24 8.571 10.417C12.201 37.378 14.766 38 17.256 38c6.3 0 12.381-3.731 15.312-10.105 2.49-5.441 2.27-11.893-.586-17.1.073-.234.146-.467.146-.778Z"}),(0,t.createElement)(e.Path,{fillRule:"evenodd",d:"M2.018 11.882c2.491-5.363 7.4-9.094 12.894-9.95.293-.543.806-.932 1.465-.932.953 0 1.685.777 1.685 1.788 0 1.01-.732 1.788-1.685 1.788-.512 0-.952-.234-1.245-.622-4.835.777-9.158 4.042-11.355 8.783-3.663 7.929-.586 17.568 6.886 21.454 3.59 1.866 7.692 2.177 11.502.777 3.81-1.32 6.886-4.197 8.718-8.084 2.198-4.819 1.978-10.493-.513-15.08-.88-.077-1.612-.854-1.612-1.787 0-1.01.733-1.788 1.685-1.788.952 0 1.685.777 1.685 1.788 0 .31-.073.544-.146.777 2.857 5.208 3.077 11.66.586 17.101C29.638 34.269 23.557 38 17.256 38c-2.49 0-5.055-.622-7.472-1.865-4.03-2.177-7.106-5.83-8.571-10.416a19.201 19.201 0 0 1 .805-13.837Zm30.288-1.12c.061-.207.12-.45.122-.745 0-1.16-.85-2.088-1.985-2.088-1.134 0-1.985.929-1.985 2.088 0 1.029.762 1.897 1.72 2.065 2.378 4.479 2.569 9.99.433 14.676-1.8 3.82-4.818 6.635-8.544 7.927l-.006.002c-3.727 1.37-7.742 1.066-11.26-.762C3.482 30.117.45 20.656 4.05 12.863c2.132-4.599 6.297-7.776 10.963-8.585.343.375.821.598 1.365.598 1.135 0 1.985-.929 1.985-2.088 0-1.16-.85-2.088-1.985-2.088-.735 0-1.307.405-1.653.959-5.54.913-10.468 4.693-12.978 10.097v.002a19.624 19.624 0 0 0-.82 14.052c1.49 4.66 4.618 8.375 8.715 10.588l.006.003c2.45 1.258 5.083 1.897 7.61 1.899 6.419 0 12.605-3.801 15.583-10.28 2.512-5.487 2.31-11.986-.535-17.258Z"}),(0,t.createElement)(e.Path,{d:"M19.291 2.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0ZM33.291 10.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0ZM10.291 25.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0Z"})),n=window.wp.components,r=window.wp.data,s=window.wp.editPost,o=window.wp.i18n,l=window.wp.plugins,{document:c,dt:a,dtGutenberg:u,MouseEvent:d}=window,p=()=>{const e=c.body.classList;if(0!==parseInt(u.syndicationTime))return null;const i=c.querySelector("#wp-admin-bar-distributor"),n=c.querySelector("#wp-admin-bar-distributor > a");if(!i||!n)return(0,t.createElement)("div",{className:"distributor-toggle"},(0,t.createElement)("span",null,(0,o.__)("Refresh page to see distribution options","distributor")));const s=(0,r.select)("core/edit-post").isFeatureActive("fullscreenMode");return(0,t.createElement)("div",{className:"distributor-toggle"},(0,t.createElement)("button",{className:"components-button is-secondary",type:"button",onClick:()=>{const t=new d("mouseenter");s?e.add("is-showing-distributor"):e.remove("is-showing-distributor"),i.classList.toggle("hover"),n.dispatchEvent(t)}},(0,o.sprintf)((0,o.__)("Distribute %1$s","distributor"),u.postTypeSingular.toLowerCase()||(0,o._x)("content","generic term for post content","distributor"))))},m=()=>0!==parseInt(u.syndicationTime)?null:(0,t.createElement)("p",null,(0,o.__)("Distribution options available once published","distributor")),b=()=>0(0,t.createElement)("span",{id:"distributed-to"},(0,o.sprintf)((0,o._n)("Distributed to %1$s connection.","Distributed to %1$s connections.",1*u.syndicationCount,"distributor"),u.syndicationCount)),g=()=>(0,t.createElement)("span",{id:"distributed-from"},(0,o.sprintf)((0,o.__)("Distributed on: %1$s","distributor"),u.syndicationTime)),E=()=>(0,t.createElement)(n.Icon,{className:"components-panel__icon",icon:i,size:20});(0,l.registerPlugin)("distributor-plugin",{render:()=>{if(u.noPermissions&&1===parseInt(u.noPermissions))return null;const e=(0,r.useSelect)((t=>t("core/editor").getCurrentPostType())),i=(0,r.useSelect)((t=>t("core/editor").getCurrentPostAttribute("status")));if(u.supportedPostTypes&&void 0===u.supportedPostTypes[e])return null;const n=c.querySelector("#wp-admin-bar-distributor"),l=(0,r.useSelect)((t=>t("core/editor").getCurrentPost()));return a.postTitle=l.title,u.supportedPostStati&&!u.supportedPostStati.includes(i)?(n?.classList.add("hide"),(0,t.createElement)(s.PluginDocumentSettingPanel,{title:(0,o.__)("Distributor","distributor"),icon:E,className:"distributor-panel"},(0,t.createElement)(m,null),(0,t.createElement)(b,null))):(n?.classList.remove("hide"),(0,t.createElement)(s.PluginDocumentSettingPanel,{title:(0,o.__)("Distributor","distributor"),icon:E,className:"distributor-panel"},(0,t.createElement)(p,null),(0,t.createElement)(b,null)))}})})(); \ No newline at end of file +(()=>{"use strict";const t=window.wp.element,e=window.wp.primitives,i=(0,t.createElement)(e.SVG,{width:"36",height:"39",viewBox:"0 0 36 39",xmlns:"http://www.w3.org/2000/svg"},(0,t.createElement)(e.Path,{d:"M7.938 23.11c-.93 0-1.646.794-1.646 1.826 0 .953.715 1.826 1.575 1.826a12.226 12.226 0 0 0 4.152 3.968 10.2 10.2 0 0 0 4.94 1.27c4.152 0 8.161-2.54 10.166-6.984 1.36-3.016 1.503-6.35.573-9.524-1.003-3.175-3.007-5.715-5.728-7.223-5.584-3.016-12.314-.476-15.106 5.714l-.215.397h.072c-.286.635-.501 1.508.072 1.826l5.942 2.54c0 .238-.072.476-.072.714 0 2.619 1.933 4.762 4.296 4.762 2.362 0 4.295-2.143 4.295-4.762 0-2.62-1.933-4.762-4.295-4.762-1.432 0-2.72.793-3.508 1.984l-4.869-2.064c1.146-2.38 3.007-4.206 5.298-5.08 2.363-.872 4.94-.713 7.231.477 4.654 2.54 6.587 8.81 4.296 13.969-1.074 2.54-3.007 4.365-5.441 5.317-2.363.873-4.94.715-7.231-.476-1.36-.714-2.506-1.825-3.437-3.174.072-.238.144-.477.144-.715.143-.952-.645-1.825-1.504-1.825Z"}),(0,t.createElement)(e.Path,{fillRule:"evenodd",d:"M12.019 30.73a12.226 12.226 0 0 1-4.152-3.968c-.86 0-1.575-.873-1.575-1.826 0-1.032.715-1.825 1.646-1.825.86 0 1.647.873 1.504 1.825 0 .238-.072.477-.144.715.931 1.349 2.077 2.46 3.437 3.174 2.29 1.19 4.868 1.35 7.23.477 2.435-.953 4.368-2.778 5.442-5.318 2.29-5.16.358-11.43-4.296-13.969-2.29-1.19-4.868-1.35-7.23-.476-2.204.84-4.01 2.56-5.165 4.81-.045.09-.09.179-.134.27l4.869 2.063c.787-1.19 2.076-1.984 3.508-1.984 2.362 0 4.295 2.143 4.295 4.762 0 2.619-1.933 4.762-4.295 4.762-2.363 0-4.296-2.143-4.296-4.762 0-.12.018-.238.036-.357.018-.12.036-.238.036-.358l-5.942-2.54c-.487-.269-.405-.94-.194-1.525a4.051 4.051 0 0 1 .122-.3H6.65l.215-.397c2.792-6.19 9.522-8.73 15.106-5.714 2.72 1.508 4.725 4.048 5.728 7.223.93 3.174.787 6.508-.573 9.524C25.12 29.46 21.111 32 16.959 32a10.2 10.2 0 0 1-4.94-1.27ZM6.595 13.85c2.858-6.323 9.765-8.952 15.518-5.845l.003.002c2.793 1.548 4.844 4.153 5.868 7.394l.002.006c.94 3.223.791 6.662-.588 9.732-2.05 4.544-6.16 7.161-10.44 7.161a10.631 10.631 0 0 1-5.085-1.307l-.004-.003a12.653 12.653 0 0 1-4.17-3.937c-.985-.103-1.708-1.103-1.708-2.117 0-1.167.822-2.125 1.947-2.125 1.04 0 1.96 1.028 1.803 2.15-.006.22-.058.439-.114.636.896 1.271 1.962 2.29 3.246 2.962 2.216 1.152 4.704 1.304 6.986.462 2.359-.924 4.23-2.69 5.271-5.154l.003-.005c2.233-5.03.338-11.123-4.163-13.582-2.215-1.15-4.703-1.303-6.984-.46-2.12.808-3.868 2.465-4.993 4.647l4.35 1.844c.845-1.149 2.155-1.913 3.616-1.913 2.556 0 4.595 2.307 4.595 5.062 0 2.755-2.039 5.062-4.595 5.062-2.557 0-4.596-2.307-4.596-5.062.001-.142.021-.283.04-.402l.002-.017.015-.104-5.76-2.461-.013-.008c-.43-.238-.533-.68-.512-1.072.014-.23.072-.48.149-.716h-.138l.45-.83Z"}),(0,t.createElement)(e.Path,{d:"M32.128 10.017c0-1.01-.733-1.788-1.685-1.788-.952 0-1.685.777-1.685 1.788 0 .933.733 1.71 1.612 1.788 2.49 4.586 2.71 10.26.513 15.08-1.832 3.886-4.909 6.762-8.718 8.083-3.81 1.4-7.912 1.089-11.502-.777C3.191 30.305.113 20.666 3.777 12.737c2.197-4.741 6.52-8.006 11.355-8.783.293.388.732.622 1.245.622.953 0 1.685-.778 1.685-1.788S17.33 1 16.377 1c-.659 0-1.172.389-1.465.933-5.494.855-10.403 4.586-12.894 9.95a19.201 19.201 0 0 0-.805 13.835c1.465 4.587 4.542 8.24 8.571 10.417C12.201 37.378 14.766 38 17.256 38c6.3 0 12.381-3.731 15.312-10.105 2.49-5.441 2.27-11.893-.586-17.1.073-.234.146-.467.146-.778Z"}),(0,t.createElement)(e.Path,{fillRule:"evenodd",d:"M2.018 11.882c2.491-5.363 7.4-9.094 12.894-9.95.293-.543.806-.932 1.465-.932.953 0 1.685.777 1.685 1.788 0 1.01-.732 1.788-1.685 1.788-.512 0-.952-.234-1.245-.622-4.835.777-9.158 4.042-11.355 8.783-3.663 7.929-.586 17.568 6.886 21.454 3.59 1.866 7.692 2.177 11.502.777 3.81-1.32 6.886-4.197 8.718-8.084 2.198-4.819 1.978-10.493-.513-15.08-.88-.077-1.612-.854-1.612-1.787 0-1.01.733-1.788 1.685-1.788.952 0 1.685.777 1.685 1.788 0 .31-.073.544-.146.777 2.857 5.208 3.077 11.66.586 17.101C29.638 34.269 23.557 38 17.256 38c-2.49 0-5.055-.622-7.472-1.865-4.03-2.177-7.106-5.83-8.571-10.416a19.201 19.201 0 0 1 .805-13.837Zm30.288-1.12c.061-.207.12-.45.122-.745 0-1.16-.85-2.088-1.985-2.088-1.134 0-1.985.929-1.985 2.088 0 1.029.762 1.897 1.72 2.065 2.378 4.479 2.569 9.99.433 14.676-1.8 3.82-4.818 6.635-8.544 7.927l-.006.002c-3.727 1.37-7.742 1.066-11.26-.762C3.482 30.117.45 20.656 4.05 12.863c2.132-4.599 6.297-7.776 10.963-8.585.343.375.821.598 1.365.598 1.135 0 1.985-.929 1.985-2.088 0-1.16-.85-2.088-1.985-2.088-.735 0-1.307.405-1.653.959-5.54.913-10.468 4.693-12.978 10.097v.002a19.624 19.624 0 0 0-.82 14.052c1.49 4.66 4.618 8.375 8.715 10.588l.006.003c2.45 1.258 5.083 1.897 7.61 1.899 6.419 0 12.605-3.801 15.583-10.28 2.512-5.487 2.31-11.986-.535-17.258Z"}),(0,t.createElement)(e.Path,{d:"M19.291 2.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0ZM33.291 10.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0ZM10.291 25.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0Z"})),n=window.wp.components,s=window.wp.data,r=window.wp.editPost,o=window.wp.i18n,l=window.wp.plugins,{document:c,dt:a,dtGutenberg:u,MouseEvent:d}=window,p=()=>{const e=c.body.classList;if(0!==parseInt(u.syndicationTime))return null;const i=c.querySelector("#wp-admin-bar-distributor"),n=c.querySelector("#wp-admin-bar-distributor > a");if(!i||!n)return(0,t.createElement)("div",{className:"distributor-toggle"},(0,t.createElement)("span",null,(0,o.__)("Refresh page to see distribution options","distributor")));const r=(0,s.select)("core/edit-post").isFeatureActive("fullscreenMode");return(0,t.createElement)("div",{className:"distributor-toggle"},(0,t.createElement)("button",{className:"components-button is-secondary",type:"button",onClick:()=>{const t=new d("mouseenter");r?e.add("is-showing-distributor"):e.remove("is-showing-distributor"),i.classList.toggle("hover"),n.dispatchEvent(t)}},(0,o.sprintf)((0,o.__)("Distribute %1$s","distributor"),u.postTypeSingular.toLowerCase()||(0,o._x)("content","generic term for post content","distributor"))))},m=()=>0!==parseInt(u.syndicationTime)?null:(0,t.createElement)("p",null,(0,o.__)("Distribution options available once published","distributor")),b=()=>0(0,t.createElement)("span",{id:"distributed-to"},(0,o.sprintf)((0,o._n)("Distributed to %1$s connection.","Distributed to %1$s connections.",1*u.syndicationCount,"distributor"),u.syndicationCount)),g=()=>(0,t.createElement)("span",{id:"distributed-from"},(0,o.sprintf)((0,o.__)("Distributed on: %1$s","distributor"),u.syndicationTime)),E=()=>(0,t.createElement)(n.Icon,{className:"components-panel__icon",icon:i,size:20});(0,l.registerPlugin)("distributor-plugin",{render:()=>{if(u.noPermissions&&1===parseInt(u.noPermissions))return null;const e=(0,s.useSelect)((t=>t("core/editor").getCurrentPostType())),i=(0,s.useSelect)((t=>t("core/editor").getCurrentPostAttribute("status")));if(u.supportedPostTypes&&void 0===u.supportedPostTypes[e])return null;const n=c.querySelector("#wp-admin-bar-distributor"),l=(0,s.useSelect)((t=>t("core/editor").getCurrentPost()));return a.postTitle=l.title,a.postStatus=l.status,u.supportedPostStati&&!u.supportedPostStati.includes(i)?(n?.classList.add("hide"),(0,t.createElement)(r.PluginDocumentSettingPanel,{title:(0,o.__)("Distributor","distributor"),icon:E,className:"distributor-panel"},(0,t.createElement)(m,null),(0,t.createElement)(b,null))):(n?.classList.remove("hide"),(0,t.createElement)(r.PluginDocumentSettingPanel,{title:(0,o.__)("Distributor","distributor"),icon:E,className:"distributor-panel"},(0,t.createElement)(p,null),(0,t.createElement)(b,null)))}})})(); \ No newline at end of file diff --git a/dist/js/push.min.asset.php b/dist/js/push.min.asset.php index c5cf8eb6b..07dd590fc 100644 --- a/dist/js/push.min.asset.php +++ b/dist/js/push.min.asset.php @@ -1 +1 @@ - array('jquery', 'underscore', 'wp-i18n', 'wp-polyfill'), 'version' => 'ccf98c15a1002128a135'); + array('jquery', 'underscore', 'wp-i18n', 'wp-polyfill'), 'version' => '8e105779b5a1a7b6f9ee'); diff --git a/dist/js/push.min.js b/dist/js/push.min.js index f1d899f46..97a236bc7 100644 --- a/dist/js/push.min.js +++ b/dist/js/push.min.js @@ -1 +1 @@ -(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var s in n)e.o(n,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:n[s]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.jQuery;var n=e.n(t);const s=window._;var r=e.n(s),o=Object.prototype.toString,i=Array.isArray||function(e){return"[object Array]"===o.call(e)};function a(e){return"function"==typeof e}function c(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function l(e,t){return null!=e&&"object"==typeof e&&t in e}var d=RegExp.prototype.test,u=/\S/,p={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="},h=/\s*/,f=/\s+/,g=/\s*=/,y=/\s*\}/,v=/#|\^|\/|>|\{|&|=|!/;function m(e){this.string=e,this.tail=e,this.pos=0}function b(e,t){this.view=e,this.cache={".":this.view},this.parent=t}function w(){this.templateCache={_cache:{},set:function(e,t){this._cache[e]=t},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}m.prototype.eos=function(){return""===this.tail},m.prototype.scan=function(e){var t=this.tail.match(e);if(!t||0!==t.index)return"";var n=t[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n},m.prototype.scanUntil=function(e){var t,n=this.tail.search(e);switch(n){case-1:t=this.tail,this.tail="";break;case 0:t="";break;default:t=this.tail.substring(0,n),this.tail=this.tail.substring(n)}return this.pos+=t.length,t},b.prototype.push=function(e){return new b(e,this)},b.prototype.lookup=function(e){var t,n,s,r=this.cache;if(r.hasOwnProperty(e))t=r[e];else{for(var o,i,c,d=this,u=!1;d;){if(e.indexOf(".")>0)for(o=d.view,i=e.split("."),c=0;null!=o&&c0?r[r.length-1][4]:n;break;default:s.push(t)}return n}(function(e){for(var t,n,s=[],r=0,o=e.length;r"===i?a=this.renderPartial(o,t,n,r):"&"===i?a=this.unescapedValue(o,t):"name"===i?a=this.escapedValue(o,t,r):"text"===i&&(a=this.rawValue(o)),void 0!==a&&(c+=a);return c},w.prototype.renderSection=function(e,t,n,s,r){var o=this,c="",l=t.lookup(e[1]);if(l){if(i(l))for(var d=0,u=l.length;d0||!n)&&(r[o]=s+r[o]);return r.join("\n")},w.prototype.renderPartial=function(e,t,n,s){if(n){var r=this.getConfigTags(s),o=a(n)?n(e[1]):n[e[1]];if(null!=o){var i=e[6],c=e[5],l=e[4],d=o;0==c&&l&&(d=this.indentPartial(o,l,i));var u=this.parse(d,r);return this.renderTokens(u,t,n,d,s)}}},w.prototype.unescapedValue=function(e,t){var n=t.lookup(e[1]);if(null!=n)return n},w.prototype.escapedValue=function(e,t,n){var s=this.getConfigEscape(n)||L.escape,r=t.lookup(e[1]);if(null!=r)return"number"==typeof r&&s===L.escape?String(r):s(r)},w.prototype.rawValue=function(e){return e[1]},w.prototype.getConfigTags=function(e){return i(e)?e:e&&"object"==typeof e?e.tags:void 0},w.prototype.getConfigEscape=function(e){return e&&"object"==typeof e&&!i(e)?e.escape:void 0};var L={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(e){T.templateCache=e},get templateCache(){return T.templateCache}},T=new w;L.clearCache=function(){return T.clearCache()},L.parse=function(e,t){return T.parse(e,t)},L.render=function(e,t,n,s){if("string"!=typeof e)throw new TypeError('Invalid template! Template should be a "string" but "'+(i(r=e)?"array":typeof r)+'" was given as the first argument for mustache#render(template, view, partials)');var r;return T.render(e,t,n,s)},L.escape=function(e){return String(e).replace(/[&<>"'`=\/]/g,(function(e){return p[e]}))},L.Scanner=m,L.Context=b,L.Writer=w;const C=L,k=window.wp.i18n,{document:S,dt:x}=window;let E="",j={},A="";const O=r().memoize((e=>{const t=S.getElementById(e);return!!t&&(t.attributes.template?(C.parse(t.innerHTML),"mustache"):r().template(t.innerHTML,null,{evaluate:/<#([\s\S]+?)#>/g,interpolate:/{{{([\s\S]+?)}}}/g,escape:/{{([^}]+?)}}(?!})/g}))}));n()(window).on("load",(()=>{const e=S.querySelector("#wp-admin-bar-distributor #wp-admin-bar-distributor-placeholder"),t=S.querySelector("#distributor-push-wrapper");if(!e||!t)return;let s="",o="",i="",a="",c="",l="",d="",u="",p="",h="",f="",g="";e.appendChild(t);const y=S.createElement("div");y.id="distributor-overlay";const v=S.querySelector("#wp-admin-bar-distributor");function m(){a=t.querySelector(".new-connections-list"),null!==a&&(c=a.querySelectorAll(".add-connection"),r().each(c,(e=>{e.classList.contains("syndicated")&&(e.disabled=!0)})))}function b(e){t.classList.add("message-error"),g.innerText="",r().each(function(e){return r().isArray(e)?r().map(e,(function(e){return r().isString(e)?e:r().has(e,"message")?e.message:void 0})):[e]}(e),(function(e){const t=S.createElement("li");t.innerText=e,g.appendChild(t)}))}function w(){a.innerText="";const e=O("dt-add-connection");let t="";r().each(s,(n=>{if(""!==A){const e=n.name.replace(/[^0-9a-zA-Z ]+/,"").toLowerCase().match(A.toLowerCase()),t=n.url.replace(/https?:\/\//i,"").replace(/www/i,"").replace(/[^0-9a-zA-Z ]+/,"").toLowerCase().match(A.toLowerCase());if(!e&&!t)return}"mustache"===e?(j[n.type+n.id]?n.added=!0:n.added=!1,"internal"===n.type&&(n.internal=!0),t=C.render(S.getElementById("dt-add-connection").innerHTML,{connection:n})):t=e({connection:n,selectedConnections:j}),a.innerHTML+=t})),""===a.innerHTML&&(a.innerHTML='

No results

'),"mustache"===e&&m()}function L(e){switch(e){case"addEmpty":o.classList.add("empty");break;case"removeEmpty":o.classList.remove("empty");break;case"allUnavailable":d.classList.add("unavailable");break;case"all":d.classList.remove("unavailable");break;case"noneUnavailable":u.classList.add("unavailable");break;case"none":u.classList.remove("unavailable")}}function T(){if(e.focus(),_(),t.classList.contains("loaded")&&x.postTitle===x.previousPostTitle)return;x.previousPostTitle=x.postTitle,t.classList.remove("message-error"),t.classList.add("loaded");const y={action:"dt_load_connections",loadConnectionsNonce:x.loadConnectionsNonce,postId:x.postId},v=O("dt-show-connections"),b=!!x.usexhr&&{withCredentials:!0};n().ajax({url:x.ajaxurl,xhrFields:b,method:"post",data:y}).done((e=>{if(!e.success||!e.data)return t.classList.remove("loaded"),void t.classList.add("message-error");if(s=e.data,"mustache"===v){const e={connections:[]};r().each(s,(t=>{"internal"===t.type&&(t.internal=!0),e.connections.push(t)})),t.innerHTML=C.render(S.getElementById("dt-show-connections").innerHTML,{connections:e.connections,foundConnections:e.connections.length,showSearch:5{""===e.currentTarget.value&&w(),A=e.currentTarget.value.replace(/https?:\/\//i,"").replace(/www/i,"").replace(/[^0-9a-zA-Z ]+/,""),w()}),300)),r().each(c,(e=>{e.classList.contains("syndicated")||(d.classList.remove("unavailable"),l++)}))})).error((()=>{t.classList.remove("loaded"),t.classList.add("message-error")}))}v.parentNode.insertBefore(y,v.nextSibling);const q=S.querySelector("#wp-admin-bar-distributor > a");function _(){v.classList.contains("hover")||v.classList.contains("syncing")||S.body.classList.remove("is-showing-distributor")}q.addEventListener("keydown",(function(e){13===e.keyCode&&T()}),!1),S.body.classList.contains("is-fullscreen-mode")&&window.hoverintent(v,(function(){return null}),_).options({timeout:180}),q.addEventListener("touchstart",T,!1),q.addEventListener("mouseenter",T,!1),y.addEventListener("click",(function(){v.classList.contains("syncing")||(v.classList.contains("hover")&&(v.classList.remove("hover"),S.body.classList.remove("is-showing-distributor")),_())}),!0),n()(t).on("click",".syndicate-button",(()=>{if(v.classList.contains("syncing"))return;v.classList.add("syncing");const e={action:"dt_push",nonce:x.nonce,connections:j,postId:x.postId};e.postStatus=null!==f&&f.checked?"draft":h.value;const a=!!x.usexhr&&{withCredentials:!0};n().ajax({url:x.ajaxurl,xhrFields:a,method:"post",data:e}).done((e=>{setTimeout((()=>{v.classList.remove("syncing"),_(),e.success?e.data&&e.data.results?function(e){let n=!1;const a={};["internal","external"].forEach((t=>{r().each(e[t],((e,o)=>{"success"===e.status&&(s[`${t}${o}`].syndicated=e.url,n=!0),r().isEmpty(e.errors)||(a[`${t}${o}`]=e.errors)}))})),r().isEmpty(a)||b(r().map(a,(function(e,t){return`${s[t].name}:\n${r().map(e,(function(e){return`- ${e}\n`}))}`}))),n&&r().isEmpty(a)&&(t.classList.add("message-success"),o.classList.add("empty"),i.innerText="",setTimeout((()=>{t.classList.remove("message-success")}),6e3)),j={},w()}(e.data.results):b((0,k.__)("Received empty result.","distributor")):b(e.data)}),500)})).error(((e,t,n)=>{setTimeout((()=>{v.classList.remove("syncing"),b(`${(0,k.__)("Ajax error:","distributor")} ${n}`)}),500)}))})),n()(t).on("click",".add-connection",(e=>{if("A"!==e.target.nodeName&&(e.preventDefault(),!e.currentTarget.classList.contains("syndicated")))if(e.currentTarget.classList.contains("added")){const t=e.currentTarget.getAttribute("data-connection-type"),n=e.currentTarget.getAttribute("data-connection-id"),s=i.querySelector(`[data-connection-id="${n}"][data-connection-type="${t}"]`);s.parentNode.removeChild(s),delete j[t+n],E=(0,k.sprintf)((0,k._n)("Selected connection (%d)","Selected connections (%d)",Object.keys(j).length,"distributor"),Object.keys(j).length),S.querySelector(".selected-connections-text").textContent=E,d.classList.contains("unavailable")&&L("all"),Object.keys(j).length||(L("addEmpty"),L("noneUnavailable")),w()}else{const t=e.currentTarget.getAttribute("data-connection-type"),n=e.currentTarget.getAttribute("data-connection-id");j[t+n]=s[t+n];const r=e.currentTarget.cloneNode(!0);E=(0,k.sprintf)((0,k._n)("Selected connection (%d)","Selected connections (%d)",Object.keys(j).length,"distributor"),Object.keys(j).length),S.querySelector(".selected-connections-text").textContent=E;const o=S.createElement("span");o.classList.add("remove-connection"),r.appendChild(o),r.classList="added-connection",i.appendChild(r),u.classList.contains("unavailable")&&(L("removeEmpty"),L("none")),Object.keys(j).length==l&&L("allUnavailable"),w()}})),n()(t).on("click",".selectall-connections",(()=>{n()(a).children(".add-connection").each(((e,t)=>{if(t.classList.contains("syndicated")||t.classList.contains("added"))return;const n=t.getAttribute("data-connection-type"),r=t.getAttribute("data-connection-id");j[n+r]=s[n+r];const o=t.cloneNode();o.innerText=t.innerText;const a=S.createElement("span");a.classList.add("remove-connection"),o.appendChild(a),o.classList="added-connection",E=(0,k.sprintf)((0,k._n)("Selected connection (%d)","Selected connections (%d)",Object.keys(j).length,"distributor"),Object.keys(j).length),S.querySelector(".selected-connections-text").textContent=E,i.appendChild(o),""!==l&&(L("removeEmpty"),L("allUnavailable"),L("none"))})),w()})),n()(t).on("click",".selectno-connections",(()=>{for(;i.firstChild;){const e=i.firstChild.getAttribute("data-connection-type"),t=i.firstChild.getAttribute("data-connection-id");delete j[e+t],E=(0,k.sprintf)((0,k._n)("Selected connection (%d)","Selected connections (%d)",Object.keys(j).length,"distributor"),Object.keys(j).length),S.querySelector(".selected-connections-text").textContent=E,i.removeChild(i.firstChild)}""!==l&&(L("addEmpty"),L("noneUnavailable"),L("all")),w()})),n()(t).on("click",".added-connection",(e=>{e.currentTarget.parentNode.removeChild(e.currentTarget);const t=e.currentTarget.getAttribute("data-connection-type"),n=e.currentTarget.getAttribute("data-connection-id");delete j[t+n],E=(0,k.sprintf)((0,k._n)("Selected connection (%d)","Selected connections (%d)",Object.keys(j).length,"distributor"),Object.keys(j).length),S.querySelector(".selected-connections-text").textContent=E,d.classList.contains("unavailable")&&L("all"),Object.keys(j).length||(L("addEmpty"),L("noneUnavailable")),w()}))}))})(); \ No newline at end of file +(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.jQuery;var n=e.n(t);const r=window._;var s=e.n(r),o=Object.prototype.toString,i=Array.isArray||function(e){return"[object Array]"===o.call(e)};function a(e){return"function"==typeof e}function c(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function l(e,t){return null!=e&&"object"==typeof e&&t in e}var d=RegExp.prototype.test,u=/\S/,p={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="},h=/\s*/,f=/\s+/,g=/\s*=/,y=/\s*\}/,v=/#|\^|\/|>|\{|&|=|!/;function m(e){this.string=e,this.tail=e,this.pos=0}function b(e,t){this.view=e,this.cache={".":this.view},this.parent=t}function w(){this.templateCache={_cache:{},set:function(e,t){this._cache[e]=t},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}m.prototype.eos=function(){return""===this.tail},m.prototype.scan=function(e){var t=this.tail.match(e);if(!t||0!==t.index)return"";var n=t[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n},m.prototype.scanUntil=function(e){var t,n=this.tail.search(e);switch(n){case-1:t=this.tail,this.tail="";break;case 0:t="";break;default:t=this.tail.substring(0,n),this.tail=this.tail.substring(n)}return this.pos+=t.length,t},b.prototype.push=function(e){return new b(e,this)},b.prototype.lookup=function(e){var t,n,r,s=this.cache;if(s.hasOwnProperty(e))t=s[e];else{for(var o,i,c,d=this,u=!1;d;){if(e.indexOf(".")>0)for(o=d.view,i=e.split("."),c=0;null!=o&&c0?s[s.length-1][4]:n;break;default:r.push(t)}return n}(function(e){for(var t,n,r=[],s=0,o=e.length;s"===i?a=this.renderPartial(o,t,n,s):"&"===i?a=this.unescapedValue(o,t):"name"===i?a=this.escapedValue(o,t,s):"text"===i&&(a=this.rawValue(o)),void 0!==a&&(c+=a);return c},w.prototype.renderSection=function(e,t,n,r,s){var o=this,c="",l=t.lookup(e[1]);if(l){if(i(l))for(var d=0,u=l.length;d0||!n)&&(s[o]=r+s[o]);return s.join("\n")},w.prototype.renderPartial=function(e,t,n,r){if(n){var s=this.getConfigTags(r),o=a(n)?n(e[1]):n[e[1]];if(null!=o){var i=e[6],c=e[5],l=e[4],d=o;0==c&&l&&(d=this.indentPartial(o,l,i));var u=this.parse(d,s);return this.renderTokens(u,t,n,d,r)}}},w.prototype.unescapedValue=function(e,t){var n=t.lookup(e[1]);if(null!=n)return n},w.prototype.escapedValue=function(e,t,n){var r=this.getConfigEscape(n)||L.escape,s=t.lookup(e[1]);if(null!=s)return"number"==typeof s&&r===L.escape?String(s):r(s)},w.prototype.rawValue=function(e){return e[1]},w.prototype.getConfigTags=function(e){return i(e)?e:e&&"object"==typeof e?e.tags:void 0},w.prototype.getConfigEscape=function(e){return e&&"object"==typeof e&&!i(e)?e.escape:void 0};var L={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(e){T.templateCache=e},get templateCache(){return T.templateCache}},T=new w;L.clearCache=function(){return T.clearCache()},L.parse=function(e,t){return T.parse(e,t)},L.render=function(e,t,n,r){if("string"!=typeof e)throw new TypeError('Invalid template! Template should be a "string" but "'+(i(s=e)?"array":typeof s)+'" was given as the first argument for mustache#render(template, view, partials)');var s;return T.render(e,t,n,r)},L.escape=function(e){return String(e).replace(/[&<>"'`=\/]/g,(function(e){return p[e]}))},L.Scanner=m,L.Context=b,L.Writer=w;const C=L,k=window.wp.i18n,{document:S,dt:x}=window;let E="",j={},A="";const O=s().memoize((e=>{const t=S.getElementById(e);return!!t&&(t.attributes.template?(C.parse(t.innerHTML),"mustache"):s().template(t.innerHTML,null,{evaluate:/<#([\s\S]+?)#>/g,interpolate:/{{{([\s\S]+?)}}}/g,escape:/{{([^}]+?)}}(?!})/g}))}));n()(window).on("load",(()=>{const e=S.querySelector("#wp-admin-bar-distributor #wp-admin-bar-distributor-placeholder"),t=S.querySelector("#distributor-push-wrapper");if(!e||!t)return;let r="",o="",i="",a="",c="",l="",d="",u="",p="",h="",f="";e.appendChild(t);const g=S.createElement("div");g.id="distributor-overlay";const y=S.querySelector("#wp-admin-bar-distributor");function v(){a=t.querySelector(".new-connections-list"),null!==a&&(c=a.querySelectorAll(".add-connection"),s().each(c,(e=>{e.classList.contains("syndicated")&&(e.disabled=!0)})))}function m(e){t.classList.add("message-error"),f.innerText="",s().each(function(e){return s().isArray(e)?s().map(e,(function(e){return s().isString(e)?e:s().has(e,"message")?e.message:void 0})):[e]}(e),(function(e){const t=S.createElement("li");t.innerText=e,f.appendChild(t)}))}function b(){a.innerText="";const e=O("dt-add-connection");let t="";s().each(r,(n=>{if(""!==A){const e=n.name.replace(/[^0-9a-zA-Z ]+/,"").toLowerCase().match(A.toLowerCase()),t=n.url.replace(/https?:\/\//i,"").replace(/www/i,"").replace(/[^0-9a-zA-Z ]+/,"").toLowerCase().match(A.toLowerCase());if(!e&&!t)return}"mustache"===e?(j[n.type+n.id]?n.added=!0:n.added=!1,"internal"===n.type&&(n.internal=!0),t=C.render(S.getElementById("dt-add-connection").innerHTML,{connection:n})):t=e({connection:n,selectedConnections:j}),a.innerHTML+=t})),""===a.innerHTML&&(a.innerHTML='

No results

'),"mustache"===e&&v()}function w(e){switch(e){case"addEmpty":o.classList.add("empty");break;case"removeEmpty":o.classList.remove("empty");break;case"allUnavailable":d.classList.add("unavailable");break;case"all":d.classList.remove("unavailable");break;case"noneUnavailable":u.classList.add("unavailable");break;case"none":u.classList.remove("unavailable")}}function L(){if(e.focus(),q(),t.classList.contains("loaded")&&x.postTitle===x.previousPostTitle)return;x.previousPostTitle=x.postTitle,t.classList.remove("message-error"),t.classList.add("loaded");const g={action:"dt_load_connections",loadConnectionsNonce:x.loadConnectionsNonce,postId:x.postId},y=O("dt-show-connections"),m=!!x.usexhr&&{withCredentials:!0};n().ajax({url:x.ajaxurl,xhrFields:m,method:"post",data:g}).done((e=>{if(!e.success||!e.data)return t.classList.remove("loaded"),void t.classList.add("message-error");if(r=e.data,"mustache"===y){const e={connections:[]};s().each(r,(t=>{"internal"===t.type&&(t.internal=!0),e.connections.push(t)})),t.innerHTML=C.render(S.getElementById("dt-show-connections").innerHTML,{connections:e.connections,foundConnections:e.connections.length,showSearch:5{""===e.currentTarget.value&&b(),A=e.currentTarget.value.replace(/https?:\/\//i,"").replace(/www/i,"").replace(/[^0-9a-zA-Z ]+/,""),b()}),300)),s().each(c,(e=>{e.classList.contains("syndicated")||(d.classList.remove("unavailable"),l++)}))})).error((()=>{t.classList.remove("loaded"),t.classList.add("message-error")}))}y.parentNode.insertBefore(g,y.nextSibling);const T=S.querySelector("#wp-admin-bar-distributor > a");function q(){y.classList.contains("hover")||y.classList.contains("syncing")||S.body.classList.remove("is-showing-distributor")}T.addEventListener("keydown",(function(e){13===e.keyCode&&L()}),!1),S.body.classList.contains("is-fullscreen-mode")&&window.hoverintent(y,(function(){return null}),q).options({timeout:180}),T.addEventListener("touchstart",L,!1),T.addEventListener("mouseenter",L,!1),g.addEventListener("click",(function(){y.classList.contains("syncing")||(y.classList.contains("hover")&&(y.classList.remove("hover"),S.body.classList.remove("is-showing-distributor")),q())}),!0),n()(t).on("click",".syndicate-button",(()=>{if(y.classList.contains("syncing"))return;y.classList.add("syncing");const e={action:"dt_push",nonce:x.nonce,connections:j,postId:x.postId};e.postStatus=null!==h&&h.checked?"draft":x.postStatus;const a=!!x.usexhr&&{withCredentials:!0};n().ajax({url:x.ajaxurl,xhrFields:a,method:"post",data:e}).done((e=>{setTimeout((()=>{y.classList.remove("syncing"),q(),e.success?e.data&&e.data.results?function(e){let n=!1;const a={};["internal","external"].forEach((t=>{s().each(e[t],((e,o)=>{"success"===e.status&&(r[`${t}${o}`].syndicated=e.url,n=!0),s().isEmpty(e.errors)||(a[`${t}${o}`]=e.errors)}))})),s().isEmpty(a)||m(s().map(a,(function(e,t){return`${r[t].name}:\n${s().map(e,(function(e){return`- ${e}\n`}))}`}))),n&&s().isEmpty(a)&&(t.classList.add("message-success"),o.classList.add("empty"),i.innerText="",setTimeout((()=>{t.classList.remove("message-success")}),6e3)),j={},b()}(e.data.results):m((0,k.__)("Received empty result.","distributor")):m(e.data)}),500)})).error(((e,t,n)=>{setTimeout((()=>{y.classList.remove("syncing"),m(`${(0,k.__)("Ajax error:","distributor")} ${n}`)}),500)}))})),n()(t).on("click",".add-connection",(e=>{if("A"!==e.target.nodeName&&(e.preventDefault(),!e.currentTarget.classList.contains("syndicated")))if(e.currentTarget.classList.contains("added")){const t=e.currentTarget.getAttribute("data-connection-type"),n=e.currentTarget.getAttribute("data-connection-id"),r=i.querySelector(`[data-connection-id="${n}"][data-connection-type="${t}"]`);r.parentNode.removeChild(r),delete j[t+n],E=(0,k.sprintf)((0,k._n)("Selected connection (%d)","Selected connections (%d)",Object.keys(j).length,"distributor"),Object.keys(j).length),S.querySelector(".selected-connections-text").textContent=E,d.classList.contains("unavailable")&&w("all"),Object.keys(j).length||(w("addEmpty"),w("noneUnavailable")),b()}else{const t=e.currentTarget.getAttribute("data-connection-type"),n=e.currentTarget.getAttribute("data-connection-id");j[t+n]=r[t+n];const s=e.currentTarget.cloneNode(!0);E=(0,k.sprintf)((0,k._n)("Selected connection (%d)","Selected connections (%d)",Object.keys(j).length,"distributor"),Object.keys(j).length),S.querySelector(".selected-connections-text").textContent=E;const o=S.createElement("span");o.classList.add("remove-connection"),s.appendChild(o),s.classList="added-connection",i.appendChild(s),u.classList.contains("unavailable")&&(w("removeEmpty"),w("none")),Object.keys(j).length==l&&w("allUnavailable"),b()}})),n()(t).on("click",".selectall-connections",(()=>{n()(a).children(".add-connection").each(((e,t)=>{if(t.classList.contains("syndicated")||t.classList.contains("added"))return;const n=t.getAttribute("data-connection-type"),s=t.getAttribute("data-connection-id");j[n+s]=r[n+s];const o=t.cloneNode();o.innerText=t.innerText;const a=S.createElement("span");a.classList.add("remove-connection"),o.appendChild(a),o.classList="added-connection",E=(0,k.sprintf)((0,k._n)("Selected connection (%d)","Selected connections (%d)",Object.keys(j).length,"distributor"),Object.keys(j).length),S.querySelector(".selected-connections-text").textContent=E,i.appendChild(o),""!==l&&(w("removeEmpty"),w("allUnavailable"),w("none"))})),b()})),n()(t).on("click",".selectno-connections",(()=>{for(;i.firstChild;){const e=i.firstChild.getAttribute("data-connection-type"),t=i.firstChild.getAttribute("data-connection-id");delete j[e+t],E=(0,k.sprintf)((0,k._n)("Selected connection (%d)","Selected connections (%d)",Object.keys(j).length,"distributor"),Object.keys(j).length),S.querySelector(".selected-connections-text").textContent=E,i.removeChild(i.firstChild)}""!==l&&(w("addEmpty"),w("noneUnavailable"),w("all")),b()})),n()(t).on("click",".added-connection",(e=>{e.currentTarget.parentNode.removeChild(e.currentTarget);const t=e.currentTarget.getAttribute("data-connection-type"),n=e.currentTarget.getAttribute("data-connection-id");delete j[t+n],E=(0,k.sprintf)((0,k._n)("Selected connection (%d)","Selected connections (%d)",Object.keys(j).length,"distributor"),Object.keys(j).length),S.querySelector(".selected-connections-text").textContent=E,d.classList.contains("unavailable")&&w("all"),Object.keys(j).length||(w("addEmpty"),w("noneUnavailable")),b()}))}))})(); \ No newline at end of file diff --git a/distributor.php b/distributor.php index c0ccad235..e031d2a56 100644 --- a/distributor.php +++ b/distributor.php @@ -4,7 +4,7 @@ * Plugin URI: https://github.com/10up/distributor * Update URI: https://distributorplugin.com * Description: Makes it easy to distribute and reuse content across your websites, whether inside of a multisite or across the web. - * Version: 2.0.0-beta2 + * Version: 2.0.0-rc1 * Requires at least: 5.7 * Requires PHP: 7.4 * Author: 10up Inc. @@ -28,7 +28,7 @@ exit; // Exit if accessed directly. } -define( 'DT_VERSION', '2.0.0-beta2' ); +define( 'DT_VERSION', '2.0.0-rc1' ); define( 'DT_PLUGIN_FILE', preg_replace( '#^.*plugins/(.*)$#i', '$1', __FILE__ ) ); define( 'DT_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); define( 'DT_PLUGIN_FULL_FILE', __FILE__ ); diff --git a/includes/push-ui.php b/includes/push-ui.php index b58a5ad7e..d883425ed 100644 --- a/includes/push-ui.php +++ b/includes/push-ui.php @@ -414,6 +414,7 @@ function enqueue_scripts( $hook ) { 'loadConnectionsNonce' => wp_create_nonce( 'dt-load-connections' ), 'postId' => (int) get_the_ID(), 'postTitle' => get_the_title(), + 'postStatus' => get_post_status(), 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ), /** diff --git a/lang/distributor.pot b/lang/distributor.pot index 1f5eb865e..a2e885ad7 100644 --- a/lang/distributor.pot +++ b/lang/distributor.pot @@ -2,14 +2,14 @@ # This file is distributed under the GPLv2 or later. msgid "" msgstr "" -"Project-Id-Version: Distributor 2.0.0-beta2\n" +"Project-Id-Version: Distributor 2.0.0-rc1\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/distributor\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2023-07-13T03:36:48+00:00\n" +"POT-Creation-Date: 2023-08-03T22:53:58+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.8.1\n" "X-Domain: distributor\n" @@ -415,7 +415,7 @@ msgid "Invalid remote post ID" msgstr "" #: includes/classes/InternalConnections/NetworkSiteConnection.php:235 -#: release/includes/classes/InternalConnections/NetworkSiteConnection.php:234 +#: release/includes/classes/InternalConnections/NetworkSiteConnection.php:235 msgid "The dt_push_post action has been deprecated. Please use dt_push_network_post or dt_push_external_post instead." msgstr "" diff --git a/templates/show-connections-amp.php b/templates/show-connections-amp.php index 98cdda683..a50833b5d 100644 --- a/templates/show-connections-amp.php +++ b/templates/show-connections-amp.php @@ -55,7 +55,6 @@ class="add-connection{{#syndicated}} syndicated{{/syndicated}}"
- post_status ) ? true : false; /** diff --git a/templates/show-connections.php b/templates/show-connections.php index cbc74ae68..cdfeb7c2f 100644 --- a/templates/show-connections.php +++ b/templates/show-connections.php @@ -53,7 +53,6 @@ class="add-connection<# if ( ! _.isEmpty( connections[ key ]['syndicated'] ) ) {
- post_status ) ? true : false; /**