@lvce-editor/explorer-view 7.10.1 → 7.12.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 +145 -104
- package/package.json +1 -1
|
@@ -2509,6 +2509,50 @@ const acceptCreateFolder = async state => {
|
|
|
2509
2509
|
return acceptCreate(state, Directory);
|
|
2510
2510
|
};
|
|
2511
2511
|
|
|
2512
|
+
const getFocusedIndexCancel = (items, editingIndex) => {
|
|
2513
|
+
const newFocusedIndex = editingIndex >= items.length ? items.length - 1 : editingIndex;
|
|
2514
|
+
return newFocusedIndex;
|
|
2515
|
+
};
|
|
2516
|
+
|
|
2517
|
+
const normalizeDirentType = direntType => {
|
|
2518
|
+
if (direntType > DELTA_EDITING) {
|
|
2519
|
+
return direntType - DELTA_EDITING;
|
|
2520
|
+
}
|
|
2521
|
+
return direntType;
|
|
2522
|
+
};
|
|
2523
|
+
|
|
2524
|
+
const getNewDirentsForCancelRename = (items, editingIndex) => {
|
|
2525
|
+
const item = items[editingIndex];
|
|
2526
|
+
const newItems = [...items];
|
|
2527
|
+
newItems[editingIndex] = {
|
|
2528
|
+
...item,
|
|
2529
|
+
type: normalizeDirentType(item.type)
|
|
2530
|
+
};
|
|
2531
|
+
return newItems;
|
|
2532
|
+
};
|
|
2533
|
+
|
|
2534
|
+
const cancelEditRename = (state, keepFocus) => {
|
|
2535
|
+
const {
|
|
2536
|
+
editingIndex,
|
|
2537
|
+
items
|
|
2538
|
+
} = state;
|
|
2539
|
+
const newItems = getNewDirentsForCancelRename(items, editingIndex);
|
|
2540
|
+
const newFocusedIndex = getFocusedIndexCancel(items, editingIndex);
|
|
2541
|
+
return {
|
|
2542
|
+
...state,
|
|
2543
|
+
editingErrorMessage: '',
|
|
2544
|
+
editingIndex: -1,
|
|
2545
|
+
editingSelectionEnd: 0,
|
|
2546
|
+
editingSelectionStart: 0,
|
|
2547
|
+
editingType: None$5,
|
|
2548
|
+
editingValue: '',
|
|
2549
|
+
focus: List,
|
|
2550
|
+
focused: keepFocus,
|
|
2551
|
+
focusedIndex: newFocusedIndex,
|
|
2552
|
+
items: newItems
|
|
2553
|
+
};
|
|
2554
|
+
};
|
|
2555
|
+
|
|
2512
2556
|
const getUpdatedChildren = (children, oldItems, newUri) => {
|
|
2513
2557
|
const setSize = children.length;
|
|
2514
2558
|
return children.toSorted(compareDirent).map((child, index) => {
|
|
@@ -2596,6 +2640,9 @@ const acceptRename = async state => {
|
|
|
2596
2640
|
const oldUri = renamedDirent.path;
|
|
2597
2641
|
const dirname = dirname2(oldUri);
|
|
2598
2642
|
const newUri = join2(dirname, editingValue);
|
|
2643
|
+
if (oldUri === newUri) {
|
|
2644
|
+
return cancelEditRename(state, true);
|
|
2645
|
+
}
|
|
2599
2646
|
const operations = getFileOperationsRename(renamedDirent.path, editingValue);
|
|
2600
2647
|
const renameErrorMessage = await applyFileOperations(operations);
|
|
2601
2648
|
if (renameErrorMessage) {
|
|
@@ -2625,28 +2672,35 @@ const acceptRename = async state => {
|
|
|
2625
2672
|
};
|
|
2626
2673
|
};
|
|
2627
2674
|
|
|
2628
|
-
const
|
|
2675
|
+
const User = 1;
|
|
2676
|
+
const Script = 2;
|
|
2677
|
+
|
|
2678
|
+
const acceptEdit = async (state, inputSource = Script) => {
|
|
2629
2679
|
if (state.isReadonly) {
|
|
2630
2680
|
return state;
|
|
2631
2681
|
}
|
|
2632
2682
|
const {
|
|
2633
|
-
editingType
|
|
2683
|
+
editingType,
|
|
2684
|
+
inputSource: currentInputSource
|
|
2634
2685
|
} = state;
|
|
2686
|
+
let newState;
|
|
2635
2687
|
switch (editingType) {
|
|
2636
2688
|
case CreateFile:
|
|
2637
|
-
|
|
2689
|
+
newState = await acceptCreateFile(state);
|
|
2690
|
+
break;
|
|
2638
2691
|
case CreateFolder:
|
|
2639
|
-
|
|
2692
|
+
newState = await acceptCreateFolder(state);
|
|
2693
|
+
break;
|
|
2640
2694
|
case Rename$1:
|
|
2641
|
-
|
|
2695
|
+
newState = await acceptRename(state);
|
|
2696
|
+
break;
|
|
2642
2697
|
default:
|
|
2643
2698
|
return state;
|
|
2644
2699
|
}
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
return newFocusedIndex;
|
|
2700
|
+
return {
|
|
2701
|
+
...newState,
|
|
2702
|
+
inputSource: currentInputSource === User ? inputSource : currentInputSource
|
|
2703
|
+
};
|
|
2650
2704
|
};
|
|
2651
2705
|
|
|
2652
2706
|
const isNormalItem = item => {
|
|
@@ -2673,45 +2727,6 @@ const cancelEditCreate = async (state, keepFocus) => {
|
|
|
2673
2727
|
};
|
|
2674
2728
|
};
|
|
2675
2729
|
|
|
2676
|
-
const normalizeDirentType = direntType => {
|
|
2677
|
-
if (direntType > DELTA_EDITING) {
|
|
2678
|
-
return direntType - DELTA_EDITING;
|
|
2679
|
-
}
|
|
2680
|
-
return direntType;
|
|
2681
|
-
};
|
|
2682
|
-
|
|
2683
|
-
const getNewDirentsForCancelRename = (items, editingIndex) => {
|
|
2684
|
-
const item = items[editingIndex];
|
|
2685
|
-
const newItems = [...items];
|
|
2686
|
-
newItems[editingIndex] = {
|
|
2687
|
-
...item,
|
|
2688
|
-
type: normalizeDirentType(item.type)
|
|
2689
|
-
};
|
|
2690
|
-
return newItems;
|
|
2691
|
-
};
|
|
2692
|
-
|
|
2693
|
-
const cancelEditRename = (state, keepFocus) => {
|
|
2694
|
-
const {
|
|
2695
|
-
editingIndex,
|
|
2696
|
-
items
|
|
2697
|
-
} = state;
|
|
2698
|
-
const newItems = getNewDirentsForCancelRename(items, editingIndex);
|
|
2699
|
-
const newFocusedIndex = getFocusedIndexCancel(items, editingIndex);
|
|
2700
|
-
return {
|
|
2701
|
-
...state,
|
|
2702
|
-
editingErrorMessage: '',
|
|
2703
|
-
editingIndex: -1,
|
|
2704
|
-
editingSelectionEnd: 0,
|
|
2705
|
-
editingSelectionStart: 0,
|
|
2706
|
-
editingType: None$5,
|
|
2707
|
-
editingValue: '',
|
|
2708
|
-
focus: List,
|
|
2709
|
-
focused: keepFocus,
|
|
2710
|
-
focusedIndex: newFocusedIndex,
|
|
2711
|
-
items: newItems
|
|
2712
|
-
};
|
|
2713
|
-
};
|
|
2714
|
-
|
|
2715
2730
|
const cancelEditInternal = async (state, keepFocus) => {
|
|
2716
2731
|
const {
|
|
2717
2732
|
editingType
|
|
@@ -2723,7 +2738,14 @@ const cancelEditInternal = async (state, keepFocus) => {
|
|
|
2723
2738
|
};
|
|
2724
2739
|
|
|
2725
2740
|
const cancelEdit = async state => {
|
|
2726
|
-
|
|
2741
|
+
const {
|
|
2742
|
+
inputSource
|
|
2743
|
+
} = state;
|
|
2744
|
+
const newState = await cancelEditInternal(state, true);
|
|
2745
|
+
return {
|
|
2746
|
+
...newState,
|
|
2747
|
+
inputSource: inputSource === User ? Script : inputSource
|
|
2748
|
+
};
|
|
2727
2749
|
};
|
|
2728
2750
|
|
|
2729
2751
|
const cancelTypeAhead = state => {
|
|
@@ -3509,17 +3531,14 @@ const diffTrees = (oldTree, newTree, patches, path) => {
|
|
|
3509
3531
|
};
|
|
3510
3532
|
|
|
3511
3533
|
const removeTrailingNavigationPatches = patches => {
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
for (let i = patches.length - 1; i >= 0; i--) {
|
|
3515
|
-
const patch = patches[i];
|
|
3534
|
+
while (patches.length > 0) {
|
|
3535
|
+
const patch = patches.at(-1);
|
|
3516
3536
|
if (patch.type !== NavigateChild && patch.type !== NavigateParent && patch.type !== NavigateSibling) {
|
|
3517
|
-
lastNonNavigationIndex = i;
|
|
3518
3537
|
break;
|
|
3519
3538
|
}
|
|
3539
|
+
patches.pop();
|
|
3520
3540
|
}
|
|
3521
|
-
|
|
3522
|
-
return lastNonNavigationIndex === -1 ? [] : patches.slice(0, lastNonNavigationIndex + 1);
|
|
3541
|
+
return patches;
|
|
3523
3542
|
};
|
|
3524
3543
|
|
|
3525
3544
|
const diffTree = (oldNodes, newNodes) => {
|
|
@@ -3650,7 +3669,7 @@ const enqueueCommand = async (id, command) => {
|
|
|
3650
3669
|
}
|
|
3651
3670
|
};
|
|
3652
3671
|
const hasSameVisibleExplorerItemInputs = (oldState, newState) => {
|
|
3653
|
-
return oldState.items === newState.items && oldState.minLineY === newState.minLineY && oldState.height === newState.height && oldState.itemHeight === newState.itemHeight && oldState.focusedIndex === newState.focusedIndex && oldState.editingIndex === newState.editingIndex && oldState.editingIcon === newState.editingIcon && oldState.cutItems === newState.cutItems && oldState.editingErrorMessage === newState.editingErrorMessage && oldState.dropTargets === newState.dropTargets && oldState.fileIconCache === newState.fileIconCache && oldState.decorations === newState.decorations && oldState.useChevrons === newState.useChevrons && oldState.sourceControlIgnoredUris === newState.sourceControlIgnoredUris;
|
|
3672
|
+
return oldState.items === newState.items && oldState.minLineY === newState.minLineY && oldState.height === newState.height && oldState.itemHeight === newState.itemHeight && oldState.focusedIndex === newState.focusedIndex && oldState.editingIndex === newState.editingIndex && oldState.editingSessionId === newState.editingSessionId && oldState.editingIcon === newState.editingIcon && oldState.cutItems === newState.cutItems && oldState.editingErrorMessage === newState.editingErrorMessage && oldState.dropTargets === newState.dropTargets && oldState.fileIconCache === newState.fileIconCache && oldState.decorations === newState.decorations && oldState.useChevrons === newState.useChevrons && oldState.sourceControlIgnoredUris === newState.sourceControlIgnoredUris;
|
|
3654
3673
|
};
|
|
3655
3674
|
const maybeUpdateGitIgnoredUris = async (oldState, newState) => {
|
|
3656
3675
|
if (oldState.items === newState.items || oldState.sourceControlIgnoredUris !== newState.sourceControlIgnoredUris) {
|
|
@@ -3697,6 +3716,9 @@ const wrapListItemCommandInternal = (fn, queued) => {
|
|
|
3697
3716
|
const intermediate = get(id);
|
|
3698
3717
|
set(id, intermediate.oldState, updatedState, intermediate.scheduledState);
|
|
3699
3718
|
if (hasSameVisibleExplorerItemInputs(intermediate.newState, updatedState)) {
|
|
3719
|
+
if (updatedState.inputSource === User) {
|
|
3720
|
+
set(id, intermediate.oldState, updatedState);
|
|
3721
|
+
}
|
|
3700
3722
|
return;
|
|
3701
3723
|
}
|
|
3702
3724
|
const maxLineY = getExplorerMaxLineY(minLineY, height, itemHeight, items.length);
|
|
@@ -3755,6 +3777,7 @@ const create = (id, uri, x, y, width, height, args, parentUid, platform = 0, ass
|
|
|
3755
3777
|
editingIndex: -1,
|
|
3756
3778
|
editingSelectionEnd: 0,
|
|
3757
3779
|
editingSelectionStart: 0,
|
|
3780
|
+
editingSessionId: 0,
|
|
3758
3781
|
editingType: None$5,
|
|
3759
3782
|
editingValue: '',
|
|
3760
3783
|
errorCode: '',
|
|
@@ -4734,6 +4757,7 @@ const newDirent = async (state, editingType, editingIcon = '') => {
|
|
|
4734
4757
|
// TODO do it like vscode, select position between folders and files
|
|
4735
4758
|
const {
|
|
4736
4759
|
editingIndex,
|
|
4760
|
+
editingSessionId,
|
|
4737
4761
|
excluded,
|
|
4738
4762
|
focusedIndex,
|
|
4739
4763
|
items,
|
|
@@ -4750,6 +4774,7 @@ const newDirent = async (state, editingType, editingIcon = '') => {
|
|
|
4750
4774
|
...state,
|
|
4751
4775
|
editingIcon,
|
|
4752
4776
|
editingIndex: newEditingIndex,
|
|
4777
|
+
editingSessionId: editingSessionId + 1,
|
|
4753
4778
|
editingType,
|
|
4754
4779
|
editingValue: '',
|
|
4755
4780
|
focus: Input$1,
|
|
@@ -5269,10 +5294,15 @@ const handleCut = async state => {
|
|
|
5269
5294
|
|
|
5270
5295
|
const handleDoubleClick = async (state, eventX, eventY) => {
|
|
5271
5296
|
const index = getIndexFromPosition(state, eventX, eventY);
|
|
5272
|
-
if (index
|
|
5273
|
-
return state;
|
|
5297
|
+
if (index === -1) {
|
|
5298
|
+
return newFile(state);
|
|
5274
5299
|
}
|
|
5275
|
-
|
|
5300
|
+
const item = state.items[index];
|
|
5301
|
+
const type = normalizeDirentType(item.type);
|
|
5302
|
+
if (type === File || type === SymLinkFile) {
|
|
5303
|
+
await openUri(item.path, true);
|
|
5304
|
+
}
|
|
5305
|
+
return state;
|
|
5276
5306
|
};
|
|
5277
5307
|
|
|
5278
5308
|
const handleDragEnd = state => {
|
|
@@ -5346,7 +5376,7 @@ const isEqual = (a, b) => {
|
|
|
5346
5376
|
};
|
|
5347
5377
|
|
|
5348
5378
|
const handleDragOverIndex = (state, index) => {
|
|
5349
|
-
if (state.isReadonly) {
|
|
5379
|
+
if (state.isReadonly && state.root !== '') {
|
|
5350
5380
|
return state;
|
|
5351
5381
|
}
|
|
5352
5382
|
const {
|
|
@@ -5365,7 +5395,7 @@ const handleDragOverIndex = (state, index) => {
|
|
|
5365
5395
|
const handleDragOver = (state, x, y) => {
|
|
5366
5396
|
number(x);
|
|
5367
5397
|
number(y);
|
|
5368
|
-
if (state.isReadonly) {
|
|
5398
|
+
if (state.isReadonly && state.root !== '') {
|
|
5369
5399
|
return state;
|
|
5370
5400
|
}
|
|
5371
5401
|
const index = getIndexFromPosition(state, x, y);
|
|
@@ -5624,7 +5654,7 @@ const loadContent = async (state, savedState) => {
|
|
|
5624
5654
|
// TODO path separator could be restored from saved state
|
|
5625
5655
|
const [pathSeparator, isReadonly$1] = await Promise.all([getPathSeparator(root),
|
|
5626
5656
|
// TODO only load path separator once
|
|
5627
|
-
isReadonly(root)]);
|
|
5657
|
+
root === '' ? false : isReadonly(root)]);
|
|
5628
5658
|
const restoredDirents = await restoreExpandedState(savedState, root, pathSeparator, excluded);
|
|
5629
5659
|
const rawDeltaY = getRestoredDeltaY(savedState);
|
|
5630
5660
|
const maxDeltaY = Math.max(restoredDirents.length * itemHeight - height, 0);
|
|
@@ -5919,7 +5949,7 @@ const getModule = isElectron => {
|
|
|
5919
5949
|
return handleDrop$2;
|
|
5920
5950
|
};
|
|
5921
5951
|
const handleDropRoot = async (state, fileHandles, files, paths) => {
|
|
5922
|
-
if (state.isReadonly) {
|
|
5952
|
+
if (state.isReadonly && state.root !== '') {
|
|
5923
5953
|
return state;
|
|
5924
5954
|
}
|
|
5925
5955
|
const isElectron = state.platform === Electron;
|
|
@@ -6033,7 +6063,7 @@ const getFilePaths = async (files, platform) => {
|
|
|
6033
6063
|
};
|
|
6034
6064
|
|
|
6035
6065
|
const handleDrop = async (state, x, y, fileIds, fileList) => {
|
|
6036
|
-
if (state.isReadonly) {
|
|
6066
|
+
if (state.isReadonly && state.root !== '') {
|
|
6037
6067
|
return state;
|
|
6038
6068
|
}
|
|
6039
6069
|
try {
|
|
@@ -6091,19 +6121,23 @@ const handleIconThemeChange = state => {
|
|
|
6091
6121
|
return updateIcons(state);
|
|
6092
6122
|
};
|
|
6093
6123
|
|
|
6094
|
-
const handleInputBlur = async state => {
|
|
6124
|
+
const handleInputBlur = async (state, editingSessionId) => {
|
|
6095
6125
|
const {
|
|
6096
6126
|
editingErrorMessage,
|
|
6097
6127
|
editingIndex,
|
|
6128
|
+
editingSessionId: currentEditingSessionId,
|
|
6098
6129
|
editingValue
|
|
6099
6130
|
} = state;
|
|
6100
6131
|
if (editingIndex === -1) {
|
|
6101
6132
|
return state;
|
|
6102
6133
|
}
|
|
6134
|
+
if (editingSessionId !== undefined && editingSessionId !== String(currentEditingSessionId)) {
|
|
6135
|
+
return state;
|
|
6136
|
+
}
|
|
6103
6137
|
if (editingErrorMessage || !editingValue) {
|
|
6104
6138
|
return cancelEditInternal(state, false);
|
|
6105
6139
|
}
|
|
6106
|
-
return acceptEdit(state);
|
|
6140
|
+
return acceptEdit(state, User);
|
|
6107
6141
|
};
|
|
6108
6142
|
|
|
6109
6143
|
const handleInputClick = state => {
|
|
@@ -6656,14 +6690,12 @@ const getRenameSelectionRange = name => {
|
|
|
6656
6690
|
};
|
|
6657
6691
|
};
|
|
6658
6692
|
|
|
6659
|
-
const User = 1;
|
|
6660
|
-
const Script = 2;
|
|
6661
|
-
|
|
6662
6693
|
const renameDirent = async state => {
|
|
6663
6694
|
if (state.isReadonly) {
|
|
6664
6695
|
return state;
|
|
6665
6696
|
}
|
|
6666
6697
|
const {
|
|
6698
|
+
editingSessionId,
|
|
6667
6699
|
focusedIndex,
|
|
6668
6700
|
icons,
|
|
6669
6701
|
items,
|
|
@@ -6684,6 +6716,7 @@ const renameDirent = async state => {
|
|
|
6684
6716
|
editingIndex: focusedIndex,
|
|
6685
6717
|
editingSelectionEnd: end,
|
|
6686
6718
|
editingSelectionStart: start,
|
|
6719
|
+
editingSessionId: editingSessionId + 1,
|
|
6687
6720
|
editingType: Rename$1,
|
|
6688
6721
|
editingValue: item.name,
|
|
6689
6722
|
focus: Input$1,
|
|
@@ -6904,6 +6937,18 @@ const HandlePointerDown = 14;
|
|
|
6904
6937
|
const HandleWheel = 15;
|
|
6905
6938
|
const HandleDoubleClick = 16;
|
|
6906
6939
|
|
|
6940
|
+
const Focusable = 0;
|
|
6941
|
+
|
|
6942
|
+
const welcomeNode = {
|
|
6943
|
+
childCount: 2,
|
|
6944
|
+
className: Welcome,
|
|
6945
|
+
type: Div
|
|
6946
|
+
};
|
|
6947
|
+
const welcomeMessageNode$1 = {
|
|
6948
|
+
childCount: 1,
|
|
6949
|
+
className: WelcomeMessage,
|
|
6950
|
+
type: P
|
|
6951
|
+
};
|
|
6907
6952
|
const getClassName$1 = dropTargets => {
|
|
6908
6953
|
const extraClassName = dropTargets === dropTargetFull ? ExplorerDropTarget : Empty;
|
|
6909
6954
|
return mergeClassNames(Viewlet, Explorer$1, extraClassName);
|
|
@@ -6916,17 +6961,9 @@ const getExplorerWelcomeVirtualDom = (isWide, dropTargets) => {
|
|
|
6916
6961
|
onDragLeave: HandleDragLeave,
|
|
6917
6962
|
onDragOver: HandleDragOver,
|
|
6918
6963
|
onDrop: HandleDrop,
|
|
6919
|
-
tabIndex:
|
|
6964
|
+
tabIndex: Focusable,
|
|
6920
6965
|
type: Div
|
|
6921
|
-
}, {
|
|
6922
|
-
childCount: 2,
|
|
6923
|
-
className: Welcome,
|
|
6924
|
-
type: Div
|
|
6925
|
-
}, {
|
|
6926
|
-
childCount: 1,
|
|
6927
|
-
className: WelcomeMessage,
|
|
6928
|
-
type: P
|
|
6929
|
-
}, text(youHaveNotYetOpenedAFolder()), {
|
|
6966
|
+
}, welcomeNode, welcomeMessageNode$1, text(youHaveNotYetOpenedAFolder()), {
|
|
6930
6967
|
childCount: 1,
|
|
6931
6968
|
className: mergeClassNames(Button$2, ButtonPrimary, isWide ? ButtonWide : ButtonNarrow),
|
|
6932
6969
|
name: OpenFolder,
|
|
@@ -6969,7 +7006,7 @@ const getInputClassName = hasEditingError => {
|
|
|
6969
7006
|
return ExplorerInputBox;
|
|
6970
7007
|
};
|
|
6971
7008
|
|
|
6972
|
-
const getInputDom = (isEditing, hasEditingError) => {
|
|
7009
|
+
const getInputDom = (isEditing, hasEditingError, editingSessionId) => {
|
|
6973
7010
|
if (!isEditing) {
|
|
6974
7011
|
return [];
|
|
6975
7012
|
}
|
|
@@ -6981,6 +7018,7 @@ const getInputDom = (isEditing, hasEditingError) => {
|
|
|
6981
7018
|
autocorrect: 'off',
|
|
6982
7019
|
childCount: 0,
|
|
6983
7020
|
className: getInputClassName(hasEditingError),
|
|
7021
|
+
'data-editingSessionId': editingSessionId,
|
|
6984
7022
|
id: 'ExplorerInput',
|
|
6985
7023
|
name: ExplorerInput,
|
|
6986
7024
|
onBlur: HandleInputBlur,
|
|
@@ -7016,7 +7054,7 @@ const getTitle = path => {
|
|
|
7016
7054
|
}
|
|
7017
7055
|
return path;
|
|
7018
7056
|
};
|
|
7019
|
-
const getExplorerItemVirtualDom = item => {
|
|
7057
|
+
const getExplorerItemVirtualDom = (item, editingSessionId = 0) => {
|
|
7020
7058
|
const {
|
|
7021
7059
|
ariaExpanded,
|
|
7022
7060
|
chevron,
|
|
@@ -7036,7 +7074,6 @@ const getExplorerItemVirtualDom = item => {
|
|
|
7036
7074
|
} = item;
|
|
7037
7075
|
const chevronDom = getChevronVirtualDom(chevron);
|
|
7038
7076
|
return [{
|
|
7039
|
-
ariaDescription: '',
|
|
7040
7077
|
ariaExpanded,
|
|
7041
7078
|
ariaLabel: name,
|
|
7042
7079
|
ariaLevel: depth,
|
|
@@ -7050,7 +7087,7 @@ const getExplorerItemVirtualDom = item => {
|
|
|
7050
7087
|
role: TreeItem,
|
|
7051
7088
|
title: getTitle(path),
|
|
7052
7089
|
type: Div
|
|
7053
|
-
}, ...chevronDom, getFileIconVirtualDom(icon), ...getInputDom(isEditing, hasEditingError), ...getLabelDom(isEditing, name, isCut || isIgnored)];
|
|
7090
|
+
}, ...chevronDom, getFileIconVirtualDom(icon), ...getInputDom(isEditing, hasEditingError, editingSessionId), ...getLabelDom(isEditing, name, isCut || isIgnored)];
|
|
7054
7091
|
};
|
|
7055
7092
|
|
|
7056
7093
|
const getActiveDescendant = focusedIndex => {
|
|
@@ -7065,7 +7102,7 @@ const getClassName = (focused, focusedIndex, dropTarget) => {
|
|
|
7065
7102
|
const className = mergeClassNames(ListItems, extraClass1, extraClass2);
|
|
7066
7103
|
return className;
|
|
7067
7104
|
};
|
|
7068
|
-
const getListItemsVirtualDom = (visibleItems, focusedIndex, focused, dropTargets) => {
|
|
7105
|
+
const getListItemsVirtualDom = (visibleItems, focusedIndex, focused, dropTargets, editingSessionId = 0) => {
|
|
7069
7106
|
const dom = [{
|
|
7070
7107
|
ariaActiveDescendant: getActiveDescendant(focusedIndex),
|
|
7071
7108
|
ariaLabel: filesExplorer(),
|
|
@@ -7084,13 +7121,18 @@ const getListItemsVirtualDom = (visibleItems, focusedIndex, focused, dropTargets
|
|
|
7084
7121
|
onPointerDown: HandlePointerDown,
|
|
7085
7122
|
onWheel: HandleWheel,
|
|
7086
7123
|
role: Tree,
|
|
7087
|
-
tabIndex:
|
|
7124
|
+
tabIndex: Focusable,
|
|
7088
7125
|
type: Div
|
|
7089
7126
|
// onKeyDown: DomEventListenerFunctions.HandleListKeyDown,
|
|
7090
|
-
}, ...visibleItems.flatMap(getExplorerItemVirtualDom)];
|
|
7127
|
+
}, ...visibleItems.flatMap(item => getExplorerItemVirtualDom(item, editingSessionId))];
|
|
7091
7128
|
return dom;
|
|
7092
7129
|
};
|
|
7093
7130
|
|
|
7131
|
+
const welcomeMessageNode = {
|
|
7132
|
+
childCount: 1,
|
|
7133
|
+
className: WelcomeMessage,
|
|
7134
|
+
type: P
|
|
7135
|
+
};
|
|
7094
7136
|
const getParentNode$1 = childCount => {
|
|
7095
7137
|
return {
|
|
7096
7138
|
childCount,
|
|
@@ -7105,11 +7147,7 @@ const getLoadErrorVirtualDom = (loadErrorMessage, isWide, showOpenAnotherFolderB
|
|
|
7105
7147
|
childCount,
|
|
7106
7148
|
className: Welcome,
|
|
7107
7149
|
type: Div
|
|
7108
|
-
},
|
|
7109
|
-
childCount: 1,
|
|
7110
|
-
className: WelcomeMessage,
|
|
7111
|
-
type: P
|
|
7112
|
-
}, text(loadErrorMessage)];
|
|
7150
|
+
}, welcomeMessageNode, text(loadErrorMessage)];
|
|
7113
7151
|
const buttonDom = showOpenAnotherFolderButton ? [{
|
|
7114
7152
|
childCount: 1,
|
|
7115
7153
|
className: mergeClassNames(Button$2, ButtonPrimary, isWide ? ButtonWide : ButtonNarrow),
|
|
@@ -7121,6 +7159,11 @@ const getLoadErrorVirtualDom = (loadErrorMessage, isWide, showOpenAnotherFolderB
|
|
|
7121
7159
|
return [parentNode, ...errorDom, ...buttonDom];
|
|
7122
7160
|
};
|
|
7123
7161
|
|
|
7162
|
+
const scrollBarThumbNode = {
|
|
7163
|
+
childCount: 0,
|
|
7164
|
+
className: ScrollBarThumb,
|
|
7165
|
+
type: Div
|
|
7166
|
+
};
|
|
7124
7167
|
const getScrollBarVirtualDom = scrollBarHeight => {
|
|
7125
7168
|
const shouldShowScrollbar = scrollBarHeight > 0;
|
|
7126
7169
|
if (!shouldShowScrollbar) {
|
|
@@ -7130,11 +7173,7 @@ const getScrollBarVirtualDom = scrollBarHeight => {
|
|
|
7130
7173
|
childCount: 1,
|
|
7131
7174
|
className: mergeClassNames(ScrollBar, ScrollBarSmall),
|
|
7132
7175
|
type: Div
|
|
7133
|
-
},
|
|
7134
|
-
childCount: 0,
|
|
7135
|
-
className: ScrollBarThumb,
|
|
7136
|
-
type: Div
|
|
7137
|
-
}];
|
|
7176
|
+
}, scrollBarThumbNode];
|
|
7138
7177
|
};
|
|
7139
7178
|
|
|
7140
7179
|
const getParentNode = childCount => {
|
|
@@ -7155,7 +7194,7 @@ const getChildCount = (scrollBarDomLength, errorDomLength) => {
|
|
|
7155
7194
|
}
|
|
7156
7195
|
return childCount;
|
|
7157
7196
|
};
|
|
7158
|
-
const getExplorerVirtualDom = (visibleItems, focusedIndex, root, isWide, focused, dropTargets, height, contentHeight, editingErrorMessage, loadErrorMessage, showOpenAnotherFolderButton) => {
|
|
7197
|
+
const getExplorerVirtualDom = (visibleItems, focusedIndex, root, isWide, focused, dropTargets, height, contentHeight, editingErrorMessage, loadErrorMessage, showOpenAnotherFolderButton, editingSessionId = 0) => {
|
|
7159
7198
|
if (!root) {
|
|
7160
7199
|
return getExplorerWelcomeVirtualDom(isWide, dropTargets);
|
|
7161
7200
|
}
|
|
@@ -7167,7 +7206,7 @@ const getExplorerVirtualDom = (visibleItems, focusedIndex, root, isWide, focused
|
|
|
7167
7206
|
const errorDom = getErrorMessageDom(editingErrorMessage);
|
|
7168
7207
|
const childCount = getChildCount(scrollBarDom.length, errorDom.length);
|
|
7169
7208
|
const parentNode = getParentNode(childCount);
|
|
7170
|
-
const dom = [parentNode, ...getListItemsVirtualDom(visibleItems, focusedIndex, focused, dropTargets), ...scrollBarDom, ...errorDom];
|
|
7209
|
+
const dom = [parentNode, ...getListItemsVirtualDom(visibleItems, focusedIndex, focused, dropTargets, editingSessionId), ...scrollBarDom, ...errorDom];
|
|
7171
7210
|
return dom;
|
|
7172
7211
|
};
|
|
7173
7212
|
|
|
@@ -7196,6 +7235,7 @@ const renderItems = (oldState, newState) => {
|
|
|
7196
7235
|
const {
|
|
7197
7236
|
dropTargets,
|
|
7198
7237
|
editingErrorMessage,
|
|
7238
|
+
editingSessionId,
|
|
7199
7239
|
focused,
|
|
7200
7240
|
focusedIndex,
|
|
7201
7241
|
height,
|
|
@@ -7213,7 +7253,7 @@ const renderItems = (oldState, newState) => {
|
|
|
7213
7253
|
if (initial) {
|
|
7214
7254
|
return [SetDom2, newState.uid, []];
|
|
7215
7255
|
}
|
|
7216
|
-
const dom = getExplorerVirtualDom(visibleDirents, focusedIndex, root, isWide, focused, dropTargets, height, contentHeight, editingErrorMessage, loadErrorMessage, showOpenAnotherFolderButton);
|
|
7256
|
+
const dom = getExplorerVirtualDom(visibleDirents, focusedIndex, root, isWide, focused, dropTargets, height, contentHeight, editingErrorMessage, loadErrorMessage, showOpenAnotherFolderButton, editingSessionId);
|
|
7217
7257
|
return [SetDom2, newState.uid, dom];
|
|
7218
7258
|
};
|
|
7219
7259
|
|
|
@@ -7326,7 +7366,7 @@ const getActions = (root, isReadonly) => {
|
|
|
7326
7366
|
const getIconVirtualDom = (icon, type = Div) => {
|
|
7327
7367
|
return {
|
|
7328
7368
|
childCount: 0,
|
|
7329
|
-
className:
|
|
7369
|
+
className: mergeClassNames('MaskIcon', `MaskIcon${icon}`),
|
|
7330
7370
|
role: None,
|
|
7331
7371
|
type
|
|
7332
7372
|
};
|
|
@@ -7378,7 +7418,7 @@ const renderActions = uid => {
|
|
|
7378
7418
|
const renderEventListeners = () => {
|
|
7379
7419
|
return [{
|
|
7380
7420
|
name: HandleInputBlur,
|
|
7381
|
-
params: ['handleInputBlur']
|
|
7421
|
+
params: ['handleInputBlur', 'event.target.dataset.editingSessionId']
|
|
7382
7422
|
}, {
|
|
7383
7423
|
name: HandleListFocus,
|
|
7384
7424
|
params: ['handleFocus', IsTrusted, EventTargetClassName]
|
|
@@ -7742,7 +7782,8 @@ const updateEditingValue = async (state, value, inputSource = User) => {
|
|
|
7742
7782
|
...state,
|
|
7743
7783
|
editingErrorMessage,
|
|
7744
7784
|
editingIcon,
|
|
7745
|
-
editingValue: value
|
|
7785
|
+
editingValue: value,
|
|
7786
|
+
inputSource
|
|
7746
7787
|
};
|
|
7747
7788
|
};
|
|
7748
7789
|
|