diff --git a/src/components/notification/notification.js b/src/components/notification/notification.js index 8692c6190..3edf21de7 100644 --- a/src/components/notification/notification.js +++ b/src/components/notification/notification.js @@ -42,6 +42,7 @@ library.add( const Notification = { data () { return { + selecting: false, statusExpanded: false, unmuted: false, showingApproveConfirmDialog: false, @@ -62,11 +63,35 @@ const Notification = { UserLink, ConfirmModal }, + mounted () { + document.addEventListener('selectionchange', this.onContentSelect) + }, + unmounted () { + document.removeEventListener('selectionchange', this.onContentSelect) + }, methods: { toggleStatusExpanded () { if (!this.expandable) return this.statusExpanded = !this.statusExpanded }, + onContentSelect () { + const { isCollapsed, anchorNode, offsetNode } = document.getSelection() + if (isCollapsed) { + this.selecting = false + return + } + const within = this.$refs.root.contains(anchorNode) || this.$refs.root.contains(offsetNode) + if (within) { + this.selecting = true + } else { + this.selecting = false + } + }, + onContentClick (e) { + if (!this.selecting && !e.target.closest('a') && !e.target.closest('button')) { + this.toggleStatusExpanded() + } + }, generateUserProfileLink (user) { return generateProfileLink(user.id, user.screen_name, this.$store.state.instance.restrictedNicknames) }, diff --git a/src/components/notification/notification.vue b/src/components/notification/notification.vue index 76ede11e2..b639b9c88 100644 --- a/src/components/notification/notification.vue +++ b/src/components/notification/notification.vue @@ -1,6 +1,7 @@ diff --git a/src/components/status_body/status_body.js b/src/components/status_body/status_body.js index e89d1d173..f23055955 100644 --- a/src/components/status_body/status_body.js +++ b/src/components/status_body/status_body.js @@ -41,6 +41,7 @@ const StatusContent = { parseReadyDone: false } }, + emits: ['parseReady'], computed: { localCollapseSubjectDefault () { return this.mergedConfig.collapseMessageWithSubject diff --git a/src/components/status_content/status_content.js b/src/components/status_content/status_content.js index f61ba0d05..364123f49 100644 --- a/src/components/status_content/status_content.js +++ b/src/components/status_content/status_content.js @@ -65,6 +65,7 @@ const StatusContent = { 'controlledShowingLongSubject', 'controlledToggleShowingLongSubject' ], + emits: ['parseReady', 'mediaplay', 'mediapause'], data () { return { uncontrolledShowingTall: this.fullContent || (this.inConversation && this.focused),