Plugin Directory

Changeset 2740344

Timestamp:
06/10/2022 09:20:00 AM (2 years ago)
Author:
igmoweb
Message:

New version 1.1.0

Location:
taxonomy-terms-list-block/trunk
Files:
3 added
11 edited

Legend:

Unmodified
Added
Removed
  • taxonomy-terms-list-block/trunk/block.json

    r2676883 r2740344  
    2525            "type": "string",
    2626            "default": ""
     27
     28
     29
     30
    2731        }
    2832    },
     
    3236        "html": false,
    3337        "align": ["wide", "full"],
     38
     39
     40
     41
     42
     43
     44
     45
    3446        "typography": {
    3547            "lineHeight": true,
     
    3850    },
    3951    "editorScript": "file:./build/index.js",
     52
    4053    "style": "wp-block-taxonomy-terms-list-block"
    4154}
  • taxonomy-terms-list-block/trunk/build/index.asset.php

    r2737323 r2740344  
    1 <?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n', 'wp-server-side-render'), 'version' => '2696d2b4a1e85b060b015bcfb73080e6');
     1<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n', 'wp-server-side-render'), 'version' => '');
  • taxonomy-terms-list-block/trunk/build/index.js

    r2737323 r2740344  
    1 !function(){var e={184:function(e,t){var o;!function(){"use strict";var n={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var o=arguments[t];if(o){var l=typeof o;if("string"===l||"number"===l)e.push(o);else if(Array.isArray(o)){if(o.length){var a=r.apply(null,o);a&&e.push(a)}}else if("object"===l)if(o.toString===Object.prototype.toString)for(var s in o)n.call(o,s)&&o[s]&&e.push(s);else e.push(o.toString())}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(o=function(){return r}.apply(t,[]))||(e.exports=o)}()}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var l=t[n]={exports:{}};return e[n](l,l.exports,o),l.exports}o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,{a:t}),t},o.d=function(e,t){for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){"use strict";var e=window.wp.blocks,t=window.wp.element,n=window.wp.data,r=window.wp.coreData,l=window.wp.serverSideRender,a=o.n(l),s=window.wp.blockEditor,i=o(184),c=o.n(i),u=window.wp.components,p=window.wp.i18n,m=e=>{let{selected:o,onChange:n,taxonomies:r}=e;return(0,t.createElement)(u.SelectControl,{label:"Display terms from this taxonomy",value:o,options:[{label:(0,p.__)("-- Select a taxonomy --","taxonomyblock"),value:""},...r.map((e=>{let{name:t,slug:o}=e;return{label:t,value:o}}))],onChange:n})},y=e=>{let{taxonomies:o,attributes:n,setAttributes:r}=e;const{term:l,textAlign:a,separator:i,title:c}=n;return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(s.InspectorControls,null,(0,t.createElement)(u.PanelBody,null,(0,t.createElement)(m,{taxonomies:o,selected:l,onChange:e=>{r({term:e})}})),(0,t.createElement)(u.PanelBody,null,(0,t.createElement)(u.TextControl,{autoComplete:"off",label:(0,p.__)("Separator","taxonomyblock"),value:i||"",onChange:e=>{r({separator:e})},help:(0,p.__)("Enter character(s) used to separate terms.","taxonomyblock")}),(0,t.createElement)(u.TextControl,{autoComplete:"off",label:(0,p.__)("Title","taxonomyblock"),value:c||"",onChange:e=>{r({title:e})},help:(0,p.__)("Title prefixed to the list of elements.","taxonomyblock")}))),(0,t.createElement)(s.BlockControls,null,(0,t.createElement)(s.AlignmentToolbar,{value:a,onChange:e=>{r({textAlign:e})}})))};(0,e.registerBlockType)("taxonomy-terms-list/block",{edit:e=>{let{attributes:o,context:l,setAttributes:i}=e;const{term:m,textAlign:d}=o,{postId:b,postType:f}=l,x=(0,n.useSelect)((e=>(e("core").getTaxonomies()||[]).filter((e=>{var t;return null==e||null===(t=e.visibility)||void 0===t?void 0:t.publicly_queryable})))),g=x.filter((e=>{let{types:t}=e;return t.indexOf(f)>-1})),h=0===g.length?x:g,v=(0,n.useSelect)((e=>{var t;if(!m)return{};const{getTaxonomy:o}=e(r.store),n=o(m);return null!=n&&null!==(t=n.visibility)&&void 0!==t&&t.publicly_queryable?n:{}}),[m]),{postTerms:w,isLoading:T}=function(e){let{postId:t,postType:o,term:n}=e;const{rest_base:l}=n,[a]=(0,r.useEntityProp)("postType",o,l,t);return{postTerms:a,isLoading:void 0===a}}({postId:b,postType:f,term:v}),E=g.some((e=>{let{slug:t}=e;return t===m}));console.log({postTypeHasTaxonomy:E,term:m,postTypeTaxonomies:g}),(0,t.useEffect)((()=>{null!==w&&i({lastUpdate:(new Date).getTime()})}),[w]);const _=b&&f,k=(0,s.useBlockProps)({className:c()({[`has-text-align-${d}`]:d,[`taxonomy-block-${m}`]:m})});return(0,t.createElement)("div",k,_&&(0,t.createElement)(y,{taxonomies:h,attributes:o,setAttributes:i}),T&&m&&E&&(0,t.createElement)(u.Spinner,null),m&&!E&&(0,t.createElement)(u.Placeholder,{instructions:(0,p.__)("Taxonomy Terms List: This post hasn't got the %s taxonomy associated. This may happen inside the block editor context depending on the page you are trying to edit. The taxonomy terms list here will be replaced for an actual list in the website.","taxonomyblock")}),m&&!T&&E&&(0,t.createElement)(a(),{attributes:o,block:"taxonomy-terms-list/block",urlQueryArgs:{previewPostTerms:w}}),!m&&(0,t.createElement)(u.Placeholder,{instructions:(0,p.__)("Please, select a taxonomy in the block options","taxonomyblock")}))}})}()}();
     1(()=>{var e={184:(e,t)=>{var o;!function(){"use strict";var n={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var o=arguments[t];if(o){var l=typeof o;if("string"===l||"number"===l)e.push(o);else if(Array.isArray(o)){if(o.length){var a=r.apply(null,o);a&&e.push(a)}}else if("object"===l)if(o.toString===Object.prototype.toString)for(var s in o)n.call(o,s)&&o[s]&&e.push(s);else e.push(o.toString())}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(o=function(){return r}.apply(t,[]))||(e.exports=o)}()}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var l=t[n]={exports:{}};return e[n](l,l.exports,o),l.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";const e=window.wp.blocks,t=window.wp.element,n=window.wp.data,r=window.wp.coreData,l=window.wp.serverSideRender;var a=o.n(l);const s=window.wp.blockEditor;var i=o(184),c=o.n(i);const p=window.wp.components,m=window.wp.i18n,u=e=>{let{selected:o,onChange:n,taxonomies:r}=e;return(0,t.createElement)(p.SelectControl,{label:"Display terms from this taxonomy",value:o,options:[{label:(0,m.__)("-- Select a taxonomy --","taxonomyblock"),value:""},...r.map((e=>{let{name:t,slug:o}=e;return{label:t,value:o}}))],onChange:n})},y=e=>{let{taxonomies:o,attributes:n,setAttributes:r}=e;const{term:l,textAlign:a,separator:i,title:c}=n;return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(s.InspectorControls,null,(0,t.createElement)(p.PanelBody,null,(0,t.createElement)(u,{taxonomies:o,selected:l,onChange:e=>{r({term:e})}})),(0,t.createElement)(p.PanelBody,null,(0,t.createElement)(p.TextControl,{autoComplete:"off",label:(0,m.__)("Separator","taxonomyblock"),value:i||"",onChange:e=>{r({separator:e})},help:(0,m.__)("Enter character(s) used to separate terms.","taxonomyblock")}),(0,t.createElement)(p.TextControl,{autoComplete:"off",label:(0,m.__)("Title","taxonomyblock"),value:c||"",onChange:e=>{r({title:e})},help:(0,m.__)("Title prefixed to the list of elements.","taxonomyblock")}))),(0,t.createElement)(s.BlockControls,null,(0,t.createElement)(s.AlignmentToolbar,{value:a,onChange:e=>{r({textAlign:e})}})))};(0,e.registerBlockType)("taxonomy-terms-list/block",{edit:e=>{let{attributes:o,context:l,setAttributes:i}=e;const{term:u,textAlign:b}=o,{postId:d,postType:x}=l,g=(0,n.useSelect)((e=>(e("core").getTaxonomies()||[]).filter((e=>e?.visibility?.publicly_queryable)))),f=g.filter((e=>{let{types:t}=e;return t.indexOf(x)>-1})),h=0===f.length?g:f,w=(0,n.useSelect)((e=>{if(!u)return{};const{getTaxonomy:t}=e(r.store),o=t(u);return o?.visibility?.publicly_queryable?o:{}}),[u]),{postTerms:v,isLoading:T}=function(e){let{postId:t,postType:o,term:n}=e;const{rest_base:l}=n,[a]=(0,r.useEntityProp)("postType",o,l,t);return{postTerms:a,isLoading:void 0===a}}({postId:d,postType:x,term:w}),_=f.some((e=>{let{slug:t}=e;return t===u}));(0,t.useEffect)((()=>{null!==v&&i({lastUpdate:(new Date).getTime()})}),[v]);const E=d&&x,k=(0,s.useBlockProps)({className:c()({[`has-text-align-${b}`]:b,[`taxonomy-block-${u}`]:u})});return(0,t.createElement)("div",k,E&&(0,t.createElement)(y,{taxonomies:h,attributes:o,setAttributes:i}),T&&u&&_&&(0,t.createElement)(p.Placeholder,{icon:"tag",label:(0,m.__)("Loading terms…","taxonomyblock")}),u&&!_&&!T&&(0,t.createElement)(p.Placeholder,{icon:"tag",label:"Taxonomy Terms List",instructions:(0,m.sprintf)(// translators: %s: Taxonomy name
     2(0,m.__)("This post hasn't got the %s taxonomy associated. This may happen inside the block editor context depending on the page you are trying to edit. The taxonomy terms list will be replaced for an actual list in the website.","taxonomyblock"),u)}),u&&!T&&_&&(0,t.createElement)(a(),{attributes:o,block:"taxonomy-terms-list/block",urlQueryArgs:{previewPostTerms:v}}),!u&&(0,t.createElement)(p.Placeholder,{icon:"tag",label:"Taxonomy Terms List",instructions:(0,m.__)("Please, select a taxonomy in the block options","taxonomyblock")}))}})})()})();
  • taxonomy-terms-list-block/trunk/inc/block.php

    r2676883 r2740344  
    6464    $separator = empty( $attributes['separator'] ) ? ' ' : $attributes['separator'];
    6565
    66     $wrapper_attributes = get_block_wrapper_attributes( [ 'class' => $classes ] );
     66    $wrapper_attributes = ;
    6767
    6868    $links = [];
  • taxonomy-terms-list-block/trunk/languages/taxonomy-terms-list-block.pot

    r2737323 r2740344  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Taxonomy Terms List Block 1.0.2\n"
     5"Project-Id-Version: Taxonomy Terms List Block 1.\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/html\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2022-06-04T11:33:56+00:00\n"
     12"POT-Creation-Date: 2022-06-+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.5.0\n"
     
    3939msgstr ""
    4040
    41 #: src/components/Edit.js:74
    42 msgid "Taxonomy Terms List: This post hasn't got the %s taxonomy associated. This may happen inside the block editor context depending on the page you are trying to edit. The taxonomy terms list here will be replaced for an actual list in the website."
     41#: src/components/Edit.js:7
     42msgid ""
    4343msgstr ""
    4444
    45 #: src/components/Edit.js:91
     45#. translators: %s: Taxonomy name
     46#: src/components/Edit.js:81
     47msgid "This post hasn't got the %s taxonomy associated. This may happen inside the block editor context depending on the page you are trying to edit. The taxonomy terms list will be replaced for an actual list in the website."
     48msgstr ""
     49
     50#: src/components/Edit.js:102
    4651msgid "Please, select a taxonomy in the block options"
    4752msgstr ""
  • taxonomy-terms-list-block/trunk/readme.txt

    r2737323 r2740344  
    44Requires at least: 5.8
    55Tested up to: 5.9
    6 Stable tag: 1.0.2
     6Stable tag: 1.
    77License: GPLv2 or later
    88
     
    2424== Changelog ==
    2525
     26
     27
     28
     29
     30
    2631= 1.0.2 =
    2732Fix: Taxonomy terms previsualization was not working in the block editor.
  • taxonomy-terms-list-block/trunk/src/components/Edit.js

    r2737323 r2740344  
    77import classnames from 'classnames';
    88import Settings from './Settings';
    9 import { Placeholder, Spinner } from '@wordpress/components';
     9import { Placeholder } from '@wordpress/components';
    1010import { __, sprintf } from '@wordpress/i18n';
    1111import { store as coreStore } from '@wordpress/core-data';
     
    4343    });
    4444
    45     console.log({ postTypeHasTaxonomy, term, postTypeTaxonomies });
    46 
    4745    useEffect(() => {
    4846        if (postTerms === null) {
     
    6967                />
    7068            )}
    71             {isLoading && term && postTypeHasTaxonomy && <Spinner />}
    72             {term && !postTypeHasTaxonomy && (
     69            {isLoading && term && postTypeHasTaxonomy && (
    7370                <Placeholder
    74                     instructions={__(
    75                         "Taxonomy Terms List: This post hasn't got the %s taxonomy associated. This may happen inside the block editor context depending on the page you are trying to edit. The taxonomy terms list here will be replaced for an actual list in the website.",
    76                         'taxonomyblock'
     71                    icon="tag"
     72                    label={__('Loading terms…', 'taxonomyblock')}
     73                />
     74            )}
     75            {term && !postTypeHasTaxonomy && !isLoading && (
     76                <Placeholder
     77                    icon="tag"
     78                    label="Taxonomy Terms List"
     79                    instructions={sprintf(
     80                        // translators: %s: Taxonomy name
     81                        __(
     82                            "This post hasn't got the %s taxonomy associated. This may happen inside the block editor context depending on the page you are trying to edit. The taxonomy terms list will be replaced for an actual list in the website.",
     83                            'taxonomyblock'
     84                        ),
     85                        term
    7786                    )}
    7887                />
     
    8998            {!term && (
    9099                <Placeholder
     100
     101
    91102                    instructions={__(
    92103                        'Please, select a taxonomy in the block options',
  • taxonomy-terms-list-block/trunk/src/components/Settings.js

    r2676883 r2740344  
    1717                        taxonomies={taxonomies}
    1818                        selected={term}
    19                         onChange={(term) => {
    20                             setAttributes({ term });
     19                        onChange={() => {
     20                            setAttributes({ term });
    2121                        }}
    2222                    />
  • taxonomy-terms-list-block/trunk/src/hooks/use-taxonomies.js

    r2737323 r2740344  
    44import { useSelect } from '@wordpress/data';
    55
    6 export default function useTaxonomies(postType) {
     6export default function useTaxonomies() {
    77    return useSelect((select) => {
    88        return (select('core').getTaxonomies() || []).filter(
  • taxonomy-terms-list-block/trunk/src/index.js

    r2676883 r2740344  
     1
    12import { registerBlockType } from '@wordpress/blocks';
    23import Edit from './components/Edit';
  • taxonomy-terms-list-block/trunk/taxonomy-block.php

    r2737323 r2740344  
    44 * Description: Displays a list of a post terms for a selected taxonomy.
    55 * Plugin URI: https://wordpress.org/plugins/taxonomy-terms-list-block
    6  * Version: 1.0.2
     6 * Version: 1.
    77 * Author: igmoweb
    88 * Author URI: http://igmoweb.com
Note: See TracChangeset for help on using the changeset viewer.