@lvce-editor/explorer-view 7.24.0 → 7.24.2
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.
|
@@ -2485,6 +2485,11 @@ const validateFileName2 = (name, siblingFileNames = []) => {
|
|
|
2485
2485
|
return '';
|
|
2486
2486
|
};
|
|
2487
2487
|
|
|
2488
|
+
const focusEditorAfterExplorerRender = () => {
|
|
2489
|
+
setTimeout(() => {
|
|
2490
|
+
void invoke$3('Main.focus');
|
|
2491
|
+
}, 0);
|
|
2492
|
+
};
|
|
2488
2493
|
const acceptCreate = async (state, newDirentType) => {
|
|
2489
2494
|
const {
|
|
2490
2495
|
editingValue,
|
|
@@ -2524,12 +2529,13 @@ const acceptCreate = async (state, newDirentType) => {
|
|
|
2524
2529
|
await refreshWorkspace();
|
|
2525
2530
|
if (newDirentType === File) {
|
|
2526
2531
|
await openUri(absolutePath, true);
|
|
2532
|
+
focusEditorAfterExplorerRender();
|
|
2527
2533
|
}
|
|
2528
2534
|
return {
|
|
2529
2535
|
...state,
|
|
2530
2536
|
editingIndex: -1,
|
|
2531
2537
|
editingType: None$6,
|
|
2532
|
-
focus: List,
|
|
2538
|
+
focus: newDirentType === File ? None$5 : List,
|
|
2533
2539
|
focusedIndex: newFocusedIndex,
|
|
2534
2540
|
items: dirents
|
|
2535
2541
|
};
|
|
@@ -4867,7 +4873,16 @@ const getNewDirentsForNewDirent = async (items, focusedIndex, type, root, exclud
|
|
|
4867
4873
|
// Create new array with updated items
|
|
4868
4874
|
const parentIndex = focusedIndex;
|
|
4869
4875
|
const itemsBeforeParent = items.slice(0, parentIndex);
|
|
4870
|
-
const
|
|
4876
|
+
const parentEndIndex = getParentEndIndex(items, parentIndex);
|
|
4877
|
+
const existingDescendants = items.slice(parentIndex + 1, parentEndIndex);
|
|
4878
|
+
let childIndex = 0;
|
|
4879
|
+
for (let i = 0; i < existingDescendants.length; i++) {
|
|
4880
|
+
if (existingDescendants[i].depth === depth) {
|
|
4881
|
+
existingDescendants[i] = updatedChildren[childIndex++];
|
|
4882
|
+
}
|
|
4883
|
+
}
|
|
4884
|
+
const newChildren = existingDescendants.length === 0 ? updatedChildren : [...existingDescendants, updatedChildren.at(-1)];
|
|
4885
|
+
const itemsAfterChildren = items.slice(parentEndIndex);
|
|
4871
4886
|
let updatedParent = {
|
|
4872
4887
|
...items[parentIndex],
|
|
4873
4888
|
setSize: (items[parentIndex]?.setSize || 0) + 1
|
|
@@ -4880,7 +4895,7 @@ const getNewDirentsForNewDirent = async (items, focusedIndex, type, root, exclud
|
|
|
4880
4895
|
type: DirectoryExpanded
|
|
4881
4896
|
};
|
|
4882
4897
|
}
|
|
4883
|
-
return [...itemsBeforeParent, updatedParent, ...
|
|
4898
|
+
return [...itemsBeforeParent, updatedParent, ...newChildren, ...itemsAfterChildren];
|
|
4884
4899
|
};
|
|
4885
4900
|
|
|
4886
4901
|
const getNewDirentType = editingType => {
|