2018-05-27 15:39:20 +02:00
|
|
|
<template>
|
|
|
|
<div class="mkw-memo">
|
2019-02-15 07:35:52 +01:00
|
|
|
<ui-container :show-header="!props.compact">
|
2018-11-08 19:44:35 +01:00
|
|
|
<template slot="header"><fa :icon="['far', 'sticky-note']"/>{{ $t('title') }}</template>
|
2018-05-27 15:39:20 +02:00
|
|
|
|
|
|
|
<div class="mkw-memo--body">
|
2018-11-08 19:44:35 +01:00
|
|
|
<textarea v-model="text" :placeholder="$t('placeholder')" @input="onChange"></textarea>
|
|
|
|
<button @click="saveMemo" :disabled="!changed">{{ $t('save') }}</button>
|
2018-05-27 15:39:20 +02:00
|
|
|
</div>
|
2019-02-15 07:35:52 +01:00
|
|
|
</ui-container>
|
2018-05-27 15:39:20 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import define from '../../define-widget';
|
2018-11-08 19:44:35 +01:00
|
|
|
import i18n from '../../../i18n';
|
2018-05-27 15:39:20 +02:00
|
|
|
|
|
|
|
export default define({
|
|
|
|
name: 'memo',
|
|
|
|
props: () => ({
|
|
|
|
compact: false
|
|
|
|
})
|
|
|
|
}).extend({
|
2018-11-08 19:44:35 +01:00
|
|
|
i18n: i18n('common/views/widgets/memo.vue'),
|
2018-05-27 15:39:20 +02:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
text: null,
|
|
|
|
changed: false
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
created() {
|
|
|
|
this.text = this.$store.state.settings.memo;
|
|
|
|
|
|
|
|
this.$watch('$store.state.settings.memo', text => {
|
|
|
|
this.text = text;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
func() {
|
|
|
|
this.props.compact = !this.props.compact;
|
|
|
|
this.save();
|
|
|
|
},
|
|
|
|
|
|
|
|
onChange() {
|
|
|
|
this.changed = true;
|
|
|
|
},
|
|
|
|
|
|
|
|
saveMemo() {
|
|
|
|
this.$store.dispatch('settings/set', {
|
|
|
|
key: 'memo',
|
|
|
|
value: this.text
|
|
|
|
});
|
|
|
|
this.changed = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
2018-09-28 12:59:19 +02:00
|
|
|
.mkw-memo
|
2018-05-27 15:39:20 +02:00
|
|
|
.mkw-memo--body
|
|
|
|
padding-bottom 28px + 16px
|
|
|
|
|
|
|
|
> textarea
|
|
|
|
display block
|
|
|
|
width 100%
|
|
|
|
max-width 100%
|
|
|
|
min-width 100%
|
|
|
|
padding 16px
|
2018-09-28 12:59:19 +02:00
|
|
|
color var(--inputText)
|
2018-09-26 13:28:13 +02:00
|
|
|
background var(--face)
|
2018-05-27 15:39:20 +02:00
|
|
|
border none
|
2018-12-30 06:00:57 +01:00
|
|
|
border-bottom solid var(--lineWidth) var(--faceDivider)
|
2018-05-29 21:46:50 +02:00
|
|
|
border-radius 0
|
2018-05-27 15:39:20 +02:00
|
|
|
|
|
|
|
> button
|
|
|
|
display block
|
|
|
|
position absolute
|
|
|
|
bottom 8px
|
|
|
|
right 8px
|
|
|
|
margin 0
|
|
|
|
padding 0 10px
|
|
|
|
height 28px
|
2018-09-26 13:19:35 +02:00
|
|
|
color var(--primaryForeground)
|
|
|
|
background var(--primary) !important
|
2018-05-27 15:39:20 +02:00
|
|
|
outline none
|
|
|
|
border none
|
|
|
|
border-radius 4px
|
|
|
|
transition background 0.1s ease
|
|
|
|
cursor pointer
|
|
|
|
|
|
|
|
&:hover
|
2018-09-26 13:19:35 +02:00
|
|
|
background var(--primaryLighten10) !important
|
2018-05-27 15:39:20 +02:00
|
|
|
|
|
|
|
&:active
|
2018-09-26 13:19:35 +02:00
|
|
|
background var(--primaryDarken10) !important
|
2018-05-27 15:39:20 +02:00
|
|
|
transition background 0s ease
|
|
|
|
|
|
|
|
&:disabled
|
|
|
|
opacity 0.7
|
|
|
|
cursor default
|
|
|
|
|
|
|
|
</style>
|