File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -411,12 +411,15 @@ <h4 class="modal-title">Tag nodes</h4>
411411 $ ( this ) . find ( '#carve' ) . focus ( ) ;
412412 } ) ;
413413
414- // Select2 initialization
415- var tagsSelect = $ ( '#modal_tags' ) . select2 ( {
416- theme : "classic"
417- } ) ;
418- tagsSelect . on ( "select2:select" , function ( e ) {
419- $ ( '#add_tags' ) . append ( new Option ( e . params . data . text , e . params . data . text ) ) ;
414+ // Deferred Select2 initialization
415+ var _tagsSelectReady = false ;
416+ $ ( '#tagModal' ) . one ( 'shown.bs.modal' , function ( ) {
417+ if ( _tagsSelectReady ) return ;
418+ var tagsSelect = $ ( '#modal_tags' ) . select2 ( { theme : 'classic' } ) ;
419+ tagsSelect . on ( 'select2:select' , function ( e ) {
420+ $ ( '#add_tags' ) . append ( new Option ( e . params . data . text , e . params . data . text ) ) ;
421+ } ) ;
422+ _tagsSelectReady = true ;
420423 } ) ;
421424 } ) ;
422425 </ script >
You can’t perform that action at this time.
0 commit comments