Skip to content

Input Rich Text

Base component for all rich text input fields, which is based on tiptaps editor

Example Usage

Example

Content

[
  {
    "type": "text",
    "content": "Hier ein Beispiel Content mit"
  },
  {
    "type": "latex",
    "content": "fsbvsdfbv"
  },
  {
    "type": "text",
    "content": " eingebettet."
  }
]

Output SkTaskLayout

Hier ein Beispiel Content mit eingebettet.

vue
<template>
  <div>
    <SkInputRichText
      v-model="content"
      placeholder="Schreibe hier deine Antwort"
      :has-gap-button="true"
    />
    <SkInputRichText v-model="content" />

    <div class="content">
      <h3>Content</h3>
      <pre><code>{{ content }}</code></pre>
    </div>
    <div class="content">
      <h3>Output SkTaskLayout</h3>
      <SkTaskLayout :layout="content"></SkTaskLayout>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue';
const content = ref([
  {
    type: 'text',
    content: 'Hier ein Beispiel Content mit',
  },
  {
    type: 'latex',
    content: 'fsbvsdfbv',
  },
  {
    type: 'text',
    content: ' eingebettet.',
  },
]);
</script>

<style lang="scss">
.tiptap {
  > * + * {
    margin-top: 0.75em;
  }

  code {
    background-color: rgba(#616161, 0.1);
    color: #616161;
  }
}

.content {
  padding: 1rem 0 0;

  h3 {
    margin: 1rem 0 0.5rem;
  }

  pre {
    border-radius: 5px;
    color: #333;
  }

  code {
    display: block;
    white-space: pre-wrap;
    font-size: 0.8rem;
    padding: 0.75rem 1rem;
    background-color: #e9ecef;
    color: #495057;
  }
}
</style>

Reference

Properties

NameTypeDefaultDescription
v-modelrefnullThe value to edit
hasGapButtonBooleanfalseDetermines if the gap button is shown

Events

NameParametersDescription
@inputeventthe payload of the input

Slots

NameParametersDescription