@@ -38,10 +38,13 @@ export default class PropertyRow extends React.Component {
3838
3939 getWidget ( ) {
4040 const props = this . props ;
41- const isMap =
42- props . componentname === 'material' &&
43- ( props . name === 'envMap' || props . name === 'src' ) ;
4441 let type = props . schema . type ;
42+
43+ if ( props . componentname === 'material' && props . name === 'envMap' ) {
44+ // material envMap has the wrong type string, force it to map
45+ type = 'map' ;
46+ }
47+
4548 if (
4649 ( props . componentname === 'animation' ||
4750 props . componentname . startsWith ( 'animation__' ) ) &&
@@ -54,15 +57,17 @@ export default class PropertyRow extends React.Component {
5457 type = 'boolean' ;
5558 }
5659
57- const value =
58- props . schema . type === 'selector'
60+ let value =
61+ type === 'selector'
5962 ? props . entity . getDOMAttribute ( props . componentname ) ?. [ props . name ]
6063 : props . data ;
6164
65+ if ( type === 'string' && value && typeof value !== 'string' ) {
66+ // Allow editing a custom type like event-set component schema
67+ value = props . schema . stringify ( value ) ;
68+ }
69+
6270 const widgetProps = {
63- componentname : props . componentname ,
64- entity : props . entity ,
65- isSingle : props . isSingle ,
6671 name : props . name ,
6772 onChange : function ( name , value ) {
6873 updateEntity (
@@ -72,7 +77,8 @@ export default class PropertyRow extends React.Component {
7277 value
7378 ) ;
7479 } ,
75- value : value
80+ value : value ,
81+ id : this . id
7682 } ;
7783 const numberWidgetProps = {
7884 min : props . schema . hasOwnProperty ( 'min' ) ? props . schema . min : - Infinity ,
@@ -88,7 +94,7 @@ export default class PropertyRow extends React.Component {
8894 />
8995 ) ;
9096 }
91- if ( type === 'map' || isMap ) {
97+ if ( type === 'map' ) {
9298 return < TextureWidget { ...widgetProps } /> ;
9399 }
94100
@@ -117,14 +123,6 @@ export default class PropertyRow extends React.Component {
117123 return < BooleanWidget { ...widgetProps } /> ;
118124 }
119125 default : {
120- if (
121- props . schema . type === 'string' &&
122- widgetProps . value &&
123- typeof widgetProps . value !== 'string'
124- ) {
125- // Allow editing a custom type like event-set component schema
126- widgetProps . value = props . schema . stringify ( widgetProps . value ) ;
127- }
128126 return < InputWidget { ...widgetProps } /> ;
129127 }
130128 }
0 commit comments