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