@lvce-editor/explorer-view 3.1.0 → 3.2.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.
@@ -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
 
@@ -4537,16 +4541,6 @@ const confirmDelete = async paths => {
4537
4541
  return result === true;
4538
4542
  };
4539
4543
 
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
4544
  const removeDirent = async state => {
4551
4545
  const {
4552
4546
  items,
@@ -4564,9 +4558,18 @@ const removeDirent = async state => {
4564
4558
  return state;
4565
4559
  }
4566
4560
  }
4567
-
4568
- // TODO use file operations, bulk edit and explorer refresh
4569
- await removePaths(toRemove);
4561
+ const fileOperations = toRemove.map(item => {
4562
+ return {
4563
+ type: Remove,
4564
+ path: item
4565
+ };
4566
+ });
4567
+ // TODO use bulk edit and explorer refresh
4568
+ const errorMessage = await applyFileOperations(fileOperations);
4569
+ if (errorMessage) {
4570
+ await confirm(errorMessage);
4571
+ return state;
4572
+ }
4570
4573
  const newState = await refresh(state);
4571
4574
  return {
4572
4575
  ...newState,
@@ -4643,7 +4646,7 @@ const renameDirent = state => {
4643
4646
 
4644
4647
  const getDragLabel = urls => {
4645
4648
  if (urls.length === 1) {
4646
- return urls[0];
4649
+ return getBaseName('/', urls[0]);
4647
4650
  }
4648
4651
  return `${urls.length}`;
4649
4652
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/explorer-view",
3
- "version": "3.1.0",
3
+ "version": "3.2.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",