Merge branch 'misc-style-fixes-or-changes' into shigusegubu-themes3
This commit is contained in:
commit
09ca89871a
6 changed files with 51 additions and 6 deletions
|
|
@ -42,6 +42,7 @@ library.add(
|
||||||
const Notification = {
|
const Notification = {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
selecting: false,
|
||||||
statusExpanded: false,
|
statusExpanded: false,
|
||||||
unmuted: false,
|
unmuted: false,
|
||||||
showingApproveConfirmDialog: false,
|
showingApproveConfirmDialog: false,
|
||||||
|
|
@ -62,11 +63,35 @@ const Notification = {
|
||||||
UserLink,
|
UserLink,
|
||||||
ConfirmModal
|
ConfirmModal
|
||||||
},
|
},
|
||||||
|
mounted () {
|
||||||
|
document.addEventListener('selectionchange', this.onContentSelect)
|
||||||
|
},
|
||||||
|
unmounted () {
|
||||||
|
document.removeEventListener('selectionchange', this.onContentSelect)
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
toggleStatusExpanded () {
|
toggleStatusExpanded () {
|
||||||
if (!this.expandable) return
|
if (!this.expandable) return
|
||||||
this.statusExpanded = !this.statusExpanded
|
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) {
|
generateUserProfileLink (user) {
|
||||||
return generateProfileLink(user.id, user.screen_name, this.$store.state.instance.restrictedNicknames)
|
return generateProfileLink(user.id, user.screen_name, this.$store.state.instance.restrictedNicknames)
|
||||||
},
|
},
|
||||||
|
|
@ -138,7 +163,7 @@ const Notification = {
|
||||||
return highlightStyle(highlight[user.screen_name])
|
return highlightStyle(highlight[user.screen_name])
|
||||||
},
|
},
|
||||||
expandable () {
|
expandable () {
|
||||||
return (new Set(['like', '-pleroma:emoji_reaction', 'repeat'])).has(this.notification.type)
|
return (new Set(['like', 'pleroma:emoji_reaction', 'repeat'])).has(this.notification.type)
|
||||||
},
|
},
|
||||||
user () {
|
user () {
|
||||||
return this.$store.getters.findUser(this.notification.from_profile.id)
|
return this.$store.getters.findUser(this.notification.from_profile.id)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<article
|
<article
|
||||||
v-if="notification.type === 'mention' || notification.type === 'status'"
|
v-if="notification.type === 'mention' || notification.type === 'status'"
|
||||||
|
ref="root"
|
||||||
>
|
>
|
||||||
<Status
|
<Status
|
||||||
class="Notification"
|
class="Notification"
|
||||||
|
|
@ -12,6 +13,7 @@
|
||||||
<article
|
<article
|
||||||
class="NotificationParent"
|
class="NotificationParent"
|
||||||
:class="{ '-expandable': expandable }"
|
:class="{ '-expandable': expandable }"
|
||||||
|
ref="root"
|
||||||
v-else
|
v-else
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
|
@ -256,8 +258,8 @@
|
||||||
class="status-content"
|
class="status-content"
|
||||||
:compact="!statusExpanded"
|
:compact="!statusExpanded"
|
||||||
:status="notification.status"
|
:status="notification.status"
|
||||||
:collapse="statusExpanded"
|
:collapse="!statusExpanded"
|
||||||
@click="toggleStatusExpanded()"
|
@click="onContentClick"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,12 @@ export default {
|
||||||
required: false,
|
required: false,
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
|
},
|
||||||
|
// Collapse newlines
|
||||||
|
collapse: {
|
||||||
|
required: false,
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// NEVER EVER TOUCH DATA INSIDE RENDER
|
// NEVER EVER TOUCH DATA INSIDE RENDER
|
||||||
|
|
@ -290,11 +296,20 @@ export default {
|
||||||
|
|
||||||
const pass1 = convertHtmlToTree(html).map(processItem)
|
const pass1 = convertHtmlToTree(html).map(processItem)
|
||||||
const pass2 = [...pass1].reverse().map(processItemReverse).reverse()
|
const pass2 = [...pass1].reverse().map(processItemReverse).reverse()
|
||||||
|
|
||||||
// DO NOT USE SLOTS they cause a re-render feedback loop here.
|
// DO NOT USE SLOTS they cause a re-render feedback loop here.
|
||||||
// slots updated -> rerender -> emit -> update up the tree -> rerender -> ...
|
// slots updated -> rerender -> emit -> update up the tree -> rerender -> ...
|
||||||
// at least until vue3?
|
// at least until vue3?
|
||||||
const result = <span class={['RichContent', this.faint ? '-faint' : '']}>
|
const result =
|
||||||
{ pass2 }
|
<span class={['RichContent', this.faint ? '-faint' : '']}>
|
||||||
|
{
|
||||||
|
this.collapse
|
||||||
|
? pass2.map(x => {
|
||||||
|
if (!Array.isArray(x)) return x.replace(/\n/g, ' ')
|
||||||
|
return x.map(y => y.type === 'br' ? ' ' : y)
|
||||||
|
})
|
||||||
|
: pass2
|
||||||
|
}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
const event = {
|
const event = {
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ const StatusBody = {
|
||||||
parseReadyDone: false
|
parseReadyDone: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
emits: ['parseReady'],
|
||||||
computed: {
|
computed: {
|
||||||
localCollapseSubjectDefault () {
|
localCollapseSubjectDefault () {
|
||||||
return this.mergedConfig.collapseMessageWithSubject
|
return this.mergedConfig.collapseMessageWithSubject
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,8 @@
|
||||||
v-if="!hideSubjectStatus && !(singleLine && status.summary_raw_html)"
|
v-if="!hideSubjectStatus && !(singleLine && status.summary_raw_html)"
|
||||||
:class="{ '-single-line': singleLine }"
|
:class="{ '-single-line': singleLine }"
|
||||||
class="text media-body"
|
class="text media-body"
|
||||||
:html="collapse ? collapsedStatus : status.raw_html"
|
:html="status.raw_html"
|
||||||
|
:collapse="collapse"
|
||||||
:emoji="status.emojis"
|
:emoji="status.emojis"
|
||||||
:handle-links="true"
|
:handle-links="true"
|
||||||
:faint="compact"
|
:faint="compact"
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ const StatusContent = {
|
||||||
'controlledShowingLongSubject',
|
'controlledShowingLongSubject',
|
||||||
'controlledToggleShowingLongSubject'
|
'controlledToggleShowingLongSubject'
|
||||||
],
|
],
|
||||||
|
emits: ['parseReady', 'mediaplay', 'mediapause'],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
uncontrolledShowingTall: this.fullContent || (this.inConversation && this.focused),
|
uncontrolledShowingTall: this.fullContent || (this.inConversation && this.focused),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue