1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-11-24 07:06:22 +09:00

chore: fix bug

This commit is contained in:
syuilo 2021-10-12 00:44:52 +09:00
parent abd3efa318
commit 50bad84747

View File

@ -1,79 +1,83 @@
<template> <template>
<div class="_root"> <div>
<MkA class="view" v-if="pageId" :to="`/@${ author.username }/pages/${ currentName }`"><i class="fas fa-external-link-square-alt"></i> {{ $ts._pages.viewPage }}</MkA> <MkHeader :info="header"/>
<div class="buttons" style="margin: 16px;"> <div class="_root">
<MkButton inline @click="save" primary class="save" v-if="!readonly"><i class="fas fa-save"></i> {{ $ts.save }}</MkButton> <MkA class="view" v-if="pageId" :to="`/@${ author.username }/pages/${ currentName }`"><i class="fas fa-external-link-square-alt"></i> {{ $ts._pages.viewPage }}</MkA>
<MkButton inline @click="duplicate" class="duplicate" v-if="pageId"><i class="fas fa-copy"></i> {{ $ts.duplicate }}</MkButton>
<MkButton inline @click="del" class="delete" v-if="pageId && !readonly"><i class="fas fa-trash-alt"></i> {{ $ts.delete }}</MkButton>
</div>
<div v-if="tab === 'settings'"> <div class="buttons" style="margin: 16px;">
<div style="padding: 16px;" class="_formRoot"> <MkButton inline @click="save" primary class="save" v-if="!readonly"><i class="fas fa-save"></i> {{ $ts.save }}</MkButton>
<MkInput v-model="title" class="_formBlock"> <MkButton inline @click="duplicate" class="duplicate" v-if="pageId"><i class="fas fa-copy"></i> {{ $ts.duplicate }}</MkButton>
<template #label>{{ $ts._pages.title }}</template> <MkButton inline @click="del" class="delete" v-if="pageId && !readonly"><i class="fas fa-trash-alt"></i> {{ $ts.delete }}</MkButton>
</MkInput> </div>
<MkInput v-model="summary" class="_formBlock"> <div v-if="tab === 'settings'">
<template #label>{{ $ts._pages.summary }}</template> <div style="padding: 16px;" class="_formRoot">
</MkInput> <MkInput v-model="title" class="_formBlock">
<template #label>{{ $ts._pages.title }}</template>
</MkInput>
<MkInput v-model="name" class="_formBlock"> <MkInput v-model="summary" class="_formBlock">
<template #prefix>{{ url }}/@{{ author.username }}/pages/</template> <template #label>{{ $ts._pages.summary }}</template>
<template #label>{{ $ts._pages.url }}</template> </MkInput>
</MkInput>
<MkSwitch v-model="alignCenter" class="_formBlock">{{ $ts._pages.alignCenter }}</MkSwitch> <MkInput v-model="name" class="_formBlock">
<template #prefix>{{ url }}/@{{ author.username }}/pages/</template>
<template #label>{{ $ts._pages.url }}</template>
</MkInput>
<MkSelect v-model="font" class="_formBlock"> <MkSwitch v-model="alignCenter" class="_formBlock">{{ $ts._pages.alignCenter }}</MkSwitch>
<template #label>{{ $ts._pages.font }}</template>
<option value="serif">{{ $ts._pages.fontSerif }}</option>
<option value="sans-serif">{{ $ts._pages.fontSansSerif }}</option>
</MkSelect>
<MkSwitch v-model="hideTitleWhenPinned" class="_formBlock">{{ $ts._pages.hideTitleWhenPinned }}</MkSwitch> <MkSelect v-model="font" class="_formBlock">
<template #label>{{ $ts._pages.font }}</template>
<option value="serif">{{ $ts._pages.fontSerif }}</option>
<option value="sans-serif">{{ $ts._pages.fontSansSerif }}</option>
</MkSelect>
<div class="eyeCatch"> <MkSwitch v-model="hideTitleWhenPinned" class="_formBlock">{{ $ts._pages.hideTitleWhenPinned }}</MkSwitch>
<MkButton v-if="eyeCatchingImageId == null && !readonly" @click="setEyeCatchingImage"><i class="fas fa-plus"></i> {{ $ts._pages.eyeCatchingImageSet }}</MkButton>
<div v-else-if="eyeCatchingImage"> <div class="eyeCatch">
<img :src="eyeCatchingImage.url" :alt="eyeCatchingImage.name" style="max-width: 100%;"/> <MkButton v-if="eyeCatchingImageId == null && !readonly" @click="setEyeCatchingImage"><i class="fas fa-plus"></i> {{ $ts._pages.eyeCatchingImageSet }}</MkButton>
<MkButton @click="removeEyeCatchingImage()" v-if="!readonly"><i class="fas fa-trash-alt"></i> {{ $ts._pages.eyeCatchingImageRemove }}</MkButton> <div v-else-if="eyeCatchingImage">
<img :src="eyeCatchingImage.url" :alt="eyeCatchingImage.name" style="max-width: 100%;"/>
<MkButton @click="removeEyeCatchingImage()" v-if="!readonly"><i class="fas fa-trash-alt"></i> {{ $ts._pages.eyeCatchingImageRemove }}</MkButton>
</div>
</div> </div>
</div> </div>
</div> </div>
</div>
<div v-else-if="tab === 'contents'"> <div v-else-if="tab === 'contents'">
<div style="padding: 16px;"> <div style="padding: 16px;">
<XBlocks class="content" v-model="content" :hpml="hpml"/> <XBlocks class="content" v-model="content" :hpml="hpml"/>
<MkButton @click="add()" v-if="!readonly"><i class="fas fa-plus"></i></MkButton> <MkButton @click="add()" v-if="!readonly"><i class="fas fa-plus"></i></MkButton>
</div>
</div> </div>
</div>
<div v-else-if="tab === 'variables'"> <div v-else-if="tab === 'variables'">
<div class="qmuvgica"> <div class="qmuvgica">
<XDraggable tag="div" class="variables" v-show="variables.length > 0" v-model="variables" item-key="name" handle=".drag-handle" :group="{ name: 'variables' }" animation="150" swap-threshold="0.5"> <XDraggable tag="div" class="variables" v-show="variables.length > 0" v-model="variables" item-key="name" handle=".drag-handle" :group="{ name: 'variables' }" animation="150" swap-threshold="0.5">
<template #item="{element}"> <template #item="{element}">
<XVariable <XVariable
:value="element" :modelValue="element"
:removable="true" :removable="true"
@remove="() => removeVariable(element)" @remove="() => removeVariable(element)"
:hpml="hpml" :hpml="hpml"
:name="element.name" :name="element.name"
:title="element.name" :title="element.name"
:draggable="true" :draggable="true"
/> />
</template> </template>
</XDraggable> </XDraggable>
<MkButton @click="addVariable()" class="add" v-if="!readonly"><i class="fas fa-plus"></i></MkButton> <MkButton @click="addVariable()" class="add" v-if="!readonly"><i class="fas fa-plus"></i></MkButton>
</div>
</div> </div>
</div>
<div v-else-if="tab === 'script'"> <div v-else-if="tab === 'script'">
<div> <div>
<MkTextarea class="_code" v-model="script"/> <MkTextarea class="_code" v-model="script"/>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -128,6 +132,21 @@ export default defineComponent({
data() { data() {
return { return {
[symbols.PAGE_INFO]: computed(() => { [symbols.PAGE_INFO]: computed(() => {
let title = this.$ts._pages.newPage;
if (this.initPageId) {
title = this.$ts._pages.editPage;
}
else if (this.initPageName && this.initUser) {
title = this.$ts._pages.readPage;
}
return {
title: title,
icon: 'fas fa-pencil-alt',
bg: 'var(--bg)',
};
}),
tab: 'settings',
header: computed(() => {
let title = this.$ts._pages.newPage; let title = this.$ts._pages.newPage;
if (this.initPageId) { if (this.initPageId) {
title = this.$ts._pages.editPage; title = this.$ts._pages.editPage;
@ -162,7 +181,6 @@ export default defineComponent({
}] }]
}; };
}), }),
tab: 'settings',
author: this.$i, author: this.$i,
readonly: false, readonly: false,
page: null, page: null,