@lvce-editor/explorer-view 7.11.0 → 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 +137 -101
- 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,
|
|
@@ -5351,7 +5376,7 @@ const isEqual = (a, b) => {
|
|
|
5351
5376
|
};
|
|
5352
5377
|
|
|
5353
5378
|
const handleDragOverIndex = (state, index) => {
|
|
5354
|
-
if (state.isReadonly) {
|
|
5379
|
+
if (state.isReadonly && state.root !== '') {
|
|
5355
5380
|
return state;
|
|
5356
5381
|
}
|
|
5357
5382
|
const {
|
|
@@ -5370,7 +5395,7 @@ const handleDragOverIndex = (state, index) => {
|
|
|
5370
5395
|
const handleDragOver = (state, x, y) => {
|
|
5371
5396
|
number(x);
|
|
5372
5397
|
number(y);
|
|
5373
|
-
if (state.isReadonly) {
|
|
5398
|
+
if (state.isReadonly && state.root !== '') {
|
|
5374
5399
|
return state;
|
|
5375
5400
|
}
|
|
5376
5401
|
const index = getIndexFromPosition(state, x, y);
|
|
@@ -5629,7 +5654,7 @@ const loadContent = async (state, savedState) => {
|
|
|
5629
5654
|
// TODO path separator could be restored from saved state
|
|
5630
5655
|
const [pathSeparator, isReadonly$1] = await Promise.all([getPathSeparator(root),
|
|
5631
5656
|
// TODO only load path separator once
|
|
5632
|
-
isReadonly(root)]);
|
|
5657
|
+
root === '' ? false : isReadonly(root)]);
|
|
5633
5658
|
const restoredDirents = await restoreExpandedState(savedState, root, pathSeparator, excluded);
|
|
5634
5659
|
const rawDeltaY = getRestoredDeltaY(savedState);
|
|
5635
5660
|
const maxDeltaY = Math.max(restoredDirents.length * itemHeight - height, 0);
|
|
@@ -5924,7 +5949,7 @@ const getModule = isElectron => {
|
|
|
5924
5949
|
return handleDrop$2;
|
|
5925
5950
|
};
|
|
5926
5951
|
const handleDropRoot = async (state, fileHandles, files, paths) => {
|
|
5927
|
-
if (state.isReadonly) {
|
|
5952
|
+
if (state.isReadonly && state.root !== '') {
|
|
5928
5953
|
return state;
|
|
5929
5954
|
}
|
|
5930
5955
|
const isElectron = state.platform === Electron;
|
|
@@ -6038,7 +6063,7 @@ const getFilePaths = async (files, platform) => {
|
|
|
6038
6063
|
};
|
|
6039
6064
|
|
|
6040
6065
|
const handleDrop = async (state, x, y, fileIds, fileList) => {
|
|
6041
|
-
if (state.isReadonly) {
|
|
6066
|
+
if (state.isReadonly && state.root !== '') {
|
|
6042
6067
|
return state;
|
|
6043
6068
|
}
|
|
6044
6069
|
try {
|
|
@@ -6096,19 +6121,23 @@ const handleIconThemeChange = state => {
|
|
|
6096
6121
|
return updateIcons(state);
|
|
6097
6122
|
};
|
|
6098
6123
|
|
|
6099
|
-
const handleInputBlur = async state => {
|
|
6124
|
+
const handleInputBlur = async (state, editingSessionId) => {
|
|
6100
6125
|
const {
|
|
6101
6126
|
editingErrorMessage,
|
|
6102
6127
|
editingIndex,
|
|
6128
|
+
editingSessionId: currentEditingSessionId,
|
|
6103
6129
|
editingValue
|
|
6104
6130
|
} = state;
|
|
6105
6131
|
if (editingIndex === -1) {
|
|
6106
6132
|
return state;
|
|
6107
6133
|
}
|
|
6134
|
+
if (editingSessionId !== undefined && editingSessionId !== String(currentEditingSessionId)) {
|
|
6135
|
+
return state;
|
|
6136
|
+
}
|
|
6108
6137
|
if (editingErrorMessage || !editingValue) {
|
|
6109
6138
|
return cancelEditInternal(state, false);
|
|
6110
6139
|
}
|
|
6111
|
-
return acceptEdit(state);
|
|
6140
|
+
return acceptEdit(state, User);
|
|
6112
6141
|
};
|
|
6113
6142
|
|
|
6114
6143
|
const handleInputClick = state => {
|
|
@@ -6661,14 +6690,12 @@ const getRenameSelectionRange = name => {
|
|
|
6661
6690
|
};
|
|
6662
6691
|
};
|
|
6663
6692
|
|
|
6664
|
-
const User = 1;
|
|
6665
|
-
const Script = 2;
|
|
6666
|
-
|
|
6667
6693
|
const renameDirent = async state => {
|
|
6668
6694
|
if (state.isReadonly) {
|
|
6669
6695
|
return state;
|
|
6670
6696
|
}
|
|
6671
6697
|
const {
|
|
6698
|
+
editingSessionId,
|
|
6672
6699
|
focusedIndex,
|
|
6673
6700
|
icons,
|
|
6674
6701
|
items,
|
|
@@ -6689,6 +6716,7 @@ const renameDirent = async state => {
|
|
|
6689
6716
|
editingIndex: focusedIndex,
|
|
6690
6717
|
editingSelectionEnd: end,
|
|
6691
6718
|
editingSelectionStart: start,
|
|
6719
|
+
editingSessionId: editingSessionId + 1,
|
|
6692
6720
|
editingType: Rename$1,
|
|
6693
6721
|
editingValue: item.name,
|
|
6694
6722
|
focus: Input$1,
|
|
@@ -6909,6 +6937,18 @@ const HandlePointerDown = 14;
|
|
|
6909
6937
|
const HandleWheel = 15;
|
|
6910
6938
|
const HandleDoubleClick = 16;
|
|
6911
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
|
+
};
|
|
6912
6952
|
const getClassName$1 = dropTargets => {
|
|
6913
6953
|
const extraClassName = dropTargets === dropTargetFull ? ExplorerDropTarget : Empty;
|
|
6914
6954
|
return mergeClassNames(Viewlet, Explorer$1, extraClassName);
|
|
@@ -6921,17 +6961,9 @@ const getExplorerWelcomeVirtualDom = (isWide, dropTargets) => {
|
|
|
6921
6961
|
onDragLeave: HandleDragLeave,
|
|
6922
6962
|
onDragOver: HandleDragOver,
|
|
6923
6963
|
onDrop: HandleDrop,
|
|
6924
|
-
tabIndex:
|
|
6964
|
+
tabIndex: Focusable,
|
|
6925
6965
|
type: Div
|
|
6926
|
-
}, {
|
|
6927
|
-
childCount: 2,
|
|
6928
|
-
className: Welcome,
|
|
6929
|
-
type: Div
|
|
6930
|
-
}, {
|
|
6931
|
-
childCount: 1,
|
|
6932
|
-
className: WelcomeMessage,
|
|
6933
|
-
type: P
|
|
6934
|
-
}, text(youHaveNotYetOpenedAFolder()), {
|
|
6966
|
+
}, welcomeNode, welcomeMessageNode$1, text(youHaveNotYetOpenedAFolder()), {
|
|
6935
6967
|
childCount: 1,
|
|
6936
6968
|
className: mergeClassNames(Button$2, ButtonPrimary, isWide ? ButtonWide : ButtonNarrow),
|
|
6937
6969
|
name: OpenFolder,
|
|
@@ -6974,7 +7006,7 @@ const getInputClassName = hasEditingError => {
|
|
|
6974
7006
|
return ExplorerInputBox;
|
|
6975
7007
|
};
|
|
6976
7008
|
|
|
6977
|
-
const getInputDom = (isEditing, hasEditingError) => {
|
|
7009
|
+
const getInputDom = (isEditing, hasEditingError, editingSessionId) => {
|
|
6978
7010
|
if (!isEditing) {
|
|
6979
7011
|
return [];
|
|
6980
7012
|
}
|
|
@@ -6986,6 +7018,7 @@ const getInputDom = (isEditing, hasEditingError) => {
|
|
|
6986
7018
|
autocorrect: 'off',
|
|
6987
7019
|
childCount: 0,
|
|
6988
7020
|
className: getInputClassName(hasEditingError),
|
|
7021
|
+
'data-editingSessionId': editingSessionId,
|
|
6989
7022
|
id: 'ExplorerInput',
|
|
6990
7023
|
name: ExplorerInput,
|
|
6991
7024
|
onBlur: HandleInputBlur,
|
|
@@ -7021,7 +7054,7 @@ const getTitle = path => {
|
|
|
7021
7054
|
}
|
|
7022
7055
|
return path;
|
|
7023
7056
|
};
|
|
7024
|
-
const getExplorerItemVirtualDom = item => {
|
|
7057
|
+
const getExplorerItemVirtualDom = (item, editingSessionId = 0) => {
|
|
7025
7058
|
const {
|
|
7026
7059
|
ariaExpanded,
|
|
7027
7060
|
chevron,
|
|
@@ -7041,7 +7074,6 @@ const getExplorerItemVirtualDom = item => {
|
|
|
7041
7074
|
} = item;
|
|
7042
7075
|
const chevronDom = getChevronVirtualDom(chevron);
|
|
7043
7076
|
return [{
|
|
7044
|
-
ariaDescription: '',
|
|
7045
7077
|
ariaExpanded,
|
|
7046
7078
|
ariaLabel: name,
|
|
7047
7079
|
ariaLevel: depth,
|
|
@@ -7055,7 +7087,7 @@ const getExplorerItemVirtualDom = item => {
|
|
|
7055
7087
|
role: TreeItem,
|
|
7056
7088
|
title: getTitle(path),
|
|
7057
7089
|
type: Div
|
|
7058
|
-
}, ...chevronDom, getFileIconVirtualDom(icon), ...getInputDom(isEditing, hasEditingError), ...getLabelDom(isEditing, name, isCut || isIgnored)];
|
|
7090
|
+
}, ...chevronDom, getFileIconVirtualDom(icon), ...getInputDom(isEditing, hasEditingError, editingSessionId), ...getLabelDom(isEditing, name, isCut || isIgnored)];
|
|
7059
7091
|
};
|
|
7060
7092
|
|
|
7061
7093
|
const getActiveDescendant = focusedIndex => {
|
|
@@ -7070,7 +7102,7 @@ const getClassName = (focused, focusedIndex, dropTarget) => {
|
|
|
7070
7102
|
const className = mergeClassNames(ListItems, extraClass1, extraClass2);
|
|
7071
7103
|
return className;
|
|
7072
7104
|
};
|
|
7073
|
-
const getListItemsVirtualDom = (visibleItems, focusedIndex, focused, dropTargets) => {
|
|
7105
|
+
const getListItemsVirtualDom = (visibleItems, focusedIndex, focused, dropTargets, editingSessionId = 0) => {
|
|
7074
7106
|
const dom = [{
|
|
7075
7107
|
ariaActiveDescendant: getActiveDescendant(focusedIndex),
|
|
7076
7108
|
ariaLabel: filesExplorer(),
|
|
@@ -7089,13 +7121,18 @@ const getListItemsVirtualDom = (visibleItems, focusedIndex, focused, dropTargets
|
|
|
7089
7121
|
onPointerDown: HandlePointerDown,
|
|
7090
7122
|
onWheel: HandleWheel,
|
|
7091
7123
|
role: Tree,
|
|
7092
|
-
tabIndex:
|
|
7124
|
+
tabIndex: Focusable,
|
|
7093
7125
|
type: Div
|
|
7094
7126
|
// onKeyDown: DomEventListenerFunctions.HandleListKeyDown,
|
|
7095
|
-
}, ...visibleItems.flatMap(getExplorerItemVirtualDom)];
|
|
7127
|
+
}, ...visibleItems.flatMap(item => getExplorerItemVirtualDom(item, editingSessionId))];
|
|
7096
7128
|
return dom;
|
|
7097
7129
|
};
|
|
7098
7130
|
|
|
7131
|
+
const welcomeMessageNode = {
|
|
7132
|
+
childCount: 1,
|
|
7133
|
+
className: WelcomeMessage,
|
|
7134
|
+
type: P
|
|
7135
|
+
};
|
|
7099
7136
|
const getParentNode$1 = childCount => {
|
|
7100
7137
|
return {
|
|
7101
7138
|
childCount,
|
|
@@ -7110,11 +7147,7 @@ const getLoadErrorVirtualDom = (loadErrorMessage, isWide, showOpenAnotherFolderB
|
|
|
7110
7147
|
childCount,
|
|
7111
7148
|
className: Welcome,
|
|
7112
7149
|
type: Div
|
|
7113
|
-
},
|
|
7114
|
-
childCount: 1,
|
|
7115
|
-
className: WelcomeMessage,
|
|
7116
|
-
type: P
|
|
7117
|
-
}, text(loadErrorMessage)];
|
|
7150
|
+
}, welcomeMessageNode, text(loadErrorMessage)];
|
|
7118
7151
|
const buttonDom = showOpenAnotherFolderButton ? [{
|
|
7119
7152
|
childCount: 1,
|
|
7120
7153
|
className: mergeClassNames(Button$2, ButtonPrimary, isWide ? ButtonWide : ButtonNarrow),
|
|
@@ -7126,6 +7159,11 @@ const getLoadErrorVirtualDom = (loadErrorMessage, isWide, showOpenAnotherFolderB
|
|
|
7126
7159
|
return [parentNode, ...errorDom, ...buttonDom];
|
|
7127
7160
|
};
|
|
7128
7161
|
|
|
7162
|
+
const scrollBarThumbNode = {
|
|
7163
|
+
childCount: 0,
|
|
7164
|
+
className: ScrollBarThumb,
|
|
7165
|
+
type: Div
|
|
7166
|
+
};
|
|
7129
7167
|
const getScrollBarVirtualDom = scrollBarHeight => {
|
|
7130
7168
|
const shouldShowScrollbar = scrollBarHeight > 0;
|
|
7131
7169
|
if (!shouldShowScrollbar) {
|
|
@@ -7135,11 +7173,7 @@ const getScrollBarVirtualDom = scrollBarHeight => {
|
|
|
7135
7173
|
childCount: 1,
|
|
7136
7174
|
className: mergeClassNames(ScrollBar, ScrollBarSmall),
|
|
7137
7175
|
type: Div
|
|
7138
|
-
},
|
|
7139
|
-
childCount: 0,
|
|
7140
|
-
className: ScrollBarThumb,
|
|
7141
|
-
type: Div
|
|
7142
|
-
}];
|
|
7176
|
+
}, scrollBarThumbNode];
|
|
7143
7177
|
};
|
|
7144
7178
|
|
|
7145
7179
|
const getParentNode = childCount => {
|
|
@@ -7160,7 +7194,7 @@ const getChildCount = (scrollBarDomLength, errorDomLength) => {
|
|
|
7160
7194
|
}
|
|
7161
7195
|
return childCount;
|
|
7162
7196
|
};
|
|
7163
|
-
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) => {
|
|
7164
7198
|
if (!root) {
|
|
7165
7199
|
return getExplorerWelcomeVirtualDom(isWide, dropTargets);
|
|
7166
7200
|
}
|
|
@@ -7172,7 +7206,7 @@ const getExplorerVirtualDom = (visibleItems, focusedIndex, root, isWide, focused
|
|
|
7172
7206
|
const errorDom = getErrorMessageDom(editingErrorMessage);
|
|
7173
7207
|
const childCount = getChildCount(scrollBarDom.length, errorDom.length);
|
|
7174
7208
|
const parentNode = getParentNode(childCount);
|
|
7175
|
-
const dom = [parentNode, ...getListItemsVirtualDom(visibleItems, focusedIndex, focused, dropTargets), ...scrollBarDom, ...errorDom];
|
|
7209
|
+
const dom = [parentNode, ...getListItemsVirtualDom(visibleItems, focusedIndex, focused, dropTargets, editingSessionId), ...scrollBarDom, ...errorDom];
|
|
7176
7210
|
return dom;
|
|
7177
7211
|
};
|
|
7178
7212
|
|
|
@@ -7201,6 +7235,7 @@ const renderItems = (oldState, newState) => {
|
|
|
7201
7235
|
const {
|
|
7202
7236
|
dropTargets,
|
|
7203
7237
|
editingErrorMessage,
|
|
7238
|
+
editingSessionId,
|
|
7204
7239
|
focused,
|
|
7205
7240
|
focusedIndex,
|
|
7206
7241
|
height,
|
|
@@ -7218,7 +7253,7 @@ const renderItems = (oldState, newState) => {
|
|
|
7218
7253
|
if (initial) {
|
|
7219
7254
|
return [SetDom2, newState.uid, []];
|
|
7220
7255
|
}
|
|
7221
|
-
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);
|
|
7222
7257
|
return [SetDom2, newState.uid, dom];
|
|
7223
7258
|
};
|
|
7224
7259
|
|
|
@@ -7331,7 +7366,7 @@ const getActions = (root, isReadonly) => {
|
|
|
7331
7366
|
const getIconVirtualDom = (icon, type = Div) => {
|
|
7332
7367
|
return {
|
|
7333
7368
|
childCount: 0,
|
|
7334
|
-
className:
|
|
7369
|
+
className: mergeClassNames('MaskIcon', `MaskIcon${icon}`),
|
|
7335
7370
|
role: None,
|
|
7336
7371
|
type
|
|
7337
7372
|
};
|
|
@@ -7383,7 +7418,7 @@ const renderActions = uid => {
|
|
|
7383
7418
|
const renderEventListeners = () => {
|
|
7384
7419
|
return [{
|
|
7385
7420
|
name: HandleInputBlur,
|
|
7386
|
-
params: ['handleInputBlur']
|
|
7421
|
+
params: ['handleInputBlur', 'event.target.dataset.editingSessionId']
|
|
7387
7422
|
}, {
|
|
7388
7423
|
name: HandleListFocus,
|
|
7389
7424
|
params: ['handleFocus', IsTrusted, EventTargetClassName]
|
|
@@ -7747,7 +7782,8 @@ const updateEditingValue = async (state, value, inputSource = User) => {
|
|
|
7747
7782
|
...state,
|
|
7748
7783
|
editingErrorMessage,
|
|
7749
7784
|
editingIcon,
|
|
7750
|
-
editingValue: value
|
|
7785
|
+
editingValue: value,
|
|
7786
|
+
inputSource
|
|
7751
7787
|
};
|
|
7752
7788
|
};
|
|
7753
7789
|
|