mirror of
https://git.boykissers.com/pawkey/pawkey-sk.git
synced 2025-12-20 12:14:18 +00:00
add option to keep CWs with "RE:" prefix
This commit is contained in:
@@ -373,7 +373,9 @@ if (props.specified) {
|
||||
// keep cw when reply
|
||||
if (prefer.s.keepCw && props.reply && props.reply.cw) {
|
||||
useCw.value = true;
|
||||
cw.value = props.reply.cw;
|
||||
cw.value = prefer.s.keepCw === 'prepend-re'
|
||||
? `RE: ${props.reply.cw}`
|
||||
: props.reply.cw;
|
||||
}
|
||||
|
||||
// apply default CW
|
||||
|
||||
@@ -39,32 +39,34 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
<script lang="ts">
|
||||
type ItemOption<T extends string | number | null | boolean = string | number | null> = {
|
||||
type?: 'option';
|
||||
value: T;
|
||||
label: string;
|
||||
};
|
||||
|
||||
type ItemGroup<T extends string | number | null | boolean = string | number | null> = {
|
||||
type: 'group';
|
||||
label: string;
|
||||
items: ItemOption<T>[];
|
||||
};
|
||||
|
||||
export type MkSelectItem<T extends string | number | null | boolean = string | number | null> = ItemOption<T> | ItemGroup<T>;
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup generic="T extends string | number | null | boolean = string | number | null">
|
||||
import { onMounted, nextTick, ref, watch, computed, toRefs, useSlots } from 'vue';
|
||||
import { useInterval } from '@@/js/use-interval.js';
|
||||
import type { VNode, VNodeChild } from 'vue';
|
||||
import type { MenuItem } from '@/types/menu.js';
|
||||
import * as os from '@/os.js';
|
||||
|
||||
type ItemOption = {
|
||||
type?: 'option';
|
||||
value: string | number | null;
|
||||
label: string;
|
||||
};
|
||||
|
||||
type ItemGroup = {
|
||||
type: 'group';
|
||||
label: string;
|
||||
items: ItemOption[];
|
||||
};
|
||||
|
||||
export type MkSelectItem = ItemOption | ItemGroup;
|
||||
|
||||
// TODO: itemsをslot内のoptionで指定する用法は廃止する(props.itemsを必須化する)
|
||||
// see: https://github.com/misskey-dev/misskey/issues/15558
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: string | number | null;
|
||||
modelValue: T;
|
||||
required?: boolean;
|
||||
readonly?: boolean;
|
||||
disabled?: boolean;
|
||||
@@ -73,11 +75,11 @@ const props = defineProps<{
|
||||
inline?: boolean;
|
||||
small?: boolean;
|
||||
large?: boolean;
|
||||
items?: MkSelectItem[];
|
||||
items?: MkSelectItem<T>[];
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(ev: 'update:modelValue', value: string | number | null): void;
|
||||
(ev: 'update:modelValue', value: T): void;
|
||||
}>();
|
||||
|
||||
const slots = useSlots();
|
||||
|
||||
@@ -403,9 +403,13 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
<div class="_gaps_s">
|
||||
<SearchMarker :keywords="['remember', 'keep', 'note', 'cw']">
|
||||
<MkPreferenceContainer k="keepCw">
|
||||
<MkSwitch v-model="keepCw">
|
||||
<MkSelect v-model="keepCw">
|
||||
<template #label><SearchLabel>{{ i18n.ts.keepCw }}</SearchLabel></template>
|
||||
</MkSwitch>
|
||||
<template #caption><SearchKeyword>{{ i18n.ts.keepCwDescription }}</SearchKeyword></template>
|
||||
<option :value="false">{{ i18n.ts.keepCwDisabled }}</option>>
|
||||
<option :value="true">{{ i18n.ts.keepCwEnabled }}</option>>
|
||||
<option value="prepend-re">{{ i18n.ts.keepCwPrependRe }}</option>
|
||||
</MkSelect>
|
||||
</MkPreferenceContainer>
|
||||
</SearchMarker>
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ export const PREF_DEF = {
|
||||
default: false,
|
||||
},
|
||||
keepCw: {
|
||||
default: true,
|
||||
default: true as boolean | 'prepend-re',
|
||||
},
|
||||
rememberNoteVisibility: {
|
||||
default: false,
|
||||
|
||||
Reference in New Issue
Block a user