Skip to content
Snippets Groups Projects
Commit aaf18e0e authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms Committed by Jan-Hendrik Willms
Browse files

blubber: compute height without padding so that the textarea won't grow...

Closes #4413

Merge request studip/studip!3276
parent ccabc66b
No related branches found
No related tags found
No related merge requests found
...@@ -28,14 +28,14 @@ ...@@ -28,14 +28,14 @@
</div> </div>
</template> </template>
<div v-else class="talk-bubble-edit"> <div v-else class="talk-bubble-edit">
<textarea <textarea
v-model="localText" v-model="localText"
ref="textarea" ref="textarea"
@input="setTextareaSize" @input="setTextareaSize"
@focus="setTextareaSize" @focus="setTextareaSize"
@keydown.enter.exact.prevent="saveComment" @keydown.enter.exact.prevent="saveComment"
@keyup.escape.exact="doneEditing" @keyup.escape.exact="doneEditing"
></textarea> ></textarea>
<button @click="saveComment" :title="$gettext('Speichern')"> <button @click="saveComment" :title="$gettext('Speichern')">
<studip-icon shape="accept" /> <studip-icon shape="accept" />
</button> </button>
...@@ -121,8 +121,11 @@ export default { ...@@ -121,8 +121,11 @@ export default {
}, },
setTextareaSize() { setTextareaSize() {
const textarea = this.$refs.textarea; const textarea = this.$refs.textarea;
const style = getComputedStyle(textarea);
const height = textarea.scrollHeight - parseInt(style.paddingTop, 10) - parseInt(style.paddingBottom, 10);
textarea.style.width = this.commentWidth + 'px'; textarea.style.width = this.commentWidth + 'px';
textarea.style.height = textarea.scrollHeight + 'px'; textarea.style.height = height + 'px';
} }
}, },
mounted() { mounted() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment