@lvce-editor/explorer-view 2.33.0 → 2.35.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 +165 -125
- package/package.json +1 -1
|
@@ -1378,6 +1378,12 @@ const join = (pathSeparator, ...parts) => {
|
|
|
1378
1378
|
const getBaseName = (pathSeparator, path) => {
|
|
1379
1379
|
return path.slice(path.lastIndexOf(pathSeparator) + 1);
|
|
1380
1380
|
};
|
|
1381
|
+
const join2 = (path, childPath) => {
|
|
1382
|
+
if (path.endsWith('/')) {
|
|
1383
|
+
return `${path}${childPath}`;
|
|
1384
|
+
}
|
|
1385
|
+
return `${path}/${childPath}`;
|
|
1386
|
+
};
|
|
1381
1387
|
|
|
1382
1388
|
const acceptRename = async state => {
|
|
1383
1389
|
const {
|
|
@@ -1391,7 +1397,7 @@ const acceptRename = async state => {
|
|
|
1391
1397
|
// TODO this does not work with rename of nested file
|
|
1392
1398
|
const oldAbsolutePath = renamedDirent.path;
|
|
1393
1399
|
const oldParentPath = dirname(pathSeparator, oldAbsolutePath);
|
|
1394
|
-
const newAbsolutePath =
|
|
1400
|
+
const newAbsolutePath = join2(oldParentPath, editingValue);
|
|
1395
1401
|
await rename(oldAbsolutePath, newAbsolutePath);
|
|
1396
1402
|
} catch (error) {
|
|
1397
1403
|
console.error(new VError(error, `Failed to rename file`));
|
|
@@ -1401,9 +1407,6 @@ const acceptRename = async state => {
|
|
|
1401
1407
|
newDirents,
|
|
1402
1408
|
focusedIndex
|
|
1403
1409
|
} = computeExplorerRenamedDirent(items, editingIndex, editingValue);
|
|
1404
|
-
// TODO move focused index
|
|
1405
|
-
// @ts-ignore
|
|
1406
|
-
state.items = newDirents;
|
|
1407
1410
|
return {
|
|
1408
1411
|
...state,
|
|
1409
1412
|
editingIndex: -1,
|
|
@@ -1412,7 +1415,8 @@ const acceptRename = async state => {
|
|
|
1412
1415
|
editingIcon: '',
|
|
1413
1416
|
focusedIndex,
|
|
1414
1417
|
focused: true,
|
|
1415
|
-
focus: List
|
|
1418
|
+
focus: List,
|
|
1419
|
+
items: newDirents
|
|
1416
1420
|
};
|
|
1417
1421
|
};
|
|
1418
1422
|
|
|
@@ -1432,6 +1436,28 @@ const acceptEdit = async state => {
|
|
|
1432
1436
|
}
|
|
1433
1437
|
};
|
|
1434
1438
|
|
|
1439
|
+
const isNormalItem = item => {
|
|
1440
|
+
return item.type !== EditingFile && item.type !== EditingFolder;
|
|
1441
|
+
};
|
|
1442
|
+
|
|
1443
|
+
const cancelEditCreate = (state, keepFocus) => {
|
|
1444
|
+
const {
|
|
1445
|
+
editingIndex,
|
|
1446
|
+
items
|
|
1447
|
+
} = state;
|
|
1448
|
+
const filteredItems = items.filter(isNormalItem);
|
|
1449
|
+
return {
|
|
1450
|
+
...state,
|
|
1451
|
+
items: filteredItems,
|
|
1452
|
+
focusedIndex: editingIndex,
|
|
1453
|
+
focused: keepFocus,
|
|
1454
|
+
editingIndex: -1,
|
|
1455
|
+
editingValue: '',
|
|
1456
|
+
editingType: None$5,
|
|
1457
|
+
focus: List
|
|
1458
|
+
};
|
|
1459
|
+
};
|
|
1460
|
+
|
|
1435
1461
|
const normalizeDirentType = direntType => {
|
|
1436
1462
|
if (direntType > DELTA_EDITING) {
|
|
1437
1463
|
return direntType - DELTA_EDITING;
|
|
@@ -1449,33 +1475,17 @@ const getNewDirentsForCancelRename = (items, editingIndex) => {
|
|
|
1449
1475
|
return newItems;
|
|
1450
1476
|
};
|
|
1451
1477
|
|
|
1452
|
-
const
|
|
1453
|
-
return item.type !== EditingFile && item.type !== EditingFolder;
|
|
1454
|
-
};
|
|
1455
|
-
const cancelEdit = state => {
|
|
1478
|
+
const cancelEditRename = (state, keepFocus) => {
|
|
1456
1479
|
const {
|
|
1457
1480
|
editingIndex,
|
|
1458
|
-
|
|
1481
|
+
items
|
|
1459
1482
|
} = state;
|
|
1460
|
-
|
|
1461
|
-
const newItems = getNewDirentsForCancelRename(state.items, editingIndex);
|
|
1462
|
-
return {
|
|
1463
|
-
...state,
|
|
1464
|
-
items: newItems,
|
|
1465
|
-
focusedIndex: editingIndex,
|
|
1466
|
-
focused: true,
|
|
1467
|
-
editingIndex: -1,
|
|
1468
|
-
editingValue: '',
|
|
1469
|
-
editingType: None$5,
|
|
1470
|
-
focus: List
|
|
1471
|
-
};
|
|
1472
|
-
}
|
|
1473
|
-
const filteredItems = state.items.filter(isNormalItem);
|
|
1483
|
+
const newItems = getNewDirentsForCancelRename(items, editingIndex);
|
|
1474
1484
|
return {
|
|
1475
1485
|
...state,
|
|
1476
|
-
items:
|
|
1486
|
+
items: newItems,
|
|
1477
1487
|
focusedIndex: editingIndex,
|
|
1478
|
-
focused:
|
|
1488
|
+
focused: keepFocus,
|
|
1479
1489
|
editingIndex: -1,
|
|
1480
1490
|
editingValue: '',
|
|
1481
1491
|
editingType: None$5,
|
|
@@ -1483,6 +1493,20 @@ const cancelEdit = state => {
|
|
|
1483
1493
|
};
|
|
1484
1494
|
};
|
|
1485
1495
|
|
|
1496
|
+
const cancelEditInternal = (state, keepFocus) => {
|
|
1497
|
+
const {
|
|
1498
|
+
editingType
|
|
1499
|
+
} = state;
|
|
1500
|
+
if (editingType === Rename$1) {
|
|
1501
|
+
return cancelEditRename(state, keepFocus);
|
|
1502
|
+
}
|
|
1503
|
+
return cancelEditCreate(state, keepFocus);
|
|
1504
|
+
};
|
|
1505
|
+
|
|
1506
|
+
const cancelEdit = state => {
|
|
1507
|
+
return cancelEditInternal(state, true);
|
|
1508
|
+
};
|
|
1509
|
+
|
|
1486
1510
|
const cancelTypeAhead = state => {
|
|
1487
1511
|
return {
|
|
1488
1512
|
...state,
|
|
@@ -2033,6 +2057,16 @@ const expandRecursively = async state => {
|
|
|
2033
2057
|
};
|
|
2034
2058
|
};
|
|
2035
2059
|
|
|
2060
|
+
const focus = state => {
|
|
2061
|
+
if (state.focus) {
|
|
2062
|
+
return state;
|
|
2063
|
+
}
|
|
2064
|
+
return {
|
|
2065
|
+
...state,
|
|
2066
|
+
focus: List
|
|
2067
|
+
};
|
|
2068
|
+
};
|
|
2069
|
+
|
|
2036
2070
|
const focusIndex = (state, index) => {
|
|
2037
2071
|
const {
|
|
2038
2072
|
minLineY,
|
|
@@ -2154,7 +2188,7 @@ const focusPrevious = state => {
|
|
|
2154
2188
|
}
|
|
2155
2189
|
};
|
|
2156
2190
|
|
|
2157
|
-
const commandIds = ['acceptEdit', 'cancelEdit', 'collapseAll', 'copyPath', 'copyRelativePath', 'dispose', 'expandAll', 'expandRecursively', 'focus', 'focusFirst', 'focusIndex', 'focusLast', 'focusNext', 'focusNone', 'focusPrevious', 'getFocusedDirent', 'getMenuEntries2', 'getMouseActions', 'handleArrowLeft', 'handleArrowLeft', 'handleArrowRight', 'handleArrowRight', 'handleBlur', 'handleClick', 'handleClickAt', 'handleClickCurrent', 'handleClickCurrentButKeepFocus', 'handleClickOpenFolder', 'handleContextMenu', 'handleContextMenuKeyboard', 'handleCopy', 'handleDragLeave', 'handleDragOver', 'handleDrop', 'handleFocus', 'handleIconThemeChange', 'handleInputBlur', 'handleInputClick', 'handleLanguagesChanged', 'handleMouseEnter', 'handleMouseLeave', 'handlePaste', 'handlePointerDown', 'handleUpload', 'handleWheel', 'handleWorkspaceChange', 'hotReload', 'newFile', 'newFolder', 'openContainingFolder', 'refresh', 'removeDirent', 'rename', 'renameDirent', 'renderEventListeners', 'revealItem', 'revealItem', 'scrollDown', 'scrollUp', 'selectAll', 'selectDown', 'selectUp', 'setDeltaY', 'setSelectedIndices', 'cancelTypeAhead', 'updateEditingValue', 'handleKeyDown', 'updateIcons'];
|
|
2191
|
+
const commandIds = ['acceptEdit', 'cancelEdit', 'collapseAll', 'copyPath', 'copyRelativePath', 'dispose', 'expandAll', 'expandRecursively', 'focus', 'focusFirst', 'focusIndex', 'focusLast', 'focusNext', 'focusNone', 'handleInputKeyDown', 'focusPrevious', 'getFocusedDirent', 'getMenuEntries2', 'getMouseActions', 'handleArrowLeft', 'handleArrowLeft', 'handleArrowRight', 'handleArrowRight', 'handleBlur', 'handleClick', 'handleClickAt', 'handleClickCurrent', 'handleClickCurrentButKeepFocus', 'handleClickOpenFolder', 'handleContextMenu', 'handleContextMenuKeyboard', 'handleCopy', 'handleDragLeave', 'handleDragOver', 'handleDrop', 'handleFocus', 'handleIconThemeChange', 'handleInputBlur', 'handleInputClick', 'handleLanguagesChanged', 'handleMouseEnter', 'handleMouseLeave', 'handlePaste', 'handlePointerDown', 'handleUpload', 'handleWheel', 'handleWorkspaceChange', 'hotReload', 'newFile', 'newFolder', 'openContainingFolder', 'refresh', 'removeDirent', 'rename', 'renameDirent', 'renderEventListeners', 'revealItem', 'revealItem', 'scrollDown', 'scrollUp', 'selectAll', 'selectDown', 'selectUp', 'setDeltaY', 'setSelectedIndices', 'cancelTypeAhead', 'updateEditingValue', 'handleKeyDown', 'updateIcons'];
|
|
2158
2192
|
|
|
2159
2193
|
const getCommandIds = () => {
|
|
2160
2194
|
return commandIds;
|
|
@@ -2461,7 +2495,7 @@ const handleClickDirectoryExpanded = async (state, dirent, index, keepFocus) =>
|
|
|
2461
2495
|
const newMaxLineY = Math.min(maxLineY, newTotal);
|
|
2462
2496
|
const newMinLineY = newMaxLineY - visibleItems;
|
|
2463
2497
|
const deltaY = newMinLineY * itemHeight;
|
|
2464
|
-
const parts = newDirents.slice(
|
|
2498
|
+
const parts = newDirents.slice(newMinLineY, newMaxLineY);
|
|
2465
2499
|
const {
|
|
2466
2500
|
icons,
|
|
2467
2501
|
newFileIconCache
|
|
@@ -2629,15 +2663,9 @@ const handleArrowRight = async state => {
|
|
|
2629
2663
|
}
|
|
2630
2664
|
};
|
|
2631
2665
|
|
|
2632
|
-
const handleBlur = state => {
|
|
2666
|
+
const handleBlur = async state => {
|
|
2633
2667
|
// TODO when blur event occurs because of context menu, focused index should stay the same
|
|
2634
2668
|
// but focus outline should be removed
|
|
2635
|
-
const {
|
|
2636
|
-
editingType
|
|
2637
|
-
} = state;
|
|
2638
|
-
if (editingType !== None$5) {
|
|
2639
|
-
return state;
|
|
2640
|
-
}
|
|
2641
2669
|
return {
|
|
2642
2670
|
...state,
|
|
2643
2671
|
focused: false
|
|
@@ -2993,36 +3021,63 @@ const getExpandedDirents = items => {
|
|
|
2993
3021
|
return items.filter(isExpanded);
|
|
2994
3022
|
};
|
|
2995
3023
|
|
|
2996
|
-
const
|
|
2997
|
-
const
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
const nestedItems = await refreshChildDirents(item, pathSeparator, expandedFolders);
|
|
3009
|
-
return [item, ...nestedItems];
|
|
3024
|
+
const getPathDirentsMap = async allPaths => {
|
|
3025
|
+
const pathToDirents = Object.create(null);
|
|
3026
|
+
await Promise.all(allPaths.map(async path => {
|
|
3027
|
+
const dirents = await readDirWithFileTypes(path);
|
|
3028
|
+
pathToDirents[path] = dirents;
|
|
3029
|
+
}));
|
|
3030
|
+
return pathToDirents;
|
|
3031
|
+
};
|
|
3032
|
+
|
|
3033
|
+
const restoreDirentType = (rawDirentType, path, expandedPaths) => {
|
|
3034
|
+
if (rawDirentType === Directory && expandedPaths.includes(path)) {
|
|
3035
|
+
return DirectoryExpanded;
|
|
3010
3036
|
}
|
|
3011
|
-
return
|
|
3037
|
+
return rawDirentType;
|
|
3012
3038
|
};
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
return
|
|
3017
|
-
}
|
|
3018
|
-
|
|
3039
|
+
|
|
3040
|
+
const getProtoMapInternal = (root, pathToDirents, expandedPaths, depth) => {
|
|
3041
|
+
if (!(root in pathToDirents)) {
|
|
3042
|
+
return [];
|
|
3043
|
+
}
|
|
3044
|
+
const items = pathToDirents[root] || [];
|
|
3045
|
+
const protoMap = [];
|
|
3046
|
+
for (let i = 0; i < items.length; i++) {
|
|
3047
|
+
const item = items[i];
|
|
3048
|
+
const path = join2(root, item.name);
|
|
3049
|
+
const displayDirent = {
|
|
3050
|
+
name: item.name,
|
|
3051
|
+
posInSet: i + 1,
|
|
3052
|
+
setSize: items.length,
|
|
3053
|
+
depth,
|
|
3054
|
+
type: restoreDirentType(item.type, path, expandedPaths),
|
|
3055
|
+
path,
|
|
3056
|
+
icon: '',
|
|
3057
|
+
selected: false
|
|
3058
|
+
};
|
|
3059
|
+
const children = getProtoMapInternal(path, pathToDirents, expandedPaths, depth + 1);
|
|
3060
|
+
protoMap.push(displayDirent, ...children);
|
|
3061
|
+
}
|
|
3062
|
+
return protoMap;
|
|
3063
|
+
};
|
|
3064
|
+
|
|
3065
|
+
const getProtoMap = (root, pathToDirents, expandedPaths) => {
|
|
3066
|
+
return getProtoMapInternal(root, pathToDirents, expandedPaths, 1);
|
|
3067
|
+
};
|
|
3068
|
+
|
|
3069
|
+
const sortPathDirentsMap = map => {
|
|
3070
|
+
const sortedMap = Object.create(null);
|
|
3071
|
+
for (const [key, value] of Object.entries(map)) {
|
|
3072
|
+
const sorted = sortExplorerItems(value);
|
|
3073
|
+
sortedMap[key] = sorted;
|
|
3074
|
+
}
|
|
3075
|
+
return sortedMap;
|
|
3019
3076
|
};
|
|
3020
3077
|
|
|
3021
|
-
// TODO add lots of tests for this
|
|
3022
3078
|
const refresh = async state => {
|
|
3023
3079
|
const {
|
|
3024
3080
|
root,
|
|
3025
|
-
pathSeparator,
|
|
3026
3081
|
minLineY,
|
|
3027
3082
|
height,
|
|
3028
3083
|
itemHeight,
|
|
@@ -3030,64 +3085,25 @@ const refresh = async state => {
|
|
|
3030
3085
|
items,
|
|
3031
3086
|
focusedIndex
|
|
3032
3087
|
} = state;
|
|
3033
|
-
|
|
3034
|
-
// Get all expanded folders
|
|
3035
3088
|
const expandedDirents = getExpandedDirents(items);
|
|
3036
|
-
const
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
const
|
|
3040
|
-
const
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
path: root.endsWith(pathSeparator) ? `${root}${dirent.name}` : `${root}${pathSeparator}${dirent.name}`,
|
|
3044
|
-
depth: 0,
|
|
3045
|
-
selected: false
|
|
3046
|
-
}));
|
|
3047
|
-
|
|
3048
|
-
// Process expanded folders in parallel
|
|
3049
|
-
const expandedFolderResults = await Promise.all(expandedFolders.map(async folderPath => {
|
|
3050
|
-
const folderIndex = newDirents.findIndex(item => item.path === folderPath);
|
|
3051
|
-
if (folderIndex !== -1) {
|
|
3052
|
-
const folder = newDirents[folderIndex];
|
|
3053
|
-
if (folder.type === Directory) {
|
|
3054
|
-
const childItems = await refreshChildDirents(folder, pathSeparator, expandedFolders);
|
|
3055
|
-
// @ts-ignore
|
|
3056
|
-
folder.type = DirectoryExpanded;
|
|
3057
|
-
return {
|
|
3058
|
-
folderIndex,
|
|
3059
|
-
childItems
|
|
3060
|
-
};
|
|
3061
|
-
}
|
|
3062
|
-
}
|
|
3063
|
-
return null;
|
|
3064
|
-
}));
|
|
3065
|
-
|
|
3066
|
-
// Insert child items in the correct order
|
|
3067
|
-
let offset = 0;
|
|
3068
|
-
for (const result of expandedFolderResults) {
|
|
3069
|
-
if (result) {
|
|
3070
|
-
const {
|
|
3071
|
-
folderIndex,
|
|
3072
|
-
childItems
|
|
3073
|
-
} = result;
|
|
3074
|
-
newDirents.splice(folderIndex + 1 + offset, 0, ...childItems);
|
|
3075
|
-
offset += childItems.length;
|
|
3076
|
-
}
|
|
3077
|
-
}
|
|
3078
|
-
const maxLineY = getExplorerMaxLineY(minLineY, height, itemHeight, newDirents.length);
|
|
3079
|
-
const visible = newDirents.slice(minLineY, maxLineY);
|
|
3089
|
+
const expandedPaths = getPaths(expandedDirents);
|
|
3090
|
+
const allPaths = [root, ...expandedPaths];
|
|
3091
|
+
const pathToDirents = await getPathDirentsMap(allPaths);
|
|
3092
|
+
const sortedPathDirents = sortPathDirentsMap(pathToDirents);
|
|
3093
|
+
const newItems = getProtoMap(root, sortedPathDirents, expandedPaths);
|
|
3094
|
+
const maxLineY = getExplorerMaxLineY(minLineY, height, itemHeight, newItems.length);
|
|
3095
|
+
const visible = newItems.slice(minLineY, maxLineY);
|
|
3080
3096
|
const {
|
|
3081
3097
|
icons,
|
|
3082
3098
|
newFileIconCache
|
|
3083
3099
|
} = await getFileIcons(visible, fileIconCache);
|
|
3084
3100
|
let newFocusedIndex = focusedIndex;
|
|
3085
|
-
if (focusedIndex >=
|
|
3086
|
-
newFocusedIndex =
|
|
3101
|
+
if (focusedIndex >= newItems.length) {
|
|
3102
|
+
newFocusedIndex = newItems.length - 1;
|
|
3087
3103
|
}
|
|
3088
3104
|
return {
|
|
3089
3105
|
...state,
|
|
3090
|
-
items:
|
|
3106
|
+
items: newItems,
|
|
3091
3107
|
fileIconCache: newFileIconCache,
|
|
3092
3108
|
icons,
|
|
3093
3109
|
maxLineY,
|
|
@@ -3155,18 +3171,18 @@ const getFileOperations = (root, uploadTree) => {
|
|
|
3155
3171
|
const operations = [];
|
|
3156
3172
|
const processTree = (tree, currentPath) => {
|
|
3157
3173
|
for (const [path, value] of Object.entries(tree)) {
|
|
3158
|
-
const fullPath = currentPath ?
|
|
3174
|
+
const fullPath = currentPath ? join2(currentPath, path) : path;
|
|
3159
3175
|
if (typeof value === 'object') {
|
|
3160
3176
|
operations.push({
|
|
3161
3177
|
type: 'createFolder',
|
|
3162
|
-
path:
|
|
3178
|
+
path: join2(root, fullPath),
|
|
3163
3179
|
text: ''
|
|
3164
3180
|
});
|
|
3165
3181
|
processTree(value, fullPath);
|
|
3166
3182
|
} else if (typeof value === 'string') {
|
|
3167
3183
|
operations.push({
|
|
3168
3184
|
type: 'createFile',
|
|
3169
|
-
path:
|
|
3185
|
+
path: join2(root, fullPath),
|
|
3170
3186
|
text: value
|
|
3171
3187
|
});
|
|
3172
3188
|
}
|
|
@@ -3232,7 +3248,7 @@ const getFileOperationsElectron = async (root, paths, fileHandles) => {
|
|
|
3232
3248
|
const path = paths[i];
|
|
3233
3249
|
operations.push({
|
|
3234
3250
|
type: 'copy',
|
|
3235
|
-
path:
|
|
3251
|
+
path: join2(root, name),
|
|
3236
3252
|
text: '',
|
|
3237
3253
|
from: path
|
|
3238
3254
|
});
|
|
@@ -3432,14 +3448,25 @@ const handleIconThemeChange = state => {
|
|
|
3432
3448
|
return updateIcons(state);
|
|
3433
3449
|
};
|
|
3434
3450
|
|
|
3435
|
-
const handleInputBlur = state => {
|
|
3436
|
-
|
|
3451
|
+
const handleInputBlur = async state => {
|
|
3452
|
+
const {
|
|
3453
|
+
editingErrorMessage,
|
|
3454
|
+
editingValue
|
|
3455
|
+
} = state;
|
|
3456
|
+
if (editingErrorMessage || !editingValue) {
|
|
3457
|
+
return cancelEditInternal(state, false);
|
|
3458
|
+
}
|
|
3459
|
+
return acceptEdit(state);
|
|
3437
3460
|
};
|
|
3438
3461
|
|
|
3439
3462
|
const handleInputClick = state => {
|
|
3440
3463
|
return state;
|
|
3441
3464
|
};
|
|
3442
3465
|
|
|
3466
|
+
const handleInputKeyDown = (state, key) => {
|
|
3467
|
+
return state;
|
|
3468
|
+
};
|
|
3469
|
+
|
|
3443
3470
|
const filterByFocusWord = (items, focusedIndex, focusWord) => {
|
|
3444
3471
|
if (items.length === 0) {
|
|
3445
3472
|
return -1;
|
|
@@ -3888,7 +3915,7 @@ const getNewChildDirentsForNewDirent = async (items, depth, parentPath, direntTy
|
|
|
3888
3915
|
existingChildren = childDirents.map((dirent, index) => ({
|
|
3889
3916
|
name: dirent.name,
|
|
3890
3917
|
type: dirent.type,
|
|
3891
|
-
path:
|
|
3918
|
+
path: join2(parentPath, dirent.name),
|
|
3892
3919
|
depth,
|
|
3893
3920
|
selected: false,
|
|
3894
3921
|
posInSet: index + 1,
|
|
@@ -4185,7 +4212,6 @@ const HandleInputBlur = 'handleInputBlur';
|
|
|
4185
4212
|
const HandleInputClick = 'handleInputClick';
|
|
4186
4213
|
const HandleListBlur = 'handleListBlur';
|
|
4187
4214
|
const HandleListFocus = 'handleListFocus';
|
|
4188
|
-
const HandleListKeyDown = 'handleListKeyDown';
|
|
4189
4215
|
const HandlePointerDown = 'handlePointerDown';
|
|
4190
4216
|
const HandleWheel = 'handleWheel';
|
|
4191
4217
|
|
|
@@ -4372,8 +4398,8 @@ const getListItemsVirtualDom = (visibleItems, focusedIndex, focused, dropTargets
|
|
|
4372
4398
|
onDrop: HandleDrop,
|
|
4373
4399
|
onFocus: HandleListFocus,
|
|
4374
4400
|
onPointerDown: HandlePointerDown,
|
|
4375
|
-
onWheel: HandleWheel
|
|
4376
|
-
onKeyDown: HandleListKeyDown
|
|
4401
|
+
onWheel: HandleWheel
|
|
4402
|
+
// onKeyDown: DomEventListenerFunctions.HandleListKeyDown,
|
|
4377
4403
|
}, ...visibleItems.flatMap(getExplorerItemVirtualDom)];
|
|
4378
4404
|
return dom;
|
|
4379
4405
|
};
|
|
@@ -4684,11 +4710,18 @@ const renderEventListeners = () => {
|
|
|
4684
4710
|
return [{
|
|
4685
4711
|
name: HandleInputBlur,
|
|
4686
4712
|
params: ['handleInputBlur']
|
|
4687
|
-
},
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4713
|
+
},
|
|
4714
|
+
// {
|
|
4715
|
+
// name: DomEventListenersFunctions.HandleInputKeyDown,
|
|
4716
|
+
// params: ['handleInputKeyDown'],
|
|
4717
|
+
// stopPropagation: true, // TODO find a way to do this without stopPropagation
|
|
4718
|
+
// },
|
|
4719
|
+
// {
|
|
4720
|
+
// name: DomEventListenersFunctions.HandleListKeyDown,
|
|
4721
|
+
// params: ['handleKeyDown', 'event.key'],
|
|
4722
|
+
// preventDefault: true,
|
|
4723
|
+
// },
|
|
4724
|
+
{
|
|
4692
4725
|
name: HandleListFocus,
|
|
4693
4726
|
params: ['handleFocus', 'event.isTrusted', 'event.target.className']
|
|
4694
4727
|
}, {
|
|
@@ -5078,7 +5111,12 @@ const getEditingIcon = async (editingType, value, direntType) => {
|
|
|
5078
5111
|
};
|
|
5079
5112
|
|
|
5080
5113
|
const updateEditingValue = async (state, value, inputSource = User) => {
|
|
5081
|
-
const
|
|
5114
|
+
const {
|
|
5115
|
+
editingType,
|
|
5116
|
+
items,
|
|
5117
|
+
editingIndex
|
|
5118
|
+
} = state;
|
|
5119
|
+
const editingIcon = await getEditingIcon(editingType, value, items[editingIndex]?.type);
|
|
5082
5120
|
return {
|
|
5083
5121
|
...state,
|
|
5084
5122
|
editingValue: value,
|
|
@@ -5088,14 +5126,14 @@ const updateEditingValue = async (state, value, inputSource = User) => {
|
|
|
5088
5126
|
|
|
5089
5127
|
const commandMap = {
|
|
5090
5128
|
'Explorer.acceptEdit': wrapCommand(acceptEdit),
|
|
5091
|
-
'Explorer.handleKeyDown': wrapCommand(handleKeyDown),
|
|
5092
|
-
'Explorer.cancelTypeAhead': wrapCommand(cancelTypeAhead),
|
|
5093
5129
|
'Explorer.cancelEdit': wrapCommand(cancelEdit),
|
|
5130
|
+
'Explorer.cancelTypeAhead': wrapCommand(cancelTypeAhead),
|
|
5094
5131
|
'Explorer.collapseAll': wrapCommand(collapseAll),
|
|
5095
5132
|
'Explorer.copyPath': wrapCommand(copyPath),
|
|
5096
5133
|
'Explorer.copyRelativePath': wrapCommand(copyRelativePath),
|
|
5097
5134
|
'Explorer.expandAll': wrapCommand(expandAll),
|
|
5098
5135
|
'Explorer.expandRecursively': wrapCommand(expandRecursively),
|
|
5136
|
+
'Explorer.focus': wrapCommand(focus),
|
|
5099
5137
|
'Explorer.focusFirst': wrapCommand(focusFirst),
|
|
5100
5138
|
'Explorer.focusIndex': wrapCommand(focusIndex),
|
|
5101
5139
|
'Explorer.focusLast': wrapCommand(focusLast),
|
|
@@ -5123,6 +5161,8 @@ const commandMap = {
|
|
|
5123
5161
|
'Explorer.handleIconThemeChange': wrapCommand(handleIconThemeChange),
|
|
5124
5162
|
'Explorer.handleInputBlur': wrapCommand(handleInputBlur),
|
|
5125
5163
|
'Explorer.handleInputClick': wrapCommand(handleInputClick),
|
|
5164
|
+
'Explorer.handleInputKeyDown': wrapCommand(handleInputKeyDown),
|
|
5165
|
+
'Explorer.handleKeyDown': wrapCommand(handleKeyDown),
|
|
5126
5166
|
'Explorer.handlePaste': wrapCommand(handlePaste),
|
|
5127
5167
|
'Explorer.handlePointerDown': wrapCommand(handlePointerDown),
|
|
5128
5168
|
'Explorer.handleUpload': wrapCommand(handleUpload),
|