refactor(client): ダミーコンポーネントを使ってノートプレビューするように
This commit is contained in:
parent
5fb4538315
commit
bd8052fedb
3 changed files with 103 additions and 15 deletions
|
|
@ -17,7 +17,7 @@
|
|||
<span v-if="visibility === 'followers'"><i class="fas fa-unlock"></i></span>
|
||||
<span v-if="visibility === 'specified'"><i class="fas fa-envelope"></i></span>
|
||||
</button>
|
||||
<button class="_button preview" @click="showPreview = !showPreview" :class="{ active: showPreview }" v-tooltip="$ts.notePreview"><i class="fas fa-file-code"></i></button>
|
||||
<button class="_button preview" @click="showPreview = !showPreview" :class="{ active: showPreview }" v-tooltip="$ts.previewNoteText"><i class="fas fa-file-code"></i></button>
|
||||
<button class="submit _buttonPrimary" :disabled="!canPost" @click="post" data-cy-open-post-form-submit>{{ submitText }}<i :class="reply ? 'fas fa-reply' : renote ? 'fas fa-quote-right' : 'fas fa-paper-plane'"></i></button>
|
||||
</div>
|
||||
</header>
|
||||
|
|
@ -41,7 +41,7 @@
|
|||
<input v-show="withHashtags" ref="hashtags" class="hashtags" v-model="hashtags" :placeholder="$ts.hashtags" list="hashtags">
|
||||
<XPostFormAttaches class="attaches" :files="files" @updated="updateFiles" @detach="detachFile" @changeSensitive="updateFileSensitive" @changeName="updateFileName"/>
|
||||
<XPollEditor v-if="poll" :poll="poll" @destroyed="poll = null" @updated="onPollUpdate"/>
|
||||
<XNoteSimple class="preview" v-if="showPreview" :note="draftedNote"/>
|
||||
<XNotePreview class="preview" v-if="showPreview" :text="text"/>
|
||||
<footer>
|
||||
<button class="_button" @click="chooseFileFrom" v-tooltip="$ts.attachFile"><i class="fas fa-photo-video"></i></button>
|
||||
<button class="_button" @click="togglePoll" :class="{ active: poll }" v-tooltip="$ts.poll"><i class="fas fa-poll-h"></i></button>
|
||||
|
|
@ -64,6 +64,7 @@ import insertTextAtCursor from 'insert-text-at-cursor';
|
|||
import { length } from 'stringz';
|
||||
import { toASCII } from 'punycode/';
|
||||
import XNoteSimple from './note-simple.vue';
|
||||
import XNotePreview from './note-preview.vue';
|
||||
import * as mfm from 'mfm-js';
|
||||
import { host, url } from '@client/config';
|
||||
import { erase, unique } from '../../prelude/array';
|
||||
|
|
@ -83,6 +84,7 @@ import { defaultStore } from '@client/store';
|
|||
export default defineComponent({
|
||||
components: {
|
||||
XNoteSimple,
|
||||
XNotePreview,
|
||||
XPostFormAttaches: defineAsyncComponent(() => import('./post-form-attaches.vue')),
|
||||
XPollEditor: defineAsyncComponent(() => import('./poll-editor.vue')),
|
||||
MkInfo,
|
||||
|
|
@ -223,18 +225,6 @@ export default defineComponent({
|
|||
return this.$instance ? this.$instance.maxNoteTextLength : 1000;
|
||||
},
|
||||
|
||||
draftedNote(): object {
|
||||
return {
|
||||
user: this.$i,
|
||||
createdAt: new Date(),
|
||||
visibility: this.visibility,
|
||||
localOnly: this.localOnly,
|
||||
cw: this.useCw ? this.cw : null,
|
||||
text: this.text,
|
||||
files: this.files,
|
||||
poll: this.poll,
|
||||
};
|
||||
}
|
||||
withHashtags: defaultStore.makeGetterSetter('postFormWithHashtags'),
|
||||
hashtags: defaultStore.makeGetterSetter('postFormHashtags'),
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue