Use textarea instead of input for composing alt text
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
This commit is contained in:
parent
9827c0e81e
commit
5b38aae357
4 changed files with 39 additions and 6 deletions
|
@ -199,6 +199,26 @@ const Attachment = {
|
||||||
const width = image.naturalWidth
|
const width = image.naturalWidth
|
||||||
const height = image.naturalHeight
|
const height = image.naturalHeight
|
||||||
this.$emit('naturalSizeLoad', { id: this.attachment.id, width, height })
|
this.$emit('naturalSizeLoad', { id: this.attachment.id, width, height })
|
||||||
|
},
|
||||||
|
resize (e) {
|
||||||
|
const target = e.target || e
|
||||||
|
if (!(target instanceof window.Element)) { return }
|
||||||
|
|
||||||
|
// Reset to default height for empty form, nothing else to do here.
|
||||||
|
if (target.value === '') {
|
||||||
|
target.style.height = null
|
||||||
|
this.$emit('resize')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const paddingString = getComputedStyle(target)['padding']
|
||||||
|
// remove -px suffix
|
||||||
|
const padding = Number(paddingString.substring(0, paddingString.length - 2))
|
||||||
|
|
||||||
|
target.style.height = 'auto'
|
||||||
|
const newHeight = Math.floor(target.scrollHeight - padding * 2)
|
||||||
|
target.style.height = `${newHeight}px`
|
||||||
|
this.$emit('resize', newHeight)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
.attachment-wrapper {
|
.attachment-wrapper {
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
height: 100%;
|
height: 200px;
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,19 @@
|
||||||
.description-field {
|
.description-field {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
|
|
||||||
|
box-sizing: content-box;
|
||||||
|
overflow: hidden;
|
||||||
|
transition: min-height 200ms 100ms;
|
||||||
|
|
||||||
|
padding-bottom: var(--_padding);
|
||||||
|
height: calc(var(--post-line-height) * 1em);
|
||||||
|
min-height: calc(var(--post-line-height) * 1em);
|
||||||
|
resize: none;
|
||||||
|
|
||||||
|
&.scrollable-form {
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
& .placeholder-container,
|
& .placeholder-container,
|
||||||
|
|
|
@ -248,14 +248,15 @@
|
||||||
class="description-container"
|
class="description-container"
|
||||||
:class="{ '-static': !edit }"
|
:class="{ '-static': !edit }"
|
||||||
>
|
>
|
||||||
<input
|
<textarea
|
||||||
v-if="edit"
|
v-if="edit"
|
||||||
v-model="localDescription"
|
v-model="localDescription"
|
||||||
type="text"
|
|
||||||
class="description-field"
|
class="description-field"
|
||||||
:placeholder="$t('post_status.media_description')"
|
:placeholder="$t('post_status.media_description')"
|
||||||
@keydown.enter.prevent=""
|
rows="1"
|
||||||
>
|
cols="1"
|
||||||
|
@input="resize"
|
||||||
|
/>
|
||||||
<p v-else>
|
<p v-else>
|
||||||
{{ localDescription }}
|
{{ localDescription }}
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -171,7 +171,6 @@
|
||||||
|
|
||||||
.gallery-item {
|
.gallery-item {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
height: 200px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue