@lvce-editor/explorer-view 2.47.0 → 2.49.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 +27 -31
- package/package.json +1 -1
|
@@ -868,10 +868,10 @@ const WebWorkerRpcClient = {
|
|
|
868
868
|
create: create$3
|
|
869
869
|
};
|
|
870
870
|
|
|
871
|
-
const CreateFolder$1 =
|
|
872
|
-
const CreateFile$1 =
|
|
873
|
-
const Copy$2 =
|
|
874
|
-
const Rename$2 =
|
|
871
|
+
const CreateFolder$1 = 1;
|
|
872
|
+
const CreateFile$1 = 2;
|
|
873
|
+
const Copy$2 = 3;
|
|
874
|
+
const Rename$2 = 4;
|
|
875
875
|
|
|
876
876
|
const rpcs = Object.create(null);
|
|
877
877
|
const set$b = (id, rpc) => {
|
|
@@ -993,7 +993,7 @@ const getBaseName = (pathSeparator, path) => {
|
|
|
993
993
|
return path.slice(path.lastIndexOf(pathSeparator) + 1);
|
|
994
994
|
};
|
|
995
995
|
const join2 = (path, childPath) => {
|
|
996
|
-
if (path.endsWith('/')) {
|
|
996
|
+
if (path.endsWith('/') || childPath.startsWith('/')) {
|
|
997
997
|
return `${path}${childPath}`;
|
|
998
998
|
}
|
|
999
999
|
return `${path}/${childPath}`;
|
|
@@ -1077,16 +1077,17 @@ const EditingFile = File + DELTA_EDITING;
|
|
|
1077
1077
|
const EditingFolder = Directory + DELTA_EDITING;
|
|
1078
1078
|
const EditingDirectoryExpanded = DirectoryExpanded + DELTA_EDITING;
|
|
1079
1079
|
|
|
1080
|
-
const
|
|
1080
|
+
const getSimpleIconRequestType = direntType => {
|
|
1081
1081
|
if (direntType === Directory || direntType === DirectoryExpanded || direntType === EditingDirectoryExpanded || direntType === EditingFolder) {
|
|
1082
1082
|
return 2;
|
|
1083
1083
|
}
|
|
1084
1084
|
return 1;
|
|
1085
1085
|
};
|
|
1086
|
+
|
|
1086
1087
|
const toSimpleIconRequest = request => {
|
|
1087
1088
|
return {
|
|
1088
1089
|
name: request.name,
|
|
1089
|
-
type:
|
|
1090
|
+
type: getSimpleIconRequestType(request.type)
|
|
1090
1091
|
};
|
|
1091
1092
|
};
|
|
1092
1093
|
|
|
@@ -1132,11 +1133,10 @@ const getFileOperationsNestedPath = (path, root, pathSeparator) => {
|
|
|
1132
1133
|
let currentPath = '';
|
|
1133
1134
|
for (const part of parts) {
|
|
1134
1135
|
if (!part) continue;
|
|
1135
|
-
currentPath = currentPath
|
|
1136
|
+
currentPath = join2(currentPath, part);
|
|
1136
1137
|
operations.push({
|
|
1137
1138
|
type: CreateFolder$1,
|
|
1138
|
-
path:
|
|
1139
|
-
text: ''
|
|
1139
|
+
path: join2(root, currentPath)
|
|
1140
1140
|
});
|
|
1141
1141
|
}
|
|
1142
1142
|
return operations;
|
|
@@ -1154,8 +1154,7 @@ const getFileOperationsCreate = (newFileName, newDirentType, pathSeparator, abso
|
|
|
1154
1154
|
} else if (newDirentType === Directory) {
|
|
1155
1155
|
operations.push({
|
|
1156
1156
|
type: CreateFolder$1,
|
|
1157
|
-
path: absolutePath
|
|
1158
|
-
text: ''
|
|
1157
|
+
path: absolutePath
|
|
1159
1158
|
});
|
|
1160
1159
|
}
|
|
1161
1160
|
return operations;
|
|
@@ -1393,7 +1392,7 @@ const treeToArrayInternal = (map, root, items, path, depth) => {
|
|
|
1393
1392
|
for (let i = 0; i < count; i++) {
|
|
1394
1393
|
const child = children[i];
|
|
1395
1394
|
const childPath = join2(path, child.name);
|
|
1396
|
-
const absolutePath =
|
|
1395
|
+
const absolutePath = join2(root, childPath);
|
|
1397
1396
|
items.push({
|
|
1398
1397
|
depth,
|
|
1399
1398
|
posInSet: i + 1,
|
|
@@ -1508,7 +1507,7 @@ const validateFileName2 = name => {
|
|
|
1508
1507
|
return '';
|
|
1509
1508
|
};
|
|
1510
1509
|
|
|
1511
|
-
const acceptCreate = async (state, newDirentType
|
|
1510
|
+
const acceptCreate = async (state, newDirentType) => {
|
|
1512
1511
|
const {
|
|
1513
1512
|
editingValue,
|
|
1514
1513
|
minLineY,
|
|
@@ -1591,18 +1590,16 @@ const computeExplorerRenamedDirentUpdate = (root, parentPath, oldUri, children,
|
|
|
1591
1590
|
return update;
|
|
1592
1591
|
};
|
|
1593
1592
|
|
|
1594
|
-
const
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
}
|
|
1605
|
-
return '';
|
|
1593
|
+
const getFileOperationsRename = (oldAbsolutePath, newFileName) => {
|
|
1594
|
+
const operations = [];
|
|
1595
|
+
const oldParentPath = dirname2(oldAbsolutePath);
|
|
1596
|
+
const newAbsolutePath = join2(oldParentPath, newFileName);
|
|
1597
|
+
operations.push({
|
|
1598
|
+
type: Rename$2,
|
|
1599
|
+
path: newAbsolutePath,
|
|
1600
|
+
from: oldAbsolutePath
|
|
1601
|
+
});
|
|
1602
|
+
return operations;
|
|
1606
1603
|
};
|
|
1607
1604
|
|
|
1608
1605
|
const updateTree2 = (tree, update) => {
|
|
@@ -1632,7 +1629,8 @@ const acceptRename = async state => {
|
|
|
1632
1629
|
};
|
|
1633
1630
|
}
|
|
1634
1631
|
const renamedDirent = items[editingIndex];
|
|
1635
|
-
const
|
|
1632
|
+
const operations = getFileOperationsRename(renamedDirent.path, editingValue);
|
|
1633
|
+
const renameErrorMessage = await applyFileOperations(operations);
|
|
1636
1634
|
if (renameErrorMessage) {
|
|
1637
1635
|
return {
|
|
1638
1636
|
...state,
|
|
@@ -3309,8 +3307,7 @@ const getFileOperations = (root, uploadTree) => {
|
|
|
3309
3307
|
if (typeof value === 'object') {
|
|
3310
3308
|
operations.push({
|
|
3311
3309
|
type: CreateFolder$1,
|
|
3312
|
-
path: join2(root, fullPath)
|
|
3313
|
-
text: ''
|
|
3310
|
+
path: join2(root, fullPath)
|
|
3314
3311
|
});
|
|
3315
3312
|
processTree(value, fullPath);
|
|
3316
3313
|
} else if (typeof value === 'string') {
|
|
@@ -3378,9 +3375,8 @@ const getFileOperationsElectron = async (root, paths, fileHandles) => {
|
|
|
3378
3375
|
} = fileHandle;
|
|
3379
3376
|
const path = paths[i];
|
|
3380
3377
|
operations.push({
|
|
3381
|
-
type:
|
|
3378
|
+
type: Copy$2,
|
|
3382
3379
|
path: join2(root, name),
|
|
3383
|
-
text: '',
|
|
3384
3380
|
from: path
|
|
3385
3381
|
});
|
|
3386
3382
|
}
|