PostFormのプレフィックスにVisivilityもしくはチャンネル名を表示
This commit is contained in:
parent
9ad63423dd
commit
06632c7c96
|
@ -102,7 +102,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { inject, watch, nextTick, onMounted, defineAsyncComponent } from 'vue';
|
import { inject, watch, nextTick, computed, onMounted, defineAsyncComponent, WritableComputedRef } from 'vue';
|
||||||
import * as mfm from 'cherrypick-mfm-js';
|
import * as mfm from 'cherrypick-mfm-js';
|
||||||
import * as Misskey from 'cherrypick-js';
|
import * as Misskey from 'cherrypick-js';
|
||||||
import insertTextAtCursor from 'insert-text-at-cursor';
|
import insertTextAtCursor from 'insert-text-at-cursor';
|
||||||
|
@ -202,6 +202,17 @@ let recentHashtags = $ref(JSON.parse(miLocalStorage.getItem('hashtags') ?? '[]')
|
||||||
let imeText = $ref('');
|
let imeText = $ref('');
|
||||||
let showingOptions = $ref(false);
|
let showingOptions = $ref(false);
|
||||||
let disableRightClick = $ref(false);
|
let disableRightClick = $ref(false);
|
||||||
|
let postChannel: WritableComputedRef<misskey.entities.Channel> = computed(defaultStore.makeGetterSetter('postChannel'));
|
||||||
|
|
||||||
|
watch(postChannel, () => {
|
||||||
|
if (postChannel.value) {
|
||||||
|
if (!postChannel.value.federation) {
|
||||||
|
localOnly = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
localOnly = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const draftKey = $computed((): string => {
|
const draftKey = $computed((): string => {
|
||||||
let key = props.channel ? `channel:${props.channel.id}` : '';
|
let key = props.channel ? `channel:${props.channel.id}` : '';
|
||||||
|
@ -218,12 +229,19 @@ const draftKey = $computed((): string => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const placeholder = $computed((): string => {
|
const placeholder = $computed((): string => {
|
||||||
|
let postTo = '';
|
||||||
|
if (postChannel.value) {
|
||||||
|
postTo = '[' + postChannel.value.name + '] ';
|
||||||
|
} else {
|
||||||
|
postTo = '[' + i18n.ts._visibility[visibility] + '] ';
|
||||||
|
}
|
||||||
|
|
||||||
if (props.renote) {
|
if (props.renote) {
|
||||||
return i18n.ts._postForm.quotePlaceholder;
|
return postTo + i18n.ts._postForm.quotePlaceholder;
|
||||||
} else if (props.reply) {
|
} else if (props.reply) {
|
||||||
return i18n.ts._postForm.replyPlaceholder;
|
return postTo + i18n.ts._postForm.replyPlaceholder;
|
||||||
} else if (props.channel) {
|
} else if (props.channel) {
|
||||||
return i18n.ts._postForm.channelPlaceholder;
|
return postTo + i18n.ts._postForm.channelPlaceholder;
|
||||||
} else {
|
} else {
|
||||||
const xs = [
|
const xs = [
|
||||||
i18n.ts._postForm._placeholders.a,
|
i18n.ts._postForm._placeholders.a,
|
||||||
|
@ -233,7 +251,7 @@ const placeholder = $computed((): string => {
|
||||||
i18n.ts._postForm._placeholders.e,
|
i18n.ts._postForm._placeholders.e,
|
||||||
i18n.ts._postForm._placeholders.f,
|
i18n.ts._postForm._placeholders.f,
|
||||||
];
|
];
|
||||||
return xs[Math.floor(Math.random() * xs.length)];
|
return postTo + xs[Math.floor(Math.random() * xs.length)];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue