mirror of
https://activitypub.software/TransFem-org/Sharkey
synced 2024-11-25 07:25:12 +00:00
Improve usability
This commit is contained in:
parent
38896205c8
commit
ef6b370d0e
2 changed files with 48 additions and 1 deletions
|
@ -718,6 +718,7 @@ fullView: "フルビュー"
|
||||||
quitFullView: "フルビュー解除"
|
quitFullView: "フルビュー解除"
|
||||||
addDescription: "説明を追加"
|
addDescription: "説明を追加"
|
||||||
userPagePinTip: "個々のノートのメニューから「ピン留め」を選択することで、ここにノートを表示しておくことができます。"
|
userPagePinTip: "個々のノートのメニューから「ピン留め」を選択することで、ここにノートを表示しておくことができます。"
|
||||||
|
notSpecifiedMentionWarning: "宛先に含まれていないメンションがあります"
|
||||||
|
|
||||||
_email:
|
_email:
|
||||||
_follow:
|
_follow:
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
<button @click="addVisibleUser" class="_buttonPrimary"><Fa :icon="faPlus" fixed-width/></button>
|
<button @click="addVisibleUser" class="_buttonPrimary"><Fa :icon="faPlus" fixed-width/></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<MkInfo warn v-if="hasNotSpecifiedMentions" class="hasNotSpecifiedMentions">{{ $ts.notSpecifiedMentionWarning }} - <button class="_textButton" @click="addMissingMention()">{{ $ts.add }}</button></MkInfo>
|
||||||
<input v-show="useCw" ref="cw" class="cw" v-model="cw" :placeholder="$ts.annotation" @keydown="onKeydown">
|
<input v-show="useCw" ref="cw" class="cw" v-model="cw" :placeholder="$ts.annotation" @keydown="onKeydown">
|
||||||
<textarea v-model="text" class="text" :class="{ withCw: useCw }" ref="text" :disabled="posting" :placeholder="placeholder" @keydown="onKeydown" @paste="onPaste" @compositionupdate="onCompositionUpdate" @compositionend="onCompositionEnd" />
|
<textarea v-model="text" class="text" :class="{ withCw: useCw }" ref="text" :disabled="posting" :placeholder="placeholder" @keydown="onKeydown" @paste="onPaste" @compositionupdate="onCompositionUpdate" @compositionend="onCompositionEnd" />
|
||||||
<XPostFormAttaches class="attaches" :files="files" @updated="updateFiles" @detach="detachFile" @changeSensitive="updateFileSensitive" @changeName="updateFileName"/>
|
<XPostFormAttaches class="attaches" :files="files" @updated="updateFiles" @detach="detachFile" @changeSensitive="updateFileSensitive" @changeName="updateFileName"/>
|
||||||
|
@ -71,12 +72,14 @@ import { selectFile } from '@client/scripts/select-file';
|
||||||
import { notePostInterruptors, postFormActions } from '@client/store';
|
import { notePostInterruptors, postFormActions } from '@client/store';
|
||||||
import { isMobile } from '@client/scripts/is-mobile';
|
import { isMobile } from '@client/scripts/is-mobile';
|
||||||
import { throttle } from 'throttle-debounce';
|
import { throttle } from 'throttle-debounce';
|
||||||
|
import MkInfo from '@client/components/ui/info.vue';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: {
|
components: {
|
||||||
XNotePreview,
|
XNotePreview,
|
||||||
XPostFormAttaches: defineAsyncComponent(() => import('./post-form-attaches.vue')),
|
XPostFormAttaches: defineAsyncComponent(() => import('./post-form-attaches.vue')),
|
||||||
XPollEditor: defineAsyncComponent(() => import('./poll-editor.vue'))
|
XPollEditor: defineAsyncComponent(() => import('./poll-editor.vue')),
|
||||||
|
MkInfo,
|
||||||
},
|
},
|
||||||
|
|
||||||
inject: ['modal'],
|
inject: ['modal'],
|
||||||
|
@ -143,6 +146,7 @@ export default defineComponent({
|
||||||
autocomplete: null,
|
autocomplete: null,
|
||||||
draghover: false,
|
draghover: false,
|
||||||
quoteId: null,
|
quoteId: null,
|
||||||
|
hasNotSpecifiedMentions: false,
|
||||||
recentHashtags: JSON.parse(localStorage.getItem('hashtags') || '[]'),
|
recentHashtags: JSON.parse(localStorage.getItem('hashtags') || '[]'),
|
||||||
imeText: '',
|
imeText: '',
|
||||||
typing: throttle(3000, () => {
|
typing: throttle(3000, () => {
|
||||||
|
@ -214,6 +218,18 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
text() {
|
||||||
|
this.checkMissingMention();
|
||||||
|
},
|
||||||
|
visibleUsers: {
|
||||||
|
handler() {
|
||||||
|
this.checkMissingMention();
|
||||||
|
},
|
||||||
|
deep: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
if (this.initialText) {
|
if (this.initialText) {
|
||||||
this.text = this.initialText;
|
this.text = this.initialText;
|
||||||
|
@ -338,6 +354,32 @@ export default defineComponent({
|
||||||
this.$watch('localOnly', () => this.saveDraft());
|
this.$watch('localOnly', () => this.saveDraft());
|
||||||
},
|
},
|
||||||
|
|
||||||
|
checkMissingMention() {
|
||||||
|
if (this.visibility === 'specified') {
|
||||||
|
const ast = mfm.parse(this.text);
|
||||||
|
|
||||||
|
for (const x of extractMentions(ast)) {
|
||||||
|
if (!this.visibleUsers.some(u => (u.username === x.username) && (u.host == x.host))) {
|
||||||
|
this.hasNotSpecifiedMentions = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.hasNotSpecifiedMentions = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
addMissingMention() {
|
||||||
|
const ast = mfm.parse(this.text);
|
||||||
|
|
||||||
|
for (const x of extractMentions(ast)) {
|
||||||
|
if (!this.visibleUsers.some(u => (u.username === x.username) && (u.host == x.host))) {
|
||||||
|
os.api('users/show', { username: x.username, host: x.host }).then(user => {
|
||||||
|
this.visibleUsers.push(user);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
togglePoll() {
|
togglePoll() {
|
||||||
if (this.poll) {
|
if (this.poll) {
|
||||||
this.poll = null;
|
this.poll = null;
|
||||||
|
@ -741,6 +783,10 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
> .hasNotSpecifiedMentions {
|
||||||
|
margin: 0 20px 16px 20px;
|
||||||
|
}
|
||||||
|
|
||||||
> .cw,
|
> .cw,
|
||||||
> .text {
|
> .text {
|
||||||
display: block;
|
display: block;
|
||||||
|
|
Loading…
Reference in a new issue