2019-04-30 12:15:41 +09:00
|
|
|
<template>
|
2020-10-17 20:12:00 +09:00
|
|
|
<MkTextarea :value="text" readonly></MkTextarea>
|
2019-04-30 12:15:41 +09:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2021-01-30 10:59:05 +09:00
|
|
|
import { TextBlock } from '@/scripts/hpml/block';
|
|
|
|
import { Hpml } from '@/scripts/hpml/evaluator';
|
|
|
|
import { defineComponent, PropType } from 'vue';
|
2020-01-30 04:37:25 +09:00
|
|
|
import MkTextarea from '../ui/textarea.vue';
|
2019-04-30 12:15:41 +09:00
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
export default defineComponent({
|
2020-01-30 04:37:25 +09:00
|
|
|
components: {
|
|
|
|
MkTextarea
|
|
|
|
},
|
2019-04-30 12:15:41 +09:00
|
|
|
props: {
|
2021-01-30 10:59:05 +09:00
|
|
|
block: {
|
|
|
|
type: Object as PropType<TextBlock>,
|
2019-04-30 12:15:41 +09:00
|
|
|
required: true
|
|
|
|
},
|
2020-04-20 21:35:27 +09:00
|
|
|
hpml: {
|
2021-01-30 10:59:05 +09:00
|
|
|
type: Object as PropType<Hpml>,
|
2019-04-30 12:15:41 +09:00
|
|
|
required: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2021-01-30 10:59:05 +09:00
|
|
|
text: this.hpml.interpolate(this.block.text),
|
2019-04-30 12:15:41 +09:00
|
|
|
};
|
|
|
|
},
|
2020-01-30 04:37:25 +09:00
|
|
|
watch: {
|
2020-04-20 21:35:27 +09:00
|
|
|
'hpml.vars': {
|
2020-01-30 04:37:25 +09:00
|
|
|
handler() {
|
2021-01-30 10:59:05 +09:00
|
|
|
this.text = this.hpml.interpolate(this.block.text);
|
2020-01-30 04:37:25 +09:00
|
|
|
},
|
|
|
|
deep: true
|
|
|
|
}
|
2019-04-30 12:15:41 +09:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|