Compare commits

..

2 Commits

20 changed files with 210 additions and 31 deletions

View File

@ -32,6 +32,7 @@ func NewPreferences() Preferences {
ShowFolding: true, ShowFolding: true,
DropText: true, DropText: true,
Links: true, Links: true,
EntryTextAlign: 0,
}, },
Cli: PreferencesCli{ Cli: PreferencesCli{
FontSize: consts.DEFAULT_FONT_SIZE, FontSize: consts.DEFAULT_FONT_SIZE,
@ -74,6 +75,7 @@ type PreferencesEditor struct {
ShowFolding bool `json:"showFolding" yaml:"show_folding"` ShowFolding bool `json:"showFolding" yaml:"show_folding"`
DropText bool `json:"dropText" yaml:"drop_text"` DropText bool `json:"dropText" yaml:"drop_text"`
Links bool `json:"links" yaml:"links"` Links bool `json:"links" yaml:"links"`
EntryTextAlign int `json:"entryTextAlign" yaml:"entry_text_align"`
} }
type PreferencesCli struct { type PreferencesCli struct {

View File

@ -253,6 +253,15 @@ const onTermKey = (e) => {
} }
// block all ctrl key combinations input // block all ctrl key combinations input
return false return false
} else {
switch (e.key) {
case 'Home': // move to head of line
moveInputCursorTo(0)
return false
case 'End': // move to tail of line
moveInputCursorTo(Number.MAX_SAFE_INTEGER)
return false
}
} }
} }
return true return true

View File

@ -19,6 +19,10 @@ import { decodeRedisKey } from '@/utils/key_convert.js'
import ContentSearchInput from '@/components/content_value/ContentSearchInput.vue' import ContentSearchInput from '@/components/content_value/ContentSearchInput.vue'
import { formatBytes } from '@/utils/byte_convert.js' import { formatBytes } from '@/utils/byte_convert.js'
import copy from 'copy-text-to-clipboard' import copy from 'copy-text-to-clipboard'
import SwitchButton from '@/components/common/SwitchButton.vue'
import AlignLeft from '@/components/icons/AlignLeft.vue'
import AlignCenter from '@/components/icons/AlignCenter.vue'
import { TextAlignType } from '@/consts/text_align_type.js'
const i18n = useI18n() const i18n = useI18n()
const themeVars = useThemeVars() const themeVars = useThemeVars()
@ -45,9 +49,10 @@ const props = defineProps({
decode: String, decode: String,
end: Boolean, end: Boolean,
loading: Boolean, loading: Boolean,
textAlign: Number,
}) })
const emit = defineEmits(['loadmore', 'loadall', 'reload', 'match']) const emit = defineEmits(['loadmore', 'loadall', 'reload', 'match', 'update:textAlign'])
/** /**
* *
@ -78,7 +83,7 @@ const fieldFilterOption = ref(null)
const fieldColumn = computed(() => ({ const fieldColumn = computed(() => ({
key: 'key', key: 'key',
title: () => i18n.t('common.field'), title: () => i18n.t('common.field'),
align: 'center', align: props.textAlign !== TextAlignType.Left ? 'center' : 'left',
titleAlign: 'center', titleAlign: 'center',
resizable: true, resizable: true,
ellipsis: { ellipsis: {
@ -111,7 +116,7 @@ const isCode = computed(() => {
const valueColumn = computed(() => ({ const valueColumn = computed(() => ({
key: 'value', key: 'value',
title: () => i18n.t('common.value'), title: () => i18n.t('common.value'),
align: isCode.value ? 'left' : 'center', align: isCode.value ? 'left' : props.textAlign !== TextAlignType.Left ? 'center' : 'left',
titleAlign: 'center', titleAlign: 'center',
resizable: true, resizable: true,
ellipsis: isCode.value ellipsis: isCode.value
@ -264,7 +269,7 @@ const columns = computed(() => {
key: 'no', key: 'no',
title: '#', title: '#',
width: 80, width: 80,
align: 'center', align: props.textAlign !== TextAlignType.Left ? 'center' : 'left',
titleAlign: 'center', titleAlign: 'center',
render: (row, index) => { render: (row, index) => {
return index + 1 return index + 1
@ -280,7 +285,7 @@ const columns = computed(() => {
key: 'no', key: 'no',
title: '#', title: '#',
width: 80, width: 80,
align: 'center', align: props.textAlign !== TextAlignType.Left ? 'center' : 'left',
titleAlign: 'center', titleAlign: 'center',
render: (row, index) => { render: (row, index) => {
if (index + 1 === currentEditRow.no) { if (index + 1 === currentEditRow.no) {
@ -442,6 +447,13 @@ defineExpose({
<n-divider v-if="showMemoryUsage" vertical /> <n-divider v-if="showMemoryUsage" vertical />
<n-text v-if="showMemoryUsage">{{ $t('interface.memory_usage') }}: {{ formatBytes(props.size) }}</n-text> <n-text v-if="showMemoryUsage">{{ $t('interface.memory_usage') }}: {{ formatBytes(props.size) }}</n-text>
<div class="flex-item-expand"></div> <div class="flex-item-expand"></div>
<switch-button
:icons="[AlignCenter, AlignLeft]"
:stroke-width="3.5"
:t-tooltips="['interface.text_align_center', 'interface.text_align_left']"
:value="props.textAlign"
unselect-stroke-width="3"
@update:value="(val) => emit('update:textAlign', val)" />
<format-selector <format-selector
v-show="!inEdit" v-show="!inEdit"
:decode="props.decode" :decode="props.decode"

View File

@ -18,6 +18,10 @@ import Edit from '@/components/icons/Edit.vue'
import ContentSearchInput from '@/components/content_value/ContentSearchInput.vue' import ContentSearchInput from '@/components/content_value/ContentSearchInput.vue'
import { formatBytes } from '@/utils/byte_convert.js' import { formatBytes } from '@/utils/byte_convert.js'
import copy from 'copy-text-to-clipboard' import copy from 'copy-text-to-clipboard'
import { TextAlignType } from '@/consts/text_align_type.js'
import AlignLeft from '@/components/icons/AlignLeft.vue'
import AlignCenter from '@/components/icons/AlignCenter.vue'
import SwitchButton from '@/components/common/SwitchButton.vue'
const i18n = useI18n() const i18n = useI18n()
const themeVars = useThemeVars() const themeVars = useThemeVars()
@ -51,9 +55,10 @@ const props = defineProps({
}, },
end: Boolean, end: Boolean,
loading: Boolean, loading: Boolean,
textAlign: Number,
}) })
const emit = defineEmits(['loadmore', 'loadall', 'reload', 'match']) const emit = defineEmits(['loadmore', 'loadall', 'reload', 'match', 'update:textAlign'])
/** /**
* *
@ -84,7 +89,7 @@ const valueFilterOption = ref(null)
const valueColumn = computed(() => ({ const valueColumn = computed(() => ({
key: 'value', key: 'value',
title: () => i18n.t('common.value'), title: () => i18n.t('common.value'),
align: isCode.value ? 'left' : 'center', align: isCode.value ? 'left' : props.textAlign !== TextAlignType.Left ? 'center' : 'left',
titleAlign: 'center', titleAlign: 'center',
ellipsis: isCode.value ellipsis: isCode.value
? false ? false
@ -214,7 +219,7 @@ const columns = computed(() => {
key: 'no', key: 'no',
title: '#', title: '#',
width: 80, width: 80,
align: 'center', align: props.textAlign !== TextAlignType.Left ? 'center' : 'left',
titleAlign: 'center', titleAlign: 'center',
render: (row, index) => { render: (row, index) => {
return index + 1 return index + 1
@ -229,7 +234,7 @@ const columns = computed(() => {
key: 'no', key: 'no',
title: '#', title: '#',
width: 80, width: 80,
align: 'center', align: props.textAlign !== TextAlignType.Left ? 'center' : 'left',
titleAlign: 'center', titleAlign: 'center',
render: (row, index) => { render: (row, index) => {
if (index + 1 === currentEditRow.no) { if (index + 1 === currentEditRow.no) {
@ -391,6 +396,13 @@ defineExpose({
<n-divider v-if="showMemoryUsage" vertical /> <n-divider v-if="showMemoryUsage" vertical />
<n-text v-if="showMemoryUsage">{{ $t('interface.memory_usage') }}: {{ formatBytes(props.size) }}</n-text> <n-text v-if="showMemoryUsage">{{ $t('interface.memory_usage') }}: {{ formatBytes(props.size) }}</n-text>
<div class="flex-item-expand"></div> <div class="flex-item-expand"></div>
<switch-button
:icons="[AlignCenter, AlignLeft]"
:stroke-width="3.5"
:t-tooltips="['interface.text_align_center', 'interface.text_align_left']"
:value="props.textAlign"
unselect-stroke-width="3"
@update:value="(val) => emit('update:textAlign', val)" />
<format-selector <format-selector
v-show="!inEdit" v-show="!inEdit"
:decode="props.decode" :decode="props.decode"

View File

@ -18,6 +18,10 @@ import FormatSelector from '@/components/content_value/FormatSelector.vue'
import ContentSearchInput from '@/components/content_value/ContentSearchInput.vue' import ContentSearchInput from '@/components/content_value/ContentSearchInput.vue'
import { formatBytes } from '@/utils/byte_convert.js' import { formatBytes } from '@/utils/byte_convert.js'
import copy from 'copy-text-to-clipboard' import copy from 'copy-text-to-clipboard'
import AlignLeft from '@/components/icons/AlignLeft.vue'
import AlignCenter from '@/components/icons/AlignCenter.vue'
import SwitchButton from '@/components/common/SwitchButton.vue'
import { TextAlignType } from '@/consts/text_align_type.js'
const i18n = useI18n() const i18n = useI18n()
const themeVars = useThemeVars() const themeVars = useThemeVars()
@ -50,9 +54,10 @@ const props = defineProps({
}, },
end: Boolean, end: Boolean,
loading: Boolean, loading: Boolean,
textAlign: Number,
}) })
const emit = defineEmits(['loadmore', 'loadall', 'reload', 'match']) const emit = defineEmits(['loadmore', 'loadall', 'reload', 'match', 'update:textAlign'])
/** /**
* *
@ -83,7 +88,7 @@ const valueFilterOption = ref(null)
const valueColumn = computed(() => ({ const valueColumn = computed(() => ({
key: 'value', key: 'value',
title: () => i18n.t('common.value'), title: () => i18n.t('common.value'),
align: isCode.value ? 'left' : 'center', align: isCode.value ? 'left' : props.textAlign !== TextAlignType.Left ? 'center' : 'left',
titleAlign: 'center', titleAlign: 'center',
ellipsis: isCode.value ellipsis: isCode.value
? false ? false
@ -211,7 +216,7 @@ const columns = computed(() => {
key: 'no', key: 'no',
title: '#', title: '#',
width: 80, width: 80,
align: 'center', align: props.textAlign !== TextAlignType.Left ? 'center' : 'left',
titleAlign: 'center', titleAlign: 'center',
render: (row, index) => { render: (row, index) => {
return index + 1 return index + 1
@ -226,7 +231,7 @@ const columns = computed(() => {
key: 'no', key: 'no',
title: '#', title: '#',
width: 80, width: 80,
align: 'center', align: props.textAlign !== TextAlignType.Left ? 'center' : 'left',
titleAlign: 'center', titleAlign: 'center',
render: (row, index) => { render: (row, index) => {
if (index + 1 === currentEditRow.no) { if (index + 1 === currentEditRow.no) {
@ -388,6 +393,13 @@ defineExpose({
<n-divider v-if="showMemoryUsage" vertical /> <n-divider v-if="showMemoryUsage" vertical />
<n-text v-if="showMemoryUsage">{{ $t('interface.memory_usage') }}: {{ formatBytes(props.size) }}</n-text> <n-text v-if="showMemoryUsage">{{ $t('interface.memory_usage') }}: {{ formatBytes(props.size) }}</n-text>
<div class="flex-item-expand"></div> <div class="flex-item-expand"></div>
<switch-button
:icons="[AlignCenter, AlignLeft]"
:stroke-width="3.5"
:t-tooltips="['interface.text_align_center', 'interface.text_align_left']"
:value="props.textAlign"
unselect-stroke-width="3"
@update:value="(val) => emit('update:textAlign', val)" />
<format-selector <format-selector
v-show="!inEdit" v-show="!inEdit"
:decode="props.decode" :decode="props.decode"

View File

@ -14,10 +14,13 @@ import useDialogStore from 'stores/dialog.js'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import ContentToolbar from '@/components/content_value/ContentToolbar.vue' import ContentToolbar from '@/components/content_value/ContentToolbar.vue'
import ContentValueJson from '@/components/content_value/ContentValueJson.vue' import ContentValueJson from '@/components/content_value/ContentValueJson.vue'
import usePreferencesStore from 'stores/preferences.js'
import { TextAlignType } from '@/consts/text_align_type.js'
const themeVars = useThemeVars() const themeVars = useThemeVars()
const browserStore = useBrowserStore() const browserStore = useBrowserStore()
const dialogStore = useDialogStore() const dialogStore = useDialogStore()
const prefStore = usePreferencesStore()
const props = defineProps({ const props = defineProps({
blank: Boolean, blank: Boolean,
@ -178,6 +181,11 @@ const onMatch = (match) => {
loadData(true, false, match || '') loadData(true, false, match || '')
} }
const onEntryTextAlignChanged = (align) => {
prefStore.editor.entryTextAlign = align !== TextAlignType.Left ? TextAlignType.Center : TextAlignType.Left
prefStore.savePreferences()
}
const contentRef = ref(null) const contentRef = ref(null)
const initContent = async () => { const initContent = async () => {
// onReload() // onReload()
@ -225,12 +233,14 @@ watch(() => data.value?.keyPath, initContent)
:ttl="data.ttl" :ttl="data.ttl"
:value="data.value" :value="data.value"
tabindex="0" tabindex="0"
:text-align="prefStore.entryTextAlign"
@delete="onDelete" @delete="onDelete"
@keydown="onKeyShortcut" @keydown="onKeyShortcut"
@loadall="onLoadAll" @loadall="onLoadAll"
@loadmore="onLoadMore" @loadmore="onLoadMore"
@match="onMatch" @match="onMatch"
@reload="onReload"> @reload="onReload"
@update:text-align="onEntryTextAlignChanged">
<template #toolbar> <template #toolbar>
<content-toolbar <content-toolbar
:db="data.db" :db="data.db"

View File

@ -18,6 +18,10 @@ import Edit from '@/components/icons/Edit.vue'
import ContentSearchInput from '@/components/content_value/ContentSearchInput.vue' import ContentSearchInput from '@/components/content_value/ContentSearchInput.vue'
import { formatBytes } from '@/utils/byte_convert.js' import { formatBytes } from '@/utils/byte_convert.js'
import copy from 'copy-text-to-clipboard' import copy from 'copy-text-to-clipboard'
import { TextAlignType } from '@/consts/text_align_type.js'
import AlignLeft from '@/components/icons/AlignLeft.vue'
import AlignCenter from '@/components/icons/AlignCenter.vue'
import SwitchButton from '@/components/common/SwitchButton.vue'
const i18n = useI18n() const i18n = useI18n()
const themeVars = useThemeVars() const themeVars = useThemeVars()
@ -50,9 +54,10 @@ const props = defineProps({
}, },
end: Boolean, end: Boolean,
loading: Boolean, loading: Boolean,
textAlign: Number,
}) })
const emit = defineEmits(['loadmore', 'loadall', 'reload', 'match']) const emit = defineEmits(['loadmore', 'loadall', 'reload', 'match', 'update:textAlign'])
/** /**
* *
@ -82,7 +87,7 @@ const fullEdit = ref(false)
const scoreColumn = computed(() => ({ const scoreColumn = computed(() => ({
key: 'score', key: 'score',
title: () => i18n.t('common.score'), title: () => i18n.t('common.score'),
align: 'center', align: props.textAlign !== TextAlignType.Left ? 'center' : 'left',
titleAlign: 'center', titleAlign: 'center',
resizable: true, resizable: true,
sorter: (row1, row2) => row1.s - row2.s, sorter: (row1, row2) => row1.s - row2.s,
@ -131,7 +136,7 @@ const valueFilterOption = ref(null)
const valueColumn = computed(() => ({ const valueColumn = computed(() => ({
key: 'value', key: 'value',
title: () => i18n.t('common.value'), title: () => i18n.t('common.value'),
align: isCode.value ? 'left' : 'center', align: isCode.value ? 'left' : props.textAlign !== TextAlignType.Left ? 'center' : 'left',
titleAlign: 'center', titleAlign: 'center',
resizable: true, resizable: true,
ellipsis: isCode.value ellipsis: isCode.value
@ -256,7 +261,7 @@ const columns = computed(() => {
key: 'no', key: 'no',
title: '#', title: '#',
width: 80, width: 80,
align: 'center', align: props.textAlign !== TextAlignType.Left ? 'center' : 'left',
titleAlign: 'center', titleAlign: 'center',
render: (row, index) => { render: (row, index) => {
return index + 1 return index + 1
@ -272,7 +277,7 @@ const columns = computed(() => {
key: 'no', key: 'no',
title: '#', title: '#',
width: 80, width: 80,
align: 'center', align: props.textAlign !== TextAlignType.Left ? 'center' : 'left',
titleAlign: 'center', titleAlign: 'center',
render: (row, index) => { render: (row, index) => {
if (index + 1 === currentEditRow.no) { if (index + 1 === currentEditRow.no) {
@ -421,6 +426,13 @@ defineExpose({
<n-divider v-if="showMemoryUsage" vertical /> <n-divider v-if="showMemoryUsage" vertical />
<n-text v-if="showMemoryUsage">{{ $t('interface.memory_usage') }}: {{ formatBytes(props.size) }}</n-text> <n-text v-if="showMemoryUsage">{{ $t('interface.memory_usage') }}: {{ formatBytes(props.size) }}</n-text>
<div class="flex-item-expand"></div> <div class="flex-item-expand"></div>
<switch-button
:icons="[AlignCenter, AlignLeft]"
:stroke-width="3.5"
:t-tooltips="['interface.text_align_center', 'interface.text_align_left']"
:value="props.textAlign"
unselect-stroke-width="3"
@update:value="(val) => emit('update:textAlign', val)" />
<format-selector <format-selector
v-show="!inEdit" v-show="!inEdit"
:decode="props.decode" :decode="props.decode"

View File

@ -0,0 +1,39 @@
<script setup>
const props = defineProps({
strokeWidth: {
type: [Number, String],
default: 3,
},
})
</script>
<template>
<svg fill="none" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path
:stroke-width="props.strokeWidth"
d="M36 19H12"
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round" />
<path
:stroke-width="props.strokeWidth"
d="M42 9H6"
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round" />
<path
:stroke-width="props.strokeWidth"
d="M42 29H6"
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round" />
<path
:stroke-width="props.strokeWidth"
d="M36 39H12"
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round" />
</svg>
</template>
<style lang="scss" scoped></style>

View File

@ -0,0 +1,39 @@
<script setup>
const props = defineProps({
strokeWidth: {
type: [Number, String],
default: 3,
},
})
</script>
<template>
<svg fill="none" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path
:stroke-width="props.strokeWidth"
d="M42 9H6"
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round" />
<path
:stroke-width="props.strokeWidth"
d="M34 19H6"
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round" />
<path
:stroke-width="props.strokeWidth"
d="M42 29H6"
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round" />
<path
:stroke-width="props.strokeWidth"
d="M34 39H6"
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round" />
</svg>
</template>
<style lang="scss" scoped></style>

View File

@ -0,0 +1,8 @@
/**
* all types of text alignment
* @enum {number}
*/
export const TextAlignType = {
Center: 0,
Left: 1,
}

View File

@ -126,6 +126,8 @@
"length": "Length", "length": "Length",
"entries": "Entries", "entries": "Entries",
"memory_usage": "Memory Usage", "memory_usage": "Memory Usage",
"text_align_left": "Text Align Left",
"text_align_center": "Text Align Center",
"view_as": "View As", "view_as": "View As",
"decode_with": "Decode / Decompress", "decode_with": "Decode / Decompress",
"custom_decoder": "New Custom Decoder", "custom_decoder": "New Custom Decoder",

View File

@ -126,6 +126,8 @@
"length": "Longitud", "length": "Longitud",
"entries": "Entradas", "entries": "Entradas",
"memory_usage": "Uso de memoria", "memory_usage": "Uso de memoria",
"text_align_left": "Alinear a la izquierda",
"text_align_center": "Centrar",
"view_as": "Ver como", "view_as": "Ver como",
"decode_with": "Decodificar / Descomprimir", "decode_with": "Decodificar / Descomprimir",
"custom_decoder": "Nuevo decodificador personalizado", "custom_decoder": "Nuevo decodificador personalizado",

View File

@ -126,6 +126,8 @@
"length": "Longueur", "length": "Longueur",
"entries": "Entrées", "entries": "Entrées",
"memory_usage": "Utilisation de la mémoire", "memory_usage": "Utilisation de la mémoire",
"text_align_left": "Aligner à gauche",
"text_align_center": "Centrer",
"view_as": "Voir comme", "view_as": "Voir comme",
"decode_with": "Décoder / Décompresser", "decode_with": "Décoder / Décompresser",
"custom_decoder": "Nouveau décodeur personnalisé", "custom_decoder": "Nouveau décodeur personnalisé",

View File

@ -126,6 +126,8 @@
"length": "長さ", "length": "長さ",
"entries": "エントリ", "entries": "エントリ",
"memory_usage": "メモリ使用量", "memory_usage": "メモリ使用量",
"text_align_left": "左揃え",
"text_align_center": "中央揃え",
"view_as": "表示形式", "view_as": "表示形式",
"decode_with": "デコード/解凍", "decode_with": "デコード/解凍",
"custom_decoder": "新しいカスタムデコーダー", "custom_decoder": "新しいカスタムデコーダー",

View File

@ -126,6 +126,8 @@
"length": "길이", "length": "길이",
"entries": "항목 수", "entries": "항목 수",
"memory_usage": "메모리 사용량", "memory_usage": "메모리 사용량",
"text_align_left": "텍스트 왼쪽 정렬",
"text_align_center": "텍스트 가운데 정렬",
"view_as": "보기", "view_as": "보기",
"decode_with": "디코딩/압축 해제", "decode_with": "디코딩/압축 해제",
"custom_decoder": "새 사용자 정의 디코더", "custom_decoder": "새 사용자 정의 디코더",

View File

@ -126,6 +126,8 @@
"length": "Tamanho", "length": "Tamanho",
"entries": "Entradas", "entries": "Entradas",
"memory_usage": "Uso de Memória", "memory_usage": "Uso de Memória",
"text_align_left": "Alinhar à esquerda",
"text_align_center": "Centralizar",
"view_as": "Visualizar Como", "view_as": "Visualizar Como",
"decode_with": "Decodificar / Descompressão", "decode_with": "Decodificar / Descompressão",
"custom_decoder": "Novo Decodificador Personalizado", "custom_decoder": "Novo Decodificador Personalizado",

View File

@ -126,6 +126,8 @@
"length": "Длина", "length": "Длина",
"entries": "Записи", "entries": "Записи",
"memory_usage": "Использование памяти", "memory_usage": "Использование памяти",
"text_align_left": "Выравнивание по левому краю",
"text_align_center": "Выравнивание по центру",
"view_as": "Вид", "view_as": "Вид",
"decode_with": "Декодировать/Распаковать", "decode_with": "Декодировать/Распаковать",
"custom_decoder": "Новый пользовательский декодер", "custom_decoder": "Новый пользовательский декодер",

View File

@ -126,6 +126,8 @@
"length": "长度", "length": "长度",
"entries": "条目", "entries": "条目",
"memory_usage": "内存占用", "memory_usage": "内存占用",
"text_align_left": "文本居左",
"text_align_center": "文本居中",
"view_as": "查看方式", "view_as": "查看方式",
"decode_with": "解码/解压方式", "decode_with": "解码/解压方式",
"custom_decoder": "添加自定义解码", "custom_decoder": "添加自定义解码",

View File

@ -126,6 +126,8 @@
"length": "長度", "length": "長度",
"entries": "條目", "entries": "條目",
"memory_usage": "記憶體使用量", "memory_usage": "記憶體使用量",
"text_align_left": "文字靠左",
"text_align_center": "文字置中",
"view_as": "檢視方式", "view_as": "檢視方式",
"decode_with": "解碼/解壓方式", "decode_with": "解碼/解壓方式",
"custom_decoder": "新增自定義解碼", "custom_decoder": "新增自定義解碼",

View File

@ -15,6 +15,7 @@ import { enUS, NButton, NSpace, useOsTheme, zhCN } from 'naive-ui'
import { h, nextTick } from 'vue' import { h, nextTick } from 'vue'
import { compareVersion } from '@/utils/version.js' import { compareVersion } from '@/utils/version.js'
import { typesIconStyle } from '@/consts/support_redis_type.js' import { typesIconStyle } from '@/consts/support_redis_type.js'
import { TextAlignType } from '@/consts/text_align_type.js'
const osTheme = useOsTheme() const osTheme = useOsTheme()
const usePreferencesStore = defineStore('preferences', { const usePreferencesStore = defineStore('preferences', {
@ -63,6 +64,7 @@ const usePreferencesStore = defineStore('preferences', {
showFolding: true, showFolding: true,
dropText: true, dropText: true,
links: true, links: true,
entryTextAlign: TextAlignType.Center,
}, },
cli: { cli: {
fontFamily: [], fontFamily: [],
@ -271,6 +273,10 @@ const usePreferencesStore = defineStore('preferences', {
keyIconType() { keyIconType() {
return get(this.general, 'keyIconStyle', typesIconStyle.SHORT) return get(this.general, 'keyIconStyle', typesIconStyle.SHORT)
}, },
entryTextAlign() {
return get(this.editor, 'entryTextAlign', TextAlignType.Center)
},
}, },
actions: { actions: {
_applyPreferences(data) { _applyPreferences(data) {