enhance(frontend): improve usability on touch device
This commit is contained in:
parent
2ddedd0ce6
commit
c2940fd77c
|
@ -5433,6 +5433,14 @@ export interface Locale extends ILocale {
|
|||
* タイムラインとノート
|
||||
*/
|
||||
"timelineAndNote": string;
|
||||
/**
|
||||
* 全てのテキスト要素を選択可能にする
|
||||
*/
|
||||
"makeEveryTextElementsSelectable": string;
|
||||
/**
|
||||
* 有効にすると、一部のシチュエーションでのユーザビリティが低下する場合があります。
|
||||
*/
|
||||
"makeEveryTextElementsSelectable_description": string;
|
||||
};
|
||||
"_preferencesProfile": {
|
||||
/**
|
||||
|
|
|
@ -1357,6 +1357,8 @@ _settings:
|
|||
appearanceBanner: "好みに応じた、クライアントの見た目・表示方法に関する設定が行えます。"
|
||||
soundsBanner: "クライアントで再生するサウンドの設定が行えます。"
|
||||
timelineAndNote: "タイムラインとノート"
|
||||
makeEveryTextElementsSelectable: "全てのテキスト要素を選択可能にする"
|
||||
makeEveryTextElementsSelectable_description: "有効にすると、一部のシチュエーションでのユーザビリティが低下する場合があります。"
|
||||
|
||||
_preferencesProfile:
|
||||
profileName: "プロファイル名"
|
||||
|
|
|
@ -234,6 +234,10 @@ export async function common(createVue: () => App<Element>) {
|
|||
});
|
||||
}
|
||||
|
||||
if (prefer.s.makeEveryTextElementsSelectable) {
|
||||
document.documentElement.classList.add('forceSelectableAll');
|
||||
}
|
||||
|
||||
//#region Fetch user
|
||||
if ($i && $i.token) {
|
||||
if (_DEV_) {
|
||||
|
|
|
@ -25,8 +25,8 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<i v-else-if="type === 'question'" :class="$style.iconInner" class="ti ti-help-circle"></i>
|
||||
<MkLoading v-else-if="type === 'waiting'" :class="$style.iconInner" :em="true"/>
|
||||
</div>
|
||||
<header v-if="title" :class="$style.title"><Mfm :text="title"/></header>
|
||||
<div v-if="text" :class="$style.text"><Mfm :text="text"/></div>
|
||||
<header v-if="title" :class="$style.title" class="_selectable"><Mfm :text="title"/></header>
|
||||
<div v-if="text" :class="$style.text" class="_selectable"><Mfm :text="text"/></div>
|
||||
<MkInput v-if="input" v-model="inputValue" autofocus :type="input.type || 'text'" :placeholder="input.placeholder || undefined" :autocomplete="input.autocomplete" @keydown="onInputKeydown">
|
||||
<template v-if="input.type === 'password'" #prefix><i class="ti ti-lock"></i></template>
|
||||
<template #caption>
|
||||
|
|
|
@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
-->
|
||||
|
||||
<template>
|
||||
<div :class="[$style.root, { [$style.warn]: warn }]">
|
||||
<div :class="[$style.root, { [$style.warn]: warn }]" class="_selectable">
|
||||
<i v-if="warn" class="ti ti-alert-triangle" :class="$style.i"></i>
|
||||
<i v-else class="ti ti-info-circle" :class="$style.i"></i>
|
||||
<div><slot></slot></div>
|
||||
|
|
|
@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
-->
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div class="_selectable">
|
||||
<div :class="$style.label" @click="focus"><slot name="label"></slot></div>
|
||||
<div :class="[$style.input, { [$style.inline]: inline, [$style.disabled]: disabled, [$style.focused]: focused }]">
|
||||
<div ref="prefixEl" :class="$style.prefix"><slot name="prefix"></slot></div>
|
||||
|
@ -45,13 +45,13 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, onUnmounted, nextTick, ref, shallowRef, watch, computed, toRefs } from 'vue';
|
||||
import type { InputHTMLAttributes } from 'vue';
|
||||
import { debounce } from 'throttle-debounce';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
import { useInterval } from '@@/js/use-interval.js';
|
||||
import type { InputHTMLAttributes } from 'vue';
|
||||
import type { SuggestionType } from '@/utility/autocomplete.js';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import { Autocomplete } from '@/utility/autocomplete.js';
|
||||
import type { SuggestionType } from '@/utility/autocomplete.js';
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: string | number | null;
|
||||
|
|
|
@ -22,7 +22,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<div :class="$style.items">
|
||||
<div>
|
||||
<div :class="$style.label">{{ i18n.ts.invitationCode }}</div>
|
||||
<div>{{ invite.code }}</div>
|
||||
<div class="_selectableAtomic">{{ invite.code }}</div>
|
||||
</div>
|
||||
<div v-if="moderator">
|
||||
<div :class="$style.label">{{ i18n.ts.inviteCodeCreator }}</div>
|
||||
|
|
|
@ -8,7 +8,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<div :class="$style.key">
|
||||
<slot name="key"></slot>
|
||||
</div>
|
||||
<div :class="$style.value">
|
||||
<div :class="$style.value" class="_selectable">
|
||||
<slot name="value"></slot>
|
||||
<button v-if="copy" v-tooltip="i18n.ts.copy" class="_textButton" style="margin-left: 0.5em;" @click="copy_"><i class="ti ti-copy"></i></button>
|
||||
</div>
|
||||
|
|
|
@ -76,12 +76,13 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
:emojiUrls="appearNote.emojis"
|
||||
:enableEmojiMenu="true"
|
||||
:enableEmojiMenuReaction="true"
|
||||
class="_selectable"
|
||||
/>
|
||||
<div v-if="translating || translation" :class="$style.translation">
|
||||
<MkLoading v-if="translating" mini/>
|
||||
<div v-else-if="translation">
|
||||
<b>{{ i18n.tsx.translatedFrom({ x: translation.sourceLang }) }}: </b>
|
||||
<Mfm :text="translation.text" :author="appearNote.user" :nyaize="'respect'" :emojiUrls="appearNote.emojis"/>
|
||||
<Mfm :text="translation.text" :author="appearNote.user" :nyaize="'respect'" :emojiUrls="appearNote.emojis" class="_selectable"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -97,13 +97,14 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
:emojiUrls="appearNote.emojis"
|
||||
:enableEmojiMenu="true"
|
||||
:enableEmojiMenuReaction="true"
|
||||
class="_selectable"
|
||||
/>
|
||||
<a v-if="appearNote.renote != null" :class="$style.rn">RN:</a>
|
||||
<div v-if="translating || translation" :class="$style.translation">
|
||||
<MkLoading v-if="translating" mini/>
|
||||
<div v-else-if="translation">
|
||||
<b>{{ i18n.tsx.translatedFrom({ x: translation.sourceLang }) }}: </b>
|
||||
<Mfm :text="translation.text" :author="appearNote.user" :nyaize="'respect'" :emojiUrls="appearNote.emojis"/>
|
||||
<Mfm :text="translation.text" :author="appearNote.user" :nyaize="'respect'" :emojiUrls="appearNote.emojis" class="_selectable"/>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="appearNote.files && appearNote.files.length > 0">
|
||||
|
|
|
@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
-->
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div class="_selectable">
|
||||
<div :class="$style.label" @click="focus"><slot name="label"></slot></div>
|
||||
<div :class="{ [$style.disabled]: disabled, [$style.focused]: focused, [$style.tall]: tall, [$style.pre]: pre }" style="position: relative;">
|
||||
<textarea
|
||||
|
@ -38,10 +38,10 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<script lang="ts" setup>
|
||||
import { onMounted, onUnmounted, nextTick, ref, watch, computed, toRefs, shallowRef } from 'vue';
|
||||
import { debounce } from 'throttle-debounce';
|
||||
import type { SuggestionType } from '@/utility/autocomplete.js';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import { Autocomplete } from '@/utility/autocomplete.js';
|
||||
import type { SuggestionType } from '@/utility/autocomplete.js';
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: string | null;
|
||||
|
|
|
@ -58,6 +58,15 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</MkSwitch>
|
||||
</MkPreferenceContainer>
|
||||
</SearchMarker>
|
||||
|
||||
<SearchMarker :keywords="['text', 'selectable']">
|
||||
<MkPreferenceContainer k="makeEveryTextElementsSelectable">
|
||||
<MkSwitch v-model="makeEveryTextElementsSelectable">
|
||||
<template #label><SearchLabel>{{ i18n.ts._settings.makeEveryTextElementsSelectable }}</SearchLabel></template>
|
||||
<template #caption>{{ i18n.ts._settings.makeEveryTextElementsSelectable_description }}</template>
|
||||
</MkSwitch>
|
||||
</MkPreferenceContainer>
|
||||
</SearchMarker>
|
||||
</div>
|
||||
|
||||
<SearchMarker :keywords="['menu', 'style', 'popup', 'drawer']">
|
||||
|
@ -122,6 +131,7 @@ const enableHorizontalSwipe = prefer.model('enableHorizontalSwipe');
|
|||
const useNativeUiForVideoAudioPlayer = prefer.model('useNativeUiForVideoAudioPlayer');
|
||||
const contextMenu = prefer.model('contextMenu');
|
||||
const menuStyle = prefer.model('menuStyle');
|
||||
const makeEveryTextElementsSelectable = prefer.model('makeEveryTextElementsSelectable');
|
||||
|
||||
const fontSize = ref(miLocalStorage.getItem('fontSize'));
|
||||
const useSystemFont = ref(miLocalStorage.getItem('useSystemFont') != null);
|
||||
|
@ -147,6 +157,7 @@ watch([
|
|||
contextMenu,
|
||||
fontSize,
|
||||
useSystemFont,
|
||||
makeEveryTextElementsSelectable,
|
||||
], async () => {
|
||||
await reloadAsk({ reason: i18n.ts.reloadToApplySetting, unison: true });
|
||||
});
|
||||
|
|
|
@ -313,6 +313,9 @@ export const PREF_DEF = {
|
|||
defaultFollowWithReplies: {
|
||||
default: false,
|
||||
},
|
||||
makeEveryTextElementsSelectable: {
|
||||
default: DEFAULT_DEVICE_KIND === 'desktop',
|
||||
},
|
||||
plugins: {
|
||||
default: [] as Plugin[],
|
||||
},
|
||||
|
|
|
@ -81,6 +81,11 @@ html {
|
|||
&.useSystemFont {
|
||||
font-family: system-ui;
|
||||
}
|
||||
|
||||
&:not(.forceSelectableAll) {
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
}
|
||||
}
|
||||
|
||||
html._themeChanging_ {
|
||||
|
@ -120,6 +125,8 @@ a {
|
|||
textarea, input {
|
||||
tap-highlight-color: transparent;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
user-select: text;
|
||||
-webkit-user-select: text;
|
||||
}
|
||||
|
||||
optgroup, option {
|
||||
|
@ -184,6 +191,16 @@ rt {
|
|||
padding: 0.3em 0.5em;
|
||||
}
|
||||
|
||||
._selectable {
|
||||
user-select: text;
|
||||
-webkit-user-select: text;
|
||||
}
|
||||
|
||||
._selectableAtomic {
|
||||
user-select: all;
|
||||
-webkit-user-select: all;
|
||||
}
|
||||
|
||||
._noSelect {
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
|
|
|
@ -897,22 +897,27 @@ export const searchIndexes: SearchIndexItem[] = [
|
|||
keywords: ['native', 'system', 'video', 'audio', 'player', 'media'],
|
||||
},
|
||||
{
|
||||
id: '1fV9WINCQ',
|
||||
id: 'b1GYEEJeh',
|
||||
label: i18n.ts._settings.makeEveryTextElementsSelectable,
|
||||
keywords: ['text', 'selectable'],
|
||||
},
|
||||
{
|
||||
id: 'vVLxwINTJ',
|
||||
label: i18n.ts.menuStyle,
|
||||
keywords: ['menu', 'style', 'popup', 'drawer'],
|
||||
},
|
||||
{
|
||||
id: 'mLQzlKUNu',
|
||||
id: '14cMhMLHL',
|
||||
label: i18n.ts._contextMenu.title,
|
||||
keywords: ['contextmenu', 'system', 'native'],
|
||||
},
|
||||
{
|
||||
id: 'yP96aA3j9',
|
||||
id: 'oSo4LXMX9',
|
||||
label: i18n.ts.fontSize,
|
||||
keywords: ['font', 'size'],
|
||||
},
|
||||
{
|
||||
id: 'jQeiMopFE',
|
||||
id: '7LQSAThST',
|
||||
label: i18n.ts.useSystemFont,
|
||||
keywords: ['font', 'system', 'native'],
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue