2020-01-29 21:37:25 +02:00
|
|
|
<template>
|
|
|
|
<div class="ngbfujlo">
|
2020-01-31 00:01:45 +02:00
|
|
|
<mk-textarea :value="text" readonly style="margin: 0;"></mk-textarea>
|
|
|
|
<mk-button class="button" primary @click="post()" :disabled="posting || posted">{{ posted ? $t('posted') : $t('post') }}</mk-button>
|
2020-01-29 21:37:25 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
|
|
|
import i18n from '../../i18n';
|
|
|
|
import MkTextarea from '../ui/textarea.vue';
|
|
|
|
import MkButton from '../ui/button.vue';
|
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
i18n,
|
|
|
|
components: {
|
|
|
|
MkTextarea,
|
|
|
|
MkButton,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
value: {
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
script: {
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
text: this.script.interpolate(this.value.text),
|
|
|
|
posted: false,
|
|
|
|
posting: false,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
'script.vars': {
|
|
|
|
handler() {
|
|
|
|
this.text = this.script.interpolate(this.value.text);
|
|
|
|
},
|
|
|
|
deep: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
post() {
|
|
|
|
this.posting = true;
|
|
|
|
this.$root.api('notes/create', {
|
|
|
|
text: this.text,
|
|
|
|
}).then(() => {
|
|
|
|
this.posted = true;
|
|
|
|
this.$root.dialog({
|
|
|
|
type: 'success',
|
|
|
|
iconOnly: true, autoClose: true
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.ngbfujlo {
|
2020-01-31 00:01:45 +02:00
|
|
|
padding: 32px;
|
2020-01-29 21:37:25 +02:00
|
|
|
border-radius: 6px;
|
2020-01-31 00:01:45 +02:00
|
|
|
box-shadow: 0 2px 8px var(--shadow);
|
|
|
|
|
|
|
|
> .button {
|
|
|
|
margin-top: 32px;
|
|
|
|
}
|
2020-01-29 21:37:25 +02:00
|
|
|
|
|
|
|
@media (max-width: 600px) {
|
2020-01-31 00:01:45 +02:00
|
|
|
padding: 16px;
|
2020-01-29 21:37:25 +02:00
|
|
|
|
2020-01-31 00:01:45 +02:00
|
|
|
> .button {
|
2020-01-29 21:37:25 +02:00
|
|
|
margin-top: 16px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|