theme description

This commit is contained in:
syuilo 2021-04-14 16:24:07 +09:00
parent fbc5b8ceb7
commit a3687dd653
3 changed files with 17 additions and 0 deletions

View File

@ -716,6 +716,7 @@ goBack: "戻る"
unlikeConfirm: "いいね解除しますか?"
fullView: "フルビュー"
quitFullView: "フルビュー解除"
addDescription: "説明を追加"
_email:
_follow:
@ -884,6 +885,7 @@ _theme:
install: "テーマのインストール"
manage: "テーマの管理"
code: "テーマコード"
description: "説明"
installed: "{name}をインストールしました"
installedThemes: "インストールされたテーマ"
builtinThemes: "標準のテーマ"

View File

@ -13,6 +13,9 @@
<FormInput readonly :value="selectedTheme.author">
<span>{{ $ts.author }}</span>
</FormInput>
<FormTextarea readonly :value="selectedTheme.desc" v-if="selectedTheme.desc">
<span>{{ $ts._theme.description }}</span>
</FormTextarea>
<FormTextarea readonly tall :value="selectedThemeCode">
<span>{{ $ts._theme.code }}</span>
<template #desc><button @click="copyThemeCode()" class="_textButton">{{ $ts.copy }}</button></template>

View File

@ -35,6 +35,7 @@
</div>
</div>
</div>
<FormGroup v-if="codeEnabled">
<FormTextarea v-model:value="themeCode" tall>
<span>{{ $ts._theme.code }}</span>
@ -42,6 +43,14 @@
<FormButton @click="applyThemeCode" primary>{{ $ts.apply }}</FormButton>
</FormGroup>
<FormButton v-else @click="codeEnabled = true"><Fa :icon="faCode"/> {{ $ts.editCode }}</FormButton>
<FormGroup v-if="descriptionEnabled">
<FormTextarea v-model:value="description">
<span>{{ $ts._theme.description }}</span>
</FormTextarea>
</FormGroup>
<FormButton v-else @click="descriptionEnabled = true">{{ $ts.addDescription }}</FormButton>
<FormGroup>
<FormButton @click="showPreview"><Fa :icon="faEye"/> {{ $ts.preview }}</FormButton>
<FormButton @click="saveAs" primary><Fa :icon="faSave"/> {{ $ts.saveAs }}</FormButton>
@ -88,6 +97,8 @@ export default defineComponent({
props: lightTheme.props
} as Theme,
codeEnabled: false,
descriptionEnabled: false,
description: null,
themeCode: null,
bgColors: [
{ color: '#f5f5f5', kind: 'light', forPreview: '#f5f5f5' },
@ -218,6 +229,7 @@ export default defineComponent({
this.theme.id = uuid();
this.theme.name = name;
this.theme.author = `@${this.$i.username}@${toUnicode(host)}`;
if (this.description) this.theme.desc = this.description;
addTheme(this.theme);
applyTheme(this.theme);
if (this.$store.state.darkMode) {