Improve usability of quote note by pasting url (#5196)

This commit is contained in:
Satsuki Yanagi 2019-07-20 03:23:16 +09:00 committed by syuilo
parent f1ab918ecd
commit 56c8ad9df3
3 changed files with 32 additions and 18 deletions

View file

@ -328,6 +328,7 @@ export default (opts) => ({
this.text = ''; this.text = '';
this.files = []; this.files = [];
this.poll = false; this.poll = false;
this.quoteId = null;
this.$emit('change-attached-files', this.files); this.$emit('change-attached-files', this.files);
}, },
@ -357,7 +358,7 @@ export default (opts) => ({
const paste = e.clipboardData.getData('text'); const paste = e.clipboardData.getData('text');
if (paste.startsWith(url + '/notes/')) { if (!this.renote && !this.quoteId && paste.startsWith(url + '/notes/')) {
e.preventDefault(); e.preventDefault();
this.$root.dialog({ this.$root.dialog({

View file

@ -6,18 +6,18 @@
@drop.stop="onDrop" @drop.stop="onDrop"
> >
<div class="content"> <div class="content">
<div v-if="visibility == 'specified'" class="visibleUsers"> <div class="hashtags" v-if="recentHashtags.length > 0 && $store.state.settings.suggestRecentHashtags">
<b>{{ $t('@.post-form.recent-tags') }}:</b>
<a v-for="tag in recentHashtags.slice(0, 5)" @click="addTag(tag)" :title="$t('@.post-form.click-to-tagging')">#{{ tag }}</a>
</div>
<div class="with-quote" v-if="quoteId">{{ $t('@.post-form.quote-attached') }} <a @click="quoteId = null">[x]</a></div>
<div v-if="visibility === 'specified'" class="visibleUsers">
<span v-for="u in visibleUsers"> <span v-for="u in visibleUsers">
<mk-user-name :user="u"/><a @click="removeVisibleUser(u)">[x]</a> <mk-user-name :user="u"/><a @click="removeVisibleUser(u)">[x]</a>
</span> </span>
<a @click="addVisibleUser">{{ $t('@.post-form.add-visible-user') }}</a> <a @click="addVisibleUser">{{ $t('@.post-form.add-visible-user') }}</a>
</div> </div>
<div class="hashtags" v-if="recentHashtags.length > 0 && $store.state.settings.suggestRecentHashtags"> <div class="local-only" v-if="localOnly === true">{{ $t('@.post-form.local-only-message') }}</div>
<b>{{ $t('@.post-form.recent-tags') }}:</b>
<a v-for="tag in recentHashtags.slice(0, 5)" @click="addTag(tag)" :title="$t('@.post-form.click-to-tagging')">#{{ tag }}</a>
</div>
<div class="with-quote" v-if="quoteId">{{ $t('@.post-form.quote-attached') }}</div>
<div class="local-only" v-if="localOnly == true">{{ $t('@.post-form.local-only-message') }}</div>
<input v-show="useCw" ref="cw" v-model="cw" :placeholder="$t('@.post-form.cw-placeholder')" v-autocomplete="{ model: 'cw' }"> <input v-show="useCw" ref="cw" v-model="cw" :placeholder="$t('@.post-form.cw-placeholder')" v-autocomplete="{ model: 'cw' }">
<div class="textarea"> <div class="textarea">
<textarea :class="{ with: (files.length != 0 || poll) }" <textarea :class="{ with: (files.length != 0 || poll) }"
@ -190,14 +190,6 @@ export default Vue.extend({
border-radius 0 0 4px 4px border-radius 0 0 4px 4px
transition border-color .3s ease transition border-color .3s ease
> .visibleUsers
margin-bottom 8px
font-size 14px
> span
margin-right 16px
color var(--primary)
> .hashtags > .hashtags
margin 0 0 8px 0 margin 0 0 8px 0
overflow hidden overflow hidden
@ -211,6 +203,18 @@ export default Vue.extend({
margin-right 8px margin-right 8px
white-space nowrap white-space nowrap
> .with-quote
margin 0 0 8px 0
color var(--primary)
> .visibleUsers
margin-bottom 8px
font-size 14px
> span
margin-right 16px
color var(--primary)
> .local-only > .local-only
margin 0 0 8px 0 margin 0 0 8px 0
color var(--primary) color var(--primary)

View file

@ -17,16 +17,17 @@
<div class="form"> <div class="form">
<mk-note-preview class="preview" v-if="reply" :note="reply"/> <mk-note-preview class="preview" v-if="reply" :note="reply"/>
<mk-note-preview class="preview" v-if="renote" :note="renote"/> <mk-note-preview class="preview" v-if="renote" :note="renote"/>
<div v-if="visibility == 'specified'" class="visibleUsers"> <div class="with-quote" v-if="quoteId">{{ $t('@.post-form.quote-attached') }} <a @click="quoteId = null">[x]</a></div>
<div v-if="visibility === 'specified'" class="visibleUsers">
<span v-for="u in visibleUsers"> <span v-for="u in visibleUsers">
<mk-user-name :user="u"/> <mk-user-name :user="u"/>
<a @click="removeVisibleUser(u)">[x]</a> <a @click="removeVisibleUser(u)">[x]</a>
</span> </span>
<a @click="addVisibleUser">+{{ $t('@.post-form.add-visible-user') }}</a> <a @click="addVisibleUser">+{{ $t('@.post-form.add-visible-user') }}</a>
</div> </div>
<div class="local-only" v-if="localOnly === true">{{ $t('@.post-form.local-only-message') }}</div>
<input v-show="useCw" ref="cw" v-model="cw" :placeholder="$t('@.post-form.cw-placeholder')" v-autocomplete="{ model: 'cw' }"> <input v-show="useCw" ref="cw" v-model="cw" :placeholder="$t('@.post-form.cw-placeholder')" v-autocomplete="{ model: 'cw' }">
<textarea v-model="text" ref="text" :disabled="posting" :placeholder="placeholder" v-autocomplete="{ model: 'text' }" @paste="onPaste"></textarea> <textarea v-model="text" ref="text" :disabled="posting" :placeholder="placeholder" v-autocomplete="{ model: 'text' }" @paste="onPaste"></textarea>
<div class="with-quote" v-if="quoteId">{{ $t('@.post-form.quote-attached') }}</div>
<x-post-form-attaches class="attaches" :files="files"/> <x-post-form-attaches class="attaches" :files="files"/>
<x-poll-editor v-if="poll" ref="poll" @destroyed="poll = false" @updated="onPollUpdate()"/> <x-poll-editor v-if="poll" ref="poll" @destroyed="poll = false" @updated="onPollUpdate()"/>
<mk-uploader ref="uploader" @uploaded="attachMedia" @change="onChangeUploadings"/> <mk-uploader ref="uploader" @uploaded="attachMedia" @change="onChangeUploadings"/>
@ -140,6 +141,10 @@ export default Vue.extend({
> .preview > .preview
padding 16px padding 16px
> .with-quote
margin 0 0 8px 0
color var(--primary)
> .visibleUsers > .visibleUsers
margin 5px margin 5px
font-size 14px font-size 14px
@ -148,6 +153,10 @@ export default Vue.extend({
margin-right 16px margin-right 16px
color var(--text) color var(--text)
> .local-only
margin 0 0 8px 0
color var(--primary)
> input > input
z-index 1 z-index 1