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> <image-icon class="content-block-chooser-widget__link-icon"></image-icon>
<div class="content-block-chooser-widget__link-title">Bild</div> <div class="content-block-chooser-widget__link-title">Bild</div>
</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> <text-icon class="content-block-chooser-widget__link-icon"></text-icon>
<div class="content-block-chooser-widget__link-title">Text</div> <div class="content-block-chooser-widget__link-title">Text</div>
</div> </div>

View File

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

View File

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

View File

@ -1,10 +1,16 @@
<template> <template>
<div class="text-form"> <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> </div>
</template> </template>
<script> <script>
export default {
props: ['text', 'index']
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">