@lvce-editor/main-area-worker 8.6.0 → 8.8.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 +237 -36
- package/package.json +1 -1
|
@@ -335,6 +335,7 @@ const ExtensionHostWorker = 44;
|
|
|
335
335
|
const IconThemeWorker = 7009;
|
|
336
336
|
const RendererWorker = 1;
|
|
337
337
|
|
|
338
|
+
const SetCss = 'Viewlet.setCss';
|
|
338
339
|
const SetDom2 = 'Viewlet.setDom2';
|
|
339
340
|
const SetPatches = 'Viewlet.setPatches';
|
|
340
341
|
|
|
@@ -1486,7 +1487,7 @@ const create$j = async ({
|
|
|
1486
1487
|
send
|
|
1487
1488
|
}) => {
|
|
1488
1489
|
return createSharedLazyRpc(() => {
|
|
1489
|
-
return create$3({
|
|
1490
|
+
return create$3$1({
|
|
1490
1491
|
commandMap,
|
|
1491
1492
|
isMessagePortOpen,
|
|
1492
1493
|
send
|
|
@@ -1514,7 +1515,7 @@ const create$5 = async ({
|
|
|
1514
1515
|
messagePort.start();
|
|
1515
1516
|
return rpc;
|
|
1516
1517
|
};
|
|
1517
|
-
const create$3 = async ({
|
|
1518
|
+
const create$3$1 = async ({
|
|
1518
1519
|
commandMap,
|
|
1519
1520
|
isMessagePortOpen,
|
|
1520
1521
|
send
|
|
@@ -1532,7 +1533,7 @@ const create$3 = async ({
|
|
|
1532
1533
|
};
|
|
1533
1534
|
const TransferMessagePortRpcParent = {
|
|
1534
1535
|
__proto__: null,
|
|
1535
|
-
create: create$3
|
|
1536
|
+
create: create$3$1
|
|
1536
1537
|
};
|
|
1537
1538
|
const create$2$1 = async ({
|
|
1538
1539
|
commandMap
|
|
@@ -1580,7 +1581,7 @@ const remove = id => {
|
|
|
1580
1581
|
};
|
|
1581
1582
|
|
|
1582
1583
|
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
1583
|
-
const create$
|
|
1584
|
+
const create$3 = rpcId => {
|
|
1584
1585
|
return {
|
|
1585
1586
|
async dispose() {
|
|
1586
1587
|
const rpc = get$1(rpcId);
|
|
@@ -1618,16 +1619,16 @@ const create$2 = rpcId => {
|
|
|
1618
1619
|
|
|
1619
1620
|
const {
|
|
1620
1621
|
set: set$4
|
|
1621
|
-
} = create$
|
|
1622
|
+
} = create$3(ClipBoardWorker);
|
|
1622
1623
|
|
|
1623
1624
|
const {
|
|
1624
1625
|
set: set$3
|
|
1625
|
-
} = create$
|
|
1626
|
+
} = create$3(ExtensionHostWorker);
|
|
1626
1627
|
|
|
1627
1628
|
const {
|
|
1628
1629
|
invoke: invoke$1,
|
|
1629
1630
|
set: set$2
|
|
1630
|
-
} = create$
|
|
1631
|
+
} = create$3(IconThemeWorker);
|
|
1631
1632
|
const getIcons = async iconRequests => {
|
|
1632
1633
|
// @ts-ignore
|
|
1633
1634
|
return invoke$1('IconTheme.getIcons', iconRequests);
|
|
@@ -1637,7 +1638,7 @@ const {
|
|
|
1637
1638
|
invoke,
|
|
1638
1639
|
invokeAndTransfer,
|
|
1639
1640
|
set: set$1
|
|
1640
|
-
} = create$
|
|
1641
|
+
} = create$3(RendererWorker);
|
|
1641
1642
|
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
1642
1643
|
number(uid);
|
|
1643
1644
|
number(menuId);
|
|
@@ -1680,7 +1681,7 @@ const {
|
|
|
1680
1681
|
wrapGetter
|
|
1681
1682
|
} = create$6();
|
|
1682
1683
|
|
|
1683
|
-
const create$
|
|
1684
|
+
const create$2 = (uid, uri, x, y, width, height, platform, assetDir, tabHeight = 35) => {
|
|
1684
1685
|
const state = {
|
|
1685
1686
|
assetDir,
|
|
1686
1687
|
fileIconCache: {},
|
|
@@ -1704,15 +1705,20 @@ const create$1 = (uid, uri, x, y, width, height, platform, assetDir, tabHeight =
|
|
|
1704
1705
|
set(uid, state, state);
|
|
1705
1706
|
};
|
|
1706
1707
|
|
|
1708
|
+
const isEqual$1 = (oldState, newState) => {
|
|
1709
|
+
return oldState.width === newState.width && oldState.height === newState.height;
|
|
1710
|
+
};
|
|
1711
|
+
|
|
1707
1712
|
const isEqual = (oldState, newState) => {
|
|
1708
1713
|
return oldState.layout === newState.layout;
|
|
1709
1714
|
};
|
|
1710
1715
|
|
|
1711
1716
|
const RenderItems = 4;
|
|
1717
|
+
const RenderCss = 10;
|
|
1712
1718
|
const RenderIncremental = 11;
|
|
1713
1719
|
|
|
1714
|
-
const modules = [isEqual];
|
|
1715
|
-
const numbers = [RenderIncremental];
|
|
1720
|
+
const modules = [isEqual, isEqual$1];
|
|
1721
|
+
const numbers = [RenderIncremental, RenderCss];
|
|
1716
1722
|
|
|
1717
1723
|
const diff = (oldState, newState) => {
|
|
1718
1724
|
const diffResult = [];
|
|
@@ -1740,11 +1746,11 @@ const createViewlet = async (viewletModuleId, editorUid, tabId, bounds, uri) =>
|
|
|
1740
1746
|
|
|
1741
1747
|
const handleAttach = async command => {
|
|
1742
1748
|
// TODO find a better way to append editors
|
|
1743
|
-
const parentNodeSelector = '.editor-groups-container';
|
|
1749
|
+
const parentNodeSelector = '.editor-groups-container, .EditorGroup';
|
|
1744
1750
|
await invoke('Layout.attachViewlet', parentNodeSelector, command.instanceId);
|
|
1745
1751
|
};
|
|
1746
1752
|
|
|
1747
|
-
const create = () => {
|
|
1753
|
+
const create$1 = () => {
|
|
1748
1754
|
return Math.random();
|
|
1749
1755
|
};
|
|
1750
1756
|
|
|
@@ -1821,7 +1827,7 @@ const loadTabContentAsync = async (tabId, path, requestId, getLatestState) => {
|
|
|
1821
1827
|
}
|
|
1822
1828
|
|
|
1823
1829
|
// Assign editorUid if tab doesn't have one yet
|
|
1824
|
-
const editorUid = latestTab.editorUid === -1 ? create() : latestTab.editorUid;
|
|
1830
|
+
const editorUid = latestTab.editorUid === -1 ? create$1() : latestTab.editorUid;
|
|
1825
1831
|
return updateTab(latestState, tabId, {
|
|
1826
1832
|
editorUid,
|
|
1827
1833
|
errorMessage: undefined,
|
|
@@ -1861,7 +1867,7 @@ const createViewletForTab = (state, tabId, viewletModuleId, bounds) => {
|
|
|
1861
1867
|
if (tab.editorUid !== -1 || tab.loadingState === 'loading' || tab.loadingState === 'loaded') {
|
|
1862
1868
|
return state;
|
|
1863
1869
|
}
|
|
1864
|
-
const editorUid = create();
|
|
1870
|
+
const editorUid = create$1();
|
|
1865
1871
|
const newState = updateTab(state, tabId, {
|
|
1866
1872
|
editorUid
|
|
1867
1873
|
});
|
|
@@ -2267,7 +2273,7 @@ const handleClick = async (state, name) => {
|
|
|
2267
2273
|
return state;
|
|
2268
2274
|
};
|
|
2269
2275
|
|
|
2270
|
-
const closeEditorGroup = (state, groupId) => {
|
|
2276
|
+
const closeEditorGroup$1 = (state, groupId) => {
|
|
2271
2277
|
const {
|
|
2272
2278
|
layout
|
|
2273
2279
|
} = state;
|
|
@@ -2361,10 +2367,10 @@ const createEmptyGroup = (state, uri, requestId) => {
|
|
|
2361
2367
|
const {
|
|
2362
2368
|
groups
|
|
2363
2369
|
} = layout;
|
|
2364
|
-
const groupId = create();
|
|
2370
|
+
const groupId = create$1();
|
|
2365
2371
|
const title = getLabel(uri);
|
|
2366
|
-
const tabId = create();
|
|
2367
|
-
const editorUid = create();
|
|
2372
|
+
const tabId = create$1();
|
|
2373
|
+
const editorUid = create$1();
|
|
2368
2374
|
const newTab = {
|
|
2369
2375
|
editorType: 'text',
|
|
2370
2376
|
editorUid,
|
|
@@ -2398,7 +2404,7 @@ const createEmptyGroup = (state, uri, requestId) => {
|
|
|
2398
2404
|
const openTab = (state, groupId, tab) => {
|
|
2399
2405
|
const newTab = 'id' in tab && tab.id !== undefined ? tab : {
|
|
2400
2406
|
...tab,
|
|
2401
|
-
id: create()
|
|
2407
|
+
id: create$1()
|
|
2402
2408
|
};
|
|
2403
2409
|
const {
|
|
2404
2410
|
layout
|
|
@@ -2446,8 +2452,8 @@ const ensureActiveGroup = (state, uri) => {
|
|
|
2446
2452
|
if (activeGroup) {
|
|
2447
2453
|
// Create a new tab with the URI in the active group
|
|
2448
2454
|
const title = getLabel(uri);
|
|
2449
|
-
const tabId = create();
|
|
2450
|
-
const editorUid = create();
|
|
2455
|
+
const tabId = create$1();
|
|
2456
|
+
const editorUid = create$1();
|
|
2451
2457
|
const newTab = {
|
|
2452
2458
|
editorType: 'text',
|
|
2453
2459
|
editorUid,
|
|
@@ -2855,7 +2861,7 @@ const splitEditorGroup$1 = (state, groupId, direction) => {
|
|
|
2855
2861
|
if (!sourceGroup) {
|
|
2856
2862
|
return state;
|
|
2857
2863
|
}
|
|
2858
|
-
const newGroupId = create();
|
|
2864
|
+
const newGroupId = create$1();
|
|
2859
2865
|
const isHorizontalSplit = direction === Left || direction === Right;
|
|
2860
2866
|
const newLayoutDirection = isHorizontalSplit ? 'horizontal' : 'vertical';
|
|
2861
2867
|
const updatedGroups = groups.map(group => {
|
|
@@ -2909,7 +2915,7 @@ const handleClickAction = async (state, action, rawGroupId) => {
|
|
|
2909
2915
|
if (rawGroupId) {
|
|
2910
2916
|
const groupId = Number.parseInt(rawGroupId, 10);
|
|
2911
2917
|
if (!Number.isNaN(groupId)) {
|
|
2912
|
-
return closeEditorGroup(state, groupId);
|
|
2918
|
+
return closeEditorGroup$1(state, groupId);
|
|
2913
2919
|
}
|
|
2914
2920
|
}
|
|
2915
2921
|
return state;
|
|
@@ -2966,7 +2972,10 @@ const handleDoubleClick = async state => {
|
|
|
2966
2972
|
};
|
|
2967
2973
|
|
|
2968
2974
|
const EditorGroupHeader = 'EditorGroupHeader';
|
|
2975
|
+
const EmptyGroupCloseButton = 'EmptyGroupCloseButton';
|
|
2969
2976
|
const EditorGroup = 'EditorGroup';
|
|
2977
|
+
const EditorGroupsHorizontal = 'EditorGroupsHorizontal';
|
|
2978
|
+
const EditorGroupsVertical = 'EditorGroupsVertical';
|
|
2970
2979
|
const EditorContainer = 'EditorContainer';
|
|
2971
2980
|
const EditorGroupActions = 'EditorGroupActions';
|
|
2972
2981
|
const EditorGroupActionButton = 'EditorGroupActionButton';
|
|
@@ -3044,8 +3053,8 @@ const newFile = async state => {
|
|
|
3044
3053
|
getActiveTabId(newState);
|
|
3045
3054
|
|
|
3046
3055
|
// Create a new empty tab
|
|
3047
|
-
const tabId = create();
|
|
3048
|
-
const editorUid = create();
|
|
3056
|
+
const tabId = create$1();
|
|
3057
|
+
const editorUid = create$1();
|
|
3049
3058
|
const newTab = {
|
|
3050
3059
|
editorType: 'text',
|
|
3051
3060
|
editorUid,
|
|
@@ -3175,6 +3184,119 @@ const handleResize = async (state, dimensions) => {
|
|
|
3175
3184
|
return allResizeCommands;
|
|
3176
3185
|
};
|
|
3177
3186
|
|
|
3187
|
+
const create = (beforeGroupId, afterGroupId) => {
|
|
3188
|
+
return `${beforeGroupId}:${afterGroupId}`;
|
|
3189
|
+
};
|
|
3190
|
+
const parse = sashId => {
|
|
3191
|
+
if (!sashId) {
|
|
3192
|
+
return undefined;
|
|
3193
|
+
}
|
|
3194
|
+
const [beforeRaw, afterRaw] = sashId.split(':');
|
|
3195
|
+
if (!beforeRaw || !afterRaw) {
|
|
3196
|
+
return undefined;
|
|
3197
|
+
}
|
|
3198
|
+
const beforeGroupId = Number.parseInt(beforeRaw, 10);
|
|
3199
|
+
const afterGroupId = Number.parseInt(afterRaw, 10);
|
|
3200
|
+
if (!Number.isFinite(beforeGroupId) || !Number.isFinite(afterGroupId)) {
|
|
3201
|
+
return undefined;
|
|
3202
|
+
}
|
|
3203
|
+
return {
|
|
3204
|
+
afterGroupId,
|
|
3205
|
+
beforeGroupId
|
|
3206
|
+
};
|
|
3207
|
+
};
|
|
3208
|
+
|
|
3209
|
+
const handleSashPointerDown = async (state, sashId, clientXRaw, clientYRaw) => {
|
|
3210
|
+
const parsed = parse(sashId);
|
|
3211
|
+
if (!parsed) {
|
|
3212
|
+
return state;
|
|
3213
|
+
}
|
|
3214
|
+
const beforeGroup = state.layout.groups.find(group => group.id === parsed.beforeGroupId);
|
|
3215
|
+
const afterGroup = state.layout.groups.find(group => group.id === parsed.afterGroupId);
|
|
3216
|
+
if (!beforeGroup || !afterGroup) {
|
|
3217
|
+
return state;
|
|
3218
|
+
}
|
|
3219
|
+
const clientX = Number.parseFloat(clientXRaw);
|
|
3220
|
+
const clientY = Number.parseFloat(clientYRaw);
|
|
3221
|
+
if (!Number.isFinite(clientX) || !Number.isFinite(clientY)) {
|
|
3222
|
+
return state;
|
|
3223
|
+
}
|
|
3224
|
+
return {
|
|
3225
|
+
...state,
|
|
3226
|
+
sashDrag: {
|
|
3227
|
+
afterGroupId: parsed.afterGroupId,
|
|
3228
|
+
afterSize: afterGroup.size,
|
|
3229
|
+
beforeGroupId: parsed.beforeGroupId,
|
|
3230
|
+
beforeSize: beforeGroup.size,
|
|
3231
|
+
sashId,
|
|
3232
|
+
startClientX: clientX,
|
|
3233
|
+
startClientY: clientY
|
|
3234
|
+
}
|
|
3235
|
+
};
|
|
3236
|
+
};
|
|
3237
|
+
|
|
3238
|
+
const MIN_GROUP_SIZE = 10;
|
|
3239
|
+
const clamp = (value, min, max) => {
|
|
3240
|
+
return Math.min(max, Math.max(min, value));
|
|
3241
|
+
};
|
|
3242
|
+
const round = value => {
|
|
3243
|
+
return Math.round(value * 100) / 100;
|
|
3244
|
+
};
|
|
3245
|
+
const handleSashPointerMove = async (state, clientXRaw, clientYRaw) => {
|
|
3246
|
+
const {
|
|
3247
|
+
sashDrag
|
|
3248
|
+
} = state;
|
|
3249
|
+
if (!sashDrag) {
|
|
3250
|
+
return state;
|
|
3251
|
+
}
|
|
3252
|
+
const clientX = Number.parseFloat(clientXRaw);
|
|
3253
|
+
const clientY = Number.parseFloat(clientYRaw);
|
|
3254
|
+
if (!Number.isFinite(clientX) || !Number.isFinite(clientY)) {
|
|
3255
|
+
return state;
|
|
3256
|
+
}
|
|
3257
|
+
const axisSize = state.layout.direction === 'horizontal' ? state.width : state.height;
|
|
3258
|
+
if (!axisSize) {
|
|
3259
|
+
return state;
|
|
3260
|
+
}
|
|
3261
|
+
const deltaPx = state.layout.direction === 'horizontal' ? clientX - sashDrag.startClientX : clientY - sashDrag.startClientY;
|
|
3262
|
+
const deltaPercent = deltaPx / axisSize * 100;
|
|
3263
|
+
const totalResizableSize = sashDrag.beforeSize + sashDrag.afterSize;
|
|
3264
|
+
const beforeSize = clamp(sashDrag.beforeSize + deltaPercent, MIN_GROUP_SIZE, totalResizableSize - MIN_GROUP_SIZE);
|
|
3265
|
+
const afterSize = totalResizableSize - beforeSize;
|
|
3266
|
+
const groups = state.layout.groups.map(group => {
|
|
3267
|
+
if (group.id === sashDrag.beforeGroupId) {
|
|
3268
|
+
return {
|
|
3269
|
+
...group,
|
|
3270
|
+
size: round(beforeSize)
|
|
3271
|
+
};
|
|
3272
|
+
}
|
|
3273
|
+
if (group.id === sashDrag.afterGroupId) {
|
|
3274
|
+
return {
|
|
3275
|
+
...group,
|
|
3276
|
+
size: round(afterSize)
|
|
3277
|
+
};
|
|
3278
|
+
}
|
|
3279
|
+
return group;
|
|
3280
|
+
});
|
|
3281
|
+
return {
|
|
3282
|
+
...state,
|
|
3283
|
+
layout: {
|
|
3284
|
+
...state.layout,
|
|
3285
|
+
groups
|
|
3286
|
+
}
|
|
3287
|
+
};
|
|
3288
|
+
};
|
|
3289
|
+
|
|
3290
|
+
const handleSashPointerUp = async state => {
|
|
3291
|
+
if (!state.sashDrag) {
|
|
3292
|
+
return state;
|
|
3293
|
+
}
|
|
3294
|
+
return {
|
|
3295
|
+
...state,
|
|
3296
|
+
sashDrag: undefined
|
|
3297
|
+
};
|
|
3298
|
+
};
|
|
3299
|
+
|
|
3178
3300
|
const show2 = async (uid, menuId, x, y, args) => {
|
|
3179
3301
|
await showContextMenu2(uid, menuId, x, y, args);
|
|
3180
3302
|
};
|
|
@@ -3366,7 +3488,7 @@ const createViewlets = async (layout, viewletModuleIds, bounds) => {
|
|
|
3366
3488
|
for (const group of layout.groups) {
|
|
3367
3489
|
const activeTab = group.tabs.find(tab => tab.id === group.activeTabId);
|
|
3368
3490
|
if (activeTab && viewletModuleIds[activeTab.id]) {
|
|
3369
|
-
const editorUid = activeTab.editorUid === -1 ? create() : activeTab.editorUid;
|
|
3491
|
+
const editorUid = activeTab.editorUid === -1 ? create$1() : activeTab.editorUid;
|
|
3370
3492
|
editorUids[activeTab.id] = editorUid;
|
|
3371
3493
|
await createViewlet(viewletModuleIds[activeTab.id], editorUid, activeTab.id, bounds, activeTab.uri);
|
|
3372
3494
|
}
|
|
@@ -3500,6 +3622,7 @@ const i18nString = (key, placeholders = emptyObject) => {
|
|
|
3500
3622
|
};
|
|
3501
3623
|
|
|
3502
3624
|
const Close = 'Close';
|
|
3625
|
+
const CloseEditorGroup = 'Close Editor Group';
|
|
3503
3626
|
const CloseAll = 'Close All';
|
|
3504
3627
|
const CloseOthers = 'Close Others';
|
|
3505
3628
|
const CloseToTheRight = 'Close To The Right';
|
|
@@ -3516,6 +3639,9 @@ const splitEditorGroup = () => {
|
|
|
3516
3639
|
const close = () => {
|
|
3517
3640
|
return i18nString(Close);
|
|
3518
3641
|
};
|
|
3642
|
+
const closeEditorGroup = () => {
|
|
3643
|
+
return i18nString(CloseEditorGroup);
|
|
3644
|
+
};
|
|
3519
3645
|
const closeOthers = () => {
|
|
3520
3646
|
return i18nString(CloseOthers);
|
|
3521
3647
|
};
|
|
@@ -3633,6 +3759,18 @@ const refresh = state => {
|
|
|
3633
3759
|
};
|
|
3634
3760
|
};
|
|
3635
3761
|
|
|
3762
|
+
const getCss = () => {
|
|
3763
|
+
const rules = [`.MainArea {
|
|
3764
|
+
}`];
|
|
3765
|
+
const css = rules.join('\n');
|
|
3766
|
+
return css;
|
|
3767
|
+
};
|
|
3768
|
+
|
|
3769
|
+
const renderCss = (oldState, newState) => {
|
|
3770
|
+
const css = getCss();
|
|
3771
|
+
return [SetCss, newState.uid, css];
|
|
3772
|
+
};
|
|
3773
|
+
|
|
3636
3774
|
const text = data => {
|
|
3637
3775
|
return {
|
|
3638
3776
|
childCount: 0,
|
|
@@ -3947,6 +4085,9 @@ const HandleClickClose = 12;
|
|
|
3947
4085
|
const HandleClickTab = 13;
|
|
3948
4086
|
const HandleTabContextMenu = 14;
|
|
3949
4087
|
const HandleHeaderDoubleClick = 15;
|
|
4088
|
+
const HandleSashPointerDown = 16;
|
|
4089
|
+
const HandleSashPointerMove = 17;
|
|
4090
|
+
const HandleSashPointerUp = 18;
|
|
3950
4091
|
|
|
3951
4092
|
const renderError = errorMessage => {
|
|
3952
4093
|
return [{
|
|
@@ -4149,11 +4290,39 @@ const renderEditorGroupHeader = (group, groupIndex, splitButtonEnabled) => {
|
|
|
4149
4290
|
}, ...getTabsVirtualDom(group, groupIndex, tabsChildCount), ...actions];
|
|
4150
4291
|
};
|
|
4151
4292
|
|
|
4152
|
-
const
|
|
4293
|
+
const renderEmptyGroupCloseButton = (group, groupIndex) => {
|
|
4294
|
+
return [{
|
|
4295
|
+
childCount: 1,
|
|
4296
|
+
className: EmptyGroupCloseButton,
|
|
4297
|
+
'data-action': 'close-group',
|
|
4298
|
+
'data-groupId': String(group.id),
|
|
4299
|
+
onClick: HandleClickAction,
|
|
4300
|
+
title: closeEditorGroup(),
|
|
4301
|
+
type: Button$2
|
|
4302
|
+
}, text('✕')];
|
|
4303
|
+
};
|
|
4304
|
+
|
|
4305
|
+
const renderEmptyEditorGroup = (group, groupIndex, style) => {
|
|
4306
|
+
return [{
|
|
4307
|
+
childCount: 1,
|
|
4308
|
+
className: EditorGroup,
|
|
4309
|
+
style,
|
|
4310
|
+
type: Div
|
|
4311
|
+
}, ...renderEmptyGroupCloseButton(group)];
|
|
4312
|
+
};
|
|
4313
|
+
|
|
4314
|
+
const renderEditorGroup = (group, groupIndex, splitButtonEnabled = false, sizeProperty = 'width') => {
|
|
4153
4315
|
const activeTab = group.tabs.find(tab => tab.id === group.activeTabId);
|
|
4316
|
+
const style = `${sizeProperty}:${group.size}%;`;
|
|
4317
|
+
const hasTabs = group.tabs.length > 0;
|
|
4318
|
+
const hasEmptyGroupCloseButton = !hasTabs;
|
|
4319
|
+
if (hasEmptyGroupCloseButton) {
|
|
4320
|
+
return renderEmptyEditorGroup(group, groupIndex, style);
|
|
4321
|
+
}
|
|
4154
4322
|
return [{
|
|
4155
4323
|
childCount: 2,
|
|
4156
4324
|
className: EditorGroup,
|
|
4325
|
+
style,
|
|
4157
4326
|
type: Div
|
|
4158
4327
|
}, ...renderEditorGroupHeader(group, groupIndex, splitButtonEnabled), {
|
|
4159
4328
|
childCount: 1,
|
|
@@ -4162,22 +4331,40 @@ const renderEditorGroup = (group, groupIndex, splitButtonEnabled = false) => {
|
|
|
4162
4331
|
}, ...renderEditor(activeTab)];
|
|
4163
4332
|
};
|
|
4164
4333
|
|
|
4165
|
-
const renderSash = direction => {
|
|
4334
|
+
const renderSash = (direction, sashId) => {
|
|
4166
4335
|
return {
|
|
4167
4336
|
childCount: 0,
|
|
4168
|
-
className: direction === '
|
|
4337
|
+
className: direction === 'horizontal' ? 'SashVertical' : 'SashHorizontal',
|
|
4338
|
+
'data-sashId': sashId,
|
|
4339
|
+
onPointerDown: HandleSashPointerDown,
|
|
4340
|
+
onPointerMove: HandleSashPointerMove,
|
|
4341
|
+
onPointerUp: HandleSashPointerUp,
|
|
4169
4342
|
type: Div
|
|
4170
4343
|
};
|
|
4171
4344
|
};
|
|
4172
4345
|
|
|
4173
4346
|
const getMainAreaVirtualDom = (layout, splitButtonEnabled = false) => {
|
|
4347
|
+
const sizeProperty = layout.direction === 'vertical' ? 'height' : 'width';
|
|
4348
|
+
if (layout.groups.length === 1) {
|
|
4349
|
+
return [{
|
|
4350
|
+
childCount: 1,
|
|
4351
|
+
className: Main,
|
|
4352
|
+
type: Div
|
|
4353
|
+
}, ...renderEditorGroup(layout.groups[0], 0, splitButtonEnabled, sizeProperty)];
|
|
4354
|
+
}
|
|
4174
4355
|
const children = [];
|
|
4356
|
+
const isSplit = layout.groups.length > 1;
|
|
4357
|
+
const directionClassName = isSplit ? layout.direction === 'horizontal' ? EditorGroupsVertical : EditorGroupsHorizontal : '';
|
|
4358
|
+
const editorGroupsContainerClassName = directionClassName ? `${EDITOR_GROUPS_CONTAINER} ${directionClassName}` : EDITOR_GROUPS_CONTAINER;
|
|
4175
4359
|
for (let i = 0; i < layout.groups.length; i++) {
|
|
4176
4360
|
if (i > 0) {
|
|
4177
4361
|
// Insert sash between groups
|
|
4178
|
-
|
|
4362
|
+
const beforeGroupId = layout.groups[i - 1].id;
|
|
4363
|
+
const afterGroupId = layout.groups[i].id;
|
|
4364
|
+
const sashId = create(beforeGroupId, afterGroupId);
|
|
4365
|
+
children.push(renderSash(layout.direction, sashId));
|
|
4179
4366
|
}
|
|
4180
|
-
children.push(...renderEditorGroup(layout.groups[i], i, splitButtonEnabled));
|
|
4367
|
+
children.push(...renderEditorGroup(layout.groups[i], i, splitButtonEnabled, sizeProperty));
|
|
4181
4368
|
}
|
|
4182
4369
|
return [{
|
|
4183
4370
|
childCount: 1,
|
|
@@ -4185,7 +4372,7 @@ const getMainAreaVirtualDom = (layout, splitButtonEnabled = false) => {
|
|
|
4185
4372
|
type: Div
|
|
4186
4373
|
}, {
|
|
4187
4374
|
childCount: children.length,
|
|
4188
|
-
className:
|
|
4375
|
+
className: editorGroupsContainerClassName,
|
|
4189
4376
|
role: None$1,
|
|
4190
4377
|
type: Div
|
|
4191
4378
|
}, ...children];
|
|
@@ -4214,6 +4401,8 @@ const renderIncremental = (oldState, newState) => {
|
|
|
4214
4401
|
|
|
4215
4402
|
const getRenderer = diffType => {
|
|
4216
4403
|
switch (diffType) {
|
|
4404
|
+
case RenderCss:
|
|
4405
|
+
return renderCss;
|
|
4217
4406
|
case RenderIncremental:
|
|
4218
4407
|
return renderIncremental;
|
|
4219
4408
|
case RenderItems:
|
|
@@ -4265,6 +4454,15 @@ const renderEventListeners = () => {
|
|
|
4265
4454
|
}, {
|
|
4266
4455
|
name: HandleHeaderDoubleClick,
|
|
4267
4456
|
params: ['handleHeaderDoubleClick', EventTargetClassName, 'event.target.dataset.groupId']
|
|
4457
|
+
}, {
|
|
4458
|
+
name: HandleSashPointerDown,
|
|
4459
|
+
params: ['handleSashPointerDown', 'event.target.dataset.sashId', ClientX, ClientY]
|
|
4460
|
+
}, {
|
|
4461
|
+
name: HandleSashPointerMove,
|
|
4462
|
+
params: ['handleSashPointerMove', ClientX, ClientY]
|
|
4463
|
+
}, {
|
|
4464
|
+
name: HandleSashPointerUp,
|
|
4465
|
+
params: ['handleSashPointerUp', ClientX, ClientY]
|
|
4268
4466
|
}];
|
|
4269
4467
|
};
|
|
4270
4468
|
|
|
@@ -4329,7 +4527,7 @@ const splitDown = (state, groupId) => {
|
|
|
4329
4527
|
|
|
4330
4528
|
// If there are no groups, create an initial empty group first
|
|
4331
4529
|
if (groups.length === 0) {
|
|
4332
|
-
const initialGroupId = create();
|
|
4530
|
+
const initialGroupId = create$1();
|
|
4333
4531
|
const initialGroup = {
|
|
4334
4532
|
activeTabId: undefined,
|
|
4335
4533
|
focused: true,
|
|
@@ -4366,7 +4564,7 @@ const splitRight = (state, groupId) => {
|
|
|
4366
4564
|
|
|
4367
4565
|
// If there are no groups, create an initial empty group first
|
|
4368
4566
|
if (groups.length === 0) {
|
|
4369
|
-
const initialGroupId = create();
|
|
4567
|
+
const initialGroupId = create$1();
|
|
4370
4568
|
const initialGroup = {
|
|
4371
4569
|
activeTabId: undefined,
|
|
4372
4570
|
focused: true,
|
|
@@ -4398,7 +4596,7 @@ const commandMap = {
|
|
|
4398
4596
|
'MainArea.closeTabsRight': wrapCommand(closeTabsRight),
|
|
4399
4597
|
'MainArea.copyPath': wrapCommand(copyPath$1),
|
|
4400
4598
|
'MainArea.copyRelativePath': wrapCommand(copyRelativePath$1),
|
|
4401
|
-
'MainArea.create': create$
|
|
4599
|
+
'MainArea.create': create$2,
|
|
4402
4600
|
'MainArea.diff2': diff2,
|
|
4403
4601
|
'MainArea.focusNext': wrapCommand(focusNextTab),
|
|
4404
4602
|
'MainArea.focusNextTab': wrapCommand(focusNextTab),
|
|
@@ -4417,6 +4615,9 @@ const commandMap = {
|
|
|
4417
4615
|
'MainArea.handleModifiedStatusChange': wrapCommand(handleModifiedStatusChange),
|
|
4418
4616
|
'MainArea.handleResize': wrapGetter(handleResize),
|
|
4419
4617
|
// TODO would need to have a function that returns newstate as well as commands
|
|
4618
|
+
'MainArea.handleSashPointerDown': wrapCommand(handleSashPointerDown),
|
|
4619
|
+
'MainArea.handleSashPointerMove': wrapCommand(handleSashPointerMove),
|
|
4620
|
+
'MainArea.handleSashPointerUp': wrapCommand(handleSashPointerUp),
|
|
4420
4621
|
'MainArea.handleTabContextMenu': wrapCommand(handleTabContextMenu),
|
|
4421
4622
|
'MainArea.handleUriChange': wrapCommand(handleUriChange),
|
|
4422
4623
|
'MainArea.handleWorkspaceChange': wrapCommand(handleWorkspaceChange),
|