@lvce-editor/explorer-view 7.27.1 → 7.29.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 +132 -63
- package/package.json +1 -1
|
@@ -1355,10 +1355,10 @@ const Button$3 = 'event.button';
|
|
|
1355
1355
|
const ClientX = 'event.clientX';
|
|
1356
1356
|
const ClientY = 'event.clientY';
|
|
1357
1357
|
const CtrlKey = 'event.ctrlKey';
|
|
1358
|
-
const DataTransferFiles2 = 'event.dataTransfer.files2';
|
|
1359
1358
|
const DefaultPrevented = 'event.defaultPrevented';
|
|
1360
1359
|
const DeltaMode = 'event.deltaMode';
|
|
1361
1360
|
const DeltaY = 'event.deltaY';
|
|
1361
|
+
const DropId = 'event.dropId';
|
|
1362
1362
|
const EventTargetClassName = 'event.target.className';
|
|
1363
1363
|
const IsTrusted = 'event.isTrusted';
|
|
1364
1364
|
const Key = 'event.key';
|
|
@@ -1416,6 +1416,12 @@ const {
|
|
|
1416
1416
|
const getDroppedItems$1 = async (itemIds, isElectron) => {
|
|
1417
1417
|
return invoke$6('DragAndDrop.getDroppedItems', itemIds, isElectron);
|
|
1418
1418
|
};
|
|
1419
|
+
const getDroppedItemsByDropId = async (dropId, isElectron) => {
|
|
1420
|
+
return invoke$6('DragAndDrop.getDroppedItemsByDropId', dropId, isElectron);
|
|
1421
|
+
};
|
|
1422
|
+
const discardDrop = async dropId => {
|
|
1423
|
+
await invoke$6('DragAndDrop.discardDrop', dropId);
|
|
1424
|
+
};
|
|
1419
1425
|
|
|
1420
1426
|
const {
|
|
1421
1427
|
set: set$8
|
|
@@ -1437,12 +1443,13 @@ const getIcons = async iconRequests => {
|
|
|
1437
1443
|
|
|
1438
1444
|
const {
|
|
1439
1445
|
invoke: invoke$4,
|
|
1446
|
+
invokeAndTransfer: invokeAndTransfer$2,
|
|
1440
1447
|
set: set$6
|
|
1441
1448
|
} = create$2(RendererProcess);
|
|
1442
1449
|
|
|
1443
1450
|
const {
|
|
1444
1451
|
invoke: invoke$3,
|
|
1445
|
-
invokeAndTransfer,
|
|
1452
|
+
invokeAndTransfer: invokeAndTransfer$1,
|
|
1446
1453
|
set: set$5
|
|
1447
1454
|
} = create$2(RendererWorker);
|
|
1448
1455
|
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
@@ -1452,21 +1459,17 @@ const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
|
1452
1459
|
number(y);
|
|
1453
1460
|
await invoke$3('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1454
1461
|
};
|
|
1455
|
-
const sendMessagePortToDragAndDropWorker = async port => {
|
|
1456
|
-
const command = 'DragAndDrop.handleMessagePort';
|
|
1457
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToDragAndDropWorker', port, command);
|
|
1458
|
-
};
|
|
1459
1462
|
const sendMessagePortToDialogWorker = async port => {
|
|
1460
1463
|
const command = 'HandleMessagePort.handleMessagePort';
|
|
1461
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToDialogWorker', port, command);
|
|
1464
|
+
await invokeAndTransfer$1('SendMessagePortToExtensionHostWorker.sendMessagePortToDialogWorker', port, command);
|
|
1462
1465
|
};
|
|
1463
1466
|
const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
|
|
1464
1467
|
const command = 'IconTheme.handleMessagePort';
|
|
1465
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
|
|
1468
|
+
await invokeAndTransfer$1('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
|
|
1466
1469
|
};
|
|
1467
1470
|
const sendMessagePortToFileSystemWorker$1 = async (port, rpcId) => {
|
|
1468
1471
|
const command = 'FileSystem.handleMessagePort';
|
|
1469
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
|
|
1472
|
+
await invokeAndTransfer$1('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
|
|
1470
1473
|
};
|
|
1471
1474
|
const confirm$1 = async (message, options) => {
|
|
1472
1475
|
const result = await invoke$3('ConfirmPrompt.prompt', message, options);
|
|
@@ -1477,7 +1480,7 @@ const writeClipBoardText = async text => {
|
|
|
1477
1480
|
};
|
|
1478
1481
|
const sendMessagePortToSourceControlWorker = async port => {
|
|
1479
1482
|
const command = 'SourceControl.handleMessagePort';
|
|
1480
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToSourceControlWorker', port, command, 0);
|
|
1483
|
+
await invokeAndTransfer$1('SendMessagePortToExtensionHostWorker.sendMessagePortToSourceControlWorker', port, command, 0);
|
|
1481
1484
|
};
|
|
1482
1485
|
const openUri$1 = async (uri, focus, options) => {
|
|
1483
1486
|
await invoke$3('Main.openUri', {
|
|
@@ -1500,7 +1503,8 @@ const create$1 = () => {
|
|
|
1500
1503
|
const commandQueues = new Map();
|
|
1501
1504
|
const generations = Object.create(null);
|
|
1502
1505
|
const states = Object.create(null);
|
|
1503
|
-
const commandMapRef =
|
|
1506
|
+
const commandMapRef = Object.create(null);
|
|
1507
|
+
const commandsById = Object.create(null);
|
|
1504
1508
|
const getGeneration = uid => generations[uid] || 0;
|
|
1505
1509
|
const isCurrentGeneration = (uid, generation) => {
|
|
1506
1510
|
return states[uid] !== undefined && getGeneration(uid) === generation;
|
|
@@ -1562,6 +1566,18 @@ const create$1 = () => {
|
|
|
1562
1566
|
delete states[key];
|
|
1563
1567
|
}
|
|
1564
1568
|
},
|
|
1569
|
+
createDirectEventCommandMap(requestRender) {
|
|
1570
|
+
return {
|
|
1571
|
+
async 'Viewlet.executeViewletCommand'(uid, command, ...args) {
|
|
1572
|
+
const fn = commandsById[command];
|
|
1573
|
+
if (!fn) {
|
|
1574
|
+
throw new Error(`Viewlet command not found: ${command}`);
|
|
1575
|
+
}
|
|
1576
|
+
await fn(uid, ...args);
|
|
1577
|
+
await requestRender(uid);
|
|
1578
|
+
}
|
|
1579
|
+
};
|
|
1580
|
+
},
|
|
1565
1581
|
diff(uid, modules, numbers) {
|
|
1566
1582
|
const {
|
|
1567
1583
|
oldState,
|
|
@@ -1593,6 +1609,9 @@ const create$1 = () => {
|
|
|
1593
1609
|
},
|
|
1594
1610
|
registerCommands(commandMap) {
|
|
1595
1611
|
Object.assign(commandMapRef, commandMap);
|
|
1612
|
+
for (const [key, fn] of Object.entries(commandMap)) {
|
|
1613
|
+
commandsById[toCommandId(key)] = fn;
|
|
1614
|
+
}
|
|
1596
1615
|
},
|
|
1597
1616
|
set(uid, oldState, newState, scheduledState) {
|
|
1598
1617
|
const current = states[uid];
|
|
@@ -2296,6 +2315,33 @@ const refreshWorkspace = async () => {
|
|
|
2296
2315
|
}
|
|
2297
2316
|
};
|
|
2298
2317
|
|
|
2318
|
+
const state$1 = {
|
|
2319
|
+
connected: false
|
|
2320
|
+
};
|
|
2321
|
+
const postRenderFocusRequests = new Set();
|
|
2322
|
+
const isConnected = () => {
|
|
2323
|
+
const {
|
|
2324
|
+
connected
|
|
2325
|
+
} = state$1;
|
|
2326
|
+
return connected;
|
|
2327
|
+
};
|
|
2328
|
+
const invoke = (method, ...params) => {
|
|
2329
|
+
return invoke$4(method, ...params);
|
|
2330
|
+
};
|
|
2331
|
+
const invokeAndTransfer = (method, ...params) => {
|
|
2332
|
+
return invokeAndTransfer$2(method, ...params);
|
|
2333
|
+
};
|
|
2334
|
+
const requestPostRenderFocus = uid => {
|
|
2335
|
+
postRenderFocusRequests.add(uid);
|
|
2336
|
+
};
|
|
2337
|
+
const set$2 = rpc => {
|
|
2338
|
+
set$6(rpc);
|
|
2339
|
+
state$1.connected = true;
|
|
2340
|
+
};
|
|
2341
|
+
const takePostRenderFocus = uid => {
|
|
2342
|
+
return postRenderFocusRequests.delete(uid);
|
|
2343
|
+
};
|
|
2344
|
+
|
|
2299
2345
|
const treeToArrayInternal = (map, root, items, path, depth) => {
|
|
2300
2346
|
const children = map[path];
|
|
2301
2347
|
if (!children) {
|
|
@@ -2490,6 +2536,16 @@ const focusEditorAfterExplorerRender = () => {
|
|
|
2490
2536
|
void invoke$3('Main.focus');
|
|
2491
2537
|
}, 0);
|
|
2492
2538
|
};
|
|
2539
|
+
const openCreatedFile = async absolutePath => {
|
|
2540
|
+
await openUri(absolutePath, true);
|
|
2541
|
+
focusEditorAfterExplorerRender();
|
|
2542
|
+
};
|
|
2543
|
+
const finishCreate = async (absolutePath, newDirentType) => {
|
|
2544
|
+
await refreshWorkspace();
|
|
2545
|
+
if (newDirentType === File) {
|
|
2546
|
+
await openCreatedFile(absolutePath);
|
|
2547
|
+
}
|
|
2548
|
+
};
|
|
2493
2549
|
const acceptCreate = async (state, newDirentType) => {
|
|
2494
2550
|
const {
|
|
2495
2551
|
editingValue,
|
|
@@ -2497,7 +2553,8 @@ const acceptCreate = async (state, newDirentType) => {
|
|
|
2497
2553
|
focusedIndex,
|
|
2498
2554
|
items,
|
|
2499
2555
|
pathSeparator,
|
|
2500
|
-
root
|
|
2556
|
+
root,
|
|
2557
|
+
uid
|
|
2501
2558
|
} = state;
|
|
2502
2559
|
const newFileName = editingValue;
|
|
2503
2560
|
const siblingFileNames = getSiblingFileNames(items, focusedIndex);
|
|
@@ -2526,10 +2583,13 @@ const acceptCreate = async (state, newDirentType) => {
|
|
|
2526
2583
|
const newItems = treeToArray$1(merged, root);
|
|
2527
2584
|
const dirents = newItems;
|
|
2528
2585
|
const newFocusedIndex = getIndex(newItems, absolutePath);
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2586
|
+
if (isConnected()) {
|
|
2587
|
+
if (newDirentType === File) {
|
|
2588
|
+
await openUri(absolutePath, true);
|
|
2589
|
+
requestPostRenderFocus(uid);
|
|
2590
|
+
}
|
|
2591
|
+
} else {
|
|
2592
|
+
await finishCreate(absolutePath, newDirentType);
|
|
2533
2593
|
}
|
|
2534
2594
|
return {
|
|
2535
2595
|
...state,
|
|
@@ -2811,11 +2871,15 @@ const toCollapsedDirent = dirent => {
|
|
|
2811
2871
|
|
|
2812
2872
|
const collapseAll = async state => {
|
|
2813
2873
|
const {
|
|
2814
|
-
|
|
2874
|
+
editingIndex
|
|
2815
2875
|
} = state;
|
|
2876
|
+
const stateWithoutEdit = editingIndex === -1 ? state : await cancelEditInternal(state, true);
|
|
2877
|
+
const {
|
|
2878
|
+
items
|
|
2879
|
+
} = stateWithoutEdit;
|
|
2816
2880
|
const newDirents = items.filter(isTopLevel).map(toCollapsedDirent);
|
|
2817
2881
|
return {
|
|
2818
|
-
...
|
|
2882
|
+
...stateWithoutEdit,
|
|
2819
2883
|
expandedPaths: [],
|
|
2820
2884
|
focusedIndex: 0,
|
|
2821
2885
|
items: newDirents
|
|
@@ -2905,16 +2969,16 @@ const copyRelativePath = async state => {
|
|
|
2905
2969
|
};
|
|
2906
2970
|
|
|
2907
2971
|
const missingDialogWorkerRelay = 'Command "SendMessagePortToExtensionHostWorker.sendMessagePortToDialogWorker" not found';
|
|
2908
|
-
const state
|
|
2972
|
+
const state = {
|
|
2909
2973
|
isTest: false
|
|
2910
2974
|
};
|
|
2911
2975
|
const setIsTest = value => {
|
|
2912
|
-
state
|
|
2976
|
+
state.isTest = value;
|
|
2913
2977
|
};
|
|
2914
2978
|
const confirm = async message => {
|
|
2915
2979
|
const {
|
|
2916
2980
|
isTest
|
|
2917
|
-
} = state
|
|
2981
|
+
} = state;
|
|
2918
2982
|
if (isTest) {
|
|
2919
2983
|
return confirm$1(message);
|
|
2920
2984
|
}
|
|
@@ -2929,7 +2993,7 @@ const confirm = async message => {
|
|
|
2929
2993
|
};
|
|
2930
2994
|
|
|
2931
2995
|
const commandCompletions = new WeakMap();
|
|
2932
|
-
const set$
|
|
2996
|
+
const set$1 = (state, completion) => {
|
|
2933
2997
|
commandCompletions.set(state, completion);
|
|
2934
2998
|
return state;
|
|
2935
2999
|
};
|
|
@@ -3750,7 +3814,7 @@ const {
|
|
|
3750
3814
|
get,
|
|
3751
3815
|
getCommandIds,
|
|
3752
3816
|
registerCommands,
|
|
3753
|
-
set
|
|
3817
|
+
set,
|
|
3754
3818
|
wrapGetter
|
|
3755
3819
|
} = create$1();
|
|
3756
3820
|
const commandQueues = new Map();
|
|
@@ -3883,10 +3947,10 @@ const wrapListItemCommandInternal = (fn, queued) => {
|
|
|
3883
3947
|
useChevrons
|
|
3884
3948
|
} = updatedState;
|
|
3885
3949
|
const intermediate = get(id);
|
|
3886
|
-
set
|
|
3950
|
+
set(id, intermediate.oldState, updatedState, intermediate.scheduledState);
|
|
3887
3951
|
if (hasSameVisibleExplorerItemInputs(intermediate.newState, updatedState)) {
|
|
3888
3952
|
if (updatedState.inputSource === User || !hasSameDragDataInputs(intermediate.newState, updatedState)) {
|
|
3889
|
-
set
|
|
3953
|
+
set(id, intermediate.oldState, updatedState);
|
|
3890
3954
|
}
|
|
3891
3955
|
return {
|
|
3892
3956
|
completion
|
|
@@ -3907,7 +3971,7 @@ const wrapListItemCommandInternal = (fn, queued) => {
|
|
|
3907
3971
|
visibleExplorerItems
|
|
3908
3972
|
};
|
|
3909
3973
|
const intermediate2 = get(id);
|
|
3910
|
-
set
|
|
3974
|
+
set(id, intermediate2.oldState, finalState);
|
|
3911
3975
|
maybeScheduleGitIgnoredUrisUpdate(newState, finalState);
|
|
3912
3976
|
return {
|
|
3913
3977
|
completion
|
|
@@ -4017,7 +4081,7 @@ const create = (id, uri, x, y, width, height, args, parentUid, platform = 0, ass
|
|
|
4017
4081
|
x,
|
|
4018
4082
|
y
|
|
4019
4083
|
};
|
|
4020
|
-
set
|
|
4084
|
+
set(state.uid, state, state);
|
|
4021
4085
|
return state;
|
|
4022
4086
|
};
|
|
4023
4087
|
|
|
@@ -4835,7 +4899,7 @@ const handleClickFile = async (state, dirent, index, keepFocus = false) => {
|
|
|
4835
4899
|
focused: keepFocus,
|
|
4836
4900
|
focusedIndex: index
|
|
4837
4901
|
};
|
|
4838
|
-
return set$
|
|
4902
|
+
return set$1(newState, completion);
|
|
4839
4903
|
};
|
|
4840
4904
|
|
|
4841
4905
|
const handleClickSymLink = async (state, dirent, index) => {
|
|
@@ -4902,13 +4966,13 @@ const NewFolder$1 = 'NewFolder';
|
|
|
4902
4966
|
const OpenFolder = 'OpenFolder';
|
|
4903
4967
|
const Refresh$1 = 'Refresh';
|
|
4904
4968
|
|
|
4905
|
-
const isFolder = direntType => {
|
|
4969
|
+
const isFolder$1 = direntType => {
|
|
4906
4970
|
return [Directory, DirectoryExpanded, SymLinkFolder].includes(direntType);
|
|
4907
4971
|
};
|
|
4908
4972
|
const getFittingIndex = (dirents, startIndex) => {
|
|
4909
4973
|
for (let i = startIndex; i >= 0; i--) {
|
|
4910
4974
|
const dirent = dirents[i];
|
|
4911
|
-
if (dirent && isFolder(dirent.type)) {
|
|
4975
|
+
if (dirent && isFolder$1(dirent.type)) {
|
|
4912
4976
|
return i;
|
|
4913
4977
|
}
|
|
4914
4978
|
}
|
|
@@ -4951,7 +5015,14 @@ const getNewChildDirentsForNewDirent = async (items, depth, parentPath, direntTy
|
|
|
4951
5015
|
return allChildDirents;
|
|
4952
5016
|
};
|
|
4953
5017
|
|
|
4954
|
-
const
|
|
5018
|
+
const isFolder = type => {
|
|
5019
|
+
return [Directory, DirectoryExpanded, DirectoryExpanding, SymLinkFolder].includes(type);
|
|
5020
|
+
};
|
|
5021
|
+
const getTopLevelFileIndex = items => {
|
|
5022
|
+
const topLevelDepth = items[0]?.depth;
|
|
5023
|
+
return items.findIndex(item => item.depth === topLevelDepth && !isFolder(item.type));
|
|
5024
|
+
};
|
|
5025
|
+
const getNewDirentsForNewDirent = async (items, focusedIndex, type, root, excluded = [], insertAtFolderBoundary = false) => {
|
|
4955
5026
|
if (items.length === 0 || focusedIndex === -1) {
|
|
4956
5027
|
const newDirent = {
|
|
4957
5028
|
depth: 0,
|
|
@@ -4966,7 +5037,14 @@ const getNewDirentsForNewDirent = async (items, focusedIndex, type, root, exclud
|
|
|
4966
5037
|
if (type === EditingFolder) {
|
|
4967
5038
|
return [newDirent, ...items];
|
|
4968
5039
|
}
|
|
4969
|
-
|
|
5040
|
+
if (!insertAtFolderBoundary) {
|
|
5041
|
+
return [...items, newDirent];
|
|
5042
|
+
}
|
|
5043
|
+
const fileIndex = getTopLevelFileIndex(items);
|
|
5044
|
+
if (fileIndex === -1) {
|
|
5045
|
+
return [...items, newDirent];
|
|
5046
|
+
}
|
|
5047
|
+
return [...items.slice(0, fileIndex), newDirent, ...items.slice(fileIndex)];
|
|
4970
5048
|
}
|
|
4971
5049
|
const focusedItem = items[focusedIndex];
|
|
4972
5050
|
if (!focusedItem) {
|
|
@@ -5016,7 +5094,6 @@ const getNewDirentType = editingType => {
|
|
|
5016
5094
|
};
|
|
5017
5095
|
|
|
5018
5096
|
const newDirent = async (state, editingType, editingIcon = '') => {
|
|
5019
|
-
// TODO do it like vscode, select position between folders and files
|
|
5020
5097
|
const {
|
|
5021
5098
|
editingIndex,
|
|
5022
5099
|
editingSessionId,
|
|
@@ -5030,7 +5107,7 @@ const newDirent = async (state, editingType, editingIcon = '') => {
|
|
|
5030
5107
|
}
|
|
5031
5108
|
const index = getFittingIndex(items, focusedIndex);
|
|
5032
5109
|
const direntType = getNewDirentType(editingType);
|
|
5033
|
-
const newDirents = await getNewDirentsForNewDirent(items, index, direntType, root, excluded);
|
|
5110
|
+
const newDirents = await getNewDirentsForNewDirent(items, index, direntType, root, excluded, focusedIndex === -1);
|
|
5034
5111
|
const newEditingIndex = newDirents.findIndex(item => item.type === EditingFile || item.type === EditingFolder);
|
|
5035
5112
|
return {
|
|
5036
5113
|
...state,
|
|
@@ -5264,7 +5341,7 @@ const handleClick = async (state, index, keepFocus = false) => {
|
|
|
5264
5341
|
...newState,
|
|
5265
5342
|
...resetEditing
|
|
5266
5343
|
};
|
|
5267
|
-
return completion ? set$
|
|
5344
|
+
return completion ? set$1(finalState, completion) : finalState;
|
|
5268
5345
|
};
|
|
5269
5346
|
|
|
5270
5347
|
// export const handleBlur=()=>{}
|
|
@@ -5412,7 +5489,7 @@ const handleContextMenuAtIndex = async (state, index, x, y) => {
|
|
|
5412
5489
|
focusedIndex: index,
|
|
5413
5490
|
items: newItems
|
|
5414
5491
|
};
|
|
5415
|
-
set
|
|
5492
|
+
set(uid, state, newState);
|
|
5416
5493
|
await show2(uid, Explorer, x, y, {
|
|
5417
5494
|
menuId: Explorer
|
|
5418
5495
|
});
|
|
@@ -5516,7 +5593,7 @@ const handleDoubleClick = async (state, eventX, eventY) => {
|
|
|
5516
5593
|
const item = state.items[index];
|
|
5517
5594
|
const type = normalizeDirentType(item.type);
|
|
5518
5595
|
if (type === File || type === SymLinkFile) {
|
|
5519
|
-
return set$
|
|
5596
|
+
return set$1(state, openUri(item.path, true));
|
|
5520
5597
|
}
|
|
5521
5598
|
return state;
|
|
5522
5599
|
};
|
|
@@ -6406,8 +6483,8 @@ const getDropHandler = index => {
|
|
|
6406
6483
|
}
|
|
6407
6484
|
};
|
|
6408
6485
|
|
|
6409
|
-
const getDroppedItems = async (
|
|
6410
|
-
const result = await getDroppedItems$1(
|
|
6486
|
+
const getDroppedItems = async (dropIdOrItemIds, isElectron) => {
|
|
6487
|
+
const result = typeof dropIdOrItemIds === 'number' ? await getDroppedItemsByDropId(dropIdOrItemIds, isElectron) : await getDroppedItems$1(dropIdOrItemIds, isElectron);
|
|
6411
6488
|
const files = isElectron ? result.files : result.files.filter(file => file.handle);
|
|
6412
6489
|
const fileHandles = files.map(file => file.handle || {
|
|
6413
6490
|
kind: file.kind,
|
|
@@ -6446,8 +6523,11 @@ const getInternalDragPaths = (items, uris) => {
|
|
|
6446
6523
|
return paths;
|
|
6447
6524
|
};
|
|
6448
6525
|
|
|
6449
|
-
const handleDrop = async (state, x, y,
|
|
6526
|
+
const handleDrop = async (state, x, y, dropIdOrFileIds) => {
|
|
6450
6527
|
if (state.isReadonly && state.root !== '') {
|
|
6528
|
+
if (typeof dropIdOrFileIds === 'number') {
|
|
6529
|
+
await discardDrop(dropIdOrFileIds);
|
|
6530
|
+
}
|
|
6451
6531
|
return state;
|
|
6452
6532
|
}
|
|
6453
6533
|
try {
|
|
@@ -6456,7 +6536,7 @@ const handleDrop = async (state, x, y, fileIds) => {
|
|
|
6456
6536
|
fileHandles,
|
|
6457
6537
|
paths,
|
|
6458
6538
|
uris
|
|
6459
|
-
} = await getDroppedItems(
|
|
6539
|
+
} = await getDroppedItems(dropIdOrFileIds, isElectron);
|
|
6460
6540
|
const internalPaths = getInternalDragPaths(state.items, uris);
|
|
6461
6541
|
const droppedPaths = internalPaths.length > 0 ? internalPaths : paths;
|
|
6462
6542
|
const index = getIndexFromPosition(state, x, y);
|
|
@@ -6601,23 +6681,6 @@ const handleKeyDown = (state, defaultPrevented, key) => {
|
|
|
6601
6681
|
};
|
|
6602
6682
|
};
|
|
6603
6683
|
|
|
6604
|
-
const state = {
|
|
6605
|
-
connected: false
|
|
6606
|
-
};
|
|
6607
|
-
const isConnected = () => {
|
|
6608
|
-
const {
|
|
6609
|
-
connected
|
|
6610
|
-
} = state;
|
|
6611
|
-
return connected;
|
|
6612
|
-
};
|
|
6613
|
-
const invoke = (method, ...params) => {
|
|
6614
|
-
return invoke$4(method, ...params);
|
|
6615
|
-
};
|
|
6616
|
-
const set = rpc => {
|
|
6617
|
-
set$6(rpc);
|
|
6618
|
-
state.connected = true;
|
|
6619
|
-
};
|
|
6620
|
-
|
|
6621
6684
|
const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess = true) => {
|
|
6622
6685
|
const executeViewletCommand = async (uid, command, ...args) => {
|
|
6623
6686
|
const fn = viewletCommandMap[`Explorer.${command}`];
|
|
@@ -6626,6 +6689,11 @@ const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess =
|
|
|
6626
6689
|
}
|
|
6627
6690
|
await fn(uid, ...args);
|
|
6628
6691
|
await invoke$3('Viewlet.requestRender', uid);
|
|
6692
|
+
if (takePostRenderFocus(uid)) {
|
|
6693
|
+
setTimeout(() => {
|
|
6694
|
+
void invoke$3('Main.focus');
|
|
6695
|
+
}, 0);
|
|
6696
|
+
}
|
|
6629
6697
|
};
|
|
6630
6698
|
const rpc = await create$6({
|
|
6631
6699
|
commandMap: {
|
|
@@ -6634,7 +6702,7 @@ const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess =
|
|
|
6634
6702
|
messagePort: port
|
|
6635
6703
|
});
|
|
6636
6704
|
if (setAsRendererProcess) {
|
|
6637
|
-
set(rpc);
|
|
6705
|
+
set$2(rpc);
|
|
6638
6706
|
}
|
|
6639
6707
|
};
|
|
6640
6708
|
|
|
@@ -7931,11 +7999,12 @@ const applyRender = (oldState, newState, diffResult) => {
|
|
|
7931
7999
|
|
|
7932
8000
|
const render2 = async (uid, _diffResult) => {
|
|
7933
8001
|
const {
|
|
8002
|
+
newState,
|
|
7934
8003
|
oldState,
|
|
7935
8004
|
scheduledState
|
|
7936
8005
|
} = get(uid);
|
|
7937
8006
|
const diffResult = diff(oldState, scheduledState);
|
|
7938
|
-
set
|
|
8007
|
+
set(uid, scheduledState, newState, scheduledState);
|
|
7939
8008
|
const commands = applyRender(oldState, scheduledState, diffResult);
|
|
7940
8009
|
if (!isConnected()) {
|
|
7941
8010
|
return commands;
|
|
@@ -7943,7 +8012,7 @@ const render2 = async (uid, _diffResult) => {
|
|
|
7943
8012
|
const rendererWorkerCommands = commands.filter(command => command[0] === SetFocusContext);
|
|
7944
8013
|
const rendererProcessCommands = commands.filter(command => command[0] !== SetFocusContext);
|
|
7945
8014
|
const transactionId = await invoke('Viewlet.queueCommands', uid, rendererProcessCommands);
|
|
7946
|
-
return [
|
|
8015
|
+
return [['Viewlet.commitPending', uid, transactionId], ...rendererWorkerCommands];
|
|
7947
8016
|
};
|
|
7948
8017
|
|
|
7949
8018
|
const Button = 1;
|
|
@@ -8107,7 +8176,7 @@ const renderEventListeners = () => {
|
|
|
8107
8176
|
preventDefault: true
|
|
8108
8177
|
}, {
|
|
8109
8178
|
name: HandleDrop,
|
|
8110
|
-
params: ['handleDrop', ClientX, ClientY,
|
|
8179
|
+
params: ['handleDrop', ClientX, ClientY, DropId],
|
|
8111
8180
|
preventDefault: true
|
|
8112
8181
|
}, {
|
|
8113
8182
|
name: HandleNativePaste,
|
|
@@ -8534,7 +8603,7 @@ const commandMap = {
|
|
|
8534
8603
|
};
|
|
8535
8604
|
|
|
8536
8605
|
const send$2 = async port => {
|
|
8537
|
-
await
|
|
8606
|
+
await invokeAndTransfer('DragAndDrop.handleMessagePort', port);
|
|
8538
8607
|
};
|
|
8539
8608
|
const createDragAndDropWorkerRpc = async () => {
|
|
8540
8609
|
return create$4({
|