Merge branch 'misc-style-fixes-or-changes' into shigusegubu-themes3

This commit is contained in:
Henry Jameson 2025-08-19 17:30:25 +03:00
commit 09ca89871a
6 changed files with 51 additions and 6 deletions

View file

@ -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)
},
@ -138,7 +163,7 @@ const Notification = {
return highlightStyle(highlight[user.screen_name])
},
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 () {
return this.$store.getters.findUser(this.notification.from_profile.id)

View file

@ -1,6 +1,7 @@
<template>
<article
v-if="notification.type === 'mention' || notification.type === 'status'"
ref="root"
>
<Status
class="Notification"
@ -12,6 +13,7 @@
<article
class="NotificationParent"
:class="{ '-expandable': expandable }"
ref="root"
v-else
>
<div
@ -256,8 +258,8 @@
class="status-content"
:compact="!statusExpanded"
:status="notification.status"
:collapse="statusExpanded"
@click="toggleStatusExpanded()"
:collapse="!statusExpanded"
@click="onContentClick"
/>
</template>
</div>

View file

@ -92,6 +92,12 @@ export default {
required: false,
type: Boolean,
default: true
},
// Collapse newlines
collapse: {
required: false,
type: Boolean,
default: false
}
},
// NEVER EVER TOUCH DATA INSIDE RENDER
@ -290,11 +296,20 @@ export default {
const pass1 = convertHtmlToTree(html).map(processItem)
const pass2 = [...pass1].reverse().map(processItemReverse).reverse()
// DO NOT USE SLOTS they cause a re-render feedback loop here.
// slots updated -> rerender -> emit -> update up the tree -> rerender -> ...
// at least until vue3?
const result = <span class={['RichContent', this.faint ? '-faint' : '']}>
{ pass2 }
const result =
<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>
const event = {

View file

@ -41,6 +41,7 @@ const StatusBody = {
parseReadyDone: false
}
},
emits: ['parseReady'],
computed: {
localCollapseSubjectDefault () {
return this.mergedConfig.collapseMessageWithSubject

View file

@ -39,7 +39,8 @@
v-if="!hideSubjectStatus && !(singleLine && status.summary_raw_html)"
:class="{ '-single-line': singleLine }"
class="text media-body"
:html="collapse ? collapsedStatus : status.raw_html"
:html="status.raw_html"
:collapse="collapse"
:emoji="status.emojis"
:handle-links="true"
:faint="compact"

View file

@ -65,6 +65,7 @@ const StatusContent = {
'controlledShowingLongSubject',
'controlledToggleShowingLongSubject'
],
emits: ['parseReady', 'mediaplay', 'mediapause'],
data () {
return {
uncontrolledShowingTall: this.fullContent || (this.inConversation && this.focused),