@lvce-editor/explorer-view 7.23.3 → 7.24.1
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
|
};
|
|
@@ -6523,9 +6529,19 @@ const set = rpc => {
|
|
|
6523
6529
|
state.connected = true;
|
|
6524
6530
|
};
|
|
6525
6531
|
|
|
6526
|
-
const handleMessagePort = async port => {
|
|
6532
|
+
const handleMessagePort = async (port, viewletCommandMap) => {
|
|
6533
|
+
const executeViewletCommand = async (uid, command, ...args) => {
|
|
6534
|
+
const fn = viewletCommandMap[`Explorer.${command}`];
|
|
6535
|
+
if (typeof fn !== 'function') {
|
|
6536
|
+
throw new TypeError(`Viewlet command not found: ${command}`);
|
|
6537
|
+
}
|
|
6538
|
+
await fn(uid, ...args);
|
|
6539
|
+
await invoke$3('Viewlet.requestRender', uid);
|
|
6540
|
+
};
|
|
6527
6541
|
const rpc = await create$6({
|
|
6528
|
-
commandMap: {
|
|
6542
|
+
commandMap: {
|
|
6543
|
+
'Viewlet.executeViewletCommand': executeViewletCommand
|
|
6544
|
+
},
|
|
6529
6545
|
messagePort: port
|
|
6530
6546
|
});
|
|
6531
6547
|
set(rpc);
|
|
@@ -8320,6 +8336,7 @@ const updateEditingValue = async (state, value, inputSource = User) => {
|
|
|
8320
8336
|
};
|
|
8321
8337
|
};
|
|
8322
8338
|
|
|
8339
|
+
const handleDirectMessagePort = port => handleMessagePort(port, commandMap);
|
|
8323
8340
|
const commandMap = {
|
|
8324
8341
|
'Explorer.acceptEdit': wrapListItemCommand(acceptEdit),
|
|
8325
8342
|
'Explorer.cancelEdit': wrapListItemCommand(cancelEdit),
|
|
@@ -8376,7 +8393,7 @@ const commandMap = {
|
|
|
8376
8393
|
'Explorer.handleInputClick': wrapListItemCommand(handleInputClick),
|
|
8377
8394
|
'Explorer.handleInputKeyDown': wrapListItemCommand(handleInputKeyDown),
|
|
8378
8395
|
'Explorer.handleKeyDown': wrapListItemCommand(handleKeyDown),
|
|
8379
|
-
'Explorer.handleMessagePort':
|
|
8396
|
+
'Explorer.handleMessagePort': handleDirectMessagePort,
|
|
8380
8397
|
'Explorer.handleNativePaste': wrapListItemCommand(handleNativePaste),
|
|
8381
8398
|
'Explorer.handlePaste': wrapListItemCommand(handlePaste),
|
|
8382
8399
|
'Explorer.handlePointerDown': wrapListItemCommand(handlePointerDown),
|