File tree Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -37,11 +37,7 @@ export default class LabelView extends View<FlatItem> {
37
37
}
38
38
39
39
addTooltip ( ) : void {
40
- const cls = this . model . get ( 'class' ) ;
41
- if (
42
- typeof this . toolTipSetting === 'string' &&
43
- ( cls . has ( skos . definition ) || cls . has ( rdfs . comment ) )
44
- ) {
40
+ if ( typeof this . toolTipSetting === 'string' ) {
45
41
attachTooltip ( this , {
46
42
direction : this . toolTipSetting ,
47
43
model : this . model ,
Original file line number Diff line number Diff line change @@ -47,18 +47,20 @@ export class Tooltip extends View<FlatItem> {
47
47
constructor ( options ?: ViewOptions ) {
48
48
super ( options ) ;
49
49
this . preferredDirection = options && options . direction || 'right' ;
50
- this . model . when ( 'class ' , this . render , this ) ;
50
+ this . model . when ( 'classLabel ' , this . render , this ) ;
51
51
}
52
52
53
53
render ( ) : this {
54
54
const cls = this . model . get ( 'class' ) ;
55
55
const languageOption = { '@language' : i18next . language } ;
56
56
const definition = cls . get ( skos . definition , languageOption ) ;
57
57
const comment = definition || cls . get ( rdfs . comment , languageOption ) ;
58
- this . $el . attr (
59
- 'data-tooltip' ,
60
- definition && definition [ 0 ] || comment && comment [ 0 ]
61
- ) ;
58
+ const text = definition && definition [ 0 ] || comment && comment [ 0 ] ;
59
+ if ( text ) {
60
+ this . $el . attr ( 'data-tooltip' , text ) ;
61
+ } else {
62
+ this . $el . removeClass ( 'tooltip' ) ;
63
+ }
62
64
return this ;
63
65
}
64
66
You can’t perform that action at this time.
0 commit comments