<template>
  <div class="text-form">
    <textarea class="text-form__input skillbox-textarea"
              placeholder="Text erfassen..."
              :value="text"
              v-on:input="$emit('text-change-value', $event.target.value, index)"></textarea>
  </div>
</template>

<script>
  export default {
    props: ['value', 'index'],

    computed: {
      text() {
        return this.value.text.replace(/<br(\/)?>/, '\n').replace(/(<([^>]+)>)/ig, '')
      }
    }
  }
</script>

<style scoped lang="scss">
  @import "@/styles/_variables.scss";

  .text-form {
    &__input {
      width: $modal-input-width;
    }
  }
</style>
