Compare commits

...

5 Commits

Author SHA1 Message Date
80728af574 Updated default values 2023-08-05 19:59:58 -07:00
HJ
a1641193b5 Merge branch 'tusooa/983-mention-twice' into 'develop'
Fix a bug where mentioning a user twice will not fill the mention into the textarea

Closes #983

See merge request pleroma/pleroma-fe!1850
2023-07-25 08:29:59 +00:00
tusooa
0dc2afb826
Fix a bug where mentioning a user twice will not fill the mention into the textarea 2023-07-24 19:13:37 -04:00
HJ
e31bf6646b Merge branch 'tusooa/1276-mentionsline-shouldbreak' into 'develop'
Make MentionsLine aware of line breaking by non-br elements

Closes #1276

See merge request pleroma/pleroma-fe!1849
2023-07-24 22:58:54 +00:00
tusooa
56a74aa392
Make MentionsLine aware of line breaking by non-br elements 2023-07-24 18:28:34 -04:00
7 changed files with 51 additions and 21 deletions

View File

@ -0,0 +1 @@
Fix a bug where mentioning a user twice will not fill the mention into the textarea

View File

@ -0,0 +1 @@
Make MentionsLine aware of line breaking by non-br elements

View File

@ -44,6 +44,10 @@ const PostStatusModal = {
methods: { methods: {
closeModal () { closeModal () {
this.$store.dispatch('closePostStatusModal') this.$store.dispatch('closePostStatusModal')
},
resetAndClose () {
this.$store.dispatch('resetPostStatusModal')
this.$store.dispatch('closePostStatusModal')
} }
} }
} }

View File

@ -12,7 +12,7 @@
<PostStatusForm <PostStatusForm
class="panel-body" class="panel-body"
v-bind="params" v-bind="params"
@posted="closeModal" @posted="resetAndClose"
/> />
</div> </div>
</Modal> </Modal>

View File

@ -8,6 +8,27 @@ import HashtagLink from 'src/components/hashtag_link/hashtag_link.vue'
import './rich_content.scss' import './rich_content.scss'
const MAYBE_LINE_BREAKING_ELEMENTS = [
'blockquote',
'br',
'hr',
'ul',
'ol',
'li',
'p',
'table',
'tbody',
'td',
'th',
'thead',
'tr',
'h1',
'h2',
'h3',
'h4',
'h5'
]
/** /**
* RichContent, The Über-powered component for rendering Post HTML. * RichContent, The Über-powered component for rendering Post HTML.
* *
@ -166,25 +187,22 @@ export default {
!(children && typeof children[0] === 'string' && children[0].match(/^\s/)) !(children && typeof children[0] === 'string' && children[0].match(/^\s/))
? lastSpacing ? lastSpacing
: '' : ''
switch (Tag) { if (MAYBE_LINE_BREAKING_ELEMENTS.includes(Tag)) {
case 'br': // all the elements that can cause a line change
currentMentions = null
} else if (Tag === 'img') { // replace images with StillImage
return ['', [mentionsLinePadding, renderImage(opener)], '']
} else if (Tag === 'a' && this.handleLinks) { // replace mentions with MentionLink
if (fullAttrs.class && fullAttrs.class.includes('mention')) {
// Handling mentions here
return renderMention(attrs, children)
} else {
currentMentions = null currentMentions = null
break }
case 'img': // replace images with StillImage } else if (Tag === 'span') {
return ['', [mentionsLinePadding, renderImage(opener)], ''] if (this.handleLinks && fullAttrs.class && fullAttrs.class.includes('h-card')) {
case 'a': // replace mentions with MentionLink return ['', children.map(processItem), '']
if (!this.handleLinks) break }
if (fullAttrs.class && fullAttrs.class.includes('mention')) {
// Handling mentions here
return renderMention(attrs, children)
} else {
currentMentions = null
break
}
case 'span':
if (this.handleLinks && fullAttrs.class && fullAttrs.class.includes('h-card')) {
return ['', children.map(processItem), '']
}
} }
if (children !== undefined) { if (children !== undefined) {

View File

@ -50,7 +50,7 @@ export const defaultState = {
alwaysShowNewPostButton: false, alwaysShowNewPostButton: false,
autohideFloatingPostButton: false, autohideFloatingPostButton: false,
pauseOnUnfocused: true, pauseOnUnfocused: true,
stopGifs: true, stopGifs: false,
replyVisibility: 'all', replyVisibility: 'all',
thirdColumnMode: 'notifications', thirdColumnMode: 'notifications',
notificationVisibility: { notificationVisibility: {
@ -90,7 +90,7 @@ export const defaultState = {
modalOnRemoveUserFromFollowers: undefined, // instance default modalOnRemoveUserFromFollowers: undefined, // instance default
playVideosInModal: false, playVideosInModal: false,
useOneClickNsfw: false, useOneClickNsfw: false,
useContainFit: true, useContainFit: false,
disableStickyHeaders: false, disableStickyHeaders: false,
showScrollbars: false, showScrollbars: false,
userPopoverAvatarAction: 'open', userPopoverAvatarAction: 'open',

View File

@ -10,6 +10,9 @@ const postStatus = {
}, },
closePostStatusModal (state) { closePostStatusModal (state) {
state.modalActivated = false state.modalActivated = false
},
resetPostStatusModal (state) {
state.params = null
} }
}, },
actions: { actions: {
@ -18,6 +21,9 @@ const postStatus = {
}, },
closePostStatusModal ({ commit }) { closePostStatusModal ({ commit }) {
commit('closePostStatusModal') commit('closePostStatusModal')
},
resetPostStatusModal ({ commit }) {
commit('resetPostStatusModal')
} }
} }
} }