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

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

    computed: {
      text() {
        return this.value.text ? 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>
