Skip to content

Commit 0cf0233

Browse files
fix. File copy-paste retains paste option after file is copied. (Acode-Foundation#1253)
* fix. File copy-paste retains paste option after file is copied. Acode-Foundation#1161 * fix formatting
1 parent e206372 commit 0cf0233

File tree

2 files changed

+24
-17
lines changed

2 files changed

+24
-17
lines changed

src/lib/openFolder.js

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -294,19 +294,21 @@ async function handleContextmenu(type, url, name, $target) {
294294
options.push(INSTALL_PLUGIN);
295295
}
296296
} else if (helpers.isDir(type)) {
297-
options = [
298-
COPY,
299-
CUT,
300-
REMOVE,
301-
RENAME,
302-
PASTE,
303-
NEW_FILE,
304-
NEW_FOLDER,
305-
OPEN_FOLDER,
306-
INSERT_FILE,
307-
];
297+
options = [COPY, CUT, REMOVE, RENAME];
298+
299+
if (clipBoard.url != null) {
300+
options.push(PASTE);
301+
}
302+
303+
options.push(NEW_FILE, NEW_FOLDER, OPEN_FOLDER, INSERT_FILE);
308304
} else if (type === "root") {
309-
options = [PASTE, NEW_FILE, NEW_FOLDER, INSERT_FILE, CLOSE_FOLDER];
305+
options = [];
306+
307+
if (clipBoard.url != null) {
308+
options.push(PASTE);
309+
}
310+
311+
options.push(NEW_FILE, NEW_FOLDER, INSERT_FILE, CLOSE_FOLDER);
310312
}
311313

312314
if (clipBoard.action) options.push(CANCEL);
@@ -526,6 +528,11 @@ function execOperation(type, action, url, $target, name) {
526528
}
527529

528530
async function paste() {
531+
if (clipBoard.url == null) {
532+
alert(strings.warning, "Nothing to paste");
533+
return;
534+
}
535+
529536
let CASE = "";
530537
const $src = clipBoard.$el;
531538
const srcType = $src.dataset.type;

www/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,17 +165,17 @@
165165

166166
<title>Acode</title>
167167
<!--styles-->
168-
<link rel="stylesheet" href="./css/build/218.css">
169-
<link rel="stylesheet" href="./css/build/32.css">
170-
<link rel="stylesheet" href="./css/build/383.css">
171-
<link rel="stylesheet" href="./css/build/53.css">
172-
<link rel="stylesheet" href="./css/build/609.css">
173168
<link rel="stylesheet" href="./css/build/about.css">
174169
<link rel="stylesheet" href="./css/build/customTheme.css">
175170
<link rel="stylesheet" href="./css/build/donate.css">
176171
<link rel="stylesheet" href="./css/build/fileBrowser.css">
177172
<link rel="stylesheet" href="./css/build/main.css">
178173
<link rel="stylesheet" href="./css/build/plugins.css">
174+
<link rel="stylesheet" href="./css/build/src_pages_quickTools_quickTools_js.css">
175+
<link rel="stylesheet" href="./css/build/src_sidebarApps_extensions_index_js.css">
176+
<link rel="stylesheet" href="./css/build/src_sidebarApps_files_index_js.css">
177+
<link rel="stylesheet" href="./css/build/src_sidebarApps_notification_index_js.css">
178+
<link rel="stylesheet" href="./css/build/src_sidebarApps_searchInFiles_index_js.css">
179179
<link rel="stylesheet" href="./css/build/themeSetting.css">
180180
<!--styles_end-->
181181
</head>

0 commit comments

Comments
 (0)