@lvce-editor/explorer-view 3.1.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/explorerViewWorkerMain.js +28 -21
- package/package.json +1 -1
|
@@ -895,6 +895,7 @@ const CreateFolder$1 = 1;
|
|
|
895
895
|
const CreateFile$1 = 2;
|
|
896
896
|
const Copy$1 = 3;
|
|
897
897
|
const Rename$2 = 4;
|
|
898
|
+
const Remove = 5;
|
|
898
899
|
|
|
899
900
|
const rpcs = Object.create(null);
|
|
900
901
|
const set$g = (id, rpc) => {
|
|
@@ -1004,6 +1005,9 @@ const applyOperation = operation => {
|
|
|
1004
1005
|
if (operation.type === Rename$2) {
|
|
1005
1006
|
return rename$1(operation.from || '', operation.path);
|
|
1006
1007
|
}
|
|
1008
|
+
if (operation.type === Remove) {
|
|
1009
|
+
return remove(operation.path);
|
|
1010
|
+
}
|
|
1007
1011
|
return writeFile(operation.path, operation.text);
|
|
1008
1012
|
};
|
|
1009
1013
|
|
|
@@ -1882,7 +1886,12 @@ const copyPath = async state => {
|
|
|
1882
1886
|
if (!dirent) {
|
|
1883
1887
|
return state;
|
|
1884
1888
|
}
|
|
1885
|
-
//
|
|
1889
|
+
// TODO windows paths
|
|
1890
|
+
// TODO handle error
|
|
1891
|
+
const {
|
|
1892
|
+
path
|
|
1893
|
+
} = dirent;
|
|
1894
|
+
await writeClipBoardText(path);
|
|
1886
1895
|
return state;
|
|
1887
1896
|
};
|
|
1888
1897
|
|
|
@@ -2022,7 +2031,8 @@ const create2 = (uid, uri, x, y, width, height, args, parentUid, platform = 0) =
|
|
|
2022
2031
|
confirmPaste: false,
|
|
2023
2032
|
pasteShouldMove: false,
|
|
2024
2033
|
cutItems: [],
|
|
2025
|
-
isPointerDown: false
|
|
2034
|
+
isPointerDown: false,
|
|
2035
|
+
pointerDownIndex: -1
|
|
2026
2036
|
};
|
|
2027
2037
|
set(uid, state, state);
|
|
2028
2038
|
};
|
|
@@ -2072,7 +2082,8 @@ const create = (id, uri, x, y, width, height, args, parentUid, platform = 0) =>
|
|
|
2072
2082
|
confirmPaste: false,
|
|
2073
2083
|
pasteShouldMove: false,
|
|
2074
2084
|
cutItems: [],
|
|
2075
|
-
isPointerDown: false
|
|
2085
|
+
isPointerDown: false,
|
|
2086
|
+
pointerDownIndex: -1
|
|
2076
2087
|
};
|
|
2077
2088
|
set(state.uid, state, state);
|
|
2078
2089
|
return state;
|
|
@@ -4104,10 +4115,7 @@ const handlePointerDown = (state, button, x, y) => {
|
|
|
4104
4115
|
focus: List
|
|
4105
4116
|
};
|
|
4106
4117
|
}
|
|
4107
|
-
return
|
|
4108
|
-
...state,
|
|
4109
|
-
focusedIndex: index
|
|
4110
|
-
};
|
|
4118
|
+
return state;
|
|
4111
4119
|
};
|
|
4112
4120
|
|
|
4113
4121
|
const handleUpload = async (state, dirents) => {
|
|
@@ -4537,16 +4545,6 @@ const confirmDelete = async paths => {
|
|
|
4537
4545
|
return result === true;
|
|
4538
4546
|
};
|
|
4539
4547
|
|
|
4540
|
-
const removePaths = async paths => {
|
|
4541
|
-
for (const item of paths) {
|
|
4542
|
-
try {
|
|
4543
|
-
await remove(item);
|
|
4544
|
-
} catch {
|
|
4545
|
-
// ignore
|
|
4546
|
-
}
|
|
4547
|
-
}
|
|
4548
|
-
};
|
|
4549
|
-
|
|
4550
4548
|
const removeDirent = async state => {
|
|
4551
4549
|
const {
|
|
4552
4550
|
items,
|
|
@@ -4564,9 +4562,18 @@ const removeDirent = async state => {
|
|
|
4564
4562
|
return state;
|
|
4565
4563
|
}
|
|
4566
4564
|
}
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4565
|
+
const fileOperations = toRemove.map(item => {
|
|
4566
|
+
return {
|
|
4567
|
+
type: Remove,
|
|
4568
|
+
path: item
|
|
4569
|
+
};
|
|
4570
|
+
});
|
|
4571
|
+
// TODO use bulk edit and explorer refresh
|
|
4572
|
+
const errorMessage = await applyFileOperations(fileOperations);
|
|
4573
|
+
if (errorMessage) {
|
|
4574
|
+
await confirm(errorMessage);
|
|
4575
|
+
return state;
|
|
4576
|
+
}
|
|
4570
4577
|
const newState = await refresh(state);
|
|
4571
4578
|
return {
|
|
4572
4579
|
...newState,
|
|
@@ -4643,7 +4650,7 @@ const renameDirent = state => {
|
|
|
4643
4650
|
|
|
4644
4651
|
const getDragLabel = urls => {
|
|
4645
4652
|
if (urls.length === 1) {
|
|
4646
|
-
return urls[0];
|
|
4653
|
+
return getBaseName('/', urls[0]);
|
|
4647
4654
|
}
|
|
4648
4655
|
return `${urls.length}`;
|
|
4649
4656
|
};
|