From 08004561c031b33e898cf5b5b72a0912a5386f18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=8C=E8=90=8C=E5=93=92=E8=B5=AB=E8=90=9D?= Date: Wed, 24 May 2023 17:14:21 +0800 Subject: [PATCH] :bug: Fix: fix an issue that clipboard listening is not working in windows --- package.json | 1 - src/main/apis/app/system/index.ts | 3 +-- src/main/events/remotes/menu.ts | 3 +-- src/main/lifeCycle/index.ts | 3 +-- src/universal/types/shims-module.d.ts | 1 - yarn.lock | 5 ----- 6 files changed, 3 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index f131dfb..5bd3453 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,6 @@ "ali-oss": "^6.17.1", "aws-sdk": "^2.1373.0", "axios": "^1.3.4", - "clipboard-event": "^1.6.0", "compare-versions": "^4.1.3", "core-js": "^3.27.1", "cos-nodejs-sdk-v5": "^2.11.19", diff --git a/src/main/apis/app/system/index.ts b/src/main/apis/app/system/index.ts index 7aab4d3..bbe5106 100644 --- a/src/main/apis/app/system/index.ts +++ b/src/main/apis/app/system/index.ts @@ -19,7 +19,6 @@ import { ensureFilePath, handleCopyUrl } from '~/main/utils/common' import { T } from '~/main/i18n' import { isMacOSVersionGreaterThanOrEqualTo } from '~/main/utils/getMacOSVersion' import { buildPicBedListMenu } from '~/main/events/remotes/menu' -import clipboardListener from 'clipboard-event' import clipboardPoll from '~/main/utils/clipboardPoll' import picgo from '../../core/picgo' import { uploadClipboardFiles } from '../uploader/apis' @@ -133,7 +132,7 @@ export function createMenu () { } export function createContextMenu () { - const ClipboardWatcher = process.platform === 'win32' ? clipboardListener : clipboardPoll + const ClipboardWatcher = clipboardPoll const isListeningClipboard = db.get('settings.isListeningClipboard') || false if (process.platform === 'darwin' || process.platform === 'win32') { const submenu = buildPicBedListMenu() diff --git a/src/main/events/remotes/menu.ts b/src/main/events/remotes/menu.ts index 3f97698..1d3e28f 100644 --- a/src/main/events/remotes/menu.ts +++ b/src/main/events/remotes/menu.ts @@ -15,7 +15,6 @@ import { PicGo as PicGoCore } from 'piclist' import { T } from '~/main/i18n' import { changeCurrentUploader } from '~/main/utils/handleUploaderConfig' import db from '~/main/apis/core/datastore' -import clipboardListener from 'clipboard-event' import clipboardPoll from '~/main/utils/clipboardPoll' interface GuiMenuItem { label: string @@ -24,7 +23,7 @@ interface GuiMenuItem { const buildMiniPageMenu = () => { const isListeningClipboard = db.get('settings.isListeningClipboard') || false - const ClipboardWatcher = process.platform === 'win32' ? clipboardListener : clipboardPoll + const ClipboardWatcher = clipboardPoll const submenu = buildPicBedListMenu() const template = [ { diff --git a/src/main/lifeCycle/index.ts b/src/main/lifeCycle/index.ts index 2db337d..0899d5c 100644 --- a/src/main/lifeCycle/index.ts +++ b/src/main/lifeCycle/index.ts @@ -43,7 +43,6 @@ import UpDownTaskQueue from '../manage/datastore/upDownTaskQueue' import { T } from '~/main/i18n' import { UpdateInfo, autoUpdater } from 'electron-updater' import updateChecker from '../utils/updateChecker' -import clipboardListener from 'clipboard-event' import clipboardPoll from '../utils/clipboardPoll' import path from 'path' import { CLIPBOARD_IMAGE_FOLDER } from '~/universal/utils/static' @@ -133,7 +132,7 @@ class LifeCycle { windowManager.create(IWindowList.TRAY_WINDOW) windowManager.create(IWindowList.SETTING_WINDOW) const isAutoListenClipboard = db.get('settings.isAutoListenClipboard') || false - const ClipboardWatcher = process.platform === 'win32' ? clipboardListener : clipboardPoll + const ClipboardWatcher = clipboardPoll if (isAutoListenClipboard) { db.set('settings.isListeningClipboard', true) ClipboardWatcher.startListening() diff --git a/src/universal/types/shims-module.d.ts b/src/universal/types/shims-module.d.ts index 0be1f4b..6f68334 100644 --- a/src/universal/types/shims-module.d.ts +++ b/src/universal/types/shims-module.d.ts @@ -8,4 +8,3 @@ declare module '*.vue' { // function fixPath(): void // export default fixPath // } -declare module 'clipboard-event' diff --git a/yarn.lock b/yarn.lock index 8f69263..b1e6c34 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5313,11 +5313,6 @@ cli-width@^2.0.0: resolved "https://registry.npmjs.org/cli-width/-/cli-width-2.2.1.tgz#b0433d0b4e9c847ef18868a4ef16fd5fc8271c48" integrity sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw== -clipboard-event@^1.6.0: - version "1.6.0" - resolved "https://registry.npmjs.org/clipboard-event/-/clipboard-event-1.6.0.tgz#2cd6c6d469b635e3d9be73e2d0cc554cdf17f3d5" - integrity sha512-a69QYimd43xM+5hcHkucs0V/QoiZz1fqEFRTnewOITVQOtypRLbCx76Q91Djn6h7O24817dQw44sFUxRYWIuYA== - clipboardy@^2.3.0: version "2.3.0" resolved "https://registry.npmjs.org/clipboardy/-/clipboardy-2.3.0.tgz#3c2903650c68e46a91b388985bc2774287dba290"