@alickjoe/webterm 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/main.js +27 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -131,6 +131,8 @@ node tools/cdp-font-probe.js "ws://127.0.0.1:9223/devtools/page/<id>"
|
|
|
131
131
|
## 行为说明
|
|
132
132
|
|
|
133
133
|
- 单实例:重复执行 `webterm` 会聚焦已打开的窗口,不会开出第二个。
|
|
134
|
+
- 右键菜单:刷新/强制刷新、复制/剪切/粘贴/全选(按当前状态启用)、外链在系统浏览器打开。
|
|
135
|
+
> 刷新与编辑操作只走右键菜单,不做全局快捷键——Ctrl+R(终端历史搜索)、Ctrl+C(SIGINT)在 SSH 终端里有语义,全局拦截会破坏终端。
|
|
134
136
|
- 断网/VPN 未连时显示内置重试页,可一键重试。
|
|
135
137
|
- 页面里的外部链接(非 webterm 同源)会在系统默认浏览器打开。
|
|
136
138
|
- 关闭窗口即完全退出。
|
package/main.js
CHANGED
|
@@ -153,6 +153,33 @@ if (!gotSingleInstanceLock) {
|
|
|
153
153
|
console.log('[webterm] 页面加载完成');
|
|
154
154
|
});
|
|
155
155
|
|
|
156
|
+
// 右键菜单:刷新 / 编辑基本操作(按状态启用)/ 链接走系统浏览器
|
|
157
|
+
// 刻意不做全局快捷键:Ctrl+R(历史搜索)、Ctrl+C(SIGINT)在 SSH 终端里有语义,
|
|
158
|
+
// 菜单级拦截会破坏终端行为,刷新/编辑操作统一走右键菜单。
|
|
159
|
+
mainWindow.webContents.on('context-menu', (event, params) => {
|
|
160
|
+
const wc = event.sender;
|
|
161
|
+
const items = [
|
|
162
|
+
{ label: '刷新', click: () => wc.reload() },
|
|
163
|
+
{ label: '强制刷新(清缓存)', click: () => wc.reloadIgnoringCache() },
|
|
164
|
+
{ type: 'separator' },
|
|
165
|
+
{
|
|
166
|
+
label: '复制',
|
|
167
|
+
role: 'copy',
|
|
168
|
+
enabled: params.editFlags.canCopy && params.selectionText.trim() !== '',
|
|
169
|
+
},
|
|
170
|
+
{ label: '剪切', role: 'cut', enabled: params.editFlags.canCut },
|
|
171
|
+
{ label: '粘贴', role: 'paste', enabled: params.editFlags.canPaste },
|
|
172
|
+
{ label: '全选', role: 'selectAll' },
|
|
173
|
+
];
|
|
174
|
+
if (params.linkURL) {
|
|
175
|
+
items.push(
|
|
176
|
+
{ type: 'separator' },
|
|
177
|
+
{ label: '在浏览器中打开链接', click: () => shell.openExternal(params.linkURL) }
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
Menu.buildFromTemplate(items).popup({ window: mainWindow });
|
|
181
|
+
});
|
|
182
|
+
|
|
156
183
|
// 页面内的跨源导航 → 系统浏览器;同源导航放行
|
|
157
184
|
const appOrigin = safeOrigin(target.url);
|
|
158
185
|
mainWindow.webContents.on('will-navigate', (event, url) => {
|