itmar-block-packages 1.3.18 → 1.3.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +65 -4
- package/build/index.asset.php +1 -1
- package/build/index.js +2 -2
- package/package.json +1 -1
- package/src/BlockPlace.js +46 -21
- package/src/wordpressApi.js +102 -30
package/README.md
CHANGED
|
@@ -14,6 +14,11 @@ import {関数名又はコンポーネント名} from "itmar-block-packages"
|
|
|
14
14
|
npm i @wordpress/scripts@^27.6.0 --save-dev
|
|
15
15
|
|
|
16
16
|
## 更新履歴
|
|
17
|
+
= 1.3.19 =
|
|
18
|
+
- FieldChoiceControlの選択可能フィールドにlinkを加えて、個別投稿ページへのリンク設定を可能にした。
|
|
19
|
+
- BlockPlaceのフレックスボックスの配置に交差軸の配置を加えた。
|
|
20
|
+
- TermChoiceControlでタームの表示をするか否かの選択を設定できるようにした。
|
|
21
|
+
|
|
17
22
|
= 1.3.18 =
|
|
18
23
|
- WordPress RestAPIのエンドポイントを文字列で受けて、その結果を返すrestFetchDataを新設
|
|
19
24
|
- TermChoiceControlでonChangeコールバックで返す引数にterm.nameを加えた。
|
|
@@ -599,23 +604,79 @@ RestAPIのエンドポイントを文字列で受けて、その結果を返す
|
|
|
599
604
|
選択済みの投稿タイプのスラッグ
|
|
600
605
|
- `choiceTerms` array
|
|
601
606
|
選択済みのタームの情報。配列の要素は次の形式のオブジェクトであること。
|
|
602
|
-
{ taxonomy: タクソノミーのスラッグ, term: タームのスラッグ }
|
|
607
|
+
{ taxonomy: タクソノミーのスラッグ, term: タームのスラッグ }
|
|
608
|
+
- `dispTaxonomies` array
|
|
609
|
+
選択済みのタクソノミの情報。配列の要素はタクソノミーのスラッグ
|
|
603
610
|
- `type` string
|
|
604
611
|
選択するデータのタイプ。将来の拡張のためにセットしている。現時点では"taxonomy"とセットすること。
|
|
605
612
|
- `label` string
|
|
606
613
|
|
|
607
614
|
- `onChange` func
|
|
608
|
-
チェックボックスの内容が変化したとき発生するコールバック関数。引数には{ taxonomy: タクソノミーのスラッグ, term:{ id: term.id, slug: term.slug, name: term.name } }という形式のオブジェクトを要素とする配列が入る。
|
|
615
|
+
チェックボックスの内容が変化したとき発生するコールバック関数。引数には{ taxonomy: タクソノミーのスラッグ, term:{ id: term.id, slug: term.slug, name: term.name } }という形式のオブジェクトを要素とする配列が入る。
|
|
616
|
+
- `onSetDispTax` func
|
|
617
|
+
トグルコントロールの内容が変化したとき発生するコールバック関数。引数にはタクソノミーのスラッグを要素とする配列が入る。
|
|
609
618
|
|
|
610
619
|
```
|
|
611
620
|
<TermChoiceControl
|
|
612
621
|
selectedSlug={selectedSlug}
|
|
613
622
|
choiceTerms={choiceTerms}
|
|
623
|
+
dispTaxonomies={dispTaxonomies}
|
|
614
624
|
type="taxonomy"
|
|
615
625
|
label={__("Choice Taxsonomy", "post-blocks")}
|
|
616
626
|
onChange={(newChoiceTerms) =>
|
|
617
627
|
setAttributes({ choiceTerms: newChoiceTerms })
|
|
618
628
|
}
|
|
629
|
+
onSetDispTax={(newChoiceTerms) => {
|
|
630
|
+
setAttributes({ dispTaxonomies: newChoiceTerms });
|
|
631
|
+
}}
|
|
632
|
+
/>
|
|
633
|
+
```
|
|
634
|
+
|
|
635
|
+
### FieldChoiceControl
|
|
636
|
+
タイトル、日付、抜粋、アイキャッチ画像、リンクの各フィールドと投稿タイプに紐づけられている全てのカスタムフィールドを選択できるチェックボックス表示し、コールバック関数に選択されたフィールドの情報を返します。
|
|
637
|
+
また、各フィールドがどのブロックでレンダリングされるかの設定機能も含みます。
|
|
638
|
+
#### プロプス
|
|
639
|
+
- `selectedSlug` string
|
|
640
|
+
選択済みの投稿タイプのスラッグ (Restタイプ)
|
|
641
|
+
- `choiceItems` array
|
|
642
|
+
選択済みのフィールドの情報。配列の要素はフィールドのスラッグ(文字列)。
|
|
643
|
+
- `type` string
|
|
644
|
+
選択するデータのタイプ。将来の拡張のためにセットしている。現時点では"field"とセットすること。
|
|
645
|
+
- `blockMap` object
|
|
646
|
+
フィールド名とブロック名を対にしたオブジェクト
|
|
647
|
+
```
|
|
648
|
+
{
|
|
649
|
+
"title":"itmar/design-title",
|
|
650
|
+
"date":"itmar/design-title",
|
|
651
|
+
"excerpt":"core/paragraph",
|
|
652
|
+
"featured_media":"core/image",
|
|
653
|
+
"link":"itmar/design-button"
|
|
654
|
+
}
|
|
655
|
+
```
|
|
656
|
+
- `textDomain` string
|
|
657
|
+
使用するブロックのテキストドメイン
|
|
658
|
+
|
|
659
|
+
- `onChange` func
|
|
660
|
+
チェックボックスの内容が変化したとき発生するコールバック関数。引数には選択されたフィールドのフィールド名を要素とする配列が入る。
|
|
661
|
+
|
|
662
|
+
```
|
|
663
|
+
|
|
664
|
+
- `onBlockMapChange` func
|
|
665
|
+
コンボボックスの内容が変化したとき発生するコールバック関数。引数には設定されたフィールド名とブロック名を対にしたオブジェクトが入る。
|
|
666
|
+
|
|
667
|
+
```
|
|
668
|
+
<FieldChoiceControl
|
|
669
|
+
type="field"
|
|
670
|
+
selectedSlug={selectedRest}
|
|
671
|
+
choiceItems={choiceFields}
|
|
672
|
+
blockMap={blockMap}
|
|
673
|
+
textDomain="post-blocks"
|
|
674
|
+
onChange={(newChoiceFields) => {
|
|
675
|
+
setAttributes({ choiceFields: newChoiceFields });
|
|
676
|
+
}}
|
|
677
|
+
onBlockMapChange={(newBlockMap) => {
|
|
678
|
+
setAttributes({ blockMap: newBlockMap });
|
|
679
|
+
}}
|
|
619
680
|
/>
|
|
620
681
|
```
|
|
621
682
|
|
|
@@ -693,8 +754,8 @@ WordPressのブロックエディタのサイドバーにブロックの配置
|
|
|
693
754
|
onReverseChange={(checked) => {
|
|
694
755
|
setAttributes({reverse: checked });
|
|
695
756
|
}}
|
|
696
|
-
onFlexChange={(position) => {
|
|
697
|
-
setAttributes({
|
|
757
|
+
onFlexChange={(position,axis) => {
|
|
758
|
+
setAttributes({[axis]: position });
|
|
698
759
|
}}
|
|
699
760
|
onAlignChange={(position) => {
|
|
700
761
|
setAttributes({outer_align: position });
|
package/build/index.asset.php
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-block-editor', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '
|
|
1
|
+
<?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-block-editor', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => 'bf5bb5c57cf2074dd749');
|