Compare commits
11 commits
30a668de7a
...
09ca89871a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
09ca89871a | ||
|
|
bebb3fcfa6 | ||
|
|
8780e0191e | ||
|
|
26a2232e18 | ||
|
|
0d6453baec | ||
|
|
6ff87af516 | ||
|
|
7b2f3b648a | ||
|
|
16ada7ec6c | ||
|
|
028556f8ab | ||
|
|
9ed2fd3c4b | ||
|
|
c47bfe53ff |
12 changed files with 86 additions and 39 deletions
|
|
@ -21,7 +21,7 @@
|
|||
}
|
||||
|
||||
html {
|
||||
font-size: var(--textSize, 14px);
|
||||
font-size: var(--textSize, 1rem);
|
||||
|
||||
--navbar-height: var(--navbarSize, 3.5rem);
|
||||
--emoji-size: var(--emojiSize, 32px);
|
||||
|
|
@ -382,6 +382,10 @@ nav {
|
|||
font-family: sans-serif;
|
||||
font-family: var(--font);
|
||||
|
||||
&.-transparent {
|
||||
backdrop-filter: blur(0.125em) contrast(60%);
|
||||
}
|
||||
|
||||
&::-moz-focus-inner {
|
||||
border: none;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,6 +64,26 @@ export default {
|
|||
opacity: 0.5
|
||||
}
|
||||
},
|
||||
{
|
||||
component: 'Text',
|
||||
parent: {
|
||||
component: 'Button',
|
||||
variant: 'transparent'
|
||||
},
|
||||
directives: {
|
||||
textColor: '--text'
|
||||
}
|
||||
},
|
||||
{
|
||||
component: 'Icon',
|
||||
parent: {
|
||||
component: 'Button',
|
||||
variant: 'transparent'
|
||||
},
|
||||
directives: {
|
||||
textColor: '--text'
|
||||
}
|
||||
},
|
||||
{
|
||||
state: ['hover'],
|
||||
directives: {
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ const EmojiPicker = {
|
|||
},
|
||||
updateEmojiSize () {
|
||||
const css = window.getComputedStyle(this.$refs.popover.$el)
|
||||
const fontSize = css.getPropertyValue('font-size') || '14px'
|
||||
const fontSize = css.getPropertyValue('font-size') || '1rem'
|
||||
const emojiSize = css.getPropertyValue('--emojiSize') || '2.2rem'
|
||||
|
||||
const fontSizeUnit = fontSize.replace(/[0-9,.]+/, '').trim()
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<template>
|
||||
<article
|
||||
v-if="notification.type === 'mention' || notification.type === 'status'"
|
||||
ref="root"
|
||||
>
|
||||
<Status
|
||||
class="Notification"
|
||||
|
|
@ -12,13 +13,14 @@
|
|||
<article
|
||||
class="NotificationParent"
|
||||
:class="{ '-expandable': expandable }"
|
||||
:aria-controls="'notif-' +notification.id"
|
||||
ref="root"
|
||||
v-else
|
||||
>
|
||||
<div
|
||||
v-if="needMute && !unmuted"
|
||||
:id="'notif-' +notification.id"
|
||||
:aria-expanded="statusExpanded"
|
||||
:aria-controls="'notif-' +notification.id"
|
||||
class="Notification container -muted"
|
||||
>
|
||||
<small>
|
||||
|
|
@ -256,8 +258,8 @@
|
|||
class="status-content"
|
||||
:compact="!statusExpanded"
|
||||
:status="notification.status"
|
||||
:collapse="statusExpanded"
|
||||
@click="toggleStatusExpanded()"
|
||||
:collapse="!statusExpanded"
|
||||
@click="onContentClick"
|
||||
/>
|
||||
</template>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -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 = {
|
||||
|
|
|
|||
|
|
@ -245,8 +245,8 @@
|
|||
margin-right: 0;
|
||||
|
||||
.emoji {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
vertical-align: middle;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ const StatusBody = {
|
|||
parseReadyDone: false
|
||||
}
|
||||
},
|
||||
emits: ['parseReady'],
|
||||
computed: {
|
||||
localCollapseSubjectDefault () {
|
||||
return this.mergedConfig.collapseMessageWithSubject
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
@ -59,32 +60,6 @@
|
|||
@click.prevent="toggleShowMore"
|
||||
>
|
||||
{{ toggleText }}
|
||||
<template v-if="!showingMore">
|
||||
<FAIcon
|
||||
v-if="attachmentTypes.includes('image')"
|
||||
icon="image"
|
||||
/>
|
||||
<FAIcon
|
||||
v-if="attachmentTypes.includes('video')"
|
||||
icon="video"
|
||||
/>
|
||||
<FAIcon
|
||||
v-if="attachmentTypes.includes('audio')"
|
||||
icon="music"
|
||||
/>
|
||||
<FAIcon
|
||||
v-if="attachmentTypes.includes('unknown')"
|
||||
icon="file"
|
||||
/>
|
||||
<FAIcon
|
||||
v-if="status.poll && status.poll.options"
|
||||
icon="poll-h"
|
||||
/>
|
||||
<FAIcon
|
||||
v-if="status.card"
|
||||
icon="link"
|
||||
/>
|
||||
</template>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ const StatusContent = {
|
|||
'controlledShowingLongSubject',
|
||||
'controlledToggleShowingLongSubject'
|
||||
],
|
||||
emits: ['parseReady', 'mediaplay', 'mediapause'],
|
||||
data () {
|
||||
return {
|
||||
uncontrolledShowingTall: this.fullContent || (this.inConversation && this.focused),
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
/>
|
||||
</div>
|
||||
|
||||
<div v-else-if="status.poll && status.poll.options && compact">
|
||||
<div class="poll-icon" v-else-if="status.poll && status.poll.options && compact">
|
||||
<FAIcon
|
||||
icon="poll-h"
|
||||
size="2x"
|
||||
|
|
@ -63,5 +63,9 @@
|
|||
.StatusContent {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
|
||||
.poll-icon {
|
||||
margin: 0.5em;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ const defaultState = {
|
|||
palette: null,
|
||||
style: null,
|
||||
emojiReactionsScale: 0.5,
|
||||
textSize: '14px',
|
||||
textSize: '1rem',
|
||||
emojiSize: '2.2rem',
|
||||
navbarSize: '3.5rem',
|
||||
panelHeaderSize: '3.2rem',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue