summaryrefslogtreecommitdiff
path: root/packages/frontend/src/components/page/page.text-input.vue
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2022-12-27 14:36:33 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2022-12-27 14:36:33 +0900
commit9384f5399da39e53855beb8e7f8ded1aa56bf72e (patch)
treece5959571a981b9c4047da3c7b3fd080aa44222c /packages/frontend/src/components/page/page.text-input.vue
parentwip: retention for dashboard (diff)
downloadmisskey-9384f5399da39e53855beb8e7f8ded1aa56bf72e.tar.gz
misskey-9384f5399da39e53855beb8e7f8ded1aa56bf72e.tar.bz2
misskey-9384f5399da39e53855beb8e7f8ded1aa56bf72e.zip
rename: client -> frontend
Diffstat (limited to 'packages/frontend/src/components/page/page.text-input.vue')
-rw-r--r--packages/frontend/src/components/page/page.text-input.vue55
1 files changed, 55 insertions, 0 deletions
diff --git a/packages/frontend/src/components/page/page.text-input.vue b/packages/frontend/src/components/page/page.text-input.vue
new file mode 100644
index 0000000000..840649ece6
--- /dev/null
+++ b/packages/frontend/src/components/page/page.text-input.vue
@@ -0,0 +1,55 @@
+<template>
+<div>
+ <MkInput class="kudkigyw" :model-value="value" type="text" @update:model-value="updateValue($event)">
+ <template #label>{{ hpml.interpolate(block.text) }}</template>
+ </MkInput>
+</div>
+</template>
+
+<script lang="ts">
+import { computed, defineComponent, PropType } from 'vue';
+import MkInput from '../form/input.vue';
+import * as os from '@/os';
+import { Hpml } from '@/scripts/hpml/evaluator';
+import { TextInputVarBlock } from '@/scripts/hpml/block';
+
+export default defineComponent({
+ components: {
+ MkInput,
+ },
+ props: {
+ block: {
+ type: Object as PropType<TextInputVarBlock>,
+ required: true,
+ },
+ hpml: {
+ type: Object as PropType<Hpml>,
+ required: true,
+ },
+ },
+ setup(props, ctx) {
+ const value = computed(() => {
+ return props.hpml.vars.value[props.block.name];
+ });
+
+ function updateValue(newValue) {
+ props.hpml.updatePageVar(props.block.name, newValue);
+ props.hpml.eval();
+ }
+
+ return {
+ value,
+ updateValue,
+ };
+ },
+});
+</script>
+
+<style lang="scss" scoped>
+.kudkigyw {
+ display: inline-block;
+ min-width: 300px;
+ max-width: 450px;
+ margin: 8px 0;
+}
+</style>