🐛 终端无法粘贴.
This commit is contained in:
@@ -7,8 +7,11 @@
|
||||
* 🚀 升级 `arco design` 到 `2.55.0`
|
||||
* 🐞 修复 新创建的用户登录会跳转到 **404**
|
||||
* 🐞 修复 分配菜单模态框没有子菜单不显示的问题
|
||||
* 🐞 修复 终端无法粘贴
|
||||
* 🐞 修复 `工作台` `快捷操作` 会展示隐藏的菜单
|
||||
* 🔨 修改 系统菜单渲染逻辑 (移除 JSX 构建时不会提示 JSX.IntrinsicElements)
|
||||
* 🔨 修改 系统菜单渲染逻辑 (移除 JSX 构建时不会提示 JSX.IntrinsicElements)
|
||||
|
||||
[如何升级](/about/update.md?id=_v103)
|
||||
|
||||
## v1.0.2
|
||||
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
⚡ 注意: 应用不支持跨版本升级, 可以进行多次升级
|
||||
|
||||
## v1.0.3
|
||||
|
||||
> sql 脚本
|
||||
|
||||
```sql
|
||||
DELETE FROM preference WHERE type = 'TERMINAL';
|
||||
```
|
||||
|
||||
## v1.0.2
|
||||
|
||||
> sql 脚本
|
||||
|
||||
@@ -74,7 +74,7 @@ public class TerminalPreferenceStrategy implements IPreferenceStrategy<TerminalP
|
||||
new TerminalPreferenceModel.ShortcutKeysModel("changeToNextSession", true, false, true, "BracketRight", true),
|
||||
// 终端快捷键
|
||||
new TerminalPreferenceModel.ShortcutKeysModel("copy", true, true, false, "KeyC", true),
|
||||
new TerminalPreferenceModel.ShortcutKeysModel("paste", true, true, false, "KeyV", true),
|
||||
new TerminalPreferenceModel.ShortcutKeysModel("paste", true, true, false, "Insert", true),
|
||||
new TerminalPreferenceModel.ShortcutKeysModel("toTop", true, true, false, "ArrowUp", true),
|
||||
new TerminalPreferenceModel.ShortcutKeysModel("toBottom", true, true, false, "ArrowDown", true),
|
||||
new TerminalPreferenceModel.ShortcutKeysModel("selectAll", true, true, false, "KeyA", true),
|
||||
@@ -94,7 +94,7 @@ public class TerminalPreferenceStrategy implements IPreferenceStrategy<TerminalP
|
||||
.selectAll(false)
|
||||
.search(true)
|
||||
.copy(true)
|
||||
.paste(true)
|
||||
.paste(false)
|
||||
.interrupt(false)
|
||||
.enter(false)
|
||||
.fontSizePlus(false)
|
||||
@@ -112,7 +112,7 @@ public class TerminalPreferenceStrategy implements IPreferenceStrategy<TerminalP
|
||||
.theme(new JSONObject())
|
||||
.displaySetting(JSONObject.parseObject(defaultDisplaySetting))
|
||||
.actionBarSetting(JSONObject.parseObject(actionBarSetting))
|
||||
.rightMenuSetting(Lists.of("copy", "paste", "checkAll", "search", "clear"))
|
||||
.rightMenuSetting(Lists.of("selectAll", "copy", "fontSizePlus", "fontSizeSubtract", "search", "clear"))
|
||||
.interactSetting(JSONObject.parseObject(defaultInteractSetting))
|
||||
.pluginsSetting(JSONObject.parseObject(defaultPluginsSetting))
|
||||
.sessionSetting(JSONObject.parseObject(defaultSessionSetting))
|
||||
|
||||
17628
orion-ops-ui/pnpm-lock.yaml
generated
17628
orion-ops-ui/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -29,7 +29,7 @@ export const readText = () => {
|
||||
try {
|
||||
const success = document.execCommand('paste');
|
||||
if (!success) {
|
||||
Message.error('当前浏览器无法读取剪切板内容');
|
||||
Message.error('当前环境无法读取剪切板内容');
|
||||
}
|
||||
resolve(textarea.value);
|
||||
} catch (error) {
|
||||
@@ -53,7 +53,10 @@ export const copyToClipboard = async (value: string) => {
|
||||
document.body.appendChild(textarea);
|
||||
textarea.select();
|
||||
try {
|
||||
document.execCommand('copy');
|
||||
const success = document.execCommand('copy');
|
||||
if (!success) {
|
||||
Message.error('当前环境无法复制到剪切板');
|
||||
}
|
||||
} catch (error) {
|
||||
throw error;
|
||||
} finally {
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
v-model="formModel.copyAutoTrim" />
|
||||
</block-setting-item>
|
||||
<!-- 粘贴去除空格 -->
|
||||
<block-setting-item label="粘贴去除空格" desc="粘贴文本前自动删除尾部空格 如: 命令输入框, 命令编辑器, 右键粘贴, 粘贴按钮, 右键菜单粘贴, 自定义粘贴快捷键">
|
||||
<block-setting-item label="粘贴去除空格" desc="粘贴文本前自动删除尾部空格 如: 命令输入框, 命令编辑器, 右键粘贴, 粘贴按钮, 右键菜单粘贴, 自定义粘贴快捷键 (内置粘贴快捷键因浏览器限制不会去除)">
|
||||
<a-switch type="round"
|
||||
v-model="formModel.pasteAutoTrim" />
|
||||
</block-setting-item>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<!-- 启用-未修改 -->
|
||||
<span v-else-if="item.enabled">{{ item.shortcutKey }}</span>
|
||||
<!-- 禁用 -->
|
||||
<span v-else />
|
||||
<span v-else class="disabled-key">已禁用</span>
|
||||
</div>
|
||||
<!-- 操作 -->
|
||||
<a-space class="shortcut-actions-container">
|
||||
@@ -52,6 +52,13 @@
|
||||
<icon-settings />
|
||||
</div>
|
||||
</a-space>
|
||||
<!-- 描述 -->
|
||||
<div class="shortcut-desc">
|
||||
<!-- 粘贴描述 -->
|
||||
<template v-if="item.item === TerminalShortcutKeys.PASTE">
|
||||
Ctrl + Shift + V, Shift + Insert 为浏览器内置快捷键, 不受环境影响
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
@@ -68,6 +75,7 @@
|
||||
import type { TerminalShortcutKeyEditable } from '@/store/modules/terminal/types';
|
||||
import type { VNodeRef } from 'vue';
|
||||
import { setAutoFocus } from '@/utils/dom';
|
||||
import { TerminalShortcutKeys } from '../../../types/terminal.const';
|
||||
|
||||
defineProps<{
|
||||
title: string;
|
||||
@@ -116,6 +124,10 @@
|
||||
.shortcut-actions-container {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.shortcut-desc {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.shortcut-name {
|
||||
@@ -132,6 +144,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
.shortcut-desc {
|
||||
display: flex;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.shortcut-actions-container {
|
||||
display: none;
|
||||
|
||||
@@ -144,6 +161,10 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.disabled-key {
|
||||
color: var(--color-neutral-6);
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@@ -16,18 +16,22 @@ const preventKeys: Array<ShortcutKey> = [
|
||||
altKey: false,
|
||||
shiftKey: true,
|
||||
code: 'KeyC'
|
||||
}
|
||||
// , {
|
||||
// ctrlKey: true,
|
||||
// altKey: false,
|
||||
// shiftKey: true,
|
||||
// code: 'KeyV'
|
||||
// }, {
|
||||
// ctrlKey: false,
|
||||
// altKey: false,
|
||||
// shiftKey: true,
|
||||
// code: 'Insert'
|
||||
// },
|
||||
},
|
||||
];
|
||||
|
||||
// 内置快捷键
|
||||
const builtinKeys: Array<ShortcutKey> = [
|
||||
{
|
||||
ctrlKey: true,
|
||||
altKey: false,
|
||||
shiftKey: true,
|
||||
code: 'KeyV'
|
||||
}, {
|
||||
ctrlKey: false,
|
||||
altKey: false,
|
||||
shiftKey: true,
|
||||
code: 'Insert'
|
||||
},
|
||||
];
|
||||
|
||||
const { copy: copyValue, readText } = useCopy();
|
||||
@@ -50,16 +54,13 @@ export default class SshSessionHandler implements ISshSessionHandler {
|
||||
this.session = session;
|
||||
this.inst = session.inst;
|
||||
this.domRef = domRef;
|
||||
const { preference, tabManager } = useTerminalStore();
|
||||
const { preference } = useTerminalStore();
|
||||
this.interactSetting = preference.interactSetting;
|
||||
this.shortcutKeys = preference.shortcutSetting.keys;
|
||||
}
|
||||
|
||||
// 检测是否忽略默认行为
|
||||
checkPreventDefault(e: KeyboardEvent): boolean {
|
||||
if (e.type !== 'keydown') {
|
||||
return false;
|
||||
}
|
||||
return !!preventKeys.find(key => {
|
||||
return key.code === e.code
|
||||
&& key.altKey === e.altKey
|
||||
@@ -68,6 +69,16 @@ export default class SshSessionHandler implements ISshSessionHandler {
|
||||
});
|
||||
}
|
||||
|
||||
// 检测是否为内置快捷键
|
||||
checkIsBuiltin(e: KeyboardEvent): boolean {
|
||||
return !!builtinKeys.find(key => {
|
||||
return key.code === e.code
|
||||
&& key.altKey === e.altKey
|
||||
&& key.shiftKey === e.shiftKey
|
||||
&& key.ctrlKey === e.ctrlKey;
|
||||
});
|
||||
}
|
||||
|
||||
// 启用状态
|
||||
enabledStatus(option: string): boolean {
|
||||
switch (option) {
|
||||
|
||||
@@ -85,6 +85,10 @@ export default class SshSession implements ISshSession {
|
||||
if (e.type !== 'keydown') {
|
||||
return true;
|
||||
}
|
||||
// 检测是否为内置快捷键
|
||||
if (this.handler.checkIsBuiltin(e)) {
|
||||
return true;
|
||||
}
|
||||
// 检测是否阻止默认行为
|
||||
if (this.handler.checkPreventDefault(e)) {
|
||||
e.preventDefault();
|
||||
|
||||
@@ -212,6 +212,8 @@ export const TerminalShortcutKeys = {
|
||||
CHANGE_TO_PREV_SESSION: 'changeToPrevSession',
|
||||
// 切换至后一个会话
|
||||
CHANGE_TO_NEXT_SESSION: 'changeToNextSession',
|
||||
// 粘贴
|
||||
PASTE: 'paste',
|
||||
};
|
||||
|
||||
// 终端操作快捷键
|
||||
@@ -257,7 +259,7 @@ export const TerminalShortcutItems: Array<ShortcutKeyItem> = [
|
||||
content: '复制',
|
||||
type: TerminalShortcutType.TERMINAL
|
||||
}, {
|
||||
item: 'paste',
|
||||
item: TerminalShortcutKeys.PASTE,
|
||||
content: '粘贴',
|
||||
type: TerminalShortcutType.TERMINAL
|
||||
}, {
|
||||
|
||||
@@ -267,6 +267,8 @@ export interface ISshSession extends ITerminalSession {
|
||||
export interface ISshSessionHandler {
|
||||
// 检测是否忽略默认行为
|
||||
checkPreventDefault: (e: KeyboardEvent) => boolean;
|
||||
// 检测是否为内置快捷键
|
||||
checkIsBuiltin: (e: KeyboardEvent) => boolean;
|
||||
// 启用状态
|
||||
enabledStatus: (option: string) => boolean;
|
||||
// 调用处理方法
|
||||
|
||||
Reference in New Issue
Block a user