2020-01-30 04:37:25 +09:00
|
|
|
<template>
|
2020-07-11 10:13:11 +09:00
|
|
|
<mk-container :show-header="props.showHeader">
|
|
|
|
<template #header><fa :icon="faStickyNote"/>{{ $t('_widgets.memo') }}</template>
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2020-07-11 10:13:11 +09:00
|
|
|
<div class="otgbylcu">
|
|
|
|
<textarea v-model="text" :placeholder="$t('placeholder')" @input="onChange"></textarea>
|
|
|
|
<button @click="saveMemo" :disabled="!changed" class="_buttonPrimary">{{ $t('save') }}</button>
|
|
|
|
</div>
|
|
|
|
</mk-container>
|
2020-01-30 04:37:25 +09:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { faStickyNote } from '@fortawesome/free-solid-svg-icons';
|
|
|
|
import MkContainer from '../components/ui/container.vue';
|
|
|
|
import define from './define';
|
|
|
|
|
|
|
|
export default define({
|
|
|
|
name: 'memo',
|
|
|
|
props: () => ({
|
2020-07-11 10:13:11 +09:00
|
|
|
showHeader: {
|
|
|
|
type: 'boolean',
|
|
|
|
default: true,
|
|
|
|
},
|
2020-01-30 04:37:25 +09:00
|
|
|
})
|
|
|
|
}).extend({
|
|
|
|
components: {
|
|
|
|
MkContainer
|
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
text: null,
|
|
|
|
changed: false,
|
|
|
|
timeoutId: null,
|
|
|
|
faStickyNote
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
created() {
|
|
|
|
this.text = this.$store.state.settings.memo;
|
|
|
|
|
|
|
|
this.$watch('$store.state.settings.memo', text => {
|
|
|
|
this.text = text;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
onChange() {
|
|
|
|
this.changed = true;
|
|
|
|
clearTimeout(this.timeoutId);
|
|
|
|
this.timeoutId = setTimeout(this.saveMemo, 1000);
|
|
|
|
},
|
|
|
|
|
|
|
|
saveMemo() {
|
|
|
|
this.$store.dispatch('settings/set', {
|
|
|
|
key: 'memo',
|
|
|
|
value: this.text
|
|
|
|
});
|
|
|
|
this.changed = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.otgbylcu {
|
|
|
|
padding-bottom: 28px + 16px;
|
|
|
|
|
|
|
|
> textarea {
|
|
|
|
display: block;
|
|
|
|
width: 100%;
|
|
|
|
max-width: 100%;
|
|
|
|
min-width: 100%;
|
|
|
|
padding: 16px;
|
|
|
|
color: var(--inputText);
|
|
|
|
background: var(--face);
|
|
|
|
border: none;
|
|
|
|
border-bottom: solid var(--lineWidth) var(--faceDivider);
|
|
|
|
border-radius: 0;
|
2020-03-29 11:06:58 +09:00
|
|
|
box-sizing: border-box;
|
2020-01-30 04:37:25 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
> button {
|
|
|
|
display: block;
|
|
|
|
position: absolute;
|
|
|
|
bottom: 8px;
|
|
|
|
right: 8px;
|
|
|
|
margin: 0;
|
|
|
|
padding: 0 10px;
|
|
|
|
height: 28px;
|
|
|
|
outline: none;
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
|
|
&:disabled {
|
|
|
|
opacity: 0.7;
|
|
|
|
cursor: default;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|