From 4700db8947cfce870fd8f543536c74a3492ab585 Mon Sep 17 00:00:00 2001 From: Louis Chemineau Date: Tue, 21 Mar 2023 12:44:16 +0100 Subject: Add composer in user profiles Signed-off-by: Louis Chemineau --- src/components/Composer/Composer.vue | 45 ++++++++++++++++++++++++------------ src/views/Profile.vue | 13 +++++++++-- 2 files changed, 41 insertions(+), 17 deletions(-) diff --git a/src/components/Composer/Composer.vue b/src/components/Composer/Composer.vue index 055f2d8c..a1ee329f 100644 --- a/src/components/Composer/Composer.vue +++ b/src/components/Composer/Composer.vue @@ -109,17 +109,6 @@
- -
@@ -172,10 +161,21 @@ export default { FocusOnCreate, }, mixins: [CurrentUserMixin], + props: { + /** @type {import('vue').PropType} */ + initialMention: { + type: Object, + default: null, + }, + defaultVisibility: { + type: String, + default: localStorage.getItem('social.lastPostType') || 'followers', + }, + }, data() { return { statusContent: '', - visibility: localStorage.getItem('social.lastPostType') || 'followers', + visibility: this.defaultVisibility, loading: false, /** @type {Object} */ attachments: {}, @@ -197,8 +197,13 @@ export default { + '' }, selectTemplate(item) { - return '' - + '@' + item.original.value + '' + return ` + + + + @${item.original.value} + + ` }, values: debounce(async (text, populate) => { if (text.length < 1) { @@ -281,6 +286,17 @@ export default { this.replyTo = data this.visibility = data.visibility }) + + if (this.initialMention !== null) { + this.$refs.composerInput.innerHTML = ` + + + + @${this.initialMention.acct} + +  ` + this.updateStatusContent() + } }, methods: { updateStatusContent() { @@ -402,7 +418,6 @@ export default { }, }, } -