@@ -122,9 +122,10 @@ function RenderAttributesTabEdit(state, defs, onchange) {
122
122
items . push ( RenderLabel ( k , defs [ k ] . displayLabel ) ) ;
123
123
const type = defs [ k ] . type ;
124
124
const value = attributes [ k ] || '' ; // catch `undefined` or React will complain about changing from uncontrolled to controlled
125
+ const helpText = defs [ k ] . help ;
125
126
switch ( type ) {
126
127
case 'string' :
127
- items . push ( RenderStringInput ( k , value , onchange ) ) ;
128
+ items . push ( RenderStringInput ( k , value , onchange , helpText ) ) ;
128
129
break ;
129
130
case 'number' :
130
131
items . push ( m_RenderNumberInput ( k , value , onchange ) ) ;
@@ -207,19 +208,22 @@ function RenderStringValue(key, value) {
207
208
* @param {function } cb
208
209
* @returns
209
210
*/
210
- function RenderStringInput ( key , value , cb ) {
211
+ function RenderStringInput ( key , value , cb , helpText ) {
211
212
const rows = String ( value ) . length > 35 ? 3 : 1 ;
212
213
return (
213
- < textarea
214
- id = { key }
215
- key = { `${ key } input` }
216
- type = "string"
217
- value = { value }
218
- onChange = { event => m_UIStringInputUpdate ( event , cb ) }
219
- autoComplete = "off" // turn off Chrome's default autocomplete, which conflicts
220
- className = { rows > 1 ? `long` : '' }
221
- rows = { rows }
222
- />
214
+ < div key = { `${ key } div` } >
215
+ { helpText }
216
+ < textarea
217
+ id = { key }
218
+ key = { `${ key } input` }
219
+ type = "string"
220
+ value = { value }
221
+ onChange = { event => m_UIStringInputUpdate ( event , cb ) }
222
+ autoComplete = "off" // turn off Chrome's default autocomplete, which conflicts
223
+ className = { rows > 1 ? `long` : '' }
224
+ rows = { rows }
225
+ />
226
+ </ div >
223
227
) ;
224
228
}
225
229
/**
@@ -231,15 +235,18 @@ function RenderStringInput(key, value, cb) {
231
235
* @param {function } cb
232
236
* @returns
233
237
*/
234
- function m_RenderNumberInput ( key , value , cb ) {
238
+ function m_RenderNumberInput ( key , value , cb , helpText ) {
235
239
return (
236
- < input
237
- id = { key }
238
- key = { `${ key } input` }
239
- value = { value }
240
- type = "number"
241
- onChange = { event => m_UINumberInputUpdate ( event , cb ) }
242
- />
240
+ < div key = { `${ key } div` } >
241
+ { helpText }
242
+ < input
243
+ id = { key }
244
+ key = { `${ key } input` }
245
+ value = { value }
246
+ type = "number"
247
+ onChange = { event => m_UINumberInputUpdate ( event , cb ) }
248
+ />
249
+ </ div >
243
250
) ;
244
251
}
245
252
/**
@@ -251,21 +258,24 @@ function m_RenderNumberInput(key, value, cb) {
251
258
* @param {function } cb
252
259
* @returns
253
260
*/
254
- function m_RenderOptionsInput ( key , value , defs , cb ) {
261
+ function m_RenderOptionsInput ( key , value , defs , cb , helpText ) {
255
262
const options = defs [ key ] . options ;
256
263
return (
257
- < select
258
- id = { key }
259
- key = { `${ key } select` }
260
- value = { value }
261
- onChange = { event => m_UISelectInputUpdate ( event , cb ) }
262
- >
263
- { options . map ( o => (
264
- < option key = { o . label } value = { o . label } >
265
- { o . label }
266
- </ option >
267
- ) ) }
268
- </ select >
264
+ < div key = { `${ key } div` } >
265
+ { helpText }
266
+ < select
267
+ id = { key }
268
+ key = { `${ key } select` }
269
+ value = { value }
270
+ onChange = { event => m_UISelectInputUpdate ( event , cb ) }
271
+ >
272
+ { options . map ( o => (
273
+ < option key = { o . label } value = { o . label } >
274
+ { o . label }
275
+ </ option >
276
+ ) ) }
277
+ </ select >
278
+ </ div >
269
279
) ;
270
280
}
271
281
0 commit comments