File tree Expand file tree Collapse file tree 4 files changed +19
-8
lines changed
Expand file tree Collapse file tree 4 files changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -66,9 +66,6 @@ $(document).on('turbo-migration:load', function() {
6666 } ) ;
6767 }
6868
69- // Enable all tooltips
70- $ ( '[data-bs-toggle="tooltip"]' ) . tooltip ( ) ;
71-
7269 // Enable sorttable again, as it is disabled otherwise by Turbo
7370 if ( sorttable ) {
7471 sorttable . init . done = false ;
Original file line number Diff line number Diff line change @@ -935,10 +935,6 @@ var CodeOceanEditor = {
935935 $ ( '#output_sidebar' ) . removeClass ( 'output-col' ) . addClass ( 'output-col-collapsed' ) ;
936936 } ,
937937
938- initializeSideBarTooltips : function ( ) {
939- $ ( '[data-bs-toggle="tooltip"]' ) . tooltip ( )
940- } ,
941-
942938 initializeDescriptionToggle : function ( ) {
943939 $ ( '#exercise-headline' ) . on ( 'click' , this . toggleDescriptionCard . bind ( this ) ) ;
944940 $ ( 'a#toggle' ) . on ( 'click' , this . toggleDescriptionCard . bind ( this ) ) ;
@@ -1096,7 +1092,6 @@ var CodeOceanEditor = {
10961092 this . initializeSideBarCollapse ( ) ;
10971093 this . initializeOutputBarToggle ( ) ;
10981094 this . initializeDescriptionToggle ( ) ;
1099- this . initializeSideBarTooltips ( ) ;
11001095 this . initializeInterventionTimer ( ) ;
11011096 this . initPrompt ( ) ;
11021097 this . renderScore ( ) ;
Original file line number Diff line number Diff line change 1+ let tooltipList = [ ] ;
2+
3+ export function initializeTooltips ( ) {
4+ const tooltipTriggerList = document . querySelectorAll ( '[data-bs-toggle="tooltip"]' ) ;
5+ tooltipList = [ ...tooltipTriggerList ] . map ( tooltipTriggerEl => new bootstrap . Tooltip ( tooltipTriggerEl ) ) ;
6+ }
7+
8+ export function destroyTooltips ( ) {
9+ tooltipList . map ( tooltip => tooltip . dispose ( ) ) ;
10+ tooltipList = [ ] ;
11+ }
Original file line number Diff line number Diff line change 1+ import { initializeTooltips , destroyTooltips } from './tooltips' ;
2+
13// `turbo:load` is dispatched earlier than the previous `turbolinks:load` event.
24// This is causing issues for our migration, since some assets are not fully loaded
35// when the event is dispatched. To ensure that the DOM content is fully rendered,
@@ -46,10 +48,16 @@ function forwardTurboLoad(event) {
4648 requestAnimationFrame ( ( ) => {
4749 const delayedEvent = new CustomEvent ( 'turbo-migration:load' , { detail : { ...event . detail } } ) ;
4850 document . dispatchEvent ( delayedEvent ) ;
51+
52+ initializeTooltips ( ) ;
4953 } ) ;
5054}
5155
5256const flushQueue = ( queue ) => {
5357 queue . forEach ( forwardTurboLoad ) ;
5458 queue . length = 0 ;
5559} ;
60+
61+ document . addEventListener ( 'turbo:visit' , ( event ) => {
62+ destroyTooltips ( ) ;
63+ } )
You can’t perform that action at this time.
0 commit comments