@@ -9,12 +9,15 @@ JSONEditor.defaults.editors.multiselect = JSONEditor.AbstractEditor.extend({
9
9
var items_schema = this . jsoneditor . expandRefs ( this . schema . items || { } ) ;
10
10
11
11
var e = items_schema [ "enum" ] || [ ] ;
12
+ var t = items_schema . options ? items_schema . options . enum_titles || [ ] : [ ] ;
12
13
this . option_keys = [ ] ;
14
+ this . option_titles = [ ] ;
13
15
for ( i = 0 ; i < e . length ; i ++ ) {
14
16
// If the sanitized value is different from the enum value, don't include it
15
17
if ( this . sanitize ( e [ i ] ) !== e [ i ] ) continue ;
16
18
17
19
this . option_keys . push ( e [ i ] + "" ) ;
20
+ this . option_titles . push ( ( t [ i ] || e [ i ] ) + "" ) ;
18
21
this . select_values [ e [ i ] + "" ] = e [ i ] ;
19
22
}
20
23
} ,
@@ -31,7 +34,7 @@ JSONEditor.defaults.editors.multiselect = JSONEditor.AbstractEditor.extend({
31
34
for ( i = 0 ; i < this . option_keys . length ; i ++ ) {
32
35
this . inputs [ this . option_keys [ i ] ] = this . theme . getCheckbox ( ) ;
33
36
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 ] ) ;
35
38
this . controls [ this . option_keys [ i ] ] = this . theme . getFormControl ( label , this . inputs [ this . option_keys [ i ] ] ) ;
36
39
}
37
40
@@ -40,6 +43,7 @@ JSONEditor.defaults.editors.multiselect = JSONEditor.AbstractEditor.extend({
40
43
else {
41
44
this . input_type = 'select' ;
42
45
this . input = this . theme . getSelectInput ( this . option_keys ) ;
46
+ this . theme . setSelectOptions ( this . input , this . option_keys , this . option_titles ) ;
43
47
this . input . multiple = true ;
44
48
this . input . size = Math . min ( 10 , this . option_keys . length ) ;
45
49
0 commit comments