@@ -9,12 +9,15 @@ JSONEditor.defaults.editors.multiselect = JSONEditor.AbstractEditor.extend({
99 var items_schema = this . jsoneditor . expandRefs ( this . schema . items || { } ) ;
1010
1111 var e = items_schema [ "enum" ] || [ ] ;
12+ var t = items_schema . options ? items_schema . options . enum_titles || [ ] : [ ] ;
1213 this . option_keys = [ ] ;
14+ this . option_titles = [ ] ;
1315 for ( i = 0 ; i < e . length ; i ++ ) {
1416 // If the sanitized value is different from the enum value, don't include it
1517 if ( this . sanitize ( e [ i ] ) !== e [ i ] ) continue ;
1618
1719 this . option_keys . push ( e [ i ] + "" ) ;
20+ this . option_titles . push ( ( t [ i ] || e [ i ] ) + "" ) ;
1821 this . select_values [ e [ i ] + "" ] = e [ i ] ;
1922 }
2023 } ,
@@ -31,7 +34,7 @@ JSONEditor.defaults.editors.multiselect = JSONEditor.AbstractEditor.extend({
3134 for ( i = 0 ; i < this . option_keys . length ; i ++ ) {
3235 this . inputs [ this . option_keys [ i ] ] = this . theme . getCheckbox ( ) ;
3336 this . select_options [ this . option_keys [ i ] ] = this . inputs [ this . option_keys [ i ] ] ;
34- var label = this . theme . getCheckboxLabel ( this . option_keys [ i ] ) ;
37+ var label = this . theme . getCheckboxLabel ( this . option_titles [ i ] ) ;
3538 this . controls [ this . option_keys [ i ] ] = this . theme . getFormControl ( label , this . inputs [ this . option_keys [ i ] ] ) ;
3639 }
3740
@@ -40,6 +43,7 @@ JSONEditor.defaults.editors.multiselect = JSONEditor.AbstractEditor.extend({
4043 else {
4144 this . input_type = 'select' ;
4245 this . input = this . theme . getSelectInput ( this . option_keys ) ;
46+ this . theme . setSelectOptions ( this . input , this . option_keys , this . option_titles ) ;
4347 this . input . multiple = true ;
4448 this . input . size = Math . min ( 10 , this . option_keys . length ) ;
4549
0 commit comments