@@ -12,12 +12,14 @@ import tippy from 'tippy.js';
12
12
const timeClaims = [ 'exp' , 'nbf' , 'iat' , 'auth_time' , 'updated_at' ] ;
13
13
14
14
function hideTooltip ( ) {
15
- decodedElement . _tippy . hide ( ) ;
15
+ decodedElement . _tippy . popper . style . opacity = 0 ;
16
16
}
17
17
18
18
function showTooltip ( text ) {
19
- decodedElement . title = text ;
20
- decodedElement . _tippy . show ( ) ;
19
+ decodedElement . _tippy . popper . querySelector ( '.tippy-content' )
20
+ . textContent = text ;
21
+ decodedElement . _tippy . popperInstance . update ( ) ;
22
+ decodedElement . _tippy . popper . style . opacity = 1 ;
21
23
}
22
24
23
25
function getTimeText ( timeStr ) {
@@ -28,6 +30,7 @@ function tooltipHandler(event) {
28
30
const editor = event . currentTarget . querySelector ( '.CodeMirror' ) . CodeMirror ;
29
31
30
32
if ( ! editor ) {
33
+ hideTooltip ( ) ;
31
34
return ;
32
35
}
33
36
@@ -64,17 +67,21 @@ function tooltipHandler(event) {
64
67
showTooltip ( claimText ) ;
65
68
}
66
69
67
- export function setupClaimsTooltip ( ) {
68
- tippy ( decodedElement , {
70
+ export function setupClaimsTooltip ( ) {
71
+ tippy ( decodedElement , {
69
72
placement : 'left' ,
70
73
arrow : true ,
71
74
followCursor : true ,
72
75
performance : true ,
73
76
size : 'large' ,
74
77
dynamicTitle : true ,
75
78
arrowTransform : 'scale(0.75)' ,
76
- distance : 20
77
- } ) ;
79
+ distance : 20 ,
80
+ sticky : true ,
81
+ updateDuration : 100
82
+ } ) ;
83
+
84
+ decodedElement . _tippy . popper . style . opacity = 0 ;
78
85
79
86
payloadElement . addEventListener ( 'mousemove' , tooltipHandler ) ;
80
87
headerElement . addEventListener ( 'mousemove' , tooltipHandler ) ;
0 commit comments