From 4894ded6a56c46b58613e1c024785d8855e6bec1 Mon Sep 17 00:00:00 2001 From: AkiraFukushima Date: Wed, 8 Feb 2023 23:24:08 +0900 Subject: [PATCH] Show character limit in compose --- src/renderer/components/TimelineSpace/Compose.vue | 13 +++++++++++-- src/renderer/components/event.ts | 3 --- 2 files changed, 11 insertions(+), 5 deletions(-) delete mode 100644 src/renderer/components/event.ts diff --git a/src/renderer/components/TimelineSpace/Compose.vue b/src/renderer/components/TimelineSpace/Compose.vue index 94fc17d7..cccf660d 100644 --- a/src/renderer/components/TimelineSpace/Compose.vue +++ b/src/renderer/components/TimelineSpace/Compose.vue @@ -92,7 +92,7 @@ CW
- 500 + {{ statusChars }} {{ $t('modals.new_toot.toot') }}
@@ -204,6 +204,9 @@ export default defineComponent({ const dropTarget = ref(null) const droppableVisible = ref(false) + const maxStatusChars = ref(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 } } }) diff --git a/src/renderer/components/event.ts b/src/renderer/components/event.ts deleted file mode 100644 index 23497e05..00000000 --- a/src/renderer/components/event.ts +++ /dev/null @@ -1,3 +0,0 @@ -import mitt from 'mitt' - -export const EventEmitter = mitt()