fix: 预览选择复制、关闭超时、链接跳转、监听器泄漏
1. 预览区无法选择复制 — #preview 添加 user-select: text 2. IPC 监听器重复注册 — 注册前先 removeAllListeners 防止堆叠 3. 关闭确认取消后 5s 超时仍强制关闭 — 新增 cancelClose IPC 清除超时 4. 预览区链接点击离开应用 — 拦截点击,通过 shell.openExternal 打开 5. 预览区链接光标样式 — .markdown-body a 添加 cursor: pointer
This commit is contained in:
+5
-1
@@ -1,4 +1,4 @@
|
||||
const { contextBridge, ipcRenderer } = require('electron');
|
||||
const { contextBridge, ipcRenderer, shell } = require('electron');
|
||||
|
||||
contextBridge.exposeInMainWorld('electronAPI', {
|
||||
// File operations
|
||||
@@ -15,6 +15,10 @@ contextBridge.exposeInMainWorld('electronAPI', {
|
||||
|
||||
// Window control
|
||||
forceClose: () => ipcRenderer.invoke('window:forceClose'),
|
||||
cancelClose: () => ipcRenderer.invoke('window:cancelClose'),
|
||||
|
||||
// Shell
|
||||
openExternal: (url) => shell.openExternal(url),
|
||||
|
||||
// Events from main process
|
||||
onFileOpenInTab: (callback) => ipcRenderer.on('file:openInTab', (event, data) => callback(data)),
|
||||
|
||||
Reference in New Issue
Block a user