@lvce-editor/main-area-worker 9.37.5 → 9.37.7
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/mainAreaWorkerMain.js +365 -387
- package/package.json +1 -1
|
@@ -54,6 +54,61 @@ class VError extends Error {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
class AssertionError extends Error {
|
|
58
|
+
constructor(message) {
|
|
59
|
+
super(message);
|
|
60
|
+
this.name = 'AssertionError';
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const Object$1 = 1;
|
|
64
|
+
const Number$1 = 2;
|
|
65
|
+
const Array$1 = 3;
|
|
66
|
+
const String$1 = 4;
|
|
67
|
+
const Boolean$1 = 5;
|
|
68
|
+
const Function = 6;
|
|
69
|
+
const Null = 7;
|
|
70
|
+
const Unknown = 8;
|
|
71
|
+
const getType = value => {
|
|
72
|
+
switch (typeof value) {
|
|
73
|
+
case 'number':
|
|
74
|
+
return Number$1;
|
|
75
|
+
case 'function':
|
|
76
|
+
return Function;
|
|
77
|
+
case 'string':
|
|
78
|
+
return String$1;
|
|
79
|
+
case 'object':
|
|
80
|
+
if (value === null) {
|
|
81
|
+
return Null;
|
|
82
|
+
}
|
|
83
|
+
if (Array.isArray(value)) {
|
|
84
|
+
return Array$1;
|
|
85
|
+
}
|
|
86
|
+
return Object$1;
|
|
87
|
+
case 'boolean':
|
|
88
|
+
return Boolean$1;
|
|
89
|
+
default:
|
|
90
|
+
return Unknown;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
const object = value => {
|
|
94
|
+
const type = getType(value);
|
|
95
|
+
if (type !== Object$1) {
|
|
96
|
+
throw new AssertionError('expected value to be of type object');
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const number = value => {
|
|
100
|
+
const type = getType(value);
|
|
101
|
+
if (type !== Number$1) {
|
|
102
|
+
throw new AssertionError('expected value to be of type number');
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const string = value => {
|
|
106
|
+
const type = getType(value);
|
|
107
|
+
if (type !== String$1) {
|
|
108
|
+
throw new AssertionError('expected value to be of type string');
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
|
|
57
112
|
const isMessagePort = value => {
|
|
58
113
|
return value && value instanceof MessagePort;
|
|
59
114
|
};
|
|
@@ -1074,41 +1129,6 @@ const create$b = async ({
|
|
|
1074
1129
|
return rpc;
|
|
1075
1130
|
};
|
|
1076
1131
|
|
|
1077
|
-
const create$a = async ({
|
|
1078
|
-
commandMap,
|
|
1079
|
-
isMessagePortOpen = true,
|
|
1080
|
-
messagePort
|
|
1081
|
-
}) => {
|
|
1082
|
-
// TODO create a commandMap per rpc instance
|
|
1083
|
-
register(commandMap);
|
|
1084
|
-
const rawIpc = await IpcParentWithMessagePort$1.create({
|
|
1085
|
-
isMessagePortOpen,
|
|
1086
|
-
messagePort
|
|
1087
|
-
});
|
|
1088
|
-
const ipc = IpcParentWithMessagePort$1.wrap(rawIpc);
|
|
1089
|
-
handleIpc(ipc);
|
|
1090
|
-
const rpc = createRpc(ipc);
|
|
1091
|
-
messagePort.start();
|
|
1092
|
-
return rpc;
|
|
1093
|
-
};
|
|
1094
|
-
|
|
1095
|
-
const create$9 = async ({
|
|
1096
|
-
commandMap,
|
|
1097
|
-
isMessagePortOpen,
|
|
1098
|
-
send
|
|
1099
|
-
}) => {
|
|
1100
|
-
const {
|
|
1101
|
-
port1,
|
|
1102
|
-
port2
|
|
1103
|
-
} = new MessageChannel();
|
|
1104
|
-
await send(port1);
|
|
1105
|
-
return create$a({
|
|
1106
|
-
commandMap,
|
|
1107
|
-
isMessagePortOpen,
|
|
1108
|
-
messagePort: port2
|
|
1109
|
-
});
|
|
1110
|
-
};
|
|
1111
|
-
|
|
1112
1132
|
const createSharedLazyRpc = factory => {
|
|
1113
1133
|
let rpcPromise;
|
|
1114
1134
|
const getOrCreate = () => {
|
|
@@ -1137,7 +1157,7 @@ const createSharedLazyRpc = factory => {
|
|
|
1137
1157
|
};
|
|
1138
1158
|
};
|
|
1139
1159
|
|
|
1140
|
-
const create$
|
|
1160
|
+
const create$a = async ({
|
|
1141
1161
|
commandMap,
|
|
1142
1162
|
getPortTuple,
|
|
1143
1163
|
send
|
|
@@ -1154,13 +1174,13 @@ const create$8 = async ({
|
|
|
1154
1174
|
return rpc;
|
|
1155
1175
|
};
|
|
1156
1176
|
|
|
1157
|
-
const create$
|
|
1177
|
+
const create$9 = async ({
|
|
1158
1178
|
commandMap,
|
|
1159
1179
|
getPortTuple,
|
|
1160
1180
|
send
|
|
1161
1181
|
}) => {
|
|
1162
1182
|
return createSharedLazyRpc(() => {
|
|
1163
|
-
return create$
|
|
1183
|
+
return create$a({
|
|
1164
1184
|
commandMap,
|
|
1165
1185
|
getPortTuple,
|
|
1166
1186
|
send
|
|
@@ -1168,13 +1188,48 @@ const create$7 = async ({
|
|
|
1168
1188
|
});
|
|
1169
1189
|
};
|
|
1170
1190
|
|
|
1191
|
+
const create$8 = async ({
|
|
1192
|
+
commandMap,
|
|
1193
|
+
isMessagePortOpen = true,
|
|
1194
|
+
messagePort
|
|
1195
|
+
}) => {
|
|
1196
|
+
// TODO create a commandMap per rpc instance
|
|
1197
|
+
register(commandMap);
|
|
1198
|
+
const rawIpc = await IpcParentWithMessagePort$1.create({
|
|
1199
|
+
isMessagePortOpen,
|
|
1200
|
+
messagePort
|
|
1201
|
+
});
|
|
1202
|
+
const ipc = IpcParentWithMessagePort$1.wrap(rawIpc);
|
|
1203
|
+
handleIpc(ipc);
|
|
1204
|
+
const rpc = createRpc(ipc);
|
|
1205
|
+
messagePort.start();
|
|
1206
|
+
return rpc;
|
|
1207
|
+
};
|
|
1208
|
+
|
|
1209
|
+
const create$7 = async ({
|
|
1210
|
+
commandMap,
|
|
1211
|
+
isMessagePortOpen,
|
|
1212
|
+
send
|
|
1213
|
+
}) => {
|
|
1214
|
+
const {
|
|
1215
|
+
port1,
|
|
1216
|
+
port2
|
|
1217
|
+
} = new MessageChannel();
|
|
1218
|
+
await send(port1);
|
|
1219
|
+
return create$8({
|
|
1220
|
+
commandMap,
|
|
1221
|
+
isMessagePortOpen,
|
|
1222
|
+
messagePort: port2
|
|
1223
|
+
});
|
|
1224
|
+
};
|
|
1225
|
+
|
|
1171
1226
|
const create$6 = async ({
|
|
1172
1227
|
commandMap,
|
|
1173
1228
|
isMessagePortOpen,
|
|
1174
1229
|
send
|
|
1175
1230
|
}) => {
|
|
1176
1231
|
return createSharedLazyRpc(() => {
|
|
1177
|
-
return create$
|
|
1232
|
+
return create$7({
|
|
1178
1233
|
commandMap,
|
|
1179
1234
|
isMessagePortOpen,
|
|
1180
1235
|
send
|
|
@@ -1214,7 +1269,7 @@ const createMockRpc = ({
|
|
|
1214
1269
|
};
|
|
1215
1270
|
|
|
1216
1271
|
const rpcs = Object.create(null);
|
|
1217
|
-
const set$
|
|
1272
|
+
const set$6 = (id, rpc) => {
|
|
1218
1273
|
rpcs[id] = rpc;
|
|
1219
1274
|
};
|
|
1220
1275
|
const get$1 = id => {
|
|
@@ -1247,7 +1302,7 @@ const create$4 = rpcId => {
|
|
|
1247
1302
|
const mockRpc = createMockRpc({
|
|
1248
1303
|
commandMap
|
|
1249
1304
|
});
|
|
1250
|
-
set$
|
|
1305
|
+
set$6(rpcId, mockRpc);
|
|
1251
1306
|
// @ts-ignore
|
|
1252
1307
|
mockRpc[Symbol.dispose] = () => {
|
|
1253
1308
|
remove(rpcId);
|
|
@@ -1256,7 +1311,7 @@ const create$4 = rpcId => {
|
|
|
1256
1311
|
return mockRpc;
|
|
1257
1312
|
},
|
|
1258
1313
|
set(rpc) {
|
|
1259
|
-
set$
|
|
1314
|
+
set$6(rpcId, rpc);
|
|
1260
1315
|
}
|
|
1261
1316
|
};
|
|
1262
1317
|
};
|
|
@@ -1438,7 +1493,6 @@ const VirtualDomElements = {
|
|
|
1438
1493
|
const Button$1 = 'event.button';
|
|
1439
1494
|
const ClientX = 'event.clientX';
|
|
1440
1495
|
const ClientY = 'event.clientY';
|
|
1441
|
-
const DataTransferFiles = 'event.dataTransfer.files';
|
|
1442
1496
|
const DataTransferFiles2 = 'event.dataTransfer.files2';
|
|
1443
1497
|
const EventTargetClassName = 'event.target.className';
|
|
1444
1498
|
const TargetName = 'event.target.name';
|
|
@@ -1453,11 +1507,11 @@ const Add$1 = 6;
|
|
|
1453
1507
|
const NavigateChild$1 = 7;
|
|
1454
1508
|
const NavigateParent$1 = 8;
|
|
1455
1509
|
|
|
1456
|
-
const Web = 1;
|
|
1457
1510
|
const Electron = 2;
|
|
1458
1511
|
|
|
1459
1512
|
const ClipBoardWorker = 3400;
|
|
1460
1513
|
const DialogWorker = 7014;
|
|
1514
|
+
const DragAndDropWorker = 3404;
|
|
1461
1515
|
const IconThemeWorker = 7009;
|
|
1462
1516
|
const RendererWorker = 1;
|
|
1463
1517
|
|
|
@@ -1468,17 +1522,25 @@ const SetPatches = 'Viewlet.setPatches';
|
|
|
1468
1522
|
const FocusEditorText = 12;
|
|
1469
1523
|
|
|
1470
1524
|
const {
|
|
1471
|
-
invoke: invoke$
|
|
1472
|
-
set: set$
|
|
1525
|
+
invoke: invoke$4,
|
|
1526
|
+
set: set$5
|
|
1473
1527
|
} = create$4(ClipBoardWorker);
|
|
1474
1528
|
const writeText = async text => {
|
|
1475
|
-
return invoke$
|
|
1529
|
+
return invoke$4('ClipBoard.writeText', text);
|
|
1476
1530
|
};
|
|
1477
1531
|
|
|
1532
|
+
const {
|
|
1533
|
+
invoke: invoke$3,
|
|
1534
|
+
set: set$4
|
|
1535
|
+
} = create$4(DialogWorker);
|
|
1536
|
+
|
|
1478
1537
|
const {
|
|
1479
1538
|
invoke: invoke$2,
|
|
1480
1539
|
set: set$3
|
|
1481
|
-
} = create$4(
|
|
1540
|
+
} = create$4(DragAndDropWorker);
|
|
1541
|
+
const getDroppedItems = async (itemIds, isElectron) => {
|
|
1542
|
+
return invoke$2('DragAndDrop.getDroppedItems', itemIds, isElectron);
|
|
1543
|
+
};
|
|
1482
1544
|
|
|
1483
1545
|
const {
|
|
1484
1546
|
invoke: invoke$1,
|
|
@@ -1489,61 +1551,6 @@ const getIcons = async iconRequests => {
|
|
|
1489
1551
|
return invoke$1('IconTheme.getIcons', iconRequests);
|
|
1490
1552
|
};
|
|
1491
1553
|
|
|
1492
|
-
class AssertionError extends Error {
|
|
1493
|
-
constructor(message) {
|
|
1494
|
-
super(message);
|
|
1495
|
-
this.name = 'AssertionError';
|
|
1496
|
-
}
|
|
1497
|
-
}
|
|
1498
|
-
const Object$1 = 1;
|
|
1499
|
-
const Number$1 = 2;
|
|
1500
|
-
const Array$1 = 3;
|
|
1501
|
-
const String$1 = 4;
|
|
1502
|
-
const Boolean$1 = 5;
|
|
1503
|
-
const Function = 6;
|
|
1504
|
-
const Null = 7;
|
|
1505
|
-
const Unknown = 8;
|
|
1506
|
-
const getType = value => {
|
|
1507
|
-
switch (typeof value) {
|
|
1508
|
-
case 'number':
|
|
1509
|
-
return Number$1;
|
|
1510
|
-
case 'function':
|
|
1511
|
-
return Function;
|
|
1512
|
-
case 'string':
|
|
1513
|
-
return String$1;
|
|
1514
|
-
case 'object':
|
|
1515
|
-
if (value === null) {
|
|
1516
|
-
return Null;
|
|
1517
|
-
}
|
|
1518
|
-
if (Array.isArray(value)) {
|
|
1519
|
-
return Array$1;
|
|
1520
|
-
}
|
|
1521
|
-
return Object$1;
|
|
1522
|
-
case 'boolean':
|
|
1523
|
-
return Boolean$1;
|
|
1524
|
-
default:
|
|
1525
|
-
return Unknown;
|
|
1526
|
-
}
|
|
1527
|
-
};
|
|
1528
|
-
const object = value => {
|
|
1529
|
-
const type = getType(value);
|
|
1530
|
-
if (type !== Object$1) {
|
|
1531
|
-
throw new AssertionError('expected value to be of type object');
|
|
1532
|
-
}
|
|
1533
|
-
};
|
|
1534
|
-
const number = value => {
|
|
1535
|
-
const type = getType(value);
|
|
1536
|
-
if (type !== Number$1) {
|
|
1537
|
-
throw new AssertionError('expected value to be of type number');
|
|
1538
|
-
}
|
|
1539
|
-
};
|
|
1540
|
-
const string = value => {
|
|
1541
|
-
const type = getType(value);
|
|
1542
|
-
if (type !== String$1) {
|
|
1543
|
-
throw new AssertionError('expected value to be of type string');
|
|
1544
|
-
}
|
|
1545
|
-
};
|
|
1546
|
-
|
|
1547
1554
|
const {
|
|
1548
1555
|
invoke,
|
|
1549
1556
|
invokeAndTransfer,
|
|
@@ -1559,14 +1566,14 @@ const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
|
1559
1566
|
number(y);
|
|
1560
1567
|
await invoke('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1561
1568
|
};
|
|
1562
|
-
const getFileHandles = async fileIds => {
|
|
1563
|
-
const files = await invoke('FileSystemHandle.getFileHandles', fileIds);
|
|
1564
|
-
return files;
|
|
1565
|
-
};
|
|
1566
1569
|
const sendMessagePortToClipBoardWorker$1 = async (port, rpcId) => {
|
|
1567
1570
|
const command = 'ClipBoard.handleMessagePort';
|
|
1568
1571
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToClipBoardWorker', port, command, rpcId);
|
|
1569
1572
|
};
|
|
1573
|
+
const sendMessagePortToDragAndDropWorker = async port => {
|
|
1574
|
+
const command = 'DragAndDrop.handleMessagePort';
|
|
1575
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToDragAndDropWorker', port, command);
|
|
1576
|
+
};
|
|
1570
1577
|
const sendMessagePortToDialogWorker = async port => {
|
|
1571
1578
|
const command = 'HandleMessagePort.handleMessagePort';
|
|
1572
1579
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToDialogWorker', port, command);
|
|
@@ -2419,7 +2426,7 @@ const saveEditor = async editorUid => {
|
|
|
2419
2426
|
const missingDialogWorkerRelay = 'Command "SendMessagePortToExtensionHostWorker.sendMessagePortToDialogWorker" not found';
|
|
2420
2427
|
const confirm = async (message, options) => {
|
|
2421
2428
|
try {
|
|
2422
|
-
return await invoke$
|
|
2429
|
+
return await invoke$3('ConfirmPrompt.prompt', message, options);
|
|
2423
2430
|
} catch (error) {
|
|
2424
2431
|
if (!String(error).includes(missingDialogWorkerRelay)) {
|
|
2425
2432
|
throw error;
|
|
@@ -3946,6 +3953,7 @@ const ensureActiveGroup = (state, uri, preview = false, title = getLabel(uri), e
|
|
|
3946
3953
|
if (activeGroup) {
|
|
3947
3954
|
const activeTab = activeGroup.tabs.find(tab => tab.id === activeGroup.activeTabId);
|
|
3948
3955
|
if (activeTab?.isPreview) {
|
|
3956
|
+
const tabId = create$2();
|
|
3949
3957
|
const updatedGroups = groups.map(group => {
|
|
3950
3958
|
if (group.id !== activeGroup.id) {
|
|
3951
3959
|
return group;
|
|
@@ -3961,6 +3969,7 @@ const ensureActiveGroup = (state, uri, preview = false, title = getLabel(uri), e
|
|
|
3961
3969
|
editorUid: create$2(),
|
|
3962
3970
|
errorMessage: '',
|
|
3963
3971
|
icon: '',
|
|
3972
|
+
id: tabId,
|
|
3964
3973
|
isDirty: false,
|
|
3965
3974
|
isPreview: preview,
|
|
3966
3975
|
language: '',
|
|
@@ -3972,6 +3981,7 @@ const ensureActiveGroup = (state, uri, preview = false, title = getLabel(uri), e
|
|
|
3972
3981
|
});
|
|
3973
3982
|
return {
|
|
3974
3983
|
...group,
|
|
3984
|
+
activeTabId: tabId,
|
|
3975
3985
|
tabs: updatedTabs
|
|
3976
3986
|
};
|
|
3977
3987
|
});
|
|
@@ -4249,7 +4259,7 @@ const openInputWithContext = async (context, options) => {
|
|
|
4249
4259
|
const title = getEditorInputTitle(editorInput);
|
|
4250
4260
|
const editorType = getEditorInputEditorType(editorInput);
|
|
4251
4261
|
const currentState = state;
|
|
4252
|
-
const existingTab = findTabByUri(currentState, uri);
|
|
4262
|
+
const existingTab = options.reuseExisting === false ? undefined : findTabByUri(currentState, uri);
|
|
4253
4263
|
const shouldRetryExistingTab = !!existingTab && existingTab.tab.loadingState === 'error';
|
|
4254
4264
|
if (existingTab && !shouldRetryExistingTab) {
|
|
4255
4265
|
const switchedState = getExistingTabState(currentState, existingTab, preview);
|
|
@@ -4363,12 +4373,13 @@ const getViewletContext = (options, viewletContext) => {
|
|
|
4363
4373
|
if (viewletContext !== undefined || typeof options === 'string') {
|
|
4364
4374
|
return viewletContext;
|
|
4365
4375
|
}
|
|
4366
|
-
const context = Object.fromEntries(Object.entries(options).filter(([key]) => key !== 'focus' && key !== 'preview' && key !== 'uri'));
|
|
4376
|
+
const context = Object.fromEntries(Object.entries(options).filter(([key]) => key !== 'focus' && key !== 'preview' && key !== 'reuseExisting' && key !== 'uri'));
|
|
4367
4377
|
return Object.keys(context).length === 0 ? undefined : context;
|
|
4368
4378
|
};
|
|
4369
4379
|
const getOpenInputOptions = (options, focus = true, viewletContext) => {
|
|
4370
4380
|
const uri = getOptionUriOptions(options);
|
|
4371
4381
|
const preview = typeof options === 'string' ? false : options.preview ?? false;
|
|
4382
|
+
const reuseExisting = typeof options === 'string' ? true : options.reuseExisting ?? true;
|
|
4372
4383
|
const context = getViewletContext(options, viewletContext);
|
|
4373
4384
|
return {
|
|
4374
4385
|
...(context !== undefined && {
|
|
@@ -4376,7 +4387,8 @@ const getOpenInputOptions = (options, focus = true, viewletContext) => {
|
|
|
4376
4387
|
}),
|
|
4377
4388
|
editorInput: getNormalizedOpenEditorInput(uri),
|
|
4378
4389
|
focus: typeof options === 'string' ? focus : options.focus,
|
|
4379
|
-
preview
|
|
4390
|
+
preview,
|
|
4391
|
+
reuseExisting
|
|
4380
4392
|
};
|
|
4381
4393
|
};
|
|
4382
4394
|
const openUri = async (state, options, focus = true, viewletContext) => {
|
|
@@ -4763,6 +4775,7 @@ const getOverlay = (x, y, width, height, splitDirection) => {
|
|
|
4763
4775
|
case Down:
|
|
4764
4776
|
return {
|
|
4765
4777
|
height: halfHeight,
|
|
4778
|
+
splitDirection,
|
|
4766
4779
|
width,
|
|
4767
4780
|
x,
|
|
4768
4781
|
y: y + halfHeight
|
|
@@ -4770,6 +4783,7 @@ const getOverlay = (x, y, width, height, splitDirection) => {
|
|
|
4770
4783
|
case Left:
|
|
4771
4784
|
return {
|
|
4772
4785
|
height,
|
|
4786
|
+
splitDirection,
|
|
4773
4787
|
width: halfWidth,
|
|
4774
4788
|
x,
|
|
4775
4789
|
y
|
|
@@ -4777,6 +4791,7 @@ const getOverlay = (x, y, width, height, splitDirection) => {
|
|
|
4777
4791
|
case Right:
|
|
4778
4792
|
return {
|
|
4779
4793
|
height,
|
|
4794
|
+
splitDirection,
|
|
4780
4795
|
width: halfWidth,
|
|
4781
4796
|
x: x + halfWidth,
|
|
4782
4797
|
y
|
|
@@ -4784,6 +4799,7 @@ const getOverlay = (x, y, width, height, splitDirection) => {
|
|
|
4784
4799
|
case Up:
|
|
4785
4800
|
return {
|
|
4786
4801
|
height: halfHeight,
|
|
4802
|
+
splitDirection,
|
|
4787
4803
|
width,
|
|
4788
4804
|
x,
|
|
4789
4805
|
y
|
|
@@ -4791,6 +4807,7 @@ const getOverlay = (x, y, width, height, splitDirection) => {
|
|
|
4791
4807
|
default:
|
|
4792
4808
|
return {
|
|
4793
4809
|
height,
|
|
4810
|
+
splitDirection,
|
|
4794
4811
|
width,
|
|
4795
4812
|
x,
|
|
4796
4813
|
y
|
|
@@ -4841,7 +4858,7 @@ const getDragOverlay = (state, eventX, eventY) => {
|
|
|
4841
4858
|
};
|
|
4842
4859
|
|
|
4843
4860
|
const isEqual = (oldOverlay, newOverlay) => {
|
|
4844
|
-
return oldOverlay?.x === newOverlay?.x && oldOverlay?.y === newOverlay?.y && oldOverlay?.width === newOverlay?.width && oldOverlay?.height === newOverlay?.height;
|
|
4861
|
+
return oldOverlay?.x === newOverlay?.x && oldOverlay?.y === newOverlay?.y && oldOverlay?.width === newOverlay?.width && oldOverlay?.height === newOverlay?.height && oldOverlay?.splitDirection === newOverlay?.splitDirection;
|
|
4845
4862
|
};
|
|
4846
4863
|
const handleDragOver = (state, eventX, eventY) => {
|
|
4847
4864
|
const {
|
|
@@ -4857,139 +4874,232 @@ const handleDragOver = (state, eventX, eventY) => {
|
|
|
4857
4874
|
};
|
|
4858
4875
|
};
|
|
4859
4876
|
|
|
4860
|
-
const
|
|
4861
|
-
const
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
};
|
|
4868
|
-
|
|
4869
|
-
const isDroppedFileSystemHandle = item => {
|
|
4870
|
-
if (!item || typeof item !== 'object') {
|
|
4871
|
-
return false;
|
|
4872
|
-
}
|
|
4873
|
-
const candidate = item;
|
|
4874
|
-
const handle = candidate.value;
|
|
4875
|
-
return candidate.kind === 'file' && Boolean(handle) && typeof handle === 'object' && (handle.kind === 'directory' || handle.kind === 'file') && typeof handle.name === 'string';
|
|
4876
|
-
};
|
|
4877
|
-
|
|
4878
|
-
const isUriList = item => {
|
|
4879
|
-
if (!item || typeof item !== 'object') {
|
|
4880
|
-
return false;
|
|
4877
|
+
const openUrisWithContext = async (context, uris, reuseExisting = true) => {
|
|
4878
|
+
for (const uri of uris) {
|
|
4879
|
+
await openUriWithContext(context, {
|
|
4880
|
+
focus: true,
|
|
4881
|
+
reuseExisting,
|
|
4882
|
+
uri
|
|
4883
|
+
});
|
|
4881
4884
|
}
|
|
4882
|
-
const candidate = item;
|
|
4883
|
-
return candidate.kind === 'string' && candidate.type === 'text/uri-list' && typeof candidate.value === 'string';
|
|
4884
|
-
};
|
|
4885
|
-
|
|
4886
|
-
const lineSeparatorRegex = /\r?\n/;
|
|
4887
|
-
const parseUriList = value => {
|
|
4888
|
-
return value.split(lineSeparatorRegex).map(uri => uri.trim()).filter(uri => uri && !uri.startsWith('#'));
|
|
4889
4885
|
};
|
|
4890
4886
|
|
|
4891
|
-
const
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
};
|
|
4895
|
-
const
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
let hasChromiumDragId = false;
|
|
4901
|
-
const uris = [];
|
|
4902
|
-
for (const [index, item] of items.entries()) {
|
|
4903
|
-
if (isUriList(item)) {
|
|
4904
|
-
uris.push(...parseUriList(item.value));
|
|
4905
|
-
continue;
|
|
4906
|
-
}
|
|
4907
|
-
if (isChromiumDragId(item)) {
|
|
4908
|
-
hasChromiumDragId = true;
|
|
4909
|
-
continue;
|
|
4910
|
-
}
|
|
4911
|
-
if (!isDroppedFileSystemHandle(item)) {
|
|
4912
|
-
continue;
|
|
4913
|
-
}
|
|
4914
|
-
const handle = item.value;
|
|
4915
|
-
const suffix = suffixByHandleKind[handle.kind];
|
|
4916
|
-
const uri = `html:///dropped-files/${Date.now()}/${itemIds[index]}/${handle.name}${suffix}`;
|
|
4917
|
-
await invoke('PersistentFileHandle.addHandle', uri, handle);
|
|
4918
|
-
uris.push(uri);
|
|
4919
|
-
}
|
|
4920
|
-
if (uris.length > 0 || !hasChromiumDragId) {
|
|
4921
|
-
return uris;
|
|
4922
|
-
}
|
|
4923
|
-
const dragInfo = await invoke('Viewlet.getDragData');
|
|
4924
|
-
if (!dragInfo || typeof dragInfo !== 'object' || !Array.isArray(dragInfo.items)) {
|
|
4925
|
-
return uris;
|
|
4926
|
-
}
|
|
4927
|
-
for (const item of dragInfo.items) {
|
|
4928
|
-
const candidate = item;
|
|
4929
|
-
if (candidate.type === 'text/uri-list' && typeof candidate.data === 'string') {
|
|
4930
|
-
uris.push(...parseUriList(candidate.data));
|
|
4931
|
-
}
|
|
4932
|
-
}
|
|
4933
|
-
return uris;
|
|
4934
|
-
};
|
|
4887
|
+
const splitDown$1 = (state, groupId) => {
|
|
4888
|
+
const {
|
|
4889
|
+
layout
|
|
4890
|
+
} = state;
|
|
4891
|
+
const {
|
|
4892
|
+
activeGroupId,
|
|
4893
|
+
direction,
|
|
4894
|
+
groups
|
|
4895
|
+
} = layout;
|
|
4935
4896
|
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4897
|
+
// If there are no groups, create an initial empty group first
|
|
4898
|
+
if (groups.length === 0) {
|
|
4899
|
+
const initialGroupId = create$2();
|
|
4900
|
+
const initialGroup = {
|
|
4901
|
+
activeTabId: -1,
|
|
4902
|
+
direction,
|
|
4903
|
+
focused: true,
|
|
4904
|
+
id: initialGroupId,
|
|
4905
|
+
isEmpty: true,
|
|
4906
|
+
size: 100,
|
|
4907
|
+
tabs: []
|
|
4908
|
+
};
|
|
4909
|
+
const stateWithInitialGroup = {
|
|
4910
|
+
...state,
|
|
4911
|
+
layout: {
|
|
4912
|
+
...layout,
|
|
4913
|
+
activeGroupId: initialGroupId,
|
|
4914
|
+
groups: [initialGroup]
|
|
4915
|
+
}
|
|
4916
|
+
};
|
|
4917
|
+
return splitEditorGroup$1(stateWithInitialGroup, initialGroupId, 'down');
|
|
4943
4918
|
}
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
return
|
|
4919
|
+
const resolvedGroupId = groupId ?? activeGroupId;
|
|
4920
|
+
if (!resolvedGroupId) {
|
|
4921
|
+
return state;
|
|
4947
4922
|
}
|
|
4948
|
-
return
|
|
4923
|
+
return splitEditorGroup$1(state, resolvedGroupId, 'down');
|
|
4949
4924
|
};
|
|
4950
4925
|
|
|
4951
|
-
const
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
}
|
|
4955
|
-
const
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4926
|
+
const splitLeft$1 = (state, groupId) => {
|
|
4927
|
+
const {
|
|
4928
|
+
layout
|
|
4929
|
+
} = state;
|
|
4930
|
+
const {
|
|
4931
|
+
activeGroupId,
|
|
4932
|
+
direction,
|
|
4933
|
+
groups
|
|
4934
|
+
} = layout;
|
|
4935
|
+
if (groups.length === 0) {
|
|
4936
|
+
const initialGroupId = create$2();
|
|
4937
|
+
const initialGroup = {
|
|
4938
|
+
activeTabId: -1,
|
|
4939
|
+
direction,
|
|
4940
|
+
focused: true,
|
|
4941
|
+
id: initialGroupId,
|
|
4942
|
+
isEmpty: true,
|
|
4943
|
+
size: 100,
|
|
4944
|
+
tabs: []
|
|
4945
|
+
};
|
|
4946
|
+
const stateWithInitialGroup = {
|
|
4947
|
+
...state,
|
|
4948
|
+
layout: {
|
|
4949
|
+
...layout,
|
|
4950
|
+
activeGroupId: initialGroupId,
|
|
4951
|
+
groups: [initialGroup]
|
|
4952
|
+
}
|
|
4953
|
+
};
|
|
4954
|
+
return splitEditorGroup$1(stateWithInitialGroup, initialGroupId, Left$1);
|
|
4959
4955
|
}
|
|
4960
|
-
|
|
4956
|
+
const targetGroupId = groupId ?? (activeGroupId === -1 ? groups[0]?.id : activeGroupId) ?? 0;
|
|
4957
|
+
return splitEditorGroup$1(state, targetGroupId, Left$1);
|
|
4961
4958
|
};
|
|
4962
4959
|
|
|
4963
|
-
const
|
|
4964
|
-
|
|
4965
|
-
|
|
4960
|
+
const splitRight$1 = (state, groupId) => {
|
|
4961
|
+
const {
|
|
4962
|
+
layout
|
|
4963
|
+
} = state;
|
|
4964
|
+
const {
|
|
4965
|
+
activeGroupId,
|
|
4966
|
+
direction,
|
|
4967
|
+
groups
|
|
4968
|
+
} = layout;
|
|
4969
|
+
|
|
4970
|
+
// If there are no groups, create an initial empty group first
|
|
4971
|
+
if (groups.length === 0) {
|
|
4972
|
+
const initialGroupId = create$2();
|
|
4973
|
+
const initialGroup = {
|
|
4974
|
+
activeTabId: -1,
|
|
4975
|
+
direction,
|
|
4976
|
+
focused: true,
|
|
4977
|
+
id: initialGroupId,
|
|
4978
|
+
isEmpty: true,
|
|
4979
|
+
size: 100,
|
|
4980
|
+
tabs: []
|
|
4981
|
+
};
|
|
4982
|
+
const stateWithInitialGroup = {
|
|
4983
|
+
...state,
|
|
4984
|
+
layout: {
|
|
4985
|
+
...layout,
|
|
4986
|
+
activeGroupId: initialGroupId,
|
|
4987
|
+
groups: [initialGroup]
|
|
4988
|
+
}
|
|
4989
|
+
};
|
|
4990
|
+
return splitEditorGroup$1(stateWithInitialGroup, initialGroupId, Right$1);
|
|
4966
4991
|
}
|
|
4967
|
-
|
|
4992
|
+
const targetGroupId = groupId ?? (activeGroupId === -1 ? groups[0]?.id : activeGroupId) ?? 0;
|
|
4993
|
+
return splitEditorGroup$1(state, targetGroupId, Right$1);
|
|
4968
4994
|
};
|
|
4969
4995
|
|
|
4970
|
-
const
|
|
4971
|
-
|
|
4972
|
-
|
|
4996
|
+
const splitUp$1 = (state, groupId) => {
|
|
4997
|
+
const {
|
|
4998
|
+
layout
|
|
4999
|
+
} = state;
|
|
5000
|
+
const {
|
|
5001
|
+
activeGroupId,
|
|
5002
|
+
direction,
|
|
5003
|
+
groups
|
|
5004
|
+
} = layout;
|
|
5005
|
+
if (groups.length === 0) {
|
|
5006
|
+
const initialGroupId = create$2();
|
|
5007
|
+
const initialGroup = {
|
|
5008
|
+
activeTabId: -1,
|
|
5009
|
+
direction,
|
|
5010
|
+
focused: true,
|
|
5011
|
+
id: initialGroupId,
|
|
5012
|
+
isEmpty: true,
|
|
5013
|
+
size: 100,
|
|
5014
|
+
tabs: []
|
|
5015
|
+
};
|
|
5016
|
+
const stateWithInitialGroup = {
|
|
5017
|
+
...state,
|
|
5018
|
+
layout: {
|
|
5019
|
+
...layout,
|
|
5020
|
+
activeGroupId: initialGroupId,
|
|
5021
|
+
groups: [initialGroup]
|
|
5022
|
+
}
|
|
5023
|
+
};
|
|
5024
|
+
return splitEditorGroup$1(stateWithInitialGroup, initialGroupId, 'up');
|
|
4973
5025
|
}
|
|
5026
|
+
const resolvedGroupId = groupId ?? activeGroupId;
|
|
5027
|
+
if (!resolvedGroupId) {
|
|
5028
|
+
return state;
|
|
5029
|
+
}
|
|
5030
|
+
return splitEditorGroup$1(state, resolvedGroupId, 'up');
|
|
4974
5031
|
};
|
|
4975
5032
|
|
|
4976
|
-
const
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
5033
|
+
const splitForDrop = (state, splitDirection) => {
|
|
5034
|
+
switch (splitDirection) {
|
|
5035
|
+
case Down:
|
|
5036
|
+
return splitDown$1(state);
|
|
5037
|
+
case Left:
|
|
5038
|
+
return splitLeft$1(state);
|
|
5039
|
+
case Right:
|
|
5040
|
+
return splitRight$1(state);
|
|
5041
|
+
case Up:
|
|
5042
|
+
return splitUp$1(state);
|
|
5043
|
+
default:
|
|
5044
|
+
return state;
|
|
5045
|
+
}
|
|
5046
|
+
};
|
|
5047
|
+
|
|
5048
|
+
const applyDropAction = async (context, action, splitDirection) => {
|
|
5049
|
+
switch (action.command) {
|
|
5050
|
+
case 'openFiles':
|
|
5051
|
+
{
|
|
5052
|
+
if (action.uris.length > 0 && splitDirection !== None) {
|
|
5053
|
+
await context.updateState(state => splitForDrop(state, splitDirection));
|
|
5054
|
+
}
|
|
5055
|
+
await openUrisWithContext(context, action.uris, splitDirection === None);
|
|
5056
|
+
break;
|
|
5057
|
+
}
|
|
5058
|
+
case 'setPath':
|
|
5059
|
+
void invoke('Workspace.setPath', action.value).catch(() => {});
|
|
5060
|
+
break;
|
|
5061
|
+
case 'setUri':
|
|
5062
|
+
void invoke('Workspace.setUri', action.value).catch(() => {});
|
|
5063
|
+
break;
|
|
5064
|
+
}
|
|
5065
|
+
};
|
|
5066
|
+
|
|
5067
|
+
const getDropAction = async uris => {
|
|
4982
5068
|
for (const uri of uris) {
|
|
4983
5069
|
if (uri.endsWith('/') || (await isDirectoryEditorInput({
|
|
4984
5070
|
type: 'editor',
|
|
4985
5071
|
uri
|
|
4986
5072
|
}))) {
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
5073
|
+
if (uri.startsWith('file://')) {
|
|
5074
|
+
return {
|
|
5075
|
+
command: 'setUri',
|
|
5076
|
+
value: uri
|
|
5077
|
+
};
|
|
5078
|
+
}
|
|
5079
|
+
return {
|
|
5080
|
+
command: 'setPath',
|
|
5081
|
+
value: uri
|
|
5082
|
+
};
|
|
4990
5083
|
}
|
|
4991
5084
|
}
|
|
4992
|
-
|
|
5085
|
+
return {
|
|
5086
|
+
command: 'openFiles',
|
|
5087
|
+
uris
|
|
5088
|
+
};
|
|
5089
|
+
};
|
|
5090
|
+
|
|
5091
|
+
const handleDrop = async (context, itemIds) => {
|
|
5092
|
+
const splitDirection = context.getState().dragOverlay?.splitDirection ?? None;
|
|
5093
|
+
await context.updateState(handleDragLeave);
|
|
5094
|
+
const {
|
|
5095
|
+
platform
|
|
5096
|
+
} = context.getState();
|
|
5097
|
+
const isElectron = platform === Electron;
|
|
5098
|
+
const {
|
|
5099
|
+
uris
|
|
5100
|
+
} = await getDroppedItems(itemIds, isElectron);
|
|
5101
|
+
const actions = await getDropAction(uris);
|
|
5102
|
+
await applyDropAction(context, actions, splitDirection);
|
|
4993
5103
|
};
|
|
4994
5104
|
|
|
4995
5105
|
const EditorGroupHeader = 'EditorGroupHeader';
|
|
@@ -6024,16 +6134,16 @@ const Retry = 'Retry';
|
|
|
6024
6134
|
const openFile = () => {
|
|
6025
6135
|
return i18nString(OpenFile);
|
|
6026
6136
|
};
|
|
6027
|
-
const splitUp
|
|
6137
|
+
const splitUp = () => {
|
|
6028
6138
|
return i18nString(SplitUp);
|
|
6029
6139
|
};
|
|
6030
|
-
const splitDown
|
|
6140
|
+
const splitDown = () => {
|
|
6031
6141
|
return i18nString(SplitDown);
|
|
6032
6142
|
};
|
|
6033
|
-
const splitLeft
|
|
6143
|
+
const splitLeft = () => {
|
|
6034
6144
|
return i18nString(SplitLeft);
|
|
6035
6145
|
};
|
|
6036
|
-
const splitRight
|
|
6146
|
+
const splitRight = () => {
|
|
6037
6147
|
return i18nString(SplitRight);
|
|
6038
6148
|
};
|
|
6039
6149
|
const splitEditorGroup = () => {
|
|
@@ -6149,25 +6259,25 @@ const getMenuEntries$2 = (state, groupId) => {
|
|
|
6149
6259
|
command: 'Main.splitUp',
|
|
6150
6260
|
flags: None$1,
|
|
6151
6261
|
id: 'splitUp',
|
|
6152
|
-
label: splitUp
|
|
6262
|
+
label: splitUp()
|
|
6153
6263
|
}, {
|
|
6154
6264
|
args: groupArgs,
|
|
6155
6265
|
command: 'Main.splitDown',
|
|
6156
6266
|
flags: None$1,
|
|
6157
6267
|
id: 'splitDown',
|
|
6158
|
-
label: splitDown
|
|
6268
|
+
label: splitDown()
|
|
6159
6269
|
}, {
|
|
6160
6270
|
args: groupArgs,
|
|
6161
6271
|
command: 'Main.splitLeft',
|
|
6162
6272
|
flags: None$1,
|
|
6163
6273
|
id: 'splitLeft',
|
|
6164
|
-
label: splitLeft
|
|
6274
|
+
label: splitLeft()
|
|
6165
6275
|
}, {
|
|
6166
6276
|
args: groupArgs,
|
|
6167
6277
|
command: 'Main.splitRight',
|
|
6168
6278
|
flags: None$1,
|
|
6169
6279
|
id: 'splitRight',
|
|
6170
|
-
label: splitRight
|
|
6280
|
+
label: splitRight()
|
|
6171
6281
|
}, ...getNewWindowMenuEntries(state)];
|
|
6172
6282
|
if (!hasTargetGroup(groupId)) {
|
|
6173
6283
|
return entries;
|
|
@@ -6281,7 +6391,7 @@ const getMenuEntries$1 = state => {
|
|
|
6281
6391
|
command: 'Main.splitRight',
|
|
6282
6392
|
flags: None$1,
|
|
6283
6393
|
id: 'splitRight',
|
|
6284
|
-
label: splitRight
|
|
6394
|
+
label: splitRight()
|
|
6285
6395
|
}, {
|
|
6286
6396
|
command: '',
|
|
6287
6397
|
flags: None$1,
|
|
@@ -7450,7 +7560,7 @@ const renderEventListeners = () => {
|
|
|
7450
7560
|
params: ['handleDragLeave']
|
|
7451
7561
|
}, {
|
|
7452
7562
|
name: HandleDrop,
|
|
7453
|
-
params: ['handleDrop', DataTransferFiles2
|
|
7563
|
+
params: ['handleDrop', DataTransferFiles2],
|
|
7454
7564
|
preventDefault: true
|
|
7455
7565
|
}];
|
|
7456
7566
|
};
|
|
@@ -7462,7 +7572,7 @@ const getViewProviderEntries = async uri => {
|
|
|
7462
7572
|
type: 'editor'
|
|
7463
7573
|
};
|
|
7464
7574
|
try {
|
|
7465
|
-
const providers = await invoke('WebView.
|
|
7575
|
+
const providers = await invoke('WebView.getEditorProviders');
|
|
7466
7576
|
const matchingProviders = providers.filter(provider => provider?.id && provider.selector?.some(selector => uri.endsWith(selector)));
|
|
7467
7577
|
return [textEditorEntry, ...matchingProviders.map(provider => {
|
|
7468
7578
|
const titleElement = provider.elements?.find(element => element.type === 'title');
|
|
@@ -7878,152 +7988,6 @@ const setEditorLayoutTwoColumnsBottom = state => {
|
|
|
7878
7988
|
}]);
|
|
7879
7989
|
};
|
|
7880
7990
|
|
|
7881
|
-
const splitDown = (state, groupId) => {
|
|
7882
|
-
const {
|
|
7883
|
-
layout
|
|
7884
|
-
} = state;
|
|
7885
|
-
const {
|
|
7886
|
-
activeGroupId,
|
|
7887
|
-
direction,
|
|
7888
|
-
groups
|
|
7889
|
-
} = layout;
|
|
7890
|
-
|
|
7891
|
-
// If there are no groups, create an initial empty group first
|
|
7892
|
-
if (groups.length === 0) {
|
|
7893
|
-
const initialGroupId = create$2();
|
|
7894
|
-
const initialGroup = {
|
|
7895
|
-
activeTabId: -1,
|
|
7896
|
-
direction,
|
|
7897
|
-
focused: true,
|
|
7898
|
-
id: initialGroupId,
|
|
7899
|
-
isEmpty: true,
|
|
7900
|
-
size: 100,
|
|
7901
|
-
tabs: []
|
|
7902
|
-
};
|
|
7903
|
-
const stateWithInitialGroup = {
|
|
7904
|
-
...state,
|
|
7905
|
-
layout: {
|
|
7906
|
-
...layout,
|
|
7907
|
-
activeGroupId: initialGroupId,
|
|
7908
|
-
groups: [initialGroup]
|
|
7909
|
-
}
|
|
7910
|
-
};
|
|
7911
|
-
return splitEditorGroup$1(stateWithInitialGroup, initialGroupId, 'down');
|
|
7912
|
-
}
|
|
7913
|
-
const resolvedGroupId = groupId ?? activeGroupId;
|
|
7914
|
-
if (!resolvedGroupId) {
|
|
7915
|
-
return state;
|
|
7916
|
-
}
|
|
7917
|
-
return splitEditorGroup$1(state, resolvedGroupId, 'down');
|
|
7918
|
-
};
|
|
7919
|
-
|
|
7920
|
-
const splitLeft = (state, groupId) => {
|
|
7921
|
-
const {
|
|
7922
|
-
layout
|
|
7923
|
-
} = state;
|
|
7924
|
-
const {
|
|
7925
|
-
activeGroupId,
|
|
7926
|
-
direction,
|
|
7927
|
-
groups
|
|
7928
|
-
} = layout;
|
|
7929
|
-
if (groups.length === 0) {
|
|
7930
|
-
const initialGroupId = create$2();
|
|
7931
|
-
const initialGroup = {
|
|
7932
|
-
activeTabId: -1,
|
|
7933
|
-
direction,
|
|
7934
|
-
focused: true,
|
|
7935
|
-
id: initialGroupId,
|
|
7936
|
-
isEmpty: true,
|
|
7937
|
-
size: 100,
|
|
7938
|
-
tabs: []
|
|
7939
|
-
};
|
|
7940
|
-
const stateWithInitialGroup = {
|
|
7941
|
-
...state,
|
|
7942
|
-
layout: {
|
|
7943
|
-
...layout,
|
|
7944
|
-
activeGroupId: initialGroupId,
|
|
7945
|
-
groups: [initialGroup]
|
|
7946
|
-
}
|
|
7947
|
-
};
|
|
7948
|
-
return splitEditorGroup$1(stateWithInitialGroup, initialGroupId, Left$1);
|
|
7949
|
-
}
|
|
7950
|
-
const targetGroupId = groupId ?? (activeGroupId === -1 ? groups[0]?.id : activeGroupId) ?? 0;
|
|
7951
|
-
return splitEditorGroup$1(state, targetGroupId, Left$1);
|
|
7952
|
-
};
|
|
7953
|
-
|
|
7954
|
-
const splitRight = (state, groupId) => {
|
|
7955
|
-
const {
|
|
7956
|
-
layout
|
|
7957
|
-
} = state;
|
|
7958
|
-
const {
|
|
7959
|
-
activeGroupId,
|
|
7960
|
-
direction,
|
|
7961
|
-
groups
|
|
7962
|
-
} = layout;
|
|
7963
|
-
|
|
7964
|
-
// If there are no groups, create an initial empty group first
|
|
7965
|
-
if (groups.length === 0) {
|
|
7966
|
-
const initialGroupId = create$2();
|
|
7967
|
-
const initialGroup = {
|
|
7968
|
-
activeTabId: -1,
|
|
7969
|
-
direction,
|
|
7970
|
-
focused: true,
|
|
7971
|
-
id: initialGroupId,
|
|
7972
|
-
isEmpty: true,
|
|
7973
|
-
size: 100,
|
|
7974
|
-
tabs: []
|
|
7975
|
-
};
|
|
7976
|
-
const stateWithInitialGroup = {
|
|
7977
|
-
...state,
|
|
7978
|
-
layout: {
|
|
7979
|
-
...layout,
|
|
7980
|
-
activeGroupId: initialGroupId,
|
|
7981
|
-
groups: [initialGroup]
|
|
7982
|
-
}
|
|
7983
|
-
};
|
|
7984
|
-
return splitEditorGroup$1(stateWithInitialGroup, initialGroupId, Right$1);
|
|
7985
|
-
}
|
|
7986
|
-
const targetGroupId = groupId ?? (activeGroupId === -1 ? groups[0]?.id : activeGroupId) ?? 0;
|
|
7987
|
-
return splitEditorGroup$1(state, targetGroupId, Right$1);
|
|
7988
|
-
};
|
|
7989
|
-
|
|
7990
|
-
const splitUp = (state, groupId) => {
|
|
7991
|
-
const {
|
|
7992
|
-
layout
|
|
7993
|
-
} = state;
|
|
7994
|
-
const {
|
|
7995
|
-
activeGroupId,
|
|
7996
|
-
direction,
|
|
7997
|
-
groups
|
|
7998
|
-
} = layout;
|
|
7999
|
-
if (groups.length === 0) {
|
|
8000
|
-
const initialGroupId = create$2();
|
|
8001
|
-
const initialGroup = {
|
|
8002
|
-
activeTabId: -1,
|
|
8003
|
-
direction,
|
|
8004
|
-
focused: true,
|
|
8005
|
-
id: initialGroupId,
|
|
8006
|
-
isEmpty: true,
|
|
8007
|
-
size: 100,
|
|
8008
|
-
tabs: []
|
|
8009
|
-
};
|
|
8010
|
-
const stateWithInitialGroup = {
|
|
8011
|
-
...state,
|
|
8012
|
-
layout: {
|
|
8013
|
-
...layout,
|
|
8014
|
-
activeGroupId: initialGroupId,
|
|
8015
|
-
groups: [initialGroup]
|
|
8016
|
-
}
|
|
8017
|
-
};
|
|
8018
|
-
return splitEditorGroup$1(stateWithInitialGroup, initialGroupId, 'up');
|
|
8019
|
-
}
|
|
8020
|
-
const resolvedGroupId = groupId ?? activeGroupId;
|
|
8021
|
-
if (!resolvedGroupId) {
|
|
8022
|
-
return state;
|
|
8023
|
-
}
|
|
8024
|
-
return splitEditorGroup$1(state, resolvedGroupId, 'up');
|
|
8025
|
-
};
|
|
8026
|
-
|
|
8027
7991
|
const pendingLoads = new Map();
|
|
8028
7992
|
const loadContent = wrapSerialCommand(loadContent$1);
|
|
8029
7993
|
const loadContentTracked = async (uid, ...args) => {
|
|
@@ -8075,7 +8039,7 @@ const commandMap = {
|
|
|
8075
8039
|
'Main.restoreClosedTab': wrapSerialCommand(restoreClosedTab),
|
|
8076
8040
|
'Main.save': wrapSerialCommand(save),
|
|
8077
8041
|
'Main.saveState': wrapGetter(saveState),
|
|
8078
|
-
'Main.splitRight': wrapSerialCommand(splitRight),
|
|
8042
|
+
'Main.splitRight': wrapSerialCommand(splitRight$1),
|
|
8079
8043
|
'MainArea.closeActiveEditor': wrapSerialCommand(closeActiveEditor),
|
|
8080
8044
|
'MainArea.closeAll': wrapSerialCommand(closeAll$1),
|
|
8081
8045
|
'MainArea.closeAllEditors': wrapSerialCommand(closeAll$1),
|
|
@@ -8149,10 +8113,10 @@ const commandMap = {
|
|
|
8149
8113
|
'MainArea.setEditorLayoutTwoColumnsBottom': wrapSerialCommand(setEditorLayoutTwoColumnsBottom),
|
|
8150
8114
|
'MainArea.setEditorLayoutTwoRows': wrapSerialCommand(setEditorLayoutTwoRows),
|
|
8151
8115
|
'MainArea.setEditorLayoutTwoRowsRight': wrapSerialCommand(setEditorLayoutTwoRowsRight),
|
|
8152
|
-
'MainArea.splitDown': wrapSerialCommand(splitDown),
|
|
8153
|
-
'MainArea.splitLeft': wrapSerialCommand(splitLeft),
|
|
8154
|
-
'MainArea.splitRight': wrapSerialCommand(splitRight),
|
|
8155
|
-
'MainArea.splitUp': wrapSerialCommand(splitUp),
|
|
8116
|
+
'MainArea.splitDown': wrapSerialCommand(splitDown$1),
|
|
8117
|
+
'MainArea.splitLeft': wrapSerialCommand(splitLeft$1),
|
|
8118
|
+
'MainArea.splitRight': wrapSerialCommand(splitRight$1),
|
|
8119
|
+
'MainArea.splitUp': wrapSerialCommand(splitUp$1),
|
|
8156
8120
|
'MainArea.terminate': terminate
|
|
8157
8121
|
};
|
|
8158
8122
|
|
|
@@ -8162,11 +8126,25 @@ const sendMessagePortToClipBoardWorker = async port => {
|
|
|
8162
8126
|
};
|
|
8163
8127
|
|
|
8164
8128
|
const initializeClipBoardWorker = async () => {
|
|
8165
|
-
const rpc = await create$
|
|
8129
|
+
const rpc = await create$9({
|
|
8166
8130
|
commandMap: {},
|
|
8167
8131
|
send: sendMessagePortToClipBoardWorker
|
|
8168
8132
|
});
|
|
8169
|
-
set$
|
|
8133
|
+
set$5(rpc);
|
|
8134
|
+
};
|
|
8135
|
+
|
|
8136
|
+
const send$1 = async port => {
|
|
8137
|
+
await sendMessagePortToDragAndDropWorker(port);
|
|
8138
|
+
};
|
|
8139
|
+
const createDragAndDropWorkerRpc = async () => {
|
|
8140
|
+
return create$6({
|
|
8141
|
+
commandMap: {},
|
|
8142
|
+
send: send$1
|
|
8143
|
+
});
|
|
8144
|
+
};
|
|
8145
|
+
|
|
8146
|
+
const initializeDragAndDropWorker = async () => {
|
|
8147
|
+
set$3(await createDragAndDropWorkerRpc());
|
|
8170
8148
|
};
|
|
8171
8149
|
|
|
8172
8150
|
const send = port => {
|
|
@@ -8211,12 +8189,12 @@ const initializeRendererWorker = async () => {
|
|
|
8211
8189
|
|
|
8212
8190
|
const listen = async () => {
|
|
8213
8191
|
registerCommands(commandMap);
|
|
8214
|
-
await Promise.all([initializeRendererWorker(), initializeIconThemeWorker(), initializeClipBoardWorker()]);
|
|
8192
|
+
await Promise.all([initializeRendererWorker(), initializeIconThemeWorker(), initializeClipBoardWorker(), initializeDragAndDropWorker()]);
|
|
8215
8193
|
const dialogRpc = await create$6({
|
|
8216
8194
|
commandMap: {},
|
|
8217
8195
|
send: sendMessagePortToDialogWorker
|
|
8218
8196
|
});
|
|
8219
|
-
set$
|
|
8197
|
+
set$4(dialogRpc);
|
|
8220
8198
|
};
|
|
8221
8199
|
|
|
8222
8200
|
const main$1 = async () => {
|