@saltcorn/builder 0.7.3-beta.6 → 0.7.4-beta.0
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/dist/builder_bundle.js +20 -12
- package/package.json +3 -2
- package/src/components/Builder.js +11 -2
- package/src/components/Library.js +48 -5
- package/src/components/elements/Action.js +9 -12
- package/src/components/elements/Aggregation.js +13 -13
- package/src/components/elements/Columns.js +17 -11
- package/src/components/elements/Container.js +15 -23
- package/src/components/elements/DropDownFilter.js +14 -11
- package/src/components/elements/Field.js +12 -11
- package/src/components/elements/Image.js +3 -7
- package/src/components/elements/JoinField.js +10 -6
- package/src/components/elements/Link.js +12 -22
- package/src/components/elements/SearchBar.js +4 -6
- package/src/components/elements/Tabs.js +13 -26
- package/src/components/elements/Text.js +10 -10
- package/src/components/elements/ToggleFilter.js +11 -14
- package/src/components/elements/View.js +9 -13
- package/src/components/elements/ViewLink.js +7 -10
- package/src/components/elements/utils.js +13 -7
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
OrFormula,
|
|
14
14
|
ButtonOrLinkSettingsRows,
|
|
15
15
|
DynamicFontAwesomeIcon,
|
|
16
|
+
setAPropGen,
|
|
16
17
|
} from "./utils";
|
|
17
18
|
import optionsCtx from "../context";
|
|
18
19
|
|
|
@@ -111,12 +112,7 @@ const LinkSettings = () => {
|
|
|
111
112
|
transfer_state,
|
|
112
113
|
} = node;
|
|
113
114
|
const options = useContext(optionsCtx);
|
|
114
|
-
const setAProp = (
|
|
115
|
-
if (e.target) {
|
|
116
|
-
const target_value = e.target.value;
|
|
117
|
-
setProp((prop) => (prop[key] = target_value));
|
|
118
|
-
}
|
|
119
|
-
};
|
|
115
|
+
const setAProp = setAPropGen(setProp);
|
|
120
116
|
return (
|
|
121
117
|
<div>
|
|
122
118
|
<table className="w-100">
|
|
@@ -144,14 +140,16 @@ const LinkSettings = () => {
|
|
|
144
140
|
<select
|
|
145
141
|
value={link_src}
|
|
146
142
|
className="form-control form-select"
|
|
147
|
-
onChange={(e) =>
|
|
143
|
+
onChange={(e) => {
|
|
144
|
+
if (!e.target) return;
|
|
145
|
+
const value = e.target.value;
|
|
148
146
|
setProp((prop) => {
|
|
149
|
-
prop.link_src =
|
|
147
|
+
prop.link_src = value;
|
|
150
148
|
if (e.target.value !== "URL") {
|
|
151
149
|
prop.isFormula.url = false;
|
|
152
150
|
}
|
|
153
|
-
})
|
|
154
|
-
}
|
|
151
|
+
});
|
|
152
|
+
}}
|
|
155
153
|
>
|
|
156
154
|
<option>URL</option>
|
|
157
155
|
{(options.pages || []).length > 0 && <option>Page</option>}
|
|
@@ -237,9 +235,7 @@ const LinkSettings = () => {
|
|
|
237
235
|
name="block"
|
|
238
236
|
type="checkbox"
|
|
239
237
|
checked={nofollow}
|
|
240
|
-
onChange={(
|
|
241
|
-
setProp((prop) => (prop.nofollow = e.target.checked))
|
|
242
|
-
}
|
|
238
|
+
onChange={setAProp("nofollow", { checked: true })}
|
|
243
239
|
/>
|
|
244
240
|
<label className="form-check-label">Nofollow</label>
|
|
245
241
|
</div>
|
|
@@ -249,9 +245,7 @@ const LinkSettings = () => {
|
|
|
249
245
|
name="block"
|
|
250
246
|
type="checkbox"
|
|
251
247
|
checked={target_blank}
|
|
252
|
-
onChange={(
|
|
253
|
-
setProp((prop) => (prop.target_blank = e.target.checked))
|
|
254
|
-
}
|
|
248
|
+
onChange={setAProp("target_blank", { checked: true })}
|
|
255
249
|
/>
|
|
256
250
|
<label className="form-check-label">Open in new tab</label>
|
|
257
251
|
</div>
|
|
@@ -261,9 +255,7 @@ const LinkSettings = () => {
|
|
|
261
255
|
name="block"
|
|
262
256
|
type="checkbox"
|
|
263
257
|
checked={in_modal}
|
|
264
|
-
onChange={(
|
|
265
|
-
setProp((prop) => (prop.in_modal = e.target.checked))
|
|
266
|
-
}
|
|
258
|
+
onChange={setAProp("in_modal", { checked: true })}
|
|
267
259
|
/>
|
|
268
260
|
<label className="form-check-label">Open in popup modal?</label>
|
|
269
261
|
</div>
|
|
@@ -275,9 +267,7 @@ const LinkSettings = () => {
|
|
|
275
267
|
name="block"
|
|
276
268
|
type="checkbox"
|
|
277
269
|
checked={transfer_state}
|
|
278
|
-
onChange={(
|
|
279
|
-
setProp((prop) => (prop.transfer_state = e.target.checked))
|
|
280
|
-
}
|
|
270
|
+
onChange={setAProp("transfer_state", { checked: true })}
|
|
281
271
|
/>
|
|
282
272
|
<label className="form-check-label">Transfer state</label>
|
|
283
273
|
</div>
|
|
@@ -9,6 +9,7 @@ import { Element, useNode } from "@craftjs/core";
|
|
|
9
9
|
import { Column } from "./Column";
|
|
10
10
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
11
11
|
import { faCaretDown } from "@fortawesome/free-solid-svg-icons";
|
|
12
|
+
import { setAPropGen } from "./utils";
|
|
12
13
|
|
|
13
14
|
export /**
|
|
14
15
|
* @param {object} props
|
|
@@ -92,6 +93,7 @@ const SearchBarSettings = () => {
|
|
|
92
93
|
has_dropdown: node.data.props.has_dropdown,
|
|
93
94
|
show_badges: node.data.props.show_badges,
|
|
94
95
|
}));
|
|
96
|
+
const setAProp = setAPropGen(setProp);
|
|
95
97
|
|
|
96
98
|
return (
|
|
97
99
|
<div>
|
|
@@ -101,9 +103,7 @@ const SearchBarSettings = () => {
|
|
|
101
103
|
name="block"
|
|
102
104
|
type="checkbox"
|
|
103
105
|
checked={has_dropdown}
|
|
104
|
-
onChange={(
|
|
105
|
-
setProp((prop) => (prop.has_dropdown = e.target.checked))
|
|
106
|
-
}
|
|
106
|
+
onChange={setAProp("has_dropdown", { checked: true })}
|
|
107
107
|
/>
|
|
108
108
|
<label className="form-check-label">Has Dropdown</label>
|
|
109
109
|
</div>
|
|
@@ -113,9 +113,7 @@ const SearchBarSettings = () => {
|
|
|
113
113
|
name="block"
|
|
114
114
|
type="checkbox"
|
|
115
115
|
checked={show_badges}
|
|
116
|
-
onChange={(
|
|
117
|
-
setProp((prop) => (prop.show_badges = e.target.checked))
|
|
118
|
-
}
|
|
116
|
+
onChange={setAProp("show_badges", { checked: true })}
|
|
119
117
|
/>
|
|
120
118
|
<label className="form-check-label">Show current state badges</label>
|
|
121
119
|
</div>
|
|
@@ -8,6 +8,7 @@ import React, { Fragment, useState, useContext, useEffect } from "react";
|
|
|
8
8
|
import { ntimes } from "./Columns";
|
|
9
9
|
import { Column } from "./Column";
|
|
10
10
|
import optionsCtx from "../context";
|
|
11
|
+
import { setAPropGen } from "./utils";
|
|
11
12
|
|
|
12
13
|
import { Element, useNode } from "@craftjs/core";
|
|
13
14
|
|
|
@@ -194,6 +195,8 @@ const TabsSettings = () => {
|
|
|
194
195
|
}
|
|
195
196
|
});
|
|
196
197
|
}, [field]);
|
|
198
|
+
const setAProp = setAPropGen(setProp);
|
|
199
|
+
|
|
197
200
|
return (
|
|
198
201
|
<table className="w-100" accordiontitle="Placement">
|
|
199
202
|
<tbody>
|
|
@@ -205,11 +208,7 @@ const TabsSettings = () => {
|
|
|
205
208
|
<select
|
|
206
209
|
value={tabsStyle}
|
|
207
210
|
className="form-control form-select"
|
|
208
|
-
onChange={(
|
|
209
|
-
setProp((prop) => {
|
|
210
|
-
prop.tabsStyle = e.target.value;
|
|
211
|
-
})
|
|
212
|
-
}
|
|
211
|
+
onChange={setAProp("tabsStyle")}
|
|
213
212
|
>
|
|
214
213
|
<option>Tabs</option>
|
|
215
214
|
<option>Pills</option>
|
|
@@ -229,9 +228,7 @@ const TabsSettings = () => {
|
|
|
229
228
|
<select
|
|
230
229
|
value={field}
|
|
231
230
|
className="form-control form-select"
|
|
232
|
-
onChange={(
|
|
233
|
-
setProp((prop) => (prop.field = e.target.value));
|
|
234
|
-
}}
|
|
231
|
+
onChange={setAProp("field")}
|
|
235
232
|
>
|
|
236
233
|
{options.fields.map((f, ix) => (
|
|
237
234
|
<option key={ix} value={f.name}>
|
|
@@ -255,9 +252,7 @@ const TabsSettings = () => {
|
|
|
255
252
|
step="1"
|
|
256
253
|
min="0"
|
|
257
254
|
max="20"
|
|
258
|
-
onChange={(
|
|
259
|
-
setProp((prop) => (prop.ntabs = e.target.value))
|
|
260
|
-
}
|
|
255
|
+
onChange={setAProp("ntabs")}
|
|
261
256
|
/>
|
|
262
257
|
</td>
|
|
263
258
|
</tr>
|
|
@@ -272,9 +267,11 @@ const TabsSettings = () => {
|
|
|
272
267
|
type="text"
|
|
273
268
|
className="form-control text-to-display"
|
|
274
269
|
value={titles[ix]}
|
|
275
|
-
onChange={(e) =>
|
|
276
|
-
|
|
277
|
-
|
|
270
|
+
onChange={(e) => {
|
|
271
|
+
if (!e.target) return;
|
|
272
|
+
const value = e.target.value;
|
|
273
|
+
setProp((prop) => (prop.titles[ix] = value));
|
|
274
|
+
}}
|
|
278
275
|
/>
|
|
279
276
|
</td>
|
|
280
277
|
</tr>
|
|
@@ -288,13 +285,7 @@ const TabsSettings = () => {
|
|
|
288
285
|
name="block"
|
|
289
286
|
type="checkbox"
|
|
290
287
|
checked={independent}
|
|
291
|
-
onChange={(
|
|
292
|
-
if (e.target) {
|
|
293
|
-
setProp(
|
|
294
|
-
(prop) => (prop.independent = e.target.checked)
|
|
295
|
-
);
|
|
296
|
-
}
|
|
297
|
-
}}
|
|
288
|
+
onChange={setAProp("independent", { checked: true })}
|
|
298
289
|
/>
|
|
299
290
|
<label className="form-check-label">
|
|
300
291
|
Open independently
|
|
@@ -311,11 +302,7 @@ const TabsSettings = () => {
|
|
|
311
302
|
name="block"
|
|
312
303
|
type="checkbox"
|
|
313
304
|
checked={deeplink}
|
|
314
|
-
onChange={(
|
|
315
|
-
if (e.target) {
|
|
316
|
-
setProp((prop) => (prop.deeplink = e.target.checked));
|
|
317
|
-
}
|
|
318
|
-
}}
|
|
305
|
+
onChange={setAProp("deeplink", { checked: true })}
|
|
319
306
|
/>
|
|
320
307
|
<label className="form-check-label">Deep link</label>
|
|
321
308
|
</div>
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
isBlock,
|
|
18
18
|
reactifyStyles,
|
|
19
19
|
SettingsRow,
|
|
20
|
+
setAPropGen,
|
|
20
21
|
} from "./utils";
|
|
21
22
|
import ContentEditable from "react-contenteditable";
|
|
22
23
|
import optionsCtx from "../context";
|
|
@@ -121,7 +122,9 @@ const Text = ({
|
|
|
121
122
|
html={text}
|
|
122
123
|
style={{ display: "inline" }}
|
|
123
124
|
disabled={!editable}
|
|
124
|
-
onChange={(e) =>
|
|
125
|
+
onChange={(e) =>
|
|
126
|
+
e?.target && setProp((props) => (props.text = e.target.value))
|
|
127
|
+
}
|
|
125
128
|
/>
|
|
126
129
|
</Fragment>
|
|
127
130
|
) : editable ? (
|
|
@@ -175,12 +178,7 @@ const TextSettings = () => {
|
|
|
175
178
|
style,
|
|
176
179
|
} = node;
|
|
177
180
|
const { mode, fields } = useContext(optionsCtx);
|
|
178
|
-
const setAProp = (
|
|
179
|
-
if (e.target) {
|
|
180
|
-
const target_value = e.target.value;
|
|
181
|
-
setProp((prop) => (prop[key] = target_value));
|
|
182
|
-
}
|
|
183
|
-
};
|
|
181
|
+
const setAProp = setAPropGen(setProp);
|
|
184
182
|
return (
|
|
185
183
|
<div>
|
|
186
184
|
{mode === "show" && (
|
|
@@ -189,9 +187,11 @@ const TextSettings = () => {
|
|
|
189
187
|
type="checkbox"
|
|
190
188
|
className="form-check-input"
|
|
191
189
|
checked={isFormula.text}
|
|
192
|
-
onChange={(e) =>
|
|
193
|
-
|
|
194
|
-
|
|
190
|
+
onChange={(e) => {
|
|
191
|
+
if (!e.target) return;
|
|
192
|
+
const checked = e.target.checked;
|
|
193
|
+
setProp((prop) => (prop.isFormula.text = checked));
|
|
194
|
+
}}
|
|
195
195
|
/>
|
|
196
196
|
<label className="form-check-label">Formula?</label>
|
|
197
197
|
</div>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import React, { useContext, Fragment } from "react";
|
|
8
8
|
import { useNode } from "@craftjs/core";
|
|
9
9
|
import optionsCtx from "../context";
|
|
10
|
-
import { blockProps, BlockSetting, TextStyleRow } from "./utils";
|
|
10
|
+
import { blockProps, BlockSetting, TextStyleRow, setAPropGen } from "./utils";
|
|
11
11
|
|
|
12
12
|
export /**
|
|
13
13
|
* @param {object} props
|
|
@@ -78,12 +78,7 @@ const ToggleFilterSettings = () => {
|
|
|
78
78
|
const field = options.fields.find((f) => f.name === name);
|
|
79
79
|
const preset_options = field.preset_options;
|
|
80
80
|
const isBool = field && field.type.name === "Bool";
|
|
81
|
-
const setAProp = (
|
|
82
|
-
if (e.target) {
|
|
83
|
-
const target_value = e.target.value;
|
|
84
|
-
setProp((prop) => (prop[key] = target_value));
|
|
85
|
-
}
|
|
86
|
-
};
|
|
81
|
+
const setAProp = setAPropGen(setProp);
|
|
87
82
|
return (
|
|
88
83
|
<table className="w-100">
|
|
89
84
|
<tbody>
|
|
@@ -96,13 +91,15 @@ const ToggleFilterSettings = () => {
|
|
|
96
91
|
value={name}
|
|
97
92
|
className="form-control form-select"
|
|
98
93
|
onChange={(e) => {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
94
|
+
if (e?.target) {
|
|
95
|
+
if (!e.target) return;
|
|
96
|
+
const value = e.target.value;
|
|
97
|
+
setProp((prop) => (prop.name = value));
|
|
98
|
+
const field = options.fields.find((f) => f.name === value);
|
|
99
|
+
const isBool = field && field.type.name === "Bool";
|
|
100
|
+
if (isBool) setProp((prop) => (prop.value = "on"));
|
|
101
|
+
setProp((prop) => (prop.preset_value = ""));
|
|
102
|
+
}
|
|
106
103
|
}}
|
|
107
104
|
>
|
|
108
105
|
{options.fields.map((f, ix) => (
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
MinRoleSetting,
|
|
16
16
|
fetchViewPreview,
|
|
17
17
|
ConfigForm,
|
|
18
|
+
setAPropGen,
|
|
18
19
|
} from "./utils";
|
|
19
20
|
|
|
20
21
|
export /**
|
|
@@ -99,18 +100,17 @@ const ViewSettings = () => {
|
|
|
99
100
|
options.fixed_state_fields && options.fixed_state_fields[view];
|
|
100
101
|
const { setPreviews } = useContext(previewCtx);
|
|
101
102
|
|
|
102
|
-
const setAProp = (
|
|
103
|
-
if (e.target) {
|
|
104
|
-
const target_value = e.target.value;
|
|
105
|
-
setProp((prop) => (prop[key] = target_value));
|
|
106
|
-
}
|
|
107
|
-
};
|
|
103
|
+
const setAProp = setAPropGen(setProp);
|
|
108
104
|
let errorString = false;
|
|
109
105
|
try {
|
|
110
106
|
Function("return " + extra_state_fml);
|
|
111
107
|
} catch (error) {
|
|
112
108
|
errorString = error.message;
|
|
113
109
|
}
|
|
110
|
+
let viewname = view;
|
|
111
|
+
if (viewname && viewname.includes(":")) viewname = viewname.split(":")[1];
|
|
112
|
+
if (viewname && viewname.includes(".")) viewname = viewname.split(".")[0];
|
|
113
|
+
|
|
114
114
|
return (
|
|
115
115
|
<div>
|
|
116
116
|
<div>
|
|
@@ -118,9 +118,7 @@ const ViewSettings = () => {
|
|
|
118
118
|
<select
|
|
119
119
|
value={view}
|
|
120
120
|
className="form-control form-select"
|
|
121
|
-
onChange={(
|
|
122
|
-
setProp((prop) => (prop.view = e.target.value));
|
|
123
|
-
}}
|
|
121
|
+
onChange={setAProp("view")}
|
|
124
122
|
>
|
|
125
123
|
{views.map((f, ix) => (
|
|
126
124
|
<option key={ix} value={f.name}>
|
|
@@ -165,9 +163,7 @@ const ViewSettings = () => {
|
|
|
165
163
|
type="text"
|
|
166
164
|
className="viewlink-label form-control"
|
|
167
165
|
value={extra_state_fml}
|
|
168
|
-
onChange={(
|
|
169
|
-
setProp((prop) => (prop.extra_state_fml = e.target.value))
|
|
170
|
-
}
|
|
166
|
+
onChange={setAProp("extra_state_fml")}
|
|
171
167
|
/>
|
|
172
168
|
{errorString ? (
|
|
173
169
|
<small className="text-danger font-monospace d-block">
|
|
@@ -180,7 +176,7 @@ const ViewSettings = () => {
|
|
|
180
176
|
<a
|
|
181
177
|
className="d-block mt-2"
|
|
182
178
|
target="_blank"
|
|
183
|
-
href={`/viewedit/config/${
|
|
179
|
+
href={`/viewedit/config/${viewname}`}
|
|
184
180
|
>
|
|
185
181
|
Configure this view
|
|
186
182
|
</a>
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
OrFormula,
|
|
15
15
|
TextStyleSetting,
|
|
16
16
|
ButtonOrLinkSettingsRows,
|
|
17
|
+
setAPropGen,
|
|
17
18
|
} from "./utils";
|
|
18
19
|
|
|
19
20
|
export /**
|
|
@@ -119,6 +120,8 @@ const ViewLinkSettings = () => {
|
|
|
119
120
|
} catch (error) {
|
|
120
121
|
errorString = error.message;
|
|
121
122
|
}
|
|
123
|
+
const setAProp = setAPropGen(setProp);
|
|
124
|
+
|
|
122
125
|
return (
|
|
123
126
|
<div>
|
|
124
127
|
<table className="w-100">
|
|
@@ -129,9 +132,7 @@ const ViewLinkSettings = () => {
|
|
|
129
132
|
<select
|
|
130
133
|
value={name}
|
|
131
134
|
className="form-control form-select"
|
|
132
|
-
onChange={(
|
|
133
|
-
setProp((prop) => (prop.name = e.target.value))
|
|
134
|
-
}
|
|
135
|
+
onChange={setAProp("name")}
|
|
135
136
|
>
|
|
136
137
|
{options.link_view_opts.map((f, ix) => (
|
|
137
138
|
<option key={ix} value={f.name}>
|
|
@@ -149,9 +150,7 @@ const ViewLinkSettings = () => {
|
|
|
149
150
|
type="text"
|
|
150
151
|
className="viewlink-label form-control"
|
|
151
152
|
value={label}
|
|
152
|
-
onChange={(
|
|
153
|
-
setProp((prop) => (prop.label = e.target.value))
|
|
154
|
-
}
|
|
153
|
+
onChange={setAProp("label")}
|
|
155
154
|
/>
|
|
156
155
|
</OrFormula>
|
|
157
156
|
</td>
|
|
@@ -163,9 +162,7 @@ const ViewLinkSettings = () => {
|
|
|
163
162
|
type="text"
|
|
164
163
|
className="viewlink-label form-control"
|
|
165
164
|
value={extra_state_fml}
|
|
166
|
-
onChange={(
|
|
167
|
-
setProp((prop) => (prop.extra_state_fml = e.target.value))
|
|
168
|
-
}
|
|
165
|
+
onChange={setAProp("extra_state_fml")}
|
|
169
166
|
/>
|
|
170
167
|
{errorString ? (
|
|
171
168
|
<small className="text-danger font-monospace d-block">
|
|
@@ -190,7 +187,7 @@ const ViewLinkSettings = () => {
|
|
|
190
187
|
name="block"
|
|
191
188
|
type="checkbox"
|
|
192
189
|
checked={inModal}
|
|
193
|
-
onChange={(
|
|
190
|
+
onChange={setAProp("inModal", { checked: true })}
|
|
194
191
|
/>
|
|
195
192
|
<label className="form-check-label">Open in popup modal?</label>
|
|
196
193
|
</div>
|
|
@@ -111,7 +111,7 @@ const OrFormula = ({ setProp, isFormula, node, nodekey, children }) => {
|
|
|
111
111
|
});
|
|
112
112
|
};
|
|
113
113
|
let errorString = false;
|
|
114
|
-
if (isFormula[nodekey]) {
|
|
114
|
+
if (mode === "show" && isFormula[nodekey]) {
|
|
115
115
|
try {
|
|
116
116
|
Function("return " + node[nodekey]);
|
|
117
117
|
} catch (error) {
|
|
@@ -820,6 +820,7 @@ const ConfigField = ({
|
|
|
820
820
|
className="w-50 form-control-sm d-inline dimunit"
|
|
821
821
|
disabled={field.autoable && styleDim === "auto"}
|
|
822
822
|
onChange={(e) =>
|
|
823
|
+
e?.target &&
|
|
823
824
|
myOnChange(
|
|
824
825
|
isStyle
|
|
825
826
|
? `${e.target.value}${styleDim || "px"}`
|
|
@@ -1053,12 +1054,7 @@ const ButtonOrLinkSettingsRows = ({
|
|
|
1053
1054
|
values,
|
|
1054
1055
|
linkFirst = false,
|
|
1055
1056
|
}) => {
|
|
1056
|
-
const setAProp = (
|
|
1057
|
-
if (e.target) {
|
|
1058
|
-
const target_value = e.target.value;
|
|
1059
|
-
setProp((prop) => (prop[key] = target_value));
|
|
1060
|
-
}
|
|
1061
|
-
};
|
|
1057
|
+
const setAProp = setAPropGen(setProp);
|
|
1062
1058
|
const addBtnClass = (s) => (btnClass ? `${btnClass} ${s}` : s);
|
|
1063
1059
|
return [
|
|
1064
1060
|
<tr key="btnstyle">
|
|
@@ -1228,3 +1224,13 @@ export const recursivelyCloneToElems = (query) => (nodeId, ix) => {
|
|
|
1228
1224
|
|
|
1229
1225
|
export const isBlock = (block, inline, textStyle) =>
|
|
1230
1226
|
!textStyle || !textStyle.startsWith("h") ? block : !inline;
|
|
1227
|
+
|
|
1228
|
+
export const setAPropGen =
|
|
1229
|
+
(setProp) =>
|
|
1230
|
+
(key, opts = {}) =>
|
|
1231
|
+
(e) => {
|
|
1232
|
+
if (e.target) {
|
|
1233
|
+
const target_value = opts?.checked ? e.target.checked : e.target.value;
|
|
1234
|
+
setProp((prop) => (prop[key] = target_value));
|
|
1235
|
+
}
|
|
1236
|
+
};
|