@@ -452,6 +452,35 @@ class Toolbar {
452
452
$jumpToInput . selectize ( {
453
453
options : options ,
454
454
openOnFocus : true ,
455
+ render : {
456
+ item : function ( data , escape ) {
457
+ // Some `data.text` input is already prepended with spaces, so we replace the translation
458
+ // ISSUE: a more consistent approach might use a formatter but this is simple. ;[prepend]indent
459
+
460
+ const item_name = data . value . replace ( / \. / g, '' ) . trim ( ) ;
461
+ const identifier_name = item_name . replace ( / / g, '_' ) ;
462
+ const canonical_name = data . value . match ( / \. / g) ? identifier_name : item_name ;
463
+ const label = data . text . replace ( item_name , i18next . t ( canonical_name ) ) ;
464
+
465
+ // TODO: not rerendering
466
+ return `<div data-i18n='${ canonical_name } '>` + escape ( label ) + `</div>` ;
467
+ } ,
468
+ option : ( data , escape ) => {
469
+ // Some `data.text` input is already prepended with spaces, so we replace the translation
470
+ // ISSUE: a more consistent approach might use a formatter but this is simple. ;[prepend]indent
471
+
472
+ const item_name = data . value . replace ( / \. / g, '' ) . trim ( ) ;
473
+ const identifier_name = item_name . replace ( / / g, '_' ) ;
474
+ const canonical_name = data . value . match ( / \. / g) ? identifier_name : item_name ;
475
+ const label = data . text . replace ( item_name , i18next . t ( canonical_name ) ) ;
476
+
477
+ let indentation = 12 + label . search ( / \S / ) * 8 ; // pixels
478
+
479
+ return `<div style="padding-left:${ indentation } px" class="option ${
480
+ data . value === '' ? 'selectize-dropdown-emptyoptionlabel' : ''
481
+ } " data-i18n='${ canonical_name } '>${ escape ( label ) } </div>`;
482
+ } ,
483
+ } ,
455
484
} ) ;
456
485
$jumpToInput . off ( 'change' ) . on ( 'change' , ( e ) => {
457
486
if ( ! e . target . value ) {
0 commit comments