Enable adding text blocks

This commit is contained in:
Ramon Wenger 2018-09-11 15:23:25 +02:00
parent d6316fc328
commit 26fa7e70bc
4 changed files with 16 additions and 9 deletions

View File

@ -12,7 +12,7 @@
<image-icon class="content-block-chooser-widget__link-icon"></image-icon>
<div class="content-block-chooser-widget__link-title">Bild</div>
</div>
<div class="content-block-chooser-widget__link" v-on:click="$emit('change-type', index, 'text')">
<div class="content-block-chooser-widget__link" v-on:click="$emit('change-type', index, 'text_block')">
<text-icon class="content-block-chooser-widget__link-icon"></text-icon>
<div class="content-block-chooser-widget__link-title">Text</div>
</div>

View File

@ -2,6 +2,7 @@
<div class="content-block-title-input">
<input placeholder="Titel für Inhaltsblock erfassen"
class="content-block-title-input__inputfield skillbox-input"
:value="title"
v-on:input="$emit('update-title', $event.target.value)">
</div>
</template>

View File

@ -10,6 +10,7 @@
v-on:change-type="changeType"
v-on:link-change-url="changeLinkUrl"
v-on:link-change-text="changeLinkText"
v-on:text-change-value="changeTextValue"
v-on:video-change-url="changeVideoUrl">
</component>
<a class="new-content-block-wizard__remove" v-on:click="removeElement(index)">
@ -69,7 +70,7 @@
return 'video-form';
case 'image':
return 'image-form';
case 'text':
case 'text_block':
return 'text-form';
case 'exercise':
return 'exercise-form';
@ -93,6 +94,9 @@
changeVideoUrl(value, index) {
this._updateProperty(value, index, 'url')
},
changeTextValue(value, index) {
this._updateProperty(value, index, 'text')
},
removeElement(index) {
this.elements.splice(index, 1);
},
@ -128,12 +132,7 @@
input: {
contentBlock: {
title: this.title,
contents: [
{
type: 'text_block',
text: 'Oh hai'
}
]
contents: this.elements
},
after: 'Q29udGVudEJsb2NrTm9kZToxOQ=='
}
@ -150,6 +149,7 @@
return {
title: '',
elements: [
{}
// {
// type: 'image'
// },

View File

@ -1,10 +1,16 @@
<template>
<div class="text-form">
<textarea class="text-form__input skillbox-textarea" placeholder="Text erfassen..."></textarea>
<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: ['text', 'index']
}
</script>
<style scoped lang="scss">