Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
68eb51e3
Commit
68eb51e3
authored
Apr 14, 2020
by
peterhegman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove tooltip event listeners in `beforeDestroy`
parent
1e5f1eb8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
+16
-8
app/assets/javascripts/notes/components/note_header.vue
app/assets/javascripts/notes/components/note_header.vue
+16
-8
No files found.
app/assets/javascripts/notes/components/note_header.vue
View file @
68eb51e3
...
...
@@ -91,18 +91,23 @@ export default {
mounted
()
{
// Temporarily remove `title` attribute from emoji when tooltip is open
// Prevents duplicate tooltips (Bootstrap tooltip and browser title tooltip)
const
{
authorStatus
}
=
this
.
$refs
;
if
(
authorStatus
&&
authorStatus
.
querySelector
(
'
.has-tooltip
'
))
{
if
(
this
.
hasAuthorStatusWithTooltip
())
{
const
{
authorStatus
}
=
this
.
$refs
;
const
emoji
=
authorStatus
.
querySelector
(
'
gl-emoji
'
);
const
emojiTitle
=
emoji
.
getAttribute
(
'
title
'
);
$
(
this
.
$refs
.
authorStatus
).
on
(
'
show.bs.tooltip
'
,
()
=>
{
emoji
.
removeAttribute
(
'
title
'
);
});
this
.
handleAuthorStatusTooltipShow
=
()
=>
emoji
.
removeAttribute
(
'
title
'
);
this
.
handleAuthorStatusTooltipHidden
=
()
=>
emoji
.
setAttribute
(
'
title
'
,
emojiTitle
);
$
(
authorStatus
).
on
(
'
show.bs.tooltip
'
,
this
.
handleAuthorStatusTooltipShow
);
$
(
authorStatus
).
on
(
'
hidden.bs.tooltip
'
,
this
.
handleAuthorStatusTooltipHidden
);
}
},
beforeDestroy
()
{
if
(
this
.
hasAuthorStatusWithTooltip
())
{
const
{
authorStatus
}
=
this
.
$refs
;
$
(
this
.
$refs
.
authorStatus
).
on
(
'
hidden.bs.tooltip
'
,
()
=>
{
emoji
.
setAttribute
(
'
title
'
,
emojiTitle
);
});
$
(
authorStatus
).
off
(
'
show.bs.tooltip
'
,
this
.
handleAuthorStatusTooltipShow
);
$
(
authorStatus
).
off
(
'
hidden.bs.tooltip
'
,
this
.
handleAuthorStatusTooltipHidden
);
}
},
methods
:
{
...
...
@@ -125,6 +130,9 @@ export default {
this
.
isUsernameLinkHovered
=
false
;
},
hasAuthorStatusWithTooltip
()
{
return
this
.
$refs
.
authorStatus
?.
querySelector
(
'
.user-status-emoji:not([title=""])
'
);
},
},
};
</
script
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment