plugins: frontend event 'paste'
Massimo Melina committed
Aug 26, 2024 at 12:39 UTC
5c11f889f58231d9e148fabb1df0306c12ba1874
2 files changed
+3
-1
dev-plugins.md
+1
@@ -630,6 +630,7 @@ If you want to override a text regardless of the language, use the special langu
630
- frontend event: showPlay
631
- api.addBlock
632
- api.misc
633
+ - frontend event: paste
634
- 8.891 (v0.53.0)
635
- api.openDb
636
- frontend event: menuZip
frontend/src/clip.ts
+2
-1
@@ -8,6 +8,7 @@ import { dirname, HTTP_MESSAGES, xlate } from '../../src/cross'
8
import { apiCall } from '@hfs/shared/api'
9
import { reloadList, usePath } from './useFetchList'
10
import _ from 'lodash'
11
+import { hfsEvent } from './misc'
12
13
export function ClipBar() {
14
const { clip, props } = useSnapState()
@@ -43,6 +44,7 @@ export function ClipBar() {
44
}
45
46
function paste() {
47
+ if (hfsEvent('paste', { from: state.clip, to: here }).isDefaultPrevent()) return
48
return apiCall('move_files', {
49
uri_from: clip.map(x => x.uri),
50
uri_to: here,
@@ -61,7 +63,6 @@ export function ClipBar() {
63
}
64
}
65
64
-
66
export function cut(files: DirList) {
67
state.clip = files
68
if (files.length)