{
writePermissions ?
<>
@@ -381,11 +432,18 @@ export function FileBrowser(props) {
Delete Selected Files ({selectedCount})
{api.loggedIn ?
-
+ >:
<>>
}
>
@@ -402,28 +460,11 @@ export function FileBrowser(props) {
-
-
-
-
- {popup.type !== "upload" ?
-
-
- onPopupChange(e, "directoryName")}/>
-
: <>>
- }
-
+ { createPopup() }
>;
- function onPopupOpen(type) {
- setPopup({...popup, visible: true, type: type});
+ function onPopupOpen(type, target = null) {
+ setPopup({...popup, visible: true, type: type, target: target});
}
function onPopupClose() {
@@ -439,13 +480,29 @@ export function FileBrowser(props) {
if (btn === "Ok") {
let parentId = popup.directory === 0 ? null : popup.directory;
if (popup.type === "createDirectory") {
- api.createDirectory(popup.directoryName, parentId).then((res) => {
+ api.createDirectory(popup.name, parentId).then((res) => {
if (!res.success) {
pushAlert(res, "Error creating directory");
} else {
fetchFiles();
}
});
+ } else if (popup.type === "moveFiles") {
+ api.moveFiles(selectedIds, parentId).then((res) => {
+ if (!res.success) {
+ pushAlert(res, "Error moving files");
+ } else {
+ fetchFiles();
+ }
+ });
+ } else if (popup.type === "rename") {
+ api.rename(popup.target, popup.name, tokenObj.valid ? tokenObj.value : null).then((res) => {
+ if (!res.success) {
+ pushAlert(res, "Error renaming file or directory");
+ } else {
+ fetchFiles();
+ }
+ });
}
}
diff --git a/fileControlPanel/src/index.js b/fileControlPanel/src/index.js
index e096076..335127b 100644
--- a/fileControlPanel/src/index.js
+++ b/fileControlPanel/src/index.js
@@ -84,9 +84,9 @@ class FileControlPanel extends React.Component {
if (this.onSelectFile(e, uid, fileElement.items)) {
if (!e.target.checked) {
fileElement.selected = false;
- } else if (this.getSelectedIds(fileElement.items, false).length === Object.values(fileElement.items).length) {
+ }/* else if (this.getSelectedIds(fileElement.items, false).length === Object.values(fileElement.items).length) {
fileElement.selected = true;
- }
+ }*/
found = true;
break;
}
diff --git a/js/files.min.js b/js/files.min.js
index c9218fc..fa35515 100644
--- a/js/files.min.js
+++ b/js/files.min.js
@@ -299,4 +299,4 @@ e.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_七月
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
- */var r,a,i,o,s;if("undefined"==typeof window||"function"!=typeof MessageChannel){var u=null,l=null,d=function(){if(null!==u)try{var e=t.unstable_now();u(!0,e),u=null}catch(e){throw setTimeout(d,0),e}},c=Date.now();t.unstable_now=function(){return Date.now()-c},r=function(e){null!==u?setTimeout(r,0,e):(u=e,setTimeout(d,0))},a=function(e,t){l=setTimeout(e,t)},i=function(){clearTimeout(l)},o=function(){return!1},s=t.unstable_forceFrameRate=function(){}}else{var f=window.performance,m=window.Date,_=window.setTimeout,h=window.clearTimeout;if("undefined"!=typeof console){var p=window.cancelAnimationFrame;"function"!=typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),"function"!=typeof p&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills")}if("object"==typeof f&&"function"==typeof f.now)t.unstable_now=function(){return f.now()};else{var y=m.now();t.unstable_now=function(){return m.now()-y}}var v=!1,g=null,M=-1,L=5,b=0;o=function(){return t.unstable_now()>=b},s=function(){},t.unstable_forceFrameRate=function(e){0>e||125