itmar-block-packages 1.6.1 → 1.6.3
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 +5 -0
- package/build/index.asset.php +1 -1
- package/build/index.js +3 -3
- package/languages/itmar-block-packages-ja-2e59d6ebc088ea4b3d475a06e1e94824.json +1 -0
- package/languages/itmar-block-packages-ja-314423d5ad20380dc5fb85a96050381e.json +1 -0
- package/languages/itmar-block-packages-ja-3e946be5d900b4a727047c8a51bb058e.json +1 -0
- package/languages/itmar-block-packages-ja-5f1760422a0125b48fdcca644f4db89f.json +1 -0
- package/languages/itmar-block-packages-ja-800102e626a7ce0305d324a5bb0ee61e.json +1 -0
- package/languages/itmar-block-packages-ja-865f209aff5ee1f8efb51f6a62e8d8e1.json +1 -0
- package/languages/itmar-block-packages-ja-88eb778e4da0e010ceace8232ab1a901.json +1 -0
- package/languages/itmar-block-packages-ja-a418e2f5e97a053f5e0785a30f28b854.json +1 -0
- package/languages/itmar-block-packages-ja-ce2d14d174f0af0f13cd9a1302cebdd7.json +1 -0
- package/languages/itmar-block-packages-ja-f55909920e3bd84845271a62dbfb8dfe.json +1 -0
- package/languages/itmar-block-packages-ja-f6bd3c69ad85ee9ae9f1315af8f44e4a.json +1 -0
- package/languages/itmar-block-packages-ja.mo +0 -0
- package/languages/itmar-block-packages-ja.po +1485 -0
- package/languages/itmar-block-packages.pot +530 -0
- package/package.json +1 -1
- package/src/BlockPlace.js +8 -2
- package/src/GridControls.js +196 -137
- package/src/IconSelectControl.js +63 -23
- package/src/ShadowStyle.js +215 -158
- package/src/TypographyControls.js +62 -30
package/src/GridControls.js
CHANGED
|
@@ -6,21 +6,20 @@ import {
|
|
|
6
6
|
ToolbarDropdownMenu,
|
|
7
7
|
__experimentalNumberControl as NumberControl,
|
|
8
8
|
__experimentalUnitControl as UnitControl,
|
|
9
|
-
__experimentalInputControl as InputControl
|
|
10
|
-
} from
|
|
9
|
+
__experimentalInputControl as InputControl,
|
|
10
|
+
} from "@wordpress/components";
|
|
11
11
|
|
|
12
|
-
import { useSelect, dispatch } from
|
|
13
|
-
import { useState, useEffect, useRef } from
|
|
12
|
+
import { useSelect, dispatch } from "@wordpress/data";
|
|
13
|
+
import { useState, useEffect, useRef } from "@wordpress/element";
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
import {
|
|
17
|
-
import { justifyCenter, justifyLeft, justifyRight } from '@wordpress/icons';
|
|
15
|
+
import { __ } from "@wordpress/i18n";
|
|
16
|
+
import { justifyCenter, justifyLeft, justifyRight } from "@wordpress/icons";
|
|
18
17
|
//上よせアイコン
|
|
19
|
-
const upper = <Icon icon={justifyLeft} className="rotate-icon"
|
|
18
|
+
const upper = <Icon icon={justifyLeft} className="rotate-icon" />;
|
|
20
19
|
//中央よせのアイコン
|
|
21
|
-
const middle = <Icon icon={justifyCenter} className="rotate-icon"
|
|
20
|
+
const middle = <Icon icon={justifyCenter} className="rotate-icon" />;
|
|
22
21
|
//下よせのアイコン
|
|
23
|
-
const lower = <Icon icon={justifyRight} className="rotate-icon"
|
|
22
|
+
const lower = <Icon icon={justifyRight} className="rotate-icon" />;
|
|
24
23
|
// アイコンと文字列キーのマッピングを作成
|
|
25
24
|
const alignIconMap = {
|
|
26
25
|
left: justifyLeft,
|
|
@@ -28,13 +27,13 @@ const alignIconMap = {
|
|
|
28
27
|
right: justifyRight,
|
|
29
28
|
upper: upper,
|
|
30
29
|
middle: middle,
|
|
31
|
-
lower: lower
|
|
30
|
+
lower: lower,
|
|
32
31
|
};
|
|
33
32
|
|
|
34
33
|
const units = [
|
|
35
|
-
{ value:
|
|
36
|
-
{ value:
|
|
37
|
-
{ value:
|
|
34
|
+
{ value: "px", label: "px" },
|
|
35
|
+
{ value: "em", label: "em" },
|
|
36
|
+
{ value: "rem", label: "rem" },
|
|
38
37
|
];
|
|
39
38
|
|
|
40
39
|
const initializeUnitArray = (rowUnit, length) => {
|
|
@@ -44,7 +43,7 @@ const initializeUnitArray = (rowUnit, length) => {
|
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
return Array.from({ length }, (_, i) => rowUnit[i] || "1fr");
|
|
47
|
-
}
|
|
46
|
+
};
|
|
48
47
|
|
|
49
48
|
//r,cで与えられた座標がgridElmsのどの要素に含まれているかを返す
|
|
50
49
|
const findElementInGrid = (gridElms, r, c) => {
|
|
@@ -62,7 +61,7 @@ const findElementInGrid = (gridElms, r, c) => {
|
|
|
62
61
|
}
|
|
63
62
|
}
|
|
64
63
|
return null;
|
|
65
|
-
}
|
|
64
|
+
};
|
|
66
65
|
|
|
67
66
|
//親にイベントを伝播させないラッパー
|
|
68
67
|
const StopPropagationWrapper = ({ children }) => {
|
|
@@ -72,22 +71,15 @@ const StopPropagationWrapper = ({ children }) => {
|
|
|
72
71
|
};
|
|
73
72
|
|
|
74
73
|
return (
|
|
75
|
-
<div className=
|
|
74
|
+
<div className="itmar_event_stopper" onClick={handleClick}>
|
|
76
75
|
{children}
|
|
77
76
|
</div>
|
|
78
77
|
);
|
|
79
78
|
};
|
|
80
79
|
|
|
81
80
|
const GridControls = ({ attributes, clientId, onChange }) => {
|
|
82
|
-
const {
|
|
83
|
-
|
|
84
|
-
rowNum,
|
|
85
|
-
colNum,
|
|
86
|
-
rowGap,
|
|
87
|
-
colGap,
|
|
88
|
-
rowUnit,
|
|
89
|
-
colUnit
|
|
90
|
-
} = attributes;
|
|
81
|
+
const { gridElms, rowNum, colNum, rowGap, colGap, rowUnit, colUnit } =
|
|
82
|
+
attributes;
|
|
91
83
|
|
|
92
84
|
//コンポーネント内の行列情報
|
|
93
85
|
const [rowCount, setRowCount] = useState(rowNum);
|
|
@@ -100,7 +92,9 @@ const GridControls = ({ attributes, clientId, onChange }) => {
|
|
|
100
92
|
const renderRows = () => {
|
|
101
93
|
//セルが埋まっているかどうかの判定配列
|
|
102
94
|
|
|
103
|
-
const occupied = new Array(rowCount)
|
|
95
|
+
const occupied = new Array(rowCount)
|
|
96
|
+
.fill(0)
|
|
97
|
+
.map(() => new Array(colCount).fill(false));
|
|
104
98
|
|
|
105
99
|
let rows = [];
|
|
106
100
|
// 列単位入力行を追加
|
|
@@ -113,7 +107,11 @@ const GridControls = ({ attributes, clientId, onChange }) => {
|
|
|
113
107
|
type="text"
|
|
114
108
|
isPressEnterToChange={true}
|
|
115
109
|
onChange={(newValue) => {
|
|
116
|
-
const newArray = [
|
|
110
|
+
const newArray = [
|
|
111
|
+
...colUnit.slice(0, c),
|
|
112
|
+
newValue,
|
|
113
|
+
...colUnit.slice(c + 1),
|
|
114
|
+
];
|
|
117
115
|
setUnitColArray(newArray);
|
|
118
116
|
}}
|
|
119
117
|
/>
|
|
@@ -133,10 +131,13 @@ const GridControls = ({ attributes, clientId, onChange }) => {
|
|
|
133
131
|
type="text"
|
|
134
132
|
isPressEnterToChange={true}
|
|
135
133
|
onChange={(newValue) => {
|
|
136
|
-
const newArray = [
|
|
134
|
+
const newArray = [
|
|
135
|
+
...rowUnit.slice(0, r),
|
|
136
|
+
newValue,
|
|
137
|
+
...rowUnit.slice(r + 1),
|
|
138
|
+
];
|
|
137
139
|
setUnitRowArray(newArray);
|
|
138
140
|
}}
|
|
139
|
-
|
|
140
141
|
/>
|
|
141
142
|
</th>
|
|
142
143
|
);
|
|
@@ -148,11 +149,15 @@ const GridControls = ({ attributes, clientId, onChange }) => {
|
|
|
148
149
|
}
|
|
149
150
|
//複数のセルを占める設定があればセルの結合オブジェクトを生成
|
|
150
151
|
const setElm = findElementInGrid(gridElms, r, c);
|
|
151
|
-
const rowSpanValue = setElm
|
|
152
|
-
|
|
152
|
+
const rowSpanValue = setElm
|
|
153
|
+
? Math.abs(setElm.elm.startCell.rowInx - setElm.elm.endCell.rowInx)
|
|
154
|
+
: 0;
|
|
155
|
+
const colSpanValue = setElm
|
|
156
|
+
? Math.abs(setElm.elm.startCell.colInx - setElm.elm.endCell.colInx)
|
|
157
|
+
: 0;
|
|
153
158
|
const cellSpan = {
|
|
154
159
|
...(rowSpanValue !== 0 && { rowspan: rowSpanValue + 1 }),
|
|
155
|
-
...(colSpanValue !== 0 && { colspan: colSpanValue + 1 })
|
|
160
|
+
...(colSpanValue !== 0 && { colspan: colSpanValue + 1 }),
|
|
156
161
|
};
|
|
157
162
|
// 占められるセルの位置を記録
|
|
158
163
|
for (let i = 0; i <= rowSpanValue; i++) {
|
|
@@ -163,36 +168,54 @@ const GridControls = ({ attributes, clientId, onChange }) => {
|
|
|
163
168
|
}
|
|
164
169
|
}
|
|
165
170
|
//セルを生成
|
|
166
|
-
cells.push(
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
171
|
+
cells.push(
|
|
172
|
+
<td
|
|
173
|
+
key={`cell-${r}-${c}`}
|
|
174
|
+
{...cellSpan}
|
|
175
|
+
className={isCellSelected(r, c) ? "selected" : ""}
|
|
176
|
+
style={
|
|
177
|
+
setElm
|
|
178
|
+
? {
|
|
179
|
+
backgroundColor: `var(--wp--custom--color--area-${setElm.index})`,
|
|
180
|
+
}
|
|
181
|
+
: undefined
|
|
182
|
+
}
|
|
183
|
+
onClick={() => detectCellPosition(r, c)}
|
|
184
|
+
>
|
|
185
|
+
{setElm && (
|
|
186
|
+
<StopPropagationWrapper>
|
|
187
|
+
<ToolbarDropdownMenu
|
|
188
|
+
label={__("Lateral Alignment", "block-collections")}
|
|
189
|
+
icon={
|
|
190
|
+
setElm.elm.latAlign
|
|
191
|
+
? alignIconMap[setElm.elm.latAlign]
|
|
192
|
+
: alignIconMap["left"]
|
|
193
|
+
}
|
|
194
|
+
controls={["left", "center", "right"].map((align) => ({
|
|
195
|
+
icon: alignIconMap[align],
|
|
196
|
+
isActive: setElm.elm.latAlign === align,
|
|
197
|
+
onClick: () =>
|
|
198
|
+
updateAlignment(setElm.index, align, "latAlign"),
|
|
199
|
+
}))}
|
|
200
|
+
/>
|
|
201
|
+
<ToolbarDropdownMenu
|
|
202
|
+
label={__("Vertical Alignment", "block-collections")}
|
|
203
|
+
icon={
|
|
204
|
+
setElm.elm.vertAlign
|
|
205
|
+
? alignIconMap[setElm.elm.vertAlign]
|
|
206
|
+
: alignIconMap["upper"]
|
|
207
|
+
}
|
|
208
|
+
controls={["upper", "middle", "lower"].map((align) => ({
|
|
209
|
+
icon: alignIconMap[align],
|
|
210
|
+
isActive: setElm.elm.vertAlign === align,
|
|
211
|
+
onClick: () =>
|
|
212
|
+
updateAlignment(setElm.index, align, "vertAlign"),
|
|
213
|
+
}))}
|
|
214
|
+
/>
|
|
215
|
+
</StopPropagationWrapper>
|
|
216
|
+
)}
|
|
217
|
+
</td>
|
|
218
|
+
);
|
|
196
219
|
}
|
|
197
220
|
// 行の追加
|
|
198
221
|
rows.push(<tr key={`row-${r}`}>{cells}</tr>);
|
|
@@ -204,33 +227,46 @@ const GridControls = ({ attributes, clientId, onChange }) => {
|
|
|
204
227
|
const detectCellPosition = (rowIndex, colIndex) => {
|
|
205
228
|
//インナーブロックの選択がなければリターン
|
|
206
229
|
if (!selBlock) {
|
|
207
|
-
dispatch(
|
|
208
|
-
|
|
209
|
-
__(
|
|
210
|
-
{ type:
|
|
230
|
+
dispatch("core/notices").createNotice(
|
|
231
|
+
"error",
|
|
232
|
+
__("No blocks selected.", "itmar_guest_contact_block"),
|
|
233
|
+
{ type: "snackbar", isDismissible: true }
|
|
211
234
|
);
|
|
212
235
|
return;
|
|
213
236
|
}
|
|
214
237
|
//選択済みのセルが選択されたときはリターン
|
|
215
238
|
if (findElementInGrid(gridElms, rowIndex, colIndex)) {
|
|
216
|
-
dispatch(
|
|
217
|
-
|
|
218
|
-
__(
|
|
219
|
-
|
|
239
|
+
dispatch("core/notices").createNotice(
|
|
240
|
+
"error",
|
|
241
|
+
__(
|
|
242
|
+
"That cell is already selected by another block.",
|
|
243
|
+
"itmar_guest_contact_block"
|
|
244
|
+
),
|
|
245
|
+
{ type: "snackbar", isDismissible: true }
|
|
220
246
|
);
|
|
221
247
|
return;
|
|
222
248
|
}
|
|
223
249
|
|
|
224
250
|
//選択されたブロックのポジションを記録
|
|
225
251
|
const newBlock = !selBlock.startCell
|
|
226
|
-
? {
|
|
252
|
+
? {
|
|
253
|
+
...selBlock,
|
|
254
|
+
startCell: { rowInx: rowIndex, colInx: colIndex },
|
|
255
|
+
endCell: { rowInx: rowIndex, colInx: colIndex },
|
|
256
|
+
}
|
|
227
257
|
: { ...selBlock, endCell: { rowInx: rowIndex, colInx: colIndex } };
|
|
228
258
|
|
|
229
259
|
setSelBlock(newBlock);
|
|
230
260
|
|
|
231
261
|
//blockNamesの更新
|
|
232
|
-
const index = gridElms?.findIndex(
|
|
233
|
-
|
|
262
|
+
const index = gridElms?.findIndex(
|
|
263
|
+
(block) => block.value === selBlock.value
|
|
264
|
+
);
|
|
265
|
+
const setAreaBlock = [
|
|
266
|
+
...blockNames.slice(0, index),
|
|
267
|
+
newBlock,
|
|
268
|
+
...blockNames.slice(index + 1),
|
|
269
|
+
];
|
|
234
270
|
setBlockNames(setAreaBlock);
|
|
235
271
|
};
|
|
236
272
|
|
|
@@ -238,51 +274,73 @@ const GridControls = ({ attributes, clientId, onChange }) => {
|
|
|
238
274
|
const isCellSelected = (rowIndex, colIndex) => {
|
|
239
275
|
if (selBlock) {
|
|
240
276
|
// 各座標の最小値と最大値を決定
|
|
241
|
-
const minRow = Math.min(
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
277
|
+
const minRow = Math.min(
|
|
278
|
+
selBlock.startCell?.rowInx,
|
|
279
|
+
selBlock.endCell?.rowInx
|
|
280
|
+
);
|
|
281
|
+
const maxRow = Math.max(
|
|
282
|
+
selBlock.startCell?.rowInx,
|
|
283
|
+
selBlock.endCell?.rowInx
|
|
284
|
+
);
|
|
285
|
+
const minCol = Math.min(
|
|
286
|
+
selBlock.startCell?.colInx,
|
|
287
|
+
selBlock.endCell?.colInx
|
|
288
|
+
);
|
|
289
|
+
const maxCol = Math.max(
|
|
290
|
+
selBlock.startCell?.colInx,
|
|
291
|
+
selBlock.endCell?.colInx
|
|
292
|
+
);
|
|
245
293
|
|
|
246
294
|
// 座標が範囲内にあるかどうかをチェック
|
|
247
295
|
return (
|
|
248
|
-
rowIndex >= minRow &&
|
|
249
|
-
|
|
296
|
+
rowIndex >= minRow &&
|
|
297
|
+
rowIndex <= maxRow &&
|
|
298
|
+
colIndex >= minCol &&
|
|
299
|
+
colIndex <= maxCol
|
|
250
300
|
);
|
|
251
301
|
} else {
|
|
252
302
|
return false;
|
|
253
303
|
}
|
|
254
|
-
|
|
255
304
|
};
|
|
256
305
|
|
|
257
306
|
//コンテンツ位置設定
|
|
258
307
|
const updateAlignment = (index, align, derection) => {
|
|
259
308
|
const alignBlock = { ...blockNames[index], [derection]: align };
|
|
260
|
-
const setAlignBlock = [
|
|
309
|
+
const setAlignBlock = [
|
|
310
|
+
...blockNames.slice(0, index),
|
|
311
|
+
alignBlock,
|
|
312
|
+
...blockNames.slice(index + 1),
|
|
313
|
+
];
|
|
261
314
|
setBlockNames(setAlignBlock);
|
|
262
|
-
}
|
|
315
|
+
};
|
|
263
316
|
|
|
264
317
|
//選択したインナーブロック
|
|
265
318
|
const [selBlock, setSelBlock] = useState(null);
|
|
266
319
|
|
|
267
320
|
//インナーブロックを取得
|
|
268
|
-
const parentBlocks = useSelect(
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
321
|
+
const parentBlocks = useSelect(
|
|
322
|
+
(select) => {
|
|
323
|
+
const innerBlocks = select("core/block-editor").getBlocks(clientId);
|
|
324
|
+
//インナーブロック入れ替えの際は既に登録したブロックの位置情報があれば、それを付加する。
|
|
325
|
+
const new_block_names = innerBlocks.map((block, index) =>
|
|
326
|
+
gridElms.length > index
|
|
327
|
+
? {
|
|
328
|
+
value: block.clientId,
|
|
329
|
+
label: block.name,
|
|
330
|
+
startCell: gridElms[index].startCell,
|
|
331
|
+
endCell: gridElms[index].endCell,
|
|
332
|
+
latAlign: gridElms[index].latAlign,
|
|
333
|
+
vertAlign: gridElms[index].vertAlign,
|
|
334
|
+
}
|
|
335
|
+
: {
|
|
336
|
+
value: block.clientId,
|
|
337
|
+
label: block.name,
|
|
338
|
+
}
|
|
339
|
+
);
|
|
340
|
+
return new_block_names;
|
|
341
|
+
},
|
|
342
|
+
[clientId]
|
|
343
|
+
);
|
|
286
344
|
const [blockNames, setBlockNames] = useState(parentBlocks);
|
|
287
345
|
|
|
288
346
|
//グリッド配置のクリア
|
|
@@ -290,30 +348,35 @@ const GridControls = ({ attributes, clientId, onChange }) => {
|
|
|
290
348
|
//ブロックの配置情報削除
|
|
291
349
|
const clear_block = blockNames.map((block) => ({
|
|
292
350
|
value: block.value,
|
|
293
|
-
label: block.label
|
|
294
|
-
}
|
|
295
|
-
));
|
|
351
|
+
label: block.label,
|
|
352
|
+
}));
|
|
296
353
|
setBlockNames(clear_block);
|
|
297
|
-
|
|
298
|
-
}
|
|
354
|
+
};
|
|
299
355
|
|
|
300
356
|
//単位配列の初期化
|
|
301
357
|
const initRowUnitArray = initializeUnitArray(rowUnit, rowCount);
|
|
302
358
|
const [unitRowArray, setUnitRowArray] = useState(initRowUnitArray);
|
|
303
|
-
const initColUnitArray = initializeUnitArray(colUnit, colCount)
|
|
359
|
+
const initColUnitArray = initializeUnitArray(colUnit, colCount);
|
|
304
360
|
const [unitColArray, setUnitColArray] = useState(initColUnitArray);
|
|
305
361
|
|
|
306
362
|
//親ブロックへの書き戻し
|
|
307
363
|
useEffect(() => {
|
|
308
|
-
const gridStyle = {
|
|
364
|
+
const gridStyle = {
|
|
365
|
+
...attributes,
|
|
366
|
+
gridElms: blockNames,
|
|
367
|
+
rowNum: rowCount,
|
|
368
|
+
colNum: colCount,
|
|
369
|
+
rowUnit: unitRowArray,
|
|
370
|
+
colUnit: unitColArray,
|
|
371
|
+
};
|
|
309
372
|
|
|
310
373
|
onChange(gridStyle);
|
|
311
|
-
|
|
312
374
|
}, [blockNames, unitRowArray, unitColArray]);
|
|
313
375
|
|
|
314
376
|
//行と列の数を変えた場合は位置情報を削除・単位の再編成
|
|
315
377
|
useEffect(() => {
|
|
316
|
-
if (!firstFlgRef.current) {
|
|
378
|
+
if (!firstFlgRef.current) {
|
|
379
|
+
//マウント時は実行しない
|
|
317
380
|
//ブロックの位置情報クリア
|
|
318
381
|
clear_placement();
|
|
319
382
|
//単位情報の再編成
|
|
@@ -322,79 +385,75 @@ const GridControls = ({ attributes, clientId, onChange }) => {
|
|
|
322
385
|
const newColUnitArray = initializeUnitArray(colUnit, colCount);
|
|
323
386
|
setUnitColArray(newColUnitArray);
|
|
324
387
|
} else {
|
|
325
|
-
firstFlgRef.current = false
|
|
388
|
+
firstFlgRef.current = false;
|
|
326
389
|
}
|
|
327
|
-
|
|
328
390
|
}, [rowCount, colCount]);
|
|
329
391
|
|
|
330
392
|
return (
|
|
331
393
|
<>
|
|
332
|
-
<PanelRow
|
|
333
|
-
className='distance_row'
|
|
334
|
-
>
|
|
394
|
+
<PanelRow className="distance_row">
|
|
335
395
|
<NumberControl
|
|
336
396
|
onChange={(newValue) => {
|
|
337
|
-
const input_val =
|
|
397
|
+
const input_val =
|
|
398
|
+
typeof newValue === "number" ? newValue : Number(newValue);
|
|
338
399
|
setRowCount(input_val);
|
|
339
400
|
}}
|
|
340
|
-
label={__(
|
|
401
|
+
label={__("Number of Row ", "block-collections")}
|
|
341
402
|
value={rowCount}
|
|
342
403
|
min={2}
|
|
343
404
|
/>
|
|
344
405
|
<NumberControl
|
|
345
406
|
onChange={(newValue) => {
|
|
346
|
-
const input_val =
|
|
407
|
+
const input_val =
|
|
408
|
+
typeof newValue === "number" ? newValue : Number(newValue);
|
|
347
409
|
setColCount(input_val);
|
|
348
410
|
}}
|
|
349
|
-
label={__(
|
|
411
|
+
label={__("Number of Colum", "block-collections")}
|
|
350
412
|
value={colCount}
|
|
351
413
|
/>
|
|
352
414
|
</PanelRow>
|
|
353
|
-
<PanelRow
|
|
354
|
-
className='distance_row'
|
|
355
|
-
>
|
|
415
|
+
<PanelRow className="distance_row">
|
|
356
416
|
<UnitControl
|
|
357
417
|
onChange={(newValue) => {
|
|
358
|
-
newValue = newValue !=
|
|
418
|
+
newValue = newValue != "" ? newValue : "0px";
|
|
359
419
|
const newStyle = { ...attributes, rowGap: newValue };
|
|
360
420
|
onChange(newStyle);
|
|
361
421
|
}}
|
|
362
|
-
label={__(
|
|
422
|
+
label={__("Row Gap", "block-collections")}
|
|
363
423
|
value={rowGap}
|
|
364
424
|
units={units}
|
|
365
425
|
/>
|
|
366
426
|
<UnitControl
|
|
367
427
|
onChange={(newValue) => {
|
|
368
|
-
newValue = newValue !=
|
|
428
|
+
newValue = newValue != "" ? newValue : "0px";
|
|
369
429
|
const newStyle = { ...attributes, colGap: newValue };
|
|
370
430
|
onChange(newStyle);
|
|
371
431
|
}}
|
|
372
|
-
label={__(
|
|
432
|
+
label={__("Colum Gap", "block-collections")}
|
|
373
433
|
value={colGap}
|
|
374
434
|
units={units}
|
|
375
435
|
/>
|
|
376
|
-
|
|
377
436
|
</PanelRow>
|
|
378
437
|
|
|
379
|
-
<PanelRow className=
|
|
380
|
-
<p>{__(
|
|
438
|
+
<PanelRow className="distance_row">
|
|
439
|
+
<p>{__("Element placement", "block-collections")}</p>
|
|
381
440
|
<Button variant="secondary" onClick={clear_placement}>
|
|
382
|
-
{__("Clear",
|
|
441
|
+
{__("Clear", "block-collections")}
|
|
383
442
|
</Button>
|
|
384
443
|
</PanelRow>
|
|
385
444
|
|
|
386
|
-
<PanelRow className=
|
|
387
|
-
<table>
|
|
388
|
-
{renderRows()}
|
|
389
|
-
</table>
|
|
445
|
+
<PanelRow className="grid_table">
|
|
446
|
+
<table>{renderRows()}</table>
|
|
390
447
|
</PanelRow>
|
|
391
448
|
<ComboboxControl
|
|
392
|
-
label={__(
|
|
449
|
+
label={__("InnerBlock Name", "block-collections")}
|
|
393
450
|
options={blockNames}
|
|
394
451
|
value={selBlock ? selBlock.value : null}
|
|
395
452
|
onChange={(sel_id) => {
|
|
396
|
-
const matchedBlock = blockNames.find(
|
|
397
|
-
|
|
453
|
+
const matchedBlock = blockNames.find(
|
|
454
|
+
(block) => block.value === sel_id
|
|
455
|
+
);
|
|
456
|
+
setSelBlock(matchedBlock);
|
|
398
457
|
}}
|
|
399
458
|
/>
|
|
400
459
|
</>
|
package/src/IconSelectControl.js
CHANGED
|
@@ -26,10 +26,15 @@ const helpTextCode = createElement(
|
|
|
26
26
|
)
|
|
27
27
|
);
|
|
28
28
|
|
|
29
|
+
const helpImageURL = createElement(
|
|
30
|
+
"span",
|
|
31
|
+
{},
|
|
32
|
+
__("Enter the URL for the image.", "block-collections")
|
|
33
|
+
);
|
|
34
|
+
|
|
29
35
|
const helpTextFamily = createElement(
|
|
30
36
|
"span",
|
|
31
37
|
{},
|
|
32
|
-
helpLink,
|
|
33
38
|
__(
|
|
34
39
|
"Please select the first class name shown in the HTML code field of the selection dialog. ",
|
|
35
40
|
"block-collections"
|
|
@@ -49,6 +54,8 @@ const family_option = [
|
|
|
49
54
|
|
|
50
55
|
export default ({ iconStyle, setPosition, onChange }) => {
|
|
51
56
|
const {
|
|
57
|
+
icon_type,
|
|
58
|
+
icon_url,
|
|
52
59
|
icon_name,
|
|
53
60
|
icon_pos,
|
|
54
61
|
icon_size,
|
|
@@ -59,29 +66,62 @@ export default ({ iconStyle, setPosition, onChange }) => {
|
|
|
59
66
|
|
|
60
67
|
return (
|
|
61
68
|
<>
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
69
|
+
<label className="components-base-control__label">
|
|
70
|
+
{__("Icon Types", "block-collections")}
|
|
71
|
+
</label>
|
|
72
|
+
<PanelRow className="itmar_position_row">
|
|
73
|
+
<RadioControl
|
|
74
|
+
selected={icon_type}
|
|
75
|
+
options={[
|
|
76
|
+
{ label: __("Awesome", "block-collections"), value: "awesome" },
|
|
77
|
+
{ label: __("Image", "block-collections"), value: "image" },
|
|
78
|
+
{ label: __("Avatar", "block-collections"), value: "avatar" },
|
|
79
|
+
]}
|
|
80
|
+
onChange={(newValue) => {
|
|
81
|
+
const newStyle = { ...iconStyle, icon_type: newValue };
|
|
82
|
+
onChange(newStyle);
|
|
83
|
+
}}
|
|
84
|
+
/>
|
|
85
|
+
</PanelRow>
|
|
86
|
+
{icon_type === "awesome" && (
|
|
87
|
+
<>
|
|
88
|
+
<TextControl
|
|
89
|
+
label={__("icon name", "block-collections")}
|
|
90
|
+
help={helpTextCode}
|
|
91
|
+
labelPosition="top"
|
|
92
|
+
value={icon_name}
|
|
93
|
+
isPressEnterToChange
|
|
94
|
+
onChange={(newValue) => {
|
|
95
|
+
const newStyle = { ...iconStyle, icon_name: newValue };
|
|
96
|
+
onChange(newStyle);
|
|
97
|
+
}}
|
|
98
|
+
/>
|
|
84
99
|
|
|
100
|
+
<ComboboxControl
|
|
101
|
+
label={__("Icon Family", "block-collections")}
|
|
102
|
+
help={helpTextFamily}
|
|
103
|
+
options={family_option}
|
|
104
|
+
value={icon_family ? icon_family : "Font Awesome 6 Free"}
|
|
105
|
+
onChange={(newValue) => {
|
|
106
|
+
const newStyle = { ...iconStyle, icon_family: newValue };
|
|
107
|
+
onChange(newStyle);
|
|
108
|
+
}}
|
|
109
|
+
/>
|
|
110
|
+
</>
|
|
111
|
+
)}
|
|
112
|
+
{icon_type === "image" && (
|
|
113
|
+
<TextControl
|
|
114
|
+
label={__("icon url", "block-collections")}
|
|
115
|
+
help={helpImageURL}
|
|
116
|
+
labelPosition="top"
|
|
117
|
+
value={icon_url}
|
|
118
|
+
isPressEnterToChange
|
|
119
|
+
onChange={(newValue) => {
|
|
120
|
+
const newStyle = { ...iconStyle, icon_url: newValue };
|
|
121
|
+
onChange(newStyle);
|
|
122
|
+
}}
|
|
123
|
+
/>
|
|
124
|
+
)}
|
|
85
125
|
<PanelRow className="sizing_row">
|
|
86
126
|
<UnitControl
|
|
87
127
|
dragDirection="e"
|