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