mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-23 04:55:21 +00:00
fix(redis): enable text selection and copy in command terminal
- Add user-select: text CSS to allow text selection - Optimize click handler to preserve user text selection
This commit is contained in:
@@ -832,6 +832,14 @@ async function clearInMemoryHistory() {
|
||||
commandHistory.value = [];
|
||||
}
|
||||
|
||||
function onCommandAreaClick() {
|
||||
// 只有在没有选中文本时才聚焦输入框,避免清除用户的文本选择
|
||||
const selection = window.getSelection();
|
||||
if (!selection || selection.toString().length === 0) {
|
||||
getCommandInput()?.focus();
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
resumeRedisBrowserBackgroundWork();
|
||||
void loadKeys();
|
||||
@@ -980,8 +988,8 @@ defineExpose({ focusSearch });
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="command" class="m-0 min-h-0 flex-1 flex flex-col">
|
||||
<div class="dbx-editor-font-family relative flex min-h-0 flex-1 flex-col bg-[#171b21] text-[13px] leading-5 text-slate-200" @click="getCommandInput()?.focus()">
|
||||
<div ref="commandTerminalRef" class="min-h-0 flex-1 overflow-auto px-4 pb-3 pt-4">
|
||||
<div class="dbx-editor-font-family relative flex min-h-0 flex-1 flex-col bg-[#171b21] text-[13px] leading-5 text-slate-200" @click="onCommandAreaClick">
|
||||
<div ref="commandTerminalRef" class="redis-command-terminal min-h-0 flex-1 overflow-auto px-4 pb-3 pt-4">
|
||||
<div class="mb-4 text-slate-400">
|
||||
<span class="text-slate-200">{{ t("redis.commandWelcome") }}</span>
|
||||
</div>
|
||||
@@ -1157,4 +1165,9 @@ defineExpose({ focusSearch });
|
||||
.redis-workspace-splitpanes :deep(.splitpanes__splitter:hover) {
|
||||
background: var(--primary) !important;
|
||||
}
|
||||
|
||||
.redis-command-terminal {
|
||||
user-select: text;
|
||||
-webkit-user-select: text;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user