@lvce-editor/main-area-worker 1.5.0 → 1.7.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/mainAreaWorkerMain.js +78 -284
- package/package.json +1 -1
|
@@ -102,12 +102,6 @@ const number = value => {
|
|
|
102
102
|
throw new AssertionError('expected value to be of type number');
|
|
103
103
|
}
|
|
104
104
|
};
|
|
105
|
-
const string = value => {
|
|
106
|
-
const type = getType(value);
|
|
107
|
-
if (type !== String) {
|
|
108
|
-
throw new AssertionError('expected value to be of type string');
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
105
|
|
|
112
106
|
const isMessagePort = value => {
|
|
113
107
|
return value && value instanceof MessagePort;
|
|
@@ -462,7 +456,7 @@ const getFirstEvent = (eventEmitter, eventMap) => {
|
|
|
462
456
|
return promise;
|
|
463
457
|
};
|
|
464
458
|
const Message$1 = 3;
|
|
465
|
-
const create$5
|
|
459
|
+
const create$5 = async ({
|
|
466
460
|
isMessagePortOpen,
|
|
467
461
|
messagePort
|
|
468
462
|
}) => {
|
|
@@ -513,7 +507,7 @@ const wrap$5 = messagePort => {
|
|
|
513
507
|
};
|
|
514
508
|
const IpcParentWithMessagePort$1 = {
|
|
515
509
|
__proto__: null,
|
|
516
|
-
create: create$5
|
|
510
|
+
create: create$5,
|
|
517
511
|
signal: signal$1,
|
|
518
512
|
wrap: wrap$5
|
|
519
513
|
};
|
|
@@ -732,7 +726,7 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
|
732
726
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
733
727
|
return create$1$2(id, errorProperty);
|
|
734
728
|
};
|
|
735
|
-
const create$
|
|
729
|
+
const create$3 = (message, result) => {
|
|
736
730
|
return {
|
|
737
731
|
jsonrpc: Two$1,
|
|
738
732
|
id: message.id,
|
|
@@ -741,7 +735,7 @@ const create$5 = (message, result) => {
|
|
|
741
735
|
};
|
|
742
736
|
const getSuccessResponse = (message, result) => {
|
|
743
737
|
const resultProperty = result ?? null;
|
|
744
|
-
return create$
|
|
738
|
+
return create$3(message, resultProperty);
|
|
745
739
|
};
|
|
746
740
|
const getErrorResponseSimple = (id, error) => {
|
|
747
741
|
return {
|
|
@@ -1065,7 +1059,7 @@ const remove = id => {
|
|
|
1065
1059
|
};
|
|
1066
1060
|
|
|
1067
1061
|
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
1068
|
-
const create$
|
|
1062
|
+
const create$2 = rpcId => {
|
|
1069
1063
|
return {
|
|
1070
1064
|
async dispose() {
|
|
1071
1065
|
const rpc = get$1(rpcId);
|
|
@@ -1103,12 +1097,12 @@ const create$3 = rpcId => {
|
|
|
1103
1097
|
|
|
1104
1098
|
const {
|
|
1105
1099
|
set: set$2
|
|
1106
|
-
} = create$
|
|
1100
|
+
} = create$2(ExtensionHostWorker);
|
|
1107
1101
|
|
|
1108
1102
|
const {
|
|
1109
1103
|
invokeAndTransfer,
|
|
1110
1104
|
set: set$1
|
|
1111
|
-
} = create$
|
|
1105
|
+
} = create$2(RendererWorker);
|
|
1112
1106
|
const sendMessagePortToExtensionHostWorker$1 = async (port, rpcId = 0) => {
|
|
1113
1107
|
const command = 'HandleMessagePort.handleMessagePort2';
|
|
1114
1108
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
|
|
@@ -1118,7 +1112,7 @@ const toCommandId = key => {
|
|
|
1118
1112
|
const dotIndex = key.indexOf('.');
|
|
1119
1113
|
return key.slice(dotIndex + 1);
|
|
1120
1114
|
};
|
|
1121
|
-
const create$
|
|
1115
|
+
const create$1 = () => {
|
|
1122
1116
|
const states = Object.create(null);
|
|
1123
1117
|
const commandMapRef = {};
|
|
1124
1118
|
return {
|
|
@@ -1204,9 +1198,9 @@ const {
|
|
|
1204
1198
|
getCommandIds,
|
|
1205
1199
|
registerCommands,
|
|
1206
1200
|
set,
|
|
1207
|
-
wrapCommand} = create$
|
|
1201
|
+
wrapCommand} = create$1();
|
|
1208
1202
|
|
|
1209
|
-
const create
|
|
1203
|
+
const create = (uid, uri, x, y, width, height, platform, assetDir) => {
|
|
1210
1204
|
const state = {
|
|
1211
1205
|
assetDir,
|
|
1212
1206
|
layout: {
|
|
@@ -1261,6 +1255,47 @@ const handleClickCloseTab = (state, groupId, tabId) => {
|
|
|
1261
1255
|
return state;
|
|
1262
1256
|
};
|
|
1263
1257
|
|
|
1258
|
+
const handleClickTab = async (state, groupIndex, index) => {
|
|
1259
|
+
const {
|
|
1260
|
+
layout
|
|
1261
|
+
} = state;
|
|
1262
|
+
const {
|
|
1263
|
+
groups
|
|
1264
|
+
} = layout;
|
|
1265
|
+
|
|
1266
|
+
// Validate indexes
|
|
1267
|
+
if (groupIndex < 0 || groupIndex >= groups.length) {
|
|
1268
|
+
return state;
|
|
1269
|
+
}
|
|
1270
|
+
const group = groups[groupIndex];
|
|
1271
|
+
if (index < 0 || index >= group.tabs.length) {
|
|
1272
|
+
return state;
|
|
1273
|
+
}
|
|
1274
|
+
const tab = group.tabs[index];
|
|
1275
|
+
const groupId = group.id;
|
|
1276
|
+
const tabId = tab.id;
|
|
1277
|
+
|
|
1278
|
+
// Return same state if this group and tab are already active
|
|
1279
|
+
if (layout.activeGroupId === groupId && group.activeTabId === tabId) {
|
|
1280
|
+
return state;
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
// Update the groups array with the new active tab and active group
|
|
1284
|
+
const updatedGroups = groups.map((g, i) => ({
|
|
1285
|
+
...g,
|
|
1286
|
+
activeTabId: i === groupIndex ? tabId : g.activeTabId,
|
|
1287
|
+
focused: i === groupIndex
|
|
1288
|
+
}));
|
|
1289
|
+
return {
|
|
1290
|
+
...state,
|
|
1291
|
+
layout: {
|
|
1292
|
+
...layout,
|
|
1293
|
+
activeGroupId: groupId,
|
|
1294
|
+
groups: updatedGroups
|
|
1295
|
+
}
|
|
1296
|
+
};
|
|
1297
|
+
};
|
|
1298
|
+
|
|
1264
1299
|
const id = 7201;
|
|
1265
1300
|
const sendMessagePortToExtensionHostWorker = async port => {
|
|
1266
1301
|
await sendMessagePortToExtensionHostWorker$1(port, id);
|
|
@@ -1303,7 +1338,7 @@ const loadContent = async state => {
|
|
|
1303
1338
|
activeGroupId: '0',
|
|
1304
1339
|
direction: 'horizontal',
|
|
1305
1340
|
groups: [{
|
|
1306
|
-
activeTabId:
|
|
1341
|
+
activeTabId: tabs.length > 0 ? tabs[0].id : undefined,
|
|
1307
1342
|
direction: 'horizontal',
|
|
1308
1343
|
focused: false,
|
|
1309
1344
|
id: '0',
|
|
@@ -1314,263 +1349,13 @@ const loadContent = async state => {
|
|
|
1314
1349
|
};
|
|
1315
1350
|
};
|
|
1316
1351
|
|
|
1317
|
-
|
|
1318
|
-
const create = () => {
|
|
1319
|
-
idCounter++;
|
|
1320
|
-
return idCounter;
|
|
1321
|
-
};
|
|
1322
|
-
|
|
1323
|
-
const getTitle = (uri, homeDir) => {
|
|
1324
|
-
if (!uri) {
|
|
1325
|
-
return '';
|
|
1326
|
-
}
|
|
1327
|
-
return uri;
|
|
1328
|
-
};
|
|
1329
|
-
const getLabel = uri => {
|
|
1330
|
-
if (uri.startsWith('settings://')) {
|
|
1331
|
-
return 'Settings';
|
|
1332
|
-
}
|
|
1333
|
-
if (uri.startsWith('simple-browser://')) {
|
|
1334
|
-
return 'Simple Browser';
|
|
1335
|
-
}
|
|
1336
|
-
return uri;
|
|
1337
|
-
// return Workspace.pathBaseName(uri)
|
|
1338
|
-
};
|
|
1339
|
-
|
|
1340
|
-
/**
|
|
1341
|
-
*
|
|
1342
|
-
* @param {string} uri
|
|
1343
|
-
* @returns
|
|
1344
|
-
*/
|
|
1345
|
-
const getFileIcon = uri => {
|
|
1346
|
-
if (uri === 'app://keybindings') {
|
|
1347
|
-
return `MaskIconRecordKey`;
|
|
1348
|
-
}
|
|
1349
|
-
if (uri.startsWith('extension-detail://')) {
|
|
1350
|
-
return `MaskIconExtensions`;
|
|
1351
|
-
}
|
|
1352
|
-
return '';
|
|
1353
|
-
};
|
|
1354
|
-
|
|
1355
|
-
const Preview = 1 << 4;
|
|
1356
|
-
|
|
1357
|
-
// @ts-nocheck
|
|
1358
|
-
|
|
1359
|
-
const focusIndex = async (state, index) => {
|
|
1360
|
-
const {
|
|
1361
|
-
activeGroupIndex,
|
|
1362
|
-
groups,
|
|
1363
|
-
tabHeight,
|
|
1364
|
-
uid
|
|
1365
|
-
} = state;
|
|
1366
|
-
const group = groups[activeGroupIndex];
|
|
1367
|
-
const {
|
|
1368
|
-
editors
|
|
1369
|
-
} = group;
|
|
1370
|
-
const oldActiveIndex = group.activeIndex;
|
|
1371
|
-
if (index === oldActiveIndex) {
|
|
1372
|
-
return {
|
|
1373
|
-
commands: [],
|
|
1374
|
-
newState: state
|
|
1375
|
-
};
|
|
1376
|
-
}
|
|
1377
|
-
const newGroup = {
|
|
1378
|
-
...group,
|
|
1379
|
-
activeIndex: index
|
|
1380
|
-
};
|
|
1381
|
-
const newGroups = [...groups.slice(0, activeGroupIndex), newGroup, ...groups.slice(activeGroupIndex + 1)];
|
|
1382
|
-
const newState = {
|
|
1383
|
-
...state,
|
|
1384
|
-
groups: newGroups
|
|
1385
|
-
};
|
|
1386
|
-
const editor = editors[index];
|
|
1387
|
-
const {
|
|
1388
|
-
x
|
|
1389
|
-
} = group;
|
|
1390
|
-
const y = group.y + tabHeight;
|
|
1391
|
-
const {
|
|
1392
|
-
width
|
|
1393
|
-
} = group;
|
|
1394
|
-
const contentHeight = group.height - tabHeight;
|
|
1395
|
-
const id = await ViewletMap.getModuleId(editor.uri);
|
|
1396
|
-
const oldEditor = editors[oldActiveIndex];
|
|
1397
|
-
const oldId = await ViewletMap.getModuleId(oldEditor.uri);
|
|
1398
|
-
// @ts-ignore
|
|
1399
|
-
ViewletStates.getInstance(oldId);
|
|
1400
|
-
const previousUid = oldEditor.uid;
|
|
1401
|
-
number(previousUid);
|
|
1402
|
-
const disposeCommands = Viewlet.disposeFunctional(previousUid);
|
|
1403
|
-
const maybeHiddenEditorInstance = ViewletStates.getInstance(editor.uid);
|
|
1404
|
-
if (maybeHiddenEditorInstance) {
|
|
1405
|
-
const commands = Viewlet.showFunctional(editor.uid);
|
|
1406
|
-
const allCommands = [...disposeCommands, ...commands];
|
|
1407
|
-
return {
|
|
1408
|
-
commands: allCommands,
|
|
1409
|
-
newState
|
|
1410
|
-
};
|
|
1411
|
-
}
|
|
1412
|
-
const instanceUid = create();
|
|
1413
|
-
const instance = ViewletManager.create(ViewletModule.load, id, uid, editor.uri, x, y, width, contentHeight);
|
|
1414
|
-
instance.show = false;
|
|
1415
|
-
instance.setBounds = false;
|
|
1416
|
-
instance.uid = instanceUid;
|
|
1417
|
-
editor.uid = instanceUid;
|
|
1418
|
-
const resizeCommands = ['Viewlet.setBounds', instanceUid, x, tabHeight, width, contentHeight];
|
|
1419
|
-
|
|
1420
|
-
// @ts-ignore
|
|
1421
|
-
const commands = await ViewletManager.load(instance);
|
|
1422
|
-
// @ts-ignore
|
|
1423
|
-
commands.unshift(...disposeCommands);
|
|
1424
|
-
// @ts-ignore
|
|
1425
|
-
commands.push(resizeCommands);
|
|
1426
|
-
// @ts-ignore
|
|
1427
|
-
commands.push(['Viewlet.append', uid, instanceUid]);
|
|
1428
|
-
return {
|
|
1429
|
-
commands,
|
|
1430
|
-
newState
|
|
1431
|
-
};
|
|
1432
|
-
};
|
|
1433
|
-
|
|
1434
|
-
// @ts-nocheck
|
|
1435
|
-
const openUri = async (state, uri, focus = true, {
|
|
1436
|
-
preview = false,
|
|
1437
|
-
...context
|
|
1438
|
-
} = {}) => {
|
|
1352
|
+
const openUri = async (state, options) => {
|
|
1439
1353
|
object(state);
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
groups,
|
|
1444
|
-
tabFontFamily,
|
|
1445
|
-
tabFontSize,
|
|
1446
|
-
tabFontWeight,
|
|
1447
|
-
tabHeight,
|
|
1448
|
-
tabLetterSpacing
|
|
1449
|
-
} = state;
|
|
1450
|
-
const {
|
|
1451
|
-
x
|
|
1452
|
-
} = state;
|
|
1453
|
-
const y = state.y + tabHeight;
|
|
1454
|
-
const {
|
|
1455
|
-
width
|
|
1456
|
-
} = state;
|
|
1457
|
-
const contentHeight = state.height - tabHeight;
|
|
1458
|
-
// @ts-ignore
|
|
1459
|
-
const moduleId = await ViewletMap.getModuleId(uri, context.opener);
|
|
1460
|
-
let activeGroup = groups[activeGroupIndex];
|
|
1461
|
-
activeGroup ||= {
|
|
1462
|
-
activeIndex: -1,
|
|
1463
|
-
editors: [],
|
|
1464
|
-
focusedIndex: -1,
|
|
1465
|
-
height: state.height,
|
|
1466
|
-
tabsUid: create(),
|
|
1467
|
-
uid: create(),
|
|
1468
|
-
width,
|
|
1469
|
-
x,
|
|
1470
|
-
y: 0
|
|
1471
|
-
};
|
|
1472
|
-
const {
|
|
1473
|
-
activeIndex,
|
|
1474
|
-
editors
|
|
1475
|
-
} = activeGroup;
|
|
1476
|
-
const previousEditor = editors[activeIndex];
|
|
1477
|
-
let disposeCommands;
|
|
1478
|
-
// @ts-ignore
|
|
1479
|
-
if (previousEditor && previousEditor.uri === uri && previousEditor.opener === context.opener) {
|
|
1480
|
-
return {
|
|
1481
|
-
commands: [],
|
|
1482
|
-
newState: state
|
|
1483
|
-
};
|
|
1484
|
-
}
|
|
1485
|
-
for (let i = 0; i < editors.length; i++) {
|
|
1486
|
-
const editor = editors[i];
|
|
1487
|
-
if (editor.uri === uri &&
|
|
1488
|
-
// @ts-ignore
|
|
1489
|
-
editor.opener === context.opener) {
|
|
1490
|
-
return focusIndex(state, i);
|
|
1491
|
-
}
|
|
1492
|
-
}
|
|
1493
|
-
// TODO editor needs to be disposed when closing
|
|
1494
|
-
// other tabs and closing all tabs
|
|
1495
|
-
if (previousEditor) {
|
|
1496
|
-
const previousUid = previousEditor.uid;
|
|
1497
|
-
disposeCommands = Viewlet.hideFunctional(previousUid);
|
|
1498
|
-
}
|
|
1499
|
-
const instanceUid = create();
|
|
1500
|
-
const instance = ViewletManager.create(ViewletModule.load, moduleId, state.uid, uri, activeGroup.x, y, activeGroup.width, contentHeight);
|
|
1501
|
-
instance.uid = instanceUid;
|
|
1502
|
-
// const oldActiveIndex = state.activeIndex
|
|
1503
|
-
const tabLabel = getLabel(uri);
|
|
1504
|
-
const tabWidth = MeasureTabWidth.measureTabWidth(tabLabel, tabFontWeight, tabFontSize, tabFontFamily, tabLetterSpacing);
|
|
1505
|
-
const tabTitle = getTitle(uri);
|
|
1506
|
-
const icon = getFileIcon(uri);
|
|
1507
|
-
const newEditor = {
|
|
1508
|
-
flags: Preview,
|
|
1509
|
-
icon,
|
|
1510
|
-
label: tabLabel,
|
|
1511
|
-
moduleId,
|
|
1512
|
-
tabWidth,
|
|
1513
|
-
title: tabTitle,
|
|
1514
|
-
uid: instanceUid,
|
|
1515
|
-
uri
|
|
1516
|
-
};
|
|
1517
|
-
const newEditors = [...activeGroup.editors, newEditor];
|
|
1518
|
-
const newActiveIndex = newEditors.length - 1;
|
|
1519
|
-
const newGroup = {
|
|
1520
|
-
...activeGroup,
|
|
1521
|
-
activeIndex: newActiveIndex,
|
|
1522
|
-
editors: newEditors
|
|
1523
|
-
};
|
|
1524
|
-
const newGroups = [...groups.slice(0, activeGroupIndex), newGroup, ...groups.slice(activeGroupIndex + 1)];
|
|
1525
|
-
// @ts-ignore
|
|
1526
|
-
instance.show = false;
|
|
1527
|
-
instance.setBounds = false;
|
|
1528
|
-
ViewletStates.setState(state.uid, {
|
|
1529
|
-
...state,
|
|
1530
|
-
activeGroupIndex: 0,
|
|
1531
|
-
groups: newGroups,
|
|
1532
|
-
pendingUid: instanceUid
|
|
1533
|
-
});
|
|
1534
|
-
if (context) {
|
|
1535
|
-
instance.args = [context];
|
|
1536
|
-
}
|
|
1537
|
-
// @ts-ignore
|
|
1538
|
-
const commands = await ViewletManager.load(instance, focus);
|
|
1539
|
-
commands.push(['Viewlet.setBounds', instanceUid, activeGroup.x, tabHeight, activeGroup.width, contentHeight]);
|
|
1540
|
-
let {
|
|
1541
|
-
tabsUid
|
|
1542
|
-
} = state;
|
|
1543
|
-
if (tabsUid === -1) {
|
|
1544
|
-
tabsUid = create();
|
|
1545
|
-
}
|
|
1546
|
-
if (disposeCommands) {
|
|
1547
|
-
commands.push(...disposeCommands);
|
|
1548
|
-
}
|
|
1549
|
-
commands.push(['Viewlet.append', state.uid, instanceUid]);
|
|
1550
|
-
if (focus) {
|
|
1551
|
-
commands.push(['Viewlet.focus', instanceUid]);
|
|
1552
|
-
}
|
|
1553
|
-
const latestState = ViewletStates.getState(state.uid);
|
|
1554
|
-
const latestPendingUid = latestState.pendingUid;
|
|
1555
|
-
if (latestPendingUid !== instanceUid) {
|
|
1556
|
-
return {
|
|
1557
|
-
commands: [],
|
|
1558
|
-
newState: state
|
|
1559
|
-
};
|
|
1560
|
-
}
|
|
1561
|
-
if (!ViewletStates.hasInstance(instanceUid)) {
|
|
1562
|
-
return {
|
|
1563
|
-
commands,
|
|
1564
|
-
newState: state
|
|
1565
|
-
};
|
|
1566
|
-
}
|
|
1354
|
+
object(options);
|
|
1355
|
+
|
|
1356
|
+
// TODO
|
|
1567
1357
|
return {
|
|
1568
|
-
|
|
1569
|
-
newState: {
|
|
1570
|
-
...state,
|
|
1571
|
-
groups: newGroups,
|
|
1572
|
-
tabsUid
|
|
1573
|
-
}
|
|
1358
|
+
...state
|
|
1574
1359
|
};
|
|
1575
1360
|
};
|
|
1576
1361
|
|
|
@@ -1607,10 +1392,17 @@ const renderEditor = tab => {
|
|
|
1607
1392
|
}, text(tab.content || '')];
|
|
1608
1393
|
};
|
|
1609
1394
|
|
|
1610
|
-
const
|
|
1395
|
+
const HandleClick = 11;
|
|
1396
|
+
const HandleClickClose = 12;
|
|
1397
|
+
const HandleClickTab = 13;
|
|
1398
|
+
|
|
1399
|
+
const renderTab = (tab, isActive, tabIndex, groupIndex) => {
|
|
1611
1400
|
return [{
|
|
1612
1401
|
childCount: 2,
|
|
1613
|
-
className: isActive ? 'MainTab
|
|
1402
|
+
className: isActive ? 'MainTab MainTabSelected' : 'MainTab',
|
|
1403
|
+
'data-group-index': groupIndex,
|
|
1404
|
+
'data-index': tabIndex,
|
|
1405
|
+
onClick: HandleClickTab,
|
|
1614
1406
|
type: Div
|
|
1615
1407
|
}, {
|
|
1616
1408
|
childCount: 1,
|
|
@@ -1619,25 +1411,26 @@ const renderTab = (tab, isActive) => {
|
|
|
1619
1411
|
}, text(tab.isDirty ? `*${tab.title}` : tab.title), {
|
|
1620
1412
|
childCount: 1,
|
|
1621
1413
|
className: 'EditorTabCloseButton',
|
|
1414
|
+
onClick: HandleClickClose,
|
|
1622
1415
|
type: Button
|
|
1623
1416
|
}, text('×')];
|
|
1624
1417
|
};
|
|
1625
1418
|
|
|
1626
|
-
const renderTabBar = group => {
|
|
1419
|
+
const renderTabBar = (group, groupIndex) => {
|
|
1627
1420
|
return [{
|
|
1628
1421
|
childCount: group.tabs.length,
|
|
1629
1422
|
className: 'MainTabs',
|
|
1630
1423
|
type: Div
|
|
1631
|
-
}, ...group.tabs.flatMap(tab => renderTab(tab, tab.id === group.activeTabId))];
|
|
1424
|
+
}, ...group.tabs.flatMap((tab, tabIndex) => renderTab(tab, tab.id === group.activeTabId, tabIndex, groupIndex))];
|
|
1632
1425
|
};
|
|
1633
1426
|
|
|
1634
|
-
const renderEditorGroup = group => {
|
|
1427
|
+
const renderEditorGroup = (group, groupIndex) => {
|
|
1635
1428
|
const activeTab = group.tabs.find(tab => tab.id === group.activeTabId);
|
|
1636
1429
|
return [{
|
|
1637
1430
|
childCount: 2,
|
|
1638
1431
|
className: 'EditorGroup',
|
|
1639
1432
|
type: Div
|
|
1640
|
-
}, ...renderTabBar(group), {
|
|
1433
|
+
}, ...renderTabBar(group, groupIndex), {
|
|
1641
1434
|
childCount: activeTab ? 1 : 1,
|
|
1642
1435
|
className: 'EditorContainer',
|
|
1643
1436
|
type: Div
|
|
@@ -1653,7 +1446,7 @@ const getMainAreaVirtualDom = layout => {
|
|
|
1653
1446
|
childCount: layout.groups.length,
|
|
1654
1447
|
className: CSS_CLASSES.EDITOR_GROUPS_CONTAINER,
|
|
1655
1448
|
type: Div
|
|
1656
|
-
}, ...layout.groups.flatMap(renderEditorGroup)];
|
|
1449
|
+
}, ...layout.groups.flatMap((group, groupIndex) => renderEditorGroup(group, groupIndex))];
|
|
1657
1450
|
};
|
|
1658
1451
|
|
|
1659
1452
|
const renderItems = (oldState, newState) => {
|
|
@@ -1696,16 +1489,16 @@ const render2 = (uid, diffResult) => {
|
|
|
1696
1489
|
return commands;
|
|
1697
1490
|
};
|
|
1698
1491
|
|
|
1699
|
-
const HandleClick = 11;
|
|
1700
|
-
const HandleClickClose = 12;
|
|
1701
|
-
|
|
1702
1492
|
const renderEventListeners = () => {
|
|
1703
1493
|
return [{
|
|
1704
1494
|
name: HandleClick,
|
|
1705
1495
|
params: ['handleClick', TargetName]
|
|
1706
1496
|
}, {
|
|
1707
1497
|
name: HandleClickClose,
|
|
1708
|
-
params: ['
|
|
1498
|
+
params: ['handleClickCloseTab', 'event.target.dataset.groupIndex', 'event.target.dataset.index']
|
|
1499
|
+
}, {
|
|
1500
|
+
name: HandleClickTab,
|
|
1501
|
+
params: ['handleClickTab', 'event.target.dataset.groupIndex', 'event.target.dataset.index']
|
|
1709
1502
|
}];
|
|
1710
1503
|
};
|
|
1711
1504
|
|
|
@@ -1733,11 +1526,12 @@ const saveState = uid => {
|
|
|
1733
1526
|
};
|
|
1734
1527
|
|
|
1735
1528
|
const commandMap = {
|
|
1736
|
-
'MainArea.create': create
|
|
1529
|
+
'MainArea.create': create,
|
|
1737
1530
|
'MainArea.diff2': diff2,
|
|
1738
1531
|
'MainArea.getCommandIds': getCommandIds,
|
|
1739
1532
|
'MainArea.handleClick': wrapCommand(handleClick),
|
|
1740
1533
|
'MainArea.handleClickCloseTab': wrapCommand(handleClickCloseTab),
|
|
1534
|
+
'MainArea.handleClickTab': wrapCommand(handleClickTab),
|
|
1741
1535
|
'MainArea.initialize': initialize,
|
|
1742
1536
|
'MainArea.loadContent': wrapCommand(loadContent),
|
|
1743
1537
|
'MainArea.openUri': wrapCommand(openUri),
|