fix invisible old popover, cleanup, add selection indicator in mentionlinks
This commit is contained in:
parent
a0ddfa499f
commit
81bf18a311
3 changed files with 28 additions and 31 deletions
|
|
@ -36,6 +36,11 @@ const MentionLink = {
|
|||
type: String
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
hasSelection: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onClick () {
|
||||
if (this.shouldShowTooltip) return
|
||||
|
|
@ -44,8 +49,17 @@ const MentionLink = {
|
|||
this.userScreenName || this.user.screen_name
|
||||
)
|
||||
this.$router.push(link)
|
||||
},
|
||||
handleSelection () {
|
||||
this.hasSelection = document.getSelection().containsNode(this.$refs.full, true)
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
document.addEventListener('selectionchange', this.handleSelection)
|
||||
},
|
||||
unmounted () {
|
||||
document.removeEventListener('selectionchange', this.handleSelection)
|
||||
},
|
||||
computed: {
|
||||
user () {
|
||||
return this.url && this.$store && this.$store.getters.findUserByUrl(this.url)
|
||||
|
|
@ -91,7 +105,8 @@ const MentionLink = {
|
|||
return [
|
||||
{
|
||||
'-you': this.isYou && this.shouldBoldenYou,
|
||||
'-highlighted': this.highlight
|
||||
'-highlighted': this.highlight,
|
||||
'-has-selection': this.hasSelection
|
||||
},
|
||||
this.highlightType
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue