fix: disallow media description exceeding limits (#1854)
This commit is contained in:
parent
8fd697126b
commit
cb0b7b58bb
3 changed files with 26 additions and 6 deletions
|
@ -15,6 +15,9 @@ const emit = defineEmits<{
|
|||
(evt: 'setDescription', description: string): void
|
||||
}>()
|
||||
|
||||
// from https://github.com/mastodon/mastodon/blob/dfa984/app/models/media_attachment.rb#L40
|
||||
const maxDescriptionLength = 1500
|
||||
|
||||
const isEditDialogOpen = ref(false)
|
||||
const description = ref(props.attachment.description ?? '')
|
||||
const toggleApply = () => {
|
||||
|
@ -55,7 +58,10 @@ const toggleApply = () => {
|
|||
</h1>
|
||||
<div flex flex-col gap-2>
|
||||
<textarea v-model="description" p-3 h-50 bg-base rounded-2 border-strong border-1 md:w-100 />
|
||||
<button btn-outline @click="toggleApply">
|
||||
<div flex flex-row-reverse>
|
||||
<PublishCharacterCounter :length="description.length" :max="maxDescriptionLength" />
|
||||
</div>
|
||||
<button btn-outline :disabled="description.length > maxDescriptionLength" @click="toggleApply">
|
||||
{{ $t('action.apply') }}
|
||||
</button>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue