itmar-block-packages 1.3.18 → 1.3.20
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 +68 -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 +103 -31
package/README.md
CHANGED
|
@@ -14,6 +14,14 @@ import {関数名又はコンポーネント名} from "itmar-block-packages"
|
|
|
14
14
|
npm i @wordpress/scripts@^27.6.0 --save-dev
|
|
15
15
|
|
|
16
16
|
## 更新履歴
|
|
17
|
+
= 1.3.20 =
|
|
18
|
+
- PageSelectControlでhomeUrlをエディタのホームURLに固定しないようにした。
|
|
19
|
+
|
|
20
|
+
= 1.3.19 =
|
|
21
|
+
- FieldChoiceControlの選択可能フィールドにlinkを加えて、個別投稿ページへのリンク設定を可能にした。
|
|
22
|
+
- BlockPlaceのフレックスボックスの配置に交差軸の配置を加えた。
|
|
23
|
+
- TermChoiceControlでタームの表示をするか否かの選択を設定できるようにした。
|
|
24
|
+
|
|
17
25
|
= 1.3.18 =
|
|
18
26
|
- WordPress RestAPIのエンドポイントを文字列で受けて、その結果を返すrestFetchDataを新設
|
|
19
27
|
- TermChoiceControlでonChangeコールバックで返す引数にterm.nameを加えた。
|
|
@@ -599,23 +607,79 @@ RestAPIのエンドポイントを文字列で受けて、その結果を返す
|
|
|
599
607
|
選択済みの投稿タイプのスラッグ
|
|
600
608
|
- `choiceTerms` array
|
|
601
609
|
選択済みのタームの情報。配列の要素は次の形式のオブジェクトであること。
|
|
602
|
-
{ taxonomy: タクソノミーのスラッグ, term: タームのスラッグ }
|
|
610
|
+
{ taxonomy: タクソノミーのスラッグ, term: タームのスラッグ }
|
|
611
|
+
- `dispTaxonomies` array
|
|
612
|
+
選択済みのタクソノミの情報。配列の要素はタクソノミーのスラッグ
|
|
603
613
|
- `type` string
|
|
604
614
|
選択するデータのタイプ。将来の拡張のためにセットしている。現時点では"taxonomy"とセットすること。
|
|
605
615
|
- `label` string
|
|
606
616
|
|
|
607
617
|
- `onChange` func
|
|
608
|
-
チェックボックスの内容が変化したとき発生するコールバック関数。引数には{ taxonomy: タクソノミーのスラッグ, term:{ id: term.id, slug: term.slug, name: term.name } }という形式のオブジェクトを要素とする配列が入る。
|
|
618
|
+
チェックボックスの内容が変化したとき発生するコールバック関数。引数には{ taxonomy: タクソノミーのスラッグ, term:{ id: term.id, slug: term.slug, name: term.name } }という形式のオブジェクトを要素とする配列が入る。
|
|
619
|
+
- `onSetDispTax` func
|
|
620
|
+
トグルコントロールの内容が変化したとき発生するコールバック関数。引数にはタクソノミーのスラッグを要素とする配列が入る。
|
|
609
621
|
|
|
610
622
|
```
|
|
611
623
|
<TermChoiceControl
|
|
612
624
|
selectedSlug={selectedSlug}
|
|
613
625
|
choiceTerms={choiceTerms}
|
|
626
|
+
dispTaxonomies={dispTaxonomies}
|
|
614
627
|
type="taxonomy"
|
|
615
628
|
label={__("Choice Taxsonomy", "post-blocks")}
|
|
616
629
|
onChange={(newChoiceTerms) =>
|
|
617
630
|
setAttributes({ choiceTerms: newChoiceTerms })
|
|
618
631
|
}
|
|
632
|
+
onSetDispTax={(newChoiceTerms) => {
|
|
633
|
+
setAttributes({ dispTaxonomies: newChoiceTerms });
|
|
634
|
+
}}
|
|
635
|
+
/>
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
### FieldChoiceControl
|
|
639
|
+
タイトル、日付、抜粋、アイキャッチ画像、リンクの各フィールドと投稿タイプに紐づけられている全てのカスタムフィールドを選択できるチェックボックス表示し、コールバック関数に選択されたフィールドの情報を返します。
|
|
640
|
+
また、各フィールドがどのブロックでレンダリングされるかの設定機能も含みます。
|
|
641
|
+
#### プロプス
|
|
642
|
+
- `selectedSlug` string
|
|
643
|
+
選択済みの投稿タイプのスラッグ (Restタイプ)
|
|
644
|
+
- `choiceItems` array
|
|
645
|
+
選択済みのフィールドの情報。配列の要素はフィールドのスラッグ(文字列)。
|
|
646
|
+
- `type` string
|
|
647
|
+
選択するデータのタイプ。将来の拡張のためにセットしている。現時点では"field"とセットすること。
|
|
648
|
+
- `blockMap` object
|
|
649
|
+
フィールド名とブロック名を対にしたオブジェクト
|
|
650
|
+
```
|
|
651
|
+
{
|
|
652
|
+
"title":"itmar/design-title",
|
|
653
|
+
"date":"itmar/design-title",
|
|
654
|
+
"excerpt":"core/paragraph",
|
|
655
|
+
"featured_media":"core/image",
|
|
656
|
+
"link":"itmar/design-button"
|
|
657
|
+
}
|
|
658
|
+
```
|
|
659
|
+
- `textDomain` string
|
|
660
|
+
使用するブロックのテキストドメイン
|
|
661
|
+
|
|
662
|
+
- `onChange` func
|
|
663
|
+
チェックボックスの内容が変化したとき発生するコールバック関数。引数には選択されたフィールドのフィールド名を要素とする配列が入る。
|
|
664
|
+
|
|
665
|
+
```
|
|
666
|
+
|
|
667
|
+
- `onBlockMapChange` func
|
|
668
|
+
コンボボックスの内容が変化したとき発生するコールバック関数。引数には設定されたフィールド名とブロック名を対にしたオブジェクトが入る。
|
|
669
|
+
|
|
670
|
+
```
|
|
671
|
+
<FieldChoiceControl
|
|
672
|
+
type="field"
|
|
673
|
+
selectedSlug={selectedRest}
|
|
674
|
+
choiceItems={choiceFields}
|
|
675
|
+
blockMap={blockMap}
|
|
676
|
+
textDomain="post-blocks"
|
|
677
|
+
onChange={(newChoiceFields) => {
|
|
678
|
+
setAttributes({ choiceFields: newChoiceFields });
|
|
679
|
+
}}
|
|
680
|
+
onBlockMapChange={(newBlockMap) => {
|
|
681
|
+
setAttributes({ blockMap: newBlockMap });
|
|
682
|
+
}}
|
|
619
683
|
/>
|
|
620
684
|
```
|
|
621
685
|
|
|
@@ -693,8 +757,8 @@ WordPressのブロックエディタのサイドバーにブロックの配置
|
|
|
693
757
|
onReverseChange={(checked) => {
|
|
694
758
|
setAttributes({reverse: checked });
|
|
695
759
|
}}
|
|
696
|
-
onFlexChange={(position) => {
|
|
697
|
-
setAttributes({
|
|
760
|
+
onFlexChange={(position,axis) => {
|
|
761
|
+
setAttributes({[axis]: position });
|
|
698
762
|
}}
|
|
699
763
|
onAlignChange={(position) => {
|
|
700
764
|
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' => 'c2d779360ec4624f6165');
|