itmar-block-packages 1.3.17 → 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 +90 -12
- package/build/index.asset.php +1 -1
- package/build/index.js +3 -3
- package/package.json +1 -1
- package/src/BlockPlace.js +159 -158
- package/src/cssPropertes.js +7 -7
- package/src/customFooks.js +24 -0
- package/src/index.js +3 -0
- package/src/wordpressApi.js +131 -33
package/package.json
CHANGED
package/src/BlockPlace.js
CHANGED
|
@@ -45,15 +45,20 @@ const vert_around = <Icon icon={justifySpaceBetween} className="rotate-icon" />;
|
|
|
45
45
|
export default function BlockPlace(props) {
|
|
46
46
|
const { attributes, clientId, blockRef, isMobile, isSubmenu, isParallax } =
|
|
47
47
|
props;
|
|
48
|
-
const { positionType, isPosCenter,
|
|
48
|
+
const { positionType, isPosCenter, default_val, mobile_val } = attributes;
|
|
49
49
|
|
|
50
50
|
//モバイルかデスクトップか
|
|
51
|
-
const sel_pos = isMobile ?
|
|
51
|
+
const sel_pos = isMobile ? mobile_val : default_val;
|
|
52
52
|
|
|
53
53
|
//配置アイコンの選択
|
|
54
|
+
|
|
54
55
|
const start_icon = sel_pos.direction === "vertical" ? upper : justifyLeft;
|
|
55
56
|
const center_icon = sel_pos.direction === "vertical" ? middle : justifyCenter;
|
|
56
57
|
const end_icon = sel_pos.direction === "vertical" ? lower : justifyRight;
|
|
58
|
+
const start_cross = sel_pos.direction === "vertical" ? justifyLeft : upper;
|
|
59
|
+
const center_cross =
|
|
60
|
+
sel_pos.direction === "vertical" ? justifyCenter : middle;
|
|
61
|
+
const end_cross = sel_pos.direction === "vertical" ? justifyRight : lower;
|
|
57
62
|
const between_icon =
|
|
58
63
|
sel_pos.direction === "vertical" ? vert_between : justifyStretch;
|
|
59
64
|
const around_icon =
|
|
@@ -67,6 +72,14 @@ export default function BlockPlace(props) {
|
|
|
67
72
|
sel_pos.direction === "vertical"
|
|
68
73
|
? __("lower alignment", "block-collections")
|
|
69
74
|
: __("right alignment", "block-collections");
|
|
75
|
+
const cross_start_tip =
|
|
76
|
+
sel_pos.direction === "vertical"
|
|
77
|
+
? __("left alignment", "block-collections")
|
|
78
|
+
: __("upper alignment", "block-collections");
|
|
79
|
+
const cross_end_tip =
|
|
80
|
+
sel_pos.direction === "vertical"
|
|
81
|
+
? __("right alignment", "block-collections")
|
|
82
|
+
: __("lower alignment", "block-collections");
|
|
70
83
|
|
|
71
84
|
const [isContainer, setIsContainer] = useState(false);
|
|
72
85
|
const [direction, setDirection] = useState("row");
|
|
@@ -186,21 +199,29 @@ export default function BlockPlace(props) {
|
|
|
186
199
|
/>
|
|
187
200
|
)}
|
|
188
201
|
</ToolbarItem>
|
|
202
|
+
{(sel_pos.direction === "horizen" ||
|
|
203
|
+
sel_pos.direction === "vertical") && (
|
|
204
|
+
<PanelRow className="position_row">
|
|
205
|
+
<ToggleControl
|
|
206
|
+
label={__("reverse", "block-collections")}
|
|
207
|
+
checked={sel_pos.reverse}
|
|
208
|
+
onChange={(checked) => props.onReverseChange(checked)}
|
|
209
|
+
/>
|
|
210
|
+
<ToggleControl
|
|
211
|
+
label={__("wrap", "block-collections")}
|
|
212
|
+
checked={sel_pos.wrap}
|
|
213
|
+
onChange={(checked) => props.onWrapChange(checked)}
|
|
214
|
+
/>
|
|
215
|
+
</PanelRow>
|
|
216
|
+
)}
|
|
189
217
|
</ToolbarGroup>
|
|
190
|
-
|
|
191
|
-
sel_pos.direction === "vertical") && (
|
|
192
|
-
<ToggleControl
|
|
193
|
-
label={__("reverse", "block-collections")}
|
|
194
|
-
checked={sel_pos.reverse}
|
|
195
|
-
onChange={(checked) => props.onReverseChange(checked)}
|
|
196
|
-
/>
|
|
197
|
-
)}
|
|
218
|
+
|
|
198
219
|
{sel_pos.direction !== "block" && sel_pos.direction !== "grid" && (
|
|
199
220
|
<>
|
|
200
221
|
{isMobile ? (
|
|
201
|
-
<p>{__("InnerBlock
|
|
222
|
+
<p>{__("InnerBlock Main Axis(Mobile)", "block-collections")}</p>
|
|
202
223
|
) : (
|
|
203
|
-
<p>{__("InnerBlock
|
|
224
|
+
<p>{__("InnerBlock Main Axis(DeskTop)", "block-collections")}</p>
|
|
204
225
|
)}
|
|
205
226
|
<ToolbarGroup>
|
|
206
227
|
<ToolbarItem>
|
|
@@ -208,7 +229,9 @@ export default function BlockPlace(props) {
|
|
|
208
229
|
<Button
|
|
209
230
|
{...itemProps}
|
|
210
231
|
isPressed={sel_pos.inner_align === "flex-start"}
|
|
211
|
-
onClick={() =>
|
|
232
|
+
onClick={() =>
|
|
233
|
+
props.onFlexChange("flex-start", "inner_align")
|
|
234
|
+
} //親コンポーネントに通知
|
|
212
235
|
icon={start_icon}
|
|
213
236
|
label={start_tip}
|
|
214
237
|
/>
|
|
@@ -219,7 +242,7 @@ export default function BlockPlace(props) {
|
|
|
219
242
|
<Button
|
|
220
243
|
{...itemProps}
|
|
221
244
|
isPressed={sel_pos.inner_align === "center"}
|
|
222
|
-
onClick={() => props.onFlexChange("center")} //親コンポーネントに通知
|
|
245
|
+
onClick={() => props.onFlexChange("center", "inner_align")} //親コンポーネントに通知
|
|
223
246
|
icon={center_icon}
|
|
224
247
|
label={__("center alignment", "block-collections")}
|
|
225
248
|
/>
|
|
@@ -230,7 +253,9 @@ export default function BlockPlace(props) {
|
|
|
230
253
|
<Button
|
|
231
254
|
{...itemProps}
|
|
232
255
|
isPressed={sel_pos.inner_align === "flex-end"}
|
|
233
|
-
onClick={() =>
|
|
256
|
+
onClick={() =>
|
|
257
|
+
props.onFlexChange("flex-end", "inner_align")
|
|
258
|
+
} //親コンポーネントに通知
|
|
234
259
|
icon={end_icon}
|
|
235
260
|
label={end_tip}
|
|
236
261
|
/>
|
|
@@ -241,7 +266,9 @@ export default function BlockPlace(props) {
|
|
|
241
266
|
<Button
|
|
242
267
|
{...itemProps}
|
|
243
268
|
isPressed={sel_pos.inner_align === "space-between"}
|
|
244
|
-
onClick={() =>
|
|
269
|
+
onClick={() =>
|
|
270
|
+
props.onFlexChange("space-between", "inner_align")
|
|
271
|
+
} //親コンポーネントに通知
|
|
245
272
|
icon={between_icon}
|
|
246
273
|
label={__("beteen stretch", "block-collections")}
|
|
247
274
|
/>
|
|
@@ -252,7 +279,9 @@ export default function BlockPlace(props) {
|
|
|
252
279
|
<Button
|
|
253
280
|
{...itemProps}
|
|
254
281
|
isPressed={sel_pos.inner_align === "space-around"}
|
|
255
|
-
onClick={() =>
|
|
282
|
+
onClick={() =>
|
|
283
|
+
props.onFlexChange("space-around", "inner_align")
|
|
284
|
+
} //親コンポーネントに通知
|
|
256
285
|
icon={around_icon}
|
|
257
286
|
label={__("around stretch", "block-collections")}
|
|
258
287
|
/>
|
|
@@ -262,24 +291,25 @@ export default function BlockPlace(props) {
|
|
|
262
291
|
</>
|
|
263
292
|
)}
|
|
264
293
|
|
|
265
|
-
{!
|
|
266
|
-
!isSubmenu &&
|
|
294
|
+
{!isSubmenu &&
|
|
267
295
|
(isMobile ? (
|
|
268
|
-
<p>{__("
|
|
296
|
+
<p>{__("InnerBlock Cross Axis(Mobile)", "block-collections")}</p>
|
|
269
297
|
) : (
|
|
270
|
-
<p>{__("
|
|
298
|
+
<p>{__("InnerBlock Cross Axis(DeskTop)", "block-collections")}</p>
|
|
271
299
|
))}
|
|
272
300
|
|
|
273
|
-
{!
|
|
301
|
+
{!isSubmenu && (
|
|
274
302
|
<ToolbarGroup>
|
|
275
303
|
<ToolbarItem>
|
|
276
304
|
{(itemProps) => (
|
|
277
305
|
<Button
|
|
278
306
|
{...itemProps}
|
|
279
|
-
isPressed={sel_pos.
|
|
280
|
-
onClick={() =>
|
|
281
|
-
|
|
282
|
-
|
|
307
|
+
isPressed={sel_pos.inner_items === "flex-start"}
|
|
308
|
+
onClick={() =>
|
|
309
|
+
props.onFlexChange("flex-start", "inner_items")
|
|
310
|
+
} //親コンポーネントに通知
|
|
311
|
+
icon={start_cross}
|
|
312
|
+
label={cross_start_tip}
|
|
283
313
|
/>
|
|
284
314
|
)}
|
|
285
315
|
</ToolbarItem>
|
|
@@ -287,9 +317,9 @@ export default function BlockPlace(props) {
|
|
|
287
317
|
{(itemProps) => (
|
|
288
318
|
<Button
|
|
289
319
|
{...itemProps}
|
|
290
|
-
isPressed={sel_pos.
|
|
291
|
-
onClick={() => props.
|
|
292
|
-
icon={
|
|
320
|
+
isPressed={sel_pos.inner_items === "center"}
|
|
321
|
+
onClick={() => props.onFlexChange("center", "inner_items")} //親コンポーネントに通知
|
|
322
|
+
icon={center_cross}
|
|
293
323
|
label={__("center alignment", "block-collections")}
|
|
294
324
|
/>
|
|
295
325
|
)}
|
|
@@ -298,10 +328,10 @@ export default function BlockPlace(props) {
|
|
|
298
328
|
{(itemProps) => (
|
|
299
329
|
<Button
|
|
300
330
|
{...itemProps}
|
|
301
|
-
isPressed={sel_pos.
|
|
302
|
-
onClick={() => props.
|
|
303
|
-
icon={
|
|
304
|
-
label={
|
|
331
|
+
isPressed={sel_pos.inner_items === "flex-end"}
|
|
332
|
+
onClick={() => props.onFlexChange("flex-end", "inner_items")} //親コンポーネントに通知
|
|
333
|
+
icon={end_cross}
|
|
334
|
+
label={cross_end_tip}
|
|
305
335
|
/>
|
|
306
336
|
)}
|
|
307
337
|
</ToolbarItem>
|
|
@@ -310,9 +340,11 @@ export default function BlockPlace(props) {
|
|
|
310
340
|
{isContainer && (
|
|
311
341
|
<>
|
|
312
342
|
{isMobile ? (
|
|
313
|
-
<p>{__("
|
|
343
|
+
<p>{__("Alignment in container(Mobile)", "block-collections")}</p>
|
|
314
344
|
) : (
|
|
315
|
-
<p>
|
|
345
|
+
<p>
|
|
346
|
+
{__("Alignment in container(DeskTop)", "block-collections")}
|
|
347
|
+
</p>
|
|
316
348
|
)}
|
|
317
349
|
|
|
318
350
|
<ToolbarGroup>
|
|
@@ -385,114 +417,22 @@ export default function BlockPlace(props) {
|
|
|
385
417
|
</>
|
|
386
418
|
)}
|
|
387
419
|
|
|
388
|
-
<
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
/>
|
|
398
|
-
)}
|
|
399
|
-
</ToolbarItem>
|
|
400
|
-
<ToolbarItem>
|
|
401
|
-
{(itemProps) => (
|
|
402
|
-
<Button
|
|
403
|
-
{...itemProps}
|
|
404
|
-
isPressed={sel_pos.width_val === "fit"}
|
|
405
|
-
onClick={() => props.onWidthChange("fit")}
|
|
406
|
-
text="fit"
|
|
407
|
-
/>
|
|
408
|
-
)}
|
|
409
|
-
</ToolbarItem>
|
|
410
|
-
<ToolbarItem>
|
|
411
|
-
{(itemProps) => (
|
|
412
|
-
<Button
|
|
413
|
-
{...itemProps}
|
|
414
|
-
isPressed={sel_pos.width_val === "wideSize"}
|
|
415
|
-
onClick={() => props.onWidthChange("wideSize")}
|
|
416
|
-
icon={stretchWide}
|
|
417
|
-
label={__("Wide Size", "block-collections")}
|
|
418
|
-
/>
|
|
419
|
-
)}
|
|
420
|
-
</ToolbarItem>
|
|
421
|
-
<ToolbarItem>
|
|
422
|
-
{(itemProps) => (
|
|
423
|
-
<Button
|
|
424
|
-
{...itemProps}
|
|
425
|
-
isPressed={sel_pos.width_val === "contentSize"}
|
|
426
|
-
onClick={() => props.onWidthChange("contentSize")}
|
|
427
|
-
icon={positionCenter}
|
|
428
|
-
label={__("Content Size", "block-collections")}
|
|
429
|
-
/>
|
|
430
|
-
)}
|
|
431
|
-
</ToolbarItem>
|
|
432
|
-
<ToolbarItem>
|
|
433
|
-
{(itemProps) => (
|
|
434
|
-
<Button
|
|
435
|
-
{...itemProps}
|
|
436
|
-
isPressed={sel_pos.width_val === "free"}
|
|
437
|
-
onClick={() => props.onWidthChange("free")}
|
|
438
|
-
text="free"
|
|
439
|
-
/>
|
|
440
|
-
)}
|
|
441
|
-
</ToolbarItem>
|
|
442
|
-
</ToolbarGroup>
|
|
443
|
-
|
|
444
|
-
{sel_pos.width_val === "free" && (
|
|
445
|
-
<UnitControl
|
|
446
|
-
dragDirection="e"
|
|
447
|
-
onChange={(newValue) => props.onFreeWidthChange(newValue)}
|
|
448
|
-
value={sel_pos.free_width}
|
|
449
|
-
/>
|
|
450
|
-
)}
|
|
420
|
+
<BlockWidth
|
|
421
|
+
attributes={attributes}
|
|
422
|
+
isMobile={isMobile}
|
|
423
|
+
isSubmenu={isSubmenu}
|
|
424
|
+
onWidthChange={(key, widthVal) => props.onWidthChange(key, widthVal)}
|
|
425
|
+
onFreeWidthChange={(key, freeVal) =>
|
|
426
|
+
props.onFreeWidthChange(key, freeVal)
|
|
427
|
+
}
|
|
428
|
+
/>
|
|
451
429
|
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
<ToolbarItem>
|
|
459
|
-
{(itemProps) => (
|
|
460
|
-
<Button
|
|
461
|
-
{...itemProps}
|
|
462
|
-
isPressed={sel_pos.height_val === "full"}
|
|
463
|
-
onClick={() => props.onHeightChange("full")}
|
|
464
|
-
text="full"
|
|
465
|
-
/>
|
|
466
|
-
)}
|
|
467
|
-
</ToolbarItem>
|
|
468
|
-
<ToolbarItem>
|
|
469
|
-
{(itemProps) => (
|
|
470
|
-
<Button
|
|
471
|
-
{...itemProps}
|
|
472
|
-
isPressed={sel_pos.height_val === "fit"}
|
|
473
|
-
onClick={() => props.onHeightChange("fit")}
|
|
474
|
-
text="fit"
|
|
475
|
-
/>
|
|
476
|
-
)}
|
|
477
|
-
</ToolbarItem>
|
|
478
|
-
<ToolbarItem>
|
|
479
|
-
{(itemProps) => (
|
|
480
|
-
<Button
|
|
481
|
-
{...itemProps}
|
|
482
|
-
isPressed={sel_pos.height_val === "free"}
|
|
483
|
-
onClick={() => props.onHeightChange("free")}
|
|
484
|
-
text="free"
|
|
485
|
-
/>
|
|
486
|
-
)}
|
|
487
|
-
</ToolbarItem>
|
|
488
|
-
</ToolbarGroup>
|
|
489
|
-
{sel_pos.height_val === "free" && (
|
|
490
|
-
<UnitControl
|
|
491
|
-
dragDirection="e"
|
|
492
|
-
onChange={(newValue) => props.onFreeHeightChange(newValue)}
|
|
493
|
-
value={sel_pos.free_height}
|
|
494
|
-
/>
|
|
495
|
-
)}
|
|
430
|
+
<BlockHeight
|
|
431
|
+
attributes={attributes}
|
|
432
|
+
isMobile={isMobile}
|
|
433
|
+
onHeightChange={(heightVal) => props.onHeightChange(heightVal)}
|
|
434
|
+
onFreeHeightChange={(freeVal) => props.onFreeHeightChange(freeVal)}
|
|
435
|
+
/>
|
|
496
436
|
|
|
497
437
|
{sel_pos.direction === "grid" && (
|
|
498
438
|
<>
|
|
@@ -675,25 +615,19 @@ export function BlockWidth(props) {
|
|
|
675
615
|
);
|
|
676
616
|
const blockWidthDesktop = __("Block Width(DeskTop)", "block-collections");
|
|
677
617
|
|
|
678
|
-
//
|
|
679
|
-
const
|
|
680
|
-
|
|
681
|
-
? blockMaxWidthMobile
|
|
682
|
-
: blockWidthMobile
|
|
683
|
-
: isSubmenu
|
|
684
|
-
? blockMaxWidthDesktop
|
|
685
|
-
: blockWidthDesktop;
|
|
686
|
-
|
|
618
|
+
// ラベル
|
|
619
|
+
const widthLabel = isMobile ? blockWidthMobile : blockWidthDesktop;
|
|
620
|
+
const maxWidthLabel = isMobile ? blockMaxWidthMobile : blockMaxWidthDesktop;
|
|
687
621
|
return (
|
|
688
622
|
<>
|
|
689
|
-
<p>{
|
|
623
|
+
<p>{widthLabel}</p>
|
|
690
624
|
<ToolbarGroup>
|
|
691
625
|
<ToolbarItem>
|
|
692
626
|
{(itemProps) => (
|
|
693
627
|
<Button
|
|
694
628
|
{...itemProps}
|
|
695
629
|
isPressed={sel_pos.width_val === "full"}
|
|
696
|
-
onClick={() => props.onWidthChange("full")}
|
|
630
|
+
onClick={() => props.onWidthChange("width_val", "full")}
|
|
697
631
|
text="full"
|
|
698
632
|
/>
|
|
699
633
|
)}
|
|
@@ -703,7 +637,7 @@ export function BlockWidth(props) {
|
|
|
703
637
|
<Button
|
|
704
638
|
{...itemProps}
|
|
705
639
|
isPressed={sel_pos.width_val === "fit"}
|
|
706
|
-
onClick={() => props.onWidthChange("fit")}
|
|
640
|
+
onClick={() => props.onWidthChange("width_val", "fit")}
|
|
707
641
|
text="fit"
|
|
708
642
|
/>
|
|
709
643
|
)}
|
|
@@ -713,7 +647,7 @@ export function BlockWidth(props) {
|
|
|
713
647
|
<Button
|
|
714
648
|
{...itemProps}
|
|
715
649
|
isPressed={sel_pos.width_val === "wideSize"}
|
|
716
|
-
onClick={() => props.onWidthChange("wideSize")}
|
|
650
|
+
onClick={() => props.onWidthChange("width_val", "wideSize")}
|
|
717
651
|
icon={stretchWide}
|
|
718
652
|
label={__("Wide Size", "block-collections")}
|
|
719
653
|
/>
|
|
@@ -724,7 +658,7 @@ export function BlockWidth(props) {
|
|
|
724
658
|
<Button
|
|
725
659
|
{...itemProps}
|
|
726
660
|
isPressed={sel_pos.width_val === "contentSize"}
|
|
727
|
-
onClick={() => props.onWidthChange("contentSize")}
|
|
661
|
+
onClick={() => props.onWidthChange("width_val", "contentSize")}
|
|
728
662
|
icon={positionCenter}
|
|
729
663
|
label={__("Content Size", "block-collections")}
|
|
730
664
|
/>
|
|
@@ -735,7 +669,7 @@ export function BlockWidth(props) {
|
|
|
735
669
|
<Button
|
|
736
670
|
{...itemProps}
|
|
737
671
|
isPressed={sel_pos.width_val === "free"}
|
|
738
|
-
onClick={() => props.onWidthChange("free")}
|
|
672
|
+
onClick={() => props.onWidthChange("width_val", "free")}
|
|
739
673
|
text="free"
|
|
740
674
|
/>
|
|
741
675
|
)}
|
|
@@ -745,10 +679,77 @@ export function BlockWidth(props) {
|
|
|
745
679
|
{sel_pos.width_val === "free" && (
|
|
746
680
|
<UnitControl
|
|
747
681
|
dragDirection="e"
|
|
748
|
-
onChange={(newValue) =>
|
|
682
|
+
onChange={(newValue) =>
|
|
683
|
+
props.onFreeWidthChange("free_width", newValue)
|
|
684
|
+
}
|
|
749
685
|
value={sel_pos.free_width}
|
|
750
686
|
/>
|
|
751
687
|
)}
|
|
688
|
+
<p>{maxWidthLabel}</p>
|
|
689
|
+
<ToolbarGroup>
|
|
690
|
+
<ToolbarItem>
|
|
691
|
+
{(itemProps) => (
|
|
692
|
+
<Button
|
|
693
|
+
{...itemProps}
|
|
694
|
+
isPressed={sel_pos.max_width === "full"}
|
|
695
|
+
onClick={() => props.onWidthChange("max_width", "full")}
|
|
696
|
+
text="full"
|
|
697
|
+
/>
|
|
698
|
+
)}
|
|
699
|
+
</ToolbarItem>
|
|
700
|
+
<ToolbarItem>
|
|
701
|
+
{(itemProps) => (
|
|
702
|
+
<Button
|
|
703
|
+
{...itemProps}
|
|
704
|
+
isPressed={sel_pos.max_width === "fit"}
|
|
705
|
+
onClick={() => props.onWidthChange("max_width", "fit")}
|
|
706
|
+
text="fit"
|
|
707
|
+
/>
|
|
708
|
+
)}
|
|
709
|
+
</ToolbarItem>
|
|
710
|
+
<ToolbarItem>
|
|
711
|
+
{(itemProps) => (
|
|
712
|
+
<Button
|
|
713
|
+
{...itemProps}
|
|
714
|
+
isPressed={sel_pos.max_width === "wideSize"}
|
|
715
|
+
onClick={() => props.onWidthChange("max_width", "wideSize")}
|
|
716
|
+
icon={stretchWide}
|
|
717
|
+
label={__("Wide Size", "block-collections")}
|
|
718
|
+
/>
|
|
719
|
+
)}
|
|
720
|
+
</ToolbarItem>
|
|
721
|
+
<ToolbarItem>
|
|
722
|
+
{(itemProps) => (
|
|
723
|
+
<Button
|
|
724
|
+
{...itemProps}
|
|
725
|
+
isPressed={sel_pos.max_width === "contentSize"}
|
|
726
|
+
onClick={() => props.onWidthChange("max_width", "contentSize")}
|
|
727
|
+
icon={positionCenter}
|
|
728
|
+
label={__("Content Size", "block-collections")}
|
|
729
|
+
/>
|
|
730
|
+
)}
|
|
731
|
+
</ToolbarItem>
|
|
732
|
+
<ToolbarItem>
|
|
733
|
+
{(itemProps) => (
|
|
734
|
+
<Button
|
|
735
|
+
{...itemProps}
|
|
736
|
+
isPressed={sel_pos.max_width === "free"}
|
|
737
|
+
onClick={() => props.onWidthChange("max_width", "free")}
|
|
738
|
+
text="free"
|
|
739
|
+
/>
|
|
740
|
+
)}
|
|
741
|
+
</ToolbarItem>
|
|
742
|
+
</ToolbarGroup>
|
|
743
|
+
|
|
744
|
+
{sel_pos.max_width === "free" && (
|
|
745
|
+
<UnitControl
|
|
746
|
+
dragDirection="e"
|
|
747
|
+
onChange={(newValue) =>
|
|
748
|
+
props.onFreeWidthChange("max_free_width", newValue)
|
|
749
|
+
}
|
|
750
|
+
value={sel_pos.max_free_width}
|
|
751
|
+
/>
|
|
752
|
+
)}
|
|
752
753
|
</>
|
|
753
754
|
);
|
|
754
755
|
}
|
package/src/cssPropertes.js
CHANGED
|
@@ -69,14 +69,14 @@ export const position_prm = (pos, type) => {
|
|
|
69
69
|
export const max_width_prm = (width, free_val) => {
|
|
70
70
|
const ret_width_prm =
|
|
71
71
|
width === "wideSize"
|
|
72
|
-
? "
|
|
72
|
+
? "max-width: var(--wp--style--global--wide-size);"
|
|
73
73
|
: width === "contentSize"
|
|
74
|
-
? "
|
|
74
|
+
? "max-width: var(--wp--style--global--content-size);"
|
|
75
75
|
: width === "free"
|
|
76
|
-
? `
|
|
76
|
+
? `max-width: ${free_val};`
|
|
77
77
|
: width === "full"
|
|
78
|
-
? "
|
|
79
|
-
: "
|
|
78
|
+
? "max-width: 100%;"
|
|
79
|
+
: "max-width: fit-content;";
|
|
80
80
|
return ret_width_prm;
|
|
81
81
|
};
|
|
82
82
|
|
|
@@ -110,8 +110,8 @@ export const align_prm = (align, camelFLg = false) => {
|
|
|
110
110
|
align === "center"
|
|
111
111
|
? "margin-left: auto; margin-right: auto;"
|
|
112
112
|
: align === "right"
|
|
113
|
-
? "margin-left: auto; margin-right: 0"
|
|
114
|
-
: "margin-right: auto; margin-left: 0";
|
|
113
|
+
? "margin-left: auto; margin-right: 0;"
|
|
114
|
+
: "margin-right: auto; margin-left: 0;";
|
|
115
115
|
//インナースタイル用
|
|
116
116
|
const camel_align_prm =
|
|
117
117
|
align === "center"
|
package/src/customFooks.js
CHANGED
|
@@ -109,6 +109,30 @@ export function useElementBackgroundColor(blockRef, style) {
|
|
|
109
109
|
return baseColor;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
+
//ブロックのスタイルを取得し、コールバック関数を返すカスタムフック
|
|
113
|
+
export function useElementStyleObject(blockRef, style) {
|
|
114
|
+
const [styleObject, setStyleObject] = useState("");
|
|
115
|
+
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
if (blockRef.current && style) {
|
|
118
|
+
//レンダリング結果に基づくスタイルの取得
|
|
119
|
+
const computedStyles = getComputedStyle(blockRef.current);
|
|
120
|
+
// styleオブジェクトのキーに基づいてnewStyleObjectを生成
|
|
121
|
+
const newStyleObject = Object.keys(style).reduce((acc, key) => {
|
|
122
|
+
if (computedStyles[key]) {
|
|
123
|
+
// computedStylesにキーが存在するか確認
|
|
124
|
+
acc[key] = computedStyles[key];
|
|
125
|
+
}
|
|
126
|
+
return acc;
|
|
127
|
+
}, {});
|
|
128
|
+
|
|
129
|
+
setStyleObject(JSON.stringify(newStyleObject));
|
|
130
|
+
}
|
|
131
|
+
}, [blockRef, style]);
|
|
132
|
+
// styleObjectをオブジェクトとして返す
|
|
133
|
+
return styleObject;
|
|
134
|
+
}
|
|
135
|
+
|
|
112
136
|
//たくさんの要素をもつオブジェクトや配列の内容の変化で発火するuseEffect
|
|
113
137
|
export function useDeepCompareEffect(callback, dependencies) {
|
|
114
138
|
const dependenciesRef = useRef();
|
package/src/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
export {
|
|
3
3
|
useIsIframeMobile,
|
|
4
4
|
useElementBackgroundColor,
|
|
5
|
+
useElementStyleObject,
|
|
5
6
|
useElementWidth,
|
|
6
7
|
useIsMobile,
|
|
7
8
|
useDeepCompareEffect,
|
|
@@ -14,8 +15,10 @@ export {
|
|
|
14
15
|
export {
|
|
15
16
|
fetchPagesOptions,
|
|
16
17
|
fetchArchiveOptions,
|
|
18
|
+
restFetchData,
|
|
17
19
|
restTaxonomies,
|
|
18
20
|
restFieldes,
|
|
21
|
+
termToDispObj,
|
|
19
22
|
PageSelectControl,
|
|
20
23
|
ArchiveSelectControl,
|
|
21
24
|
TermChoiceControl,
|