Skip to content

Commit b643835

Browse files
committed
feat!: 移除拖拽粘贴功能,因上游插件问题较多
1 parent ef1b9c5 commit b643835

10 files changed

Lines changed: 5 additions & 120 deletions

File tree

Cargo.lock

Lines changed: 0 additions & 80 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"build:icon": "tsx scripts/buildIcon.ts",
1515
"build:vite": "vite build",
1616
"tauri": "tauri",
17-
"lint": "biome check --write",
17+
"lint": "biome check --write src",
1818
"preinstall": "npx only-allow pnpm",
1919
"prepare": "simple-git-hooks",
2020
"release": "release-it",
@@ -24,7 +24,6 @@
2424
"dependencies": {
2525
"@ant-design/happy-work-theme": "^1.0.0",
2626
"@ant-design/icons": "^5.6.1",
27-
"@crabnebula/tauri-plugin-drag": "^2.1.0",
2827
"@tanstack/react-virtual": "^3.13.12",
2928
"@tauri-apps/api": "^2.5.0",
3029
"@tauri-apps/plugin-autostart": "^2.3.0",

pnpm-lock.yaml

Lines changed: 0 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ tauri-plugin-dialog = "2"
3131
tauri-plugin-fs = "2"
3232
tauri-plugin-updater = "2"
3333
tauri-plugin-process = "2"
34-
tauri-plugin-drag = "2"
3534
tauri-plugin-macos-permissions = "2"
3635
tauri-plugin-locale = "2"
3736
tauri-plugin-opener = "2"

src-tauri/assets/drag-icon.png

-16.1 KB
Binary file not shown.

src-tauri/capabilities/default.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
"dialog:default",
2929
"updater:default",
3030
"process:default",
31-
"drag:default",
3231
"macos-permissions:default",
3332
"fs-pro:default",
3433
"locale:default",

src-tauri/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ pub fn run() {
5555
.plugin(tauri_plugin_updater::Builder::new().build())
5656
// 进程相关插件:https://github.com/tauri-apps/tauri-plugin-process
5757
.plugin(tauri_plugin_process::init())
58-
// 拖拽插件:https://github.com/crabnebula-dev/drag-rs
59-
.plugin(tauri_plugin_drag::init())
6058
// 检查和请求 macos 系统权限:https://github.com/ayangweb/tauri-plugin-macos-permissions
6159
.plugin(tauri_plugin_macos_permissions::init())
6260
// 拓展了对文件和目录的操作:https://github.com/ayangweb/tauri-plugin-fs-pro

src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"icons/icon.icns",
7070
"icons/icon.ico"
7171
],
72-
"resources": ["assets/tray.ico", "assets/drag-icon.png"],
72+
"resources": ["assets/tray.ico"],
7373
"shortDescription": "EcoPaste",
7474
"targets": ["nsis", "dmg", "app", "appimage", "deb", "rpm"]
7575
},

src-tauri/tauri.macos.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"bundle": {
3-
"resources": ["assets/tray-mac.ico", "assets/drag-icon.png"]
3+
"resources": ["assets/tray-mac.ico"]
44
},
55
"identifier": "com.ayangweb.EcoPaste"
66
}

src/pages/Main/components/HistoryList/components/Item/index.tsx

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import { startDrag } from "@crabnebula/tauri-plugin-drag";
2-
import { resolveResource } from "@tauri-apps/api/path";
31
import { openPath } from "@tauri-apps/plugin-opener";
4-
import { Flex, message } from "antd";
2+
import { Flex } from "antd";
53
import type { HookAPI } from "antd/es/modal/useModal";
64
import clsx from "clsx";
7-
import type { DragEvent, FC } from "react";
5+
import type { FC } from "react";
86
import { useSnapshot } from "valtio";
97
import UnoIcon from "@/components/UnoIcon";
108
import { MainContext } from "@/pages/Main";
@@ -86,22 +84,6 @@ const Item: FC<ItemProps> = (props) => {
8684
handlePaste();
8785
};
8886

89-
const handleDragStart = async (event: DragEvent) => {
90-
event.preventDefault();
91-
92-
const icon = await resolveResource("assets/drag-icon.png");
93-
94-
if (type === "image") {
95-
return startDrag({ icon: value, item: [value] });
96-
}
97-
98-
if (type === "files") {
99-
return startDrag({ icon, item: value });
100-
}
101-
102-
return message.warning("暂不支持拖拽文本");
103-
};
104-
10587
const renderContent = () => {
10688
switch (type) {
10789
case "text":
@@ -125,12 +107,10 @@ const Item: FC<ItemProps> = (props) => {
125107
"antd-input-focus!": rootState.activeId === id,
126108
},
127109
)}
128-
draggable
129110
gap={4}
130111
onClick={() => handleClick("single")}
131112
onContextMenu={handleContextMenu}
132113
onDoubleClick={() => handleClick("double")}
133-
onDragStart={handleDragStart}
134114
vertical
135115
>
136116
<Header {...rest} data={data} handleNote={handleNote} />

0 commit comments

Comments
 (0)