Merge pull request #4099 from h3poteto/fix/char-limit

Show character limit in compose
This commit is contained in:
AkiraFukushima 2023-02-08 23:31:44 +09:00 committed by GitHub
commit 66b672ec6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View File

@ -92,7 +92,7 @@
<el-button link size="default" @click="cw = !cw"> CW </el-button>
</el-button-group>
<div class="actions-group">
<span>500</span>
<span>{{ statusChars }}</span>
<el-button type="primary" @click="post" :loading="loading"> {{ $t('modals.new_toot.toot') }} </el-button>
</div>
</div>
@ -204,6 +204,9 @@ export default defineComponent({
const dropTarget = ref<any>(null)
const droppableVisible = ref<boolean>(false)
const maxStatusChars = ref<number>(500)
const statusChars = computed(() => maxStatusChars.value - (form.status.length + form.spoiler.length))
onMounted(async () => {
const [a, s]: [LocalAccount, LocalServer] = await win.ipcRenderer.invoke('get-local-account', id.value)
const c = generator(s.sns, s.baseURL, a.accessToken, userAgent.value)
@ -215,6 +218,11 @@ export default defineComponent({
nsfw.value = credentials.data.source.sensitive
}
const instance = await c.getInstance()
if (instance.data.max_toot_chars) {
maxStatusChars.value = instance.data.max_toot_chars
}
const emojis = await c.getInstanceCustomEmojis()
const customEmojis = emojis.data
.map(emoji => {
@ -442,7 +450,8 @@ export default defineComponent({
removePollOption,
droppableVisible,
inReplyTo,
clearReply
clearReply,
statusChars
}
}
})

View File

@ -1,3 +0,0 @@
import mitt from 'mitt'
export const EventEmitter = mitt()