@lvce-editor/main-area-worker 8.19.0 → 8.21.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 +277 -99
- package/package.json +1 -1
|
@@ -245,6 +245,36 @@ const closeAll$1 = state => {
|
|
|
245
245
|
return withEmptyGroups(state);
|
|
246
246
|
};
|
|
247
247
|
|
|
248
|
+
const redistributeSizesWithRemainder = groups => {
|
|
249
|
+
const baseSize = Math.floor(100 / groups.length);
|
|
250
|
+
const remainder = 100 % groups.length;
|
|
251
|
+
return groups.map((group, index) => ({
|
|
252
|
+
...group,
|
|
253
|
+
size: baseSize + (index === groups.length - 1 ? remainder : 0)
|
|
254
|
+
}));
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
const closeEditorGroup$1 = (state, groupId) => {
|
|
258
|
+
if (Number.isNaN(groupId)) {
|
|
259
|
+
return state;
|
|
260
|
+
}
|
|
261
|
+
const {
|
|
262
|
+
layout
|
|
263
|
+
} = state;
|
|
264
|
+
const {
|
|
265
|
+
activeGroupId,
|
|
266
|
+
groups
|
|
267
|
+
} = layout;
|
|
268
|
+
const groupIndex = getGroupIndexById(state, groupId);
|
|
269
|
+
if (groupIndex === -1 || groups.length <= 1) {
|
|
270
|
+
return state;
|
|
271
|
+
}
|
|
272
|
+
const remainingGroups = groups.filter(group => group.id !== groupId);
|
|
273
|
+
const redistributedGroups = redistributeSizesWithRemainder(remainingGroups);
|
|
274
|
+
const newActiveGroupId = activeGroupId === groupId ? remainingGroups[0].id : activeGroupId;
|
|
275
|
+
return withGroupsAndActiveGroup(state, redistributedGroups, newActiveGroupId);
|
|
276
|
+
};
|
|
277
|
+
|
|
248
278
|
const isFocused = group => {
|
|
249
279
|
return group.focused;
|
|
250
280
|
};
|
|
@@ -592,16 +622,28 @@ const create$e = rpcId => {
|
|
|
592
622
|
};
|
|
593
623
|
};
|
|
594
624
|
|
|
595
|
-
const
|
|
625
|
+
const None$1 = 'none';
|
|
626
|
+
|
|
627
|
+
const Button$2 = 1;
|
|
628
|
+
const Div = 4;
|
|
629
|
+
const Span = 8;
|
|
630
|
+
const Text = 12;
|
|
631
|
+
const Img = 17;
|
|
632
|
+
const P = 50;
|
|
633
|
+
const Pre = 51;
|
|
634
|
+
const Reference = 100;
|
|
635
|
+
|
|
636
|
+
const Button$1 = 'event.button';
|
|
596
637
|
const ClientX = 'event.clientX';
|
|
597
638
|
const ClientY = 'event.clientY';
|
|
598
639
|
const EventTargetClassName = 'event.target.className';
|
|
599
640
|
const TargetName = 'event.target.name';
|
|
600
641
|
|
|
601
642
|
const Tab = 13;
|
|
643
|
+
const Main$1 = 24;
|
|
602
644
|
|
|
603
645
|
const Separator = 1;
|
|
604
|
-
const None
|
|
646
|
+
const None = 0;
|
|
605
647
|
|
|
606
648
|
const ClipBoardWorker = 3400;
|
|
607
649
|
const ExtensionHostWorker = 44;
|
|
@@ -1267,7 +1309,7 @@ const focusPreviousTab = async state => {
|
|
|
1267
1309
|
};
|
|
1268
1310
|
|
|
1269
1311
|
const getMenuIds = () => {
|
|
1270
|
-
return [Tab];
|
|
1312
|
+
return [Main$1, Tab];
|
|
1271
1313
|
};
|
|
1272
1314
|
|
|
1273
1315
|
const handleClick = async (state, name) => {
|
|
@@ -1277,36 +1319,6 @@ const handleClick = async (state, name) => {
|
|
|
1277
1319
|
return state;
|
|
1278
1320
|
};
|
|
1279
1321
|
|
|
1280
|
-
const redistributeSizesWithRemainder = groups => {
|
|
1281
|
-
const baseSize = Math.floor(100 / groups.length);
|
|
1282
|
-
const remainder = 100 % groups.length;
|
|
1283
|
-
return groups.map((group, index) => ({
|
|
1284
|
-
...group,
|
|
1285
|
-
size: baseSize + (index === groups.length - 1 ? remainder : 0)
|
|
1286
|
-
}));
|
|
1287
|
-
};
|
|
1288
|
-
|
|
1289
|
-
const closeEditorGroup$1 = (state, groupId) => {
|
|
1290
|
-
if (Number.isNaN(groupId)) {
|
|
1291
|
-
return state;
|
|
1292
|
-
}
|
|
1293
|
-
const {
|
|
1294
|
-
layout
|
|
1295
|
-
} = state;
|
|
1296
|
-
const {
|
|
1297
|
-
activeGroupId,
|
|
1298
|
-
groups
|
|
1299
|
-
} = layout;
|
|
1300
|
-
const groupIndex = getGroupIndexById(state, groupId);
|
|
1301
|
-
if (groupIndex === -1 || groups.length <= 1) {
|
|
1302
|
-
return state;
|
|
1303
|
-
}
|
|
1304
|
-
const remainingGroups = groups.filter(group => group.id !== groupId);
|
|
1305
|
-
const redistributedGroups = redistributeSizesWithRemainder(remainingGroups);
|
|
1306
|
-
const newActiveGroupId = activeGroupId === groupId ? remainingGroups[0].id : activeGroupId;
|
|
1307
|
-
return withGroupsAndActiveGroup(state, redistributedGroups, newActiveGroupId);
|
|
1308
|
-
};
|
|
1309
|
-
|
|
1310
1322
|
const getActiveGroup = (groups, activeGroupId) => {
|
|
1311
1323
|
return groups.find(g => g.id === activeGroupId);
|
|
1312
1324
|
};
|
|
@@ -1669,16 +1681,10 @@ const getFileIconsForTabs = async (tabs, fileIconCache) => {
|
|
|
1669
1681
|
};
|
|
1670
1682
|
|
|
1671
1683
|
const getOptionUriOptions = options => {
|
|
1672
|
-
let uri = '';
|
|
1673
1684
|
if (typeof options === 'string') {
|
|
1674
|
-
|
|
1675
|
-
} else {
|
|
1676
|
-
const {
|
|
1677
|
-
uri: optionsUri
|
|
1678
|
-
} = options;
|
|
1679
|
-
uri = optionsUri;
|
|
1685
|
+
return options;
|
|
1680
1686
|
}
|
|
1681
|
-
return uri;
|
|
1687
|
+
return options.uri;
|
|
1682
1688
|
};
|
|
1683
1689
|
|
|
1684
1690
|
const getViewletModuleId = async uri => {
|
|
@@ -2042,12 +2048,34 @@ const handleClickTab = async (state, groupIndexRaw, indexRaw) => {
|
|
|
2042
2048
|
return selectTab(state, groupIndex, index);
|
|
2043
2049
|
};
|
|
2044
2050
|
|
|
2051
|
+
const show2 = async (uid, menuId, x, y, args) => {
|
|
2052
|
+
await showContextMenu2(uid, menuId, x, y, args);
|
|
2053
|
+
};
|
|
2054
|
+
|
|
2055
|
+
const handleContextMenu = async (state, rawGroupId, x, y) => {
|
|
2056
|
+
number(x);
|
|
2057
|
+
number(y);
|
|
2058
|
+
if (!rawGroupId) {
|
|
2059
|
+
return state;
|
|
2060
|
+
}
|
|
2061
|
+
const groupId = Number.parseInt(rawGroupId, 10);
|
|
2062
|
+
if (Number.isNaN(groupId)) {
|
|
2063
|
+
return state;
|
|
2064
|
+
}
|
|
2065
|
+
await show2(state.uid, Main$1, x, y, {
|
|
2066
|
+
groupId,
|
|
2067
|
+
menuId: Main$1
|
|
2068
|
+
});
|
|
2069
|
+
return state;
|
|
2070
|
+
};
|
|
2071
|
+
|
|
2045
2072
|
const handleDoubleClick = async state => {
|
|
2046
2073
|
// TODO: implement handleDoubleClick
|
|
2047
2074
|
return state;
|
|
2048
2075
|
};
|
|
2049
2076
|
|
|
2050
2077
|
const EditorGroupHeader = 'EditorGroupHeader';
|
|
2078
|
+
const EmptyGroupHeader = 'EmptyGroupHeader';
|
|
2051
2079
|
const EmptyGroupCloseButton = 'EmptyGroupCloseButton';
|
|
2052
2080
|
const EditorGroup = 'EditorGroup';
|
|
2053
2081
|
const EditorGroupsHorizontal = 'EditorGroupsHorizontal';
|
|
@@ -2068,7 +2096,7 @@ const Main = 'Main';
|
|
|
2068
2096
|
const EDITOR_GROUPS_CONTAINER = 'editor-groups-container';
|
|
2069
2097
|
const TabIcon = 'TabIcon';
|
|
2070
2098
|
const TabTitle = 'TabTitle';
|
|
2071
|
-
const Button
|
|
2099
|
+
const Button = 'Button';
|
|
2072
2100
|
const ButtonSecondary = 'ButtonSecondary';
|
|
2073
2101
|
const EditorContent = 'EditorContent';
|
|
2074
2102
|
const EditorTabCloseButton = 'EditorTabCloseButton';
|
|
@@ -2401,10 +2429,6 @@ const handleSashPointerUp = async state => {
|
|
|
2401
2429
|
};
|
|
2402
2430
|
};
|
|
2403
2431
|
|
|
2404
|
-
const show2 = async (uid, menuId, x, y, args) => {
|
|
2405
|
-
await showContextMenu2(uid, menuId, x, y, args);
|
|
2406
|
-
};
|
|
2407
|
-
|
|
2408
2432
|
const handleTabContextMenu = async (state, button, x, y) => {
|
|
2409
2433
|
number(x);
|
|
2410
2434
|
number(y);
|
|
@@ -3800,16 +3824,6 @@ const loadContent = async (state, savedState) => {
|
|
|
3800
3824
|
};
|
|
3801
3825
|
};
|
|
3802
3826
|
|
|
3803
|
-
const findGroupById = (state, groupId) => {
|
|
3804
|
-
const {
|
|
3805
|
-
layout
|
|
3806
|
-
} = state;
|
|
3807
|
-
const {
|
|
3808
|
-
groups
|
|
3809
|
-
} = layout;
|
|
3810
|
-
return groups.find(group => group.id === groupId);
|
|
3811
|
-
};
|
|
3812
|
-
|
|
3813
3827
|
const emptyObject = {};
|
|
3814
3828
|
const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
|
|
3815
3829
|
const i18nString = (key, placeholders = emptyObject) => {
|
|
@@ -3841,17 +3855,37 @@ const Pin = 'Pin';
|
|
|
3841
3855
|
const SplitAndMove = 'Split & Move';
|
|
3842
3856
|
const MoveIntoNewWindow = 'Move into New Window';
|
|
3843
3857
|
const CopyIntoNewWindow = 'Copy into New Window';
|
|
3858
|
+
const NewWindow = 'New Window';
|
|
3859
|
+
const OpenFile = 'Open File';
|
|
3860
|
+
const SplitDown = 'Split Down';
|
|
3844
3861
|
const SplitEditorGroup = 'Split Editor Group';
|
|
3862
|
+
const SplitLeft = 'Split Left';
|
|
3845
3863
|
const SplitRight = 'Split Right';
|
|
3864
|
+
const SplitUp = 'Split Up';
|
|
3846
3865
|
const TogglePreview = 'Toggle Preview';
|
|
3847
3866
|
const Retry = 'Retry';
|
|
3848
3867
|
|
|
3868
|
+
const openFile = () => {
|
|
3869
|
+
return i18nString(OpenFile);
|
|
3870
|
+
};
|
|
3871
|
+
const splitUp$1 = () => {
|
|
3872
|
+
return i18nString(SplitUp);
|
|
3873
|
+
};
|
|
3874
|
+
const splitDown$1 = () => {
|
|
3875
|
+
return i18nString(SplitDown);
|
|
3876
|
+
};
|
|
3877
|
+
const splitLeft$1 = () => {
|
|
3878
|
+
return i18nString(SplitLeft);
|
|
3879
|
+
};
|
|
3849
3880
|
const splitRight$1 = () => {
|
|
3850
3881
|
return i18nString(SplitRight);
|
|
3851
3882
|
};
|
|
3852
3883
|
const splitEditorGroup = () => {
|
|
3853
3884
|
return i18nString(SplitEditorGroup);
|
|
3854
3885
|
};
|
|
3886
|
+
const newWindow = () => {
|
|
3887
|
+
return i18nString(NewWindow);
|
|
3888
|
+
};
|
|
3855
3889
|
const close = () => {
|
|
3856
3890
|
return i18nString(Close);
|
|
3857
3891
|
};
|
|
@@ -3923,6 +3957,74 @@ const menuEntrySeparator = {
|
|
|
3923
3957
|
label: ''
|
|
3924
3958
|
};
|
|
3925
3959
|
|
|
3960
|
+
const QuickPick = 'QuickPick';
|
|
3961
|
+
|
|
3962
|
+
const getArgs = groupId => {
|
|
3963
|
+
if (groupId === undefined) {
|
|
3964
|
+
return undefined;
|
|
3965
|
+
}
|
|
3966
|
+
return [groupId];
|
|
3967
|
+
};
|
|
3968
|
+
const getMenuEntries$2 = groupId => {
|
|
3969
|
+
const groupArgs = getArgs(groupId);
|
|
3970
|
+
const entries = [{
|
|
3971
|
+
args: [QuickPick, 'file'],
|
|
3972
|
+
command: 'Viewlet.openWidget',
|
|
3973
|
+
flags: None,
|
|
3974
|
+
id: 'openFile',
|
|
3975
|
+
label: openFile()
|
|
3976
|
+
}, menuEntrySeparator, {
|
|
3977
|
+
args: groupArgs,
|
|
3978
|
+
command: 'MainArea.splitUp',
|
|
3979
|
+
flags: None,
|
|
3980
|
+
id: 'splitUp',
|
|
3981
|
+
label: splitUp$1()
|
|
3982
|
+
}, {
|
|
3983
|
+
args: groupArgs,
|
|
3984
|
+
command: 'MainArea.splitDown',
|
|
3985
|
+
flags: None,
|
|
3986
|
+
id: 'splitDown',
|
|
3987
|
+
label: splitDown$1()
|
|
3988
|
+
}, {
|
|
3989
|
+
args: groupArgs,
|
|
3990
|
+
command: 'MainArea.splitLeft',
|
|
3991
|
+
flags: None,
|
|
3992
|
+
id: 'splitLeft',
|
|
3993
|
+
label: splitLeft$1()
|
|
3994
|
+
}, {
|
|
3995
|
+
args: groupArgs,
|
|
3996
|
+
command: 'MainArea.splitRight',
|
|
3997
|
+
flags: None,
|
|
3998
|
+
id: 'splitRight',
|
|
3999
|
+
label: splitRight$1()
|
|
4000
|
+
}, menuEntrySeparator, {
|
|
4001
|
+
command: 'Main.newWindow',
|
|
4002
|
+
flags: None,
|
|
4003
|
+
id: 'newWindow',
|
|
4004
|
+
label: newWindow()
|
|
4005
|
+
}];
|
|
4006
|
+
if (groupId === undefined) {
|
|
4007
|
+
return entries;
|
|
4008
|
+
}
|
|
4009
|
+
return [...entries, menuEntrySeparator, {
|
|
4010
|
+
args: [groupId],
|
|
4011
|
+
command: 'MainArea.closeEditorGroup',
|
|
4012
|
+
flags: None,
|
|
4013
|
+
id: 'closeGroup',
|
|
4014
|
+
label: closeEditorGroup()
|
|
4015
|
+
}];
|
|
4016
|
+
};
|
|
4017
|
+
|
|
4018
|
+
const findGroupById = (state, groupId) => {
|
|
4019
|
+
const {
|
|
4020
|
+
layout
|
|
4021
|
+
} = state;
|
|
4022
|
+
const {
|
|
4023
|
+
groups
|
|
4024
|
+
} = layout;
|
|
4025
|
+
return groups.find(group => group.id === groupId);
|
|
4026
|
+
};
|
|
4027
|
+
|
|
3926
4028
|
// TODO should pass tab uri as argument or tab index
|
|
3927
4029
|
const getMenuEntries$1 = state => {
|
|
3928
4030
|
const {
|
|
@@ -3948,101 +4050,101 @@ const getMenuEntries$1 = state => {
|
|
|
3948
4050
|
} = tab;
|
|
3949
4051
|
return [{
|
|
3950
4052
|
command: 'Main.closeFocusedTab',
|
|
3951
|
-
flags: None
|
|
4053
|
+
flags: None,
|
|
3952
4054
|
id: 'tabClose',
|
|
3953
4055
|
label: close()
|
|
3954
4056
|
}, {
|
|
3955
4057
|
command: 'Main.closeOthers',
|
|
3956
|
-
flags: None
|
|
4058
|
+
flags: None,
|
|
3957
4059
|
id: 'tabCloseOthers',
|
|
3958
4060
|
label: closeOthers()
|
|
3959
4061
|
}, {
|
|
3960
4062
|
command: 'Main.closeTabsRight',
|
|
3961
|
-
flags: None
|
|
4063
|
+
flags: None,
|
|
3962
4064
|
id: 'tabCloseToTheRight',
|
|
3963
4065
|
label: closeToTheRight()
|
|
3964
4066
|
}, {
|
|
3965
4067
|
command: 'Main.closeSaved',
|
|
3966
|
-
flags: None
|
|
4068
|
+
flags: None,
|
|
3967
4069
|
id: 'tabCloseSaved',
|
|
3968
4070
|
label: closeSaved()
|
|
3969
4071
|
}, {
|
|
3970
4072
|
command: 'Main.closeAll',
|
|
3971
|
-
flags: None
|
|
4073
|
+
flags: None,
|
|
3972
4074
|
id: 'tabCloseAll',
|
|
3973
4075
|
label: closeAll()
|
|
3974
4076
|
}, menuEntrySeparator, {
|
|
3975
4077
|
args: [path],
|
|
3976
4078
|
command: 'Main.copyPath',
|
|
3977
|
-
flags: None
|
|
4079
|
+
flags: None,
|
|
3978
4080
|
id: 'copyPath',
|
|
3979
4081
|
label: copyPath()
|
|
3980
4082
|
}, {
|
|
3981
4083
|
args: [path],
|
|
3982
4084
|
command: 'Main.copyRelativePath',
|
|
3983
|
-
flags: None
|
|
4085
|
+
flags: None,
|
|
3984
4086
|
id: 'copyRelativePath',
|
|
3985
4087
|
label: copyRelativePath()
|
|
3986
4088
|
}, menuEntrySeparator, {
|
|
3987
4089
|
command: '',
|
|
3988
|
-
flags: None
|
|
4090
|
+
flags: None,
|
|
3989
4091
|
id: 'reopenEditorWith',
|
|
3990
4092
|
label: reopenEditorWith()
|
|
3991
4093
|
}, menuEntrySeparator, {
|
|
3992
4094
|
command: '',
|
|
3993
|
-
flags: None
|
|
4095
|
+
flags: None,
|
|
3994
4096
|
id: 'share',
|
|
3995
4097
|
label: share()
|
|
3996
4098
|
}, menuEntrySeparator, {
|
|
3997
4099
|
command: '',
|
|
3998
|
-
flags: None
|
|
4100
|
+
flags: None,
|
|
3999
4101
|
id: 'addFileToChat',
|
|
4000
4102
|
label: addFileToChat()
|
|
4001
4103
|
}, menuEntrySeparator, {
|
|
4002
4104
|
command: '',
|
|
4003
|
-
flags: None
|
|
4105
|
+
flags: None,
|
|
4004
4106
|
id: 'openContainingFolder',
|
|
4005
4107
|
label: openContainingFolder()
|
|
4006
4108
|
}, {
|
|
4007
4109
|
args: [path],
|
|
4008
4110
|
command: 'Explorer.revealItem',
|
|
4009
|
-
flags: None
|
|
4111
|
+
flags: None,
|
|
4010
4112
|
id: 'revealInExplorerView',
|
|
4011
4113
|
label: revealInExplorerView()
|
|
4012
4114
|
}, menuEntrySeparator, {
|
|
4013
4115
|
command: '',
|
|
4014
|
-
flags: None
|
|
4116
|
+
flags: None,
|
|
4015
4117
|
id: 'keepOpen',
|
|
4016
4118
|
label: keepOpen()
|
|
4017
4119
|
}, {
|
|
4018
4120
|
command: '',
|
|
4019
|
-
flags: None
|
|
4121
|
+
flags: None,
|
|
4020
4122
|
id: 'pin',
|
|
4021
4123
|
label: pin()
|
|
4022
4124
|
}, menuEntrySeparator, {
|
|
4023
4125
|
command: 'Main.splitRight',
|
|
4024
|
-
flags: None
|
|
4126
|
+
flags: None,
|
|
4025
4127
|
id: 'splitRight',
|
|
4026
4128
|
label: splitRight$1()
|
|
4027
4129
|
}, {
|
|
4028
4130
|
command: '',
|
|
4029
|
-
flags: None
|
|
4131
|
+
flags: None,
|
|
4030
4132
|
id: 'splitAndMove',
|
|
4031
4133
|
label: splitAndMove()
|
|
4032
4134
|
}, {
|
|
4033
4135
|
command: '',
|
|
4034
|
-
flags: None
|
|
4136
|
+
flags: None,
|
|
4035
4137
|
id: 'moveIntoNewWindow',
|
|
4036
4138
|
label: moveIntoNewWindow()
|
|
4037
4139
|
}, {
|
|
4038
4140
|
command: '',
|
|
4039
|
-
flags: None
|
|
4141
|
+
flags: None,
|
|
4040
4142
|
id: 'copyIntoNewWindow',
|
|
4041
4143
|
label: copyIntoNewWindow()
|
|
4042
4144
|
}, menuEntrySeparator, {
|
|
4043
4145
|
args: [/* id */'References', /* focus */true, path],
|
|
4044
4146
|
command: 'SideBar.show',
|
|
4045
|
-
flags: None
|
|
4147
|
+
flags: None,
|
|
4046
4148
|
id: 'findFileReferences',
|
|
4047
4149
|
label: findFileReferences()
|
|
4048
4150
|
}];
|
|
@@ -4050,6 +4152,8 @@ const getMenuEntries$1 = state => {
|
|
|
4050
4152
|
|
|
4051
4153
|
const getMenuEntries = async (state, props) => {
|
|
4052
4154
|
switch (props.menuId) {
|
|
4155
|
+
case Main$1:
|
|
4156
|
+
return getMenuEntries$2(props.groupId);
|
|
4053
4157
|
case Tab:
|
|
4054
4158
|
return getMenuEntries$1(state);
|
|
4055
4159
|
default:
|
|
@@ -4101,17 +4205,6 @@ const renderCss = (oldState, newState) => {
|
|
|
4101
4205
|
return [SetCss, newState.uid, css];
|
|
4102
4206
|
};
|
|
4103
4207
|
|
|
4104
|
-
const None = 'none';
|
|
4105
|
-
|
|
4106
|
-
const Button = 1;
|
|
4107
|
-
const Div = 4;
|
|
4108
|
-
const Span = 8;
|
|
4109
|
-
const Text = 12;
|
|
4110
|
-
const Img = 17;
|
|
4111
|
-
const P = 50;
|
|
4112
|
-
const Pre = 51;
|
|
4113
|
-
const Reference = 100;
|
|
4114
|
-
|
|
4115
4208
|
const mergeClassNames = (...classNames) => {
|
|
4116
4209
|
return classNames.filter(Boolean).join(' ');
|
|
4117
4210
|
};
|
|
@@ -4424,6 +4517,7 @@ const renderContent = content => {
|
|
|
4424
4517
|
}, text(content)];
|
|
4425
4518
|
};
|
|
4426
4519
|
|
|
4520
|
+
const HandleContextMenu = 2;
|
|
4427
4521
|
const HandleClickAction = 10;
|
|
4428
4522
|
const HandleClick = 11;
|
|
4429
4523
|
const HandleClickClose = 12;
|
|
@@ -4448,11 +4542,11 @@ const renderError = errorMessage => {
|
|
|
4448
4542
|
type: P
|
|
4449
4543
|
}, text(`Error: ${errorMessage}`), {
|
|
4450
4544
|
childCount: 1,
|
|
4451
|
-
className: mergeClassNames(Button
|
|
4545
|
+
className: mergeClassNames(Button, ButtonSecondary),
|
|
4452
4546
|
'data-action': RetryOpen,
|
|
4453
4547
|
name: RetryOpen,
|
|
4454
4548
|
onClick: HandleClickAction,
|
|
4455
|
-
type: Button
|
|
4549
|
+
type: Button$2
|
|
4456
4550
|
}, text(retry())];
|
|
4457
4551
|
};
|
|
4458
4552
|
|
|
@@ -4525,7 +4619,7 @@ const renderTabActions = (isDirty, tabIndex, groupIndex) => {
|
|
|
4525
4619
|
'data-groupIndex': groupIndex,
|
|
4526
4620
|
'data-index': tabIndex,
|
|
4527
4621
|
onClick: HandleClickClose,
|
|
4528
|
-
type: Button
|
|
4622
|
+
type: Button$2
|
|
4529
4623
|
}, {
|
|
4530
4624
|
childCount: 0,
|
|
4531
4625
|
className: MaskIconClose,
|
|
@@ -4559,7 +4653,7 @@ const renderTab = (tab, isActive, tabIndex, groupIndex) => {
|
|
|
4559
4653
|
}, {
|
|
4560
4654
|
childCount: 0,
|
|
4561
4655
|
className: TabIcon,
|
|
4562
|
-
role: None,
|
|
4656
|
+
role: None$1,
|
|
4563
4657
|
src: tab.icon,
|
|
4564
4658
|
type: Img
|
|
4565
4659
|
}, {
|
|
@@ -4602,7 +4696,7 @@ const renderEditorGroupActions = (group, groupIndex, splitButtonEnabled) => {
|
|
|
4602
4696
|
name: TogglePreview$1,
|
|
4603
4697
|
onClick: HandleClickAction,
|
|
4604
4698
|
title: togglePreview(),
|
|
4605
|
-
type: Button
|
|
4699
|
+
type: Button$2
|
|
4606
4700
|
}, {
|
|
4607
4701
|
childCount: 0,
|
|
4608
4702
|
className: MaskIconPreview,
|
|
@@ -4618,7 +4712,7 @@ const renderEditorGroupActions = (group, groupIndex, splitButtonEnabled) => {
|
|
|
4618
4712
|
name: SplitRight$1,
|
|
4619
4713
|
onClick: HandleClickAction,
|
|
4620
4714
|
title: splitEditorGroup(),
|
|
4621
|
-
type: Button
|
|
4715
|
+
type: Button$2
|
|
4622
4716
|
}, text('split'));
|
|
4623
4717
|
}
|
|
4624
4718
|
return [{
|
|
@@ -4638,31 +4732,37 @@ const renderEditorGroupHeader = (group, groupIndex, splitButtonEnabled) => {
|
|
|
4638
4732
|
childCount: hasActions ? 2 : 1,
|
|
4639
4733
|
className: EditorGroupHeader,
|
|
4640
4734
|
onDblClick: HandleHeaderDoubleClick,
|
|
4641
|
-
role: None,
|
|
4735
|
+
role: None$1,
|
|
4642
4736
|
type: Div
|
|
4643
4737
|
}, ...getTabsVirtualDom(group, groupIndex, tabsChildCount), ...actions];
|
|
4644
4738
|
};
|
|
4645
4739
|
|
|
4646
4740
|
const renderEmptyGroupCloseButton = (group, groupIndex) => {
|
|
4647
4741
|
return [{
|
|
4742
|
+
childCount: 1,
|
|
4743
|
+
className: EmptyGroupHeader,
|
|
4744
|
+
type: Div
|
|
4745
|
+
}, {
|
|
4648
4746
|
childCount: 1,
|
|
4649
4747
|
className: EmptyGroupCloseButton,
|
|
4650
4748
|
'data-groupId': String(group.id),
|
|
4651
4749
|
name: CloseGroup,
|
|
4652
4750
|
onClick: HandleClickAction,
|
|
4653
4751
|
title: closeEditorGroup(),
|
|
4654
|
-
type: Button
|
|
4752
|
+
type: Button$2
|
|
4655
4753
|
}, text('✕')];
|
|
4656
4754
|
};
|
|
4657
4755
|
|
|
4658
|
-
const renderWaterMark =
|
|
4756
|
+
const renderWaterMark = groupId => {
|
|
4659
4757
|
return [{
|
|
4660
4758
|
childCount: 1,
|
|
4661
4759
|
className: 'WaterMarkWrapper',
|
|
4760
|
+
'data-groupId': String(groupId),
|
|
4662
4761
|
type: Div
|
|
4663
4762
|
}, {
|
|
4664
4763
|
childCount: 0,
|
|
4665
4764
|
className: 'WaterMark',
|
|
4765
|
+
'data-groupId': String(groupId),
|
|
4666
4766
|
type: Div
|
|
4667
4767
|
}];
|
|
4668
4768
|
};
|
|
@@ -4671,9 +4771,12 @@ const renderEmptyEditorGroup = (group, groupIndex, style) => {
|
|
|
4671
4771
|
return [{
|
|
4672
4772
|
childCount: 2,
|
|
4673
4773
|
className: EditorGroup,
|
|
4774
|
+
'data-groupId': String(group.id),
|
|
4775
|
+
onContextMenu: HandleContextMenu,
|
|
4674
4776
|
style,
|
|
4777
|
+
tabIndex: 0,
|
|
4675
4778
|
type: Div
|
|
4676
|
-
}, ...renderEmptyGroupCloseButton(group), ...renderWaterMark()];
|
|
4779
|
+
}, ...renderEmptyGroupCloseButton(group), ...renderWaterMark(group.id)];
|
|
4677
4780
|
};
|
|
4678
4781
|
|
|
4679
4782
|
const renderEditorGroup = (group, groupIndex, splitButtonEnabled = false, sizeProperty = 'width') => {
|
|
@@ -4706,8 +4809,9 @@ const renderSash = (direction, sashId, style) => {
|
|
|
4706
4809
|
className: getSashClassName(direction),
|
|
4707
4810
|
'data-sashId': sashId,
|
|
4708
4811
|
onPointerDown: HandleSashPointerDown,
|
|
4812
|
+
role: 'none',
|
|
4709
4813
|
style,
|
|
4710
|
-
type:
|
|
4814
|
+
type: Button$2
|
|
4711
4815
|
}, {
|
|
4712
4816
|
childCount: 0,
|
|
4713
4817
|
className: 'SashBorder',
|
|
@@ -4760,7 +4864,7 @@ const getMainAreaVirtualDom = (layout, splitButtonEnabled = false) => {
|
|
|
4760
4864
|
}, {
|
|
4761
4865
|
childCount,
|
|
4762
4866
|
className: editorGroupsContainerClassName,
|
|
4763
|
-
role: None,
|
|
4867
|
+
role: None$1,
|
|
4764
4868
|
type: Div
|
|
4765
4869
|
}, ...children];
|
|
4766
4870
|
};
|
|
@@ -4831,9 +4935,13 @@ const renderEventListeners = () => {
|
|
|
4831
4935
|
}, {
|
|
4832
4936
|
name: HandleClickTab,
|
|
4833
4937
|
params: ['handleClickTab', 'event.target.dataset.groupIndex', 'event.target.dataset.index']
|
|
4938
|
+
}, {
|
|
4939
|
+
name: HandleContextMenu,
|
|
4940
|
+
params: ['handleContextMenu', 'event.target.dataset.groupId', ClientX, ClientY],
|
|
4941
|
+
preventDefault: true
|
|
4834
4942
|
}, {
|
|
4835
4943
|
name: HandleTabContextMenu,
|
|
4836
|
-
params: ['handleTabContextMenu', Button$
|
|
4944
|
+
params: ['handleTabContextMenu', Button$1, ClientX, ClientY],
|
|
4837
4945
|
preventDefault: true
|
|
4838
4946
|
}, {
|
|
4839
4947
|
name: HandleClickAction,
|
|
@@ -4942,6 +5050,38 @@ const splitDown = (state, groupId) => {
|
|
|
4942
5050
|
return splitEditorGroup$1(state, resolvedGroupId, 'down');
|
|
4943
5051
|
};
|
|
4944
5052
|
|
|
5053
|
+
const splitLeft = (state, groupId) => {
|
|
5054
|
+
const {
|
|
5055
|
+
layout
|
|
5056
|
+
} = state;
|
|
5057
|
+
const {
|
|
5058
|
+
activeGroupId,
|
|
5059
|
+
groups
|
|
5060
|
+
} = layout;
|
|
5061
|
+
if (groups.length === 0) {
|
|
5062
|
+
const initialGroupId = create$c();
|
|
5063
|
+
const initialGroup = {
|
|
5064
|
+
activeTabId: undefined,
|
|
5065
|
+
focused: true,
|
|
5066
|
+
id: initialGroupId,
|
|
5067
|
+
isEmpty: true,
|
|
5068
|
+
size: 100,
|
|
5069
|
+
tabs: []
|
|
5070
|
+
};
|
|
5071
|
+
const stateWithInitialGroup = {
|
|
5072
|
+
...state,
|
|
5073
|
+
layout: {
|
|
5074
|
+
...layout,
|
|
5075
|
+
activeGroupId: initialGroupId,
|
|
5076
|
+
groups: [initialGroup]
|
|
5077
|
+
}
|
|
5078
|
+
};
|
|
5079
|
+
return splitEditorGroup$1(stateWithInitialGroup, initialGroupId, Left);
|
|
5080
|
+
}
|
|
5081
|
+
const targetGroupId = groupId ?? activeGroupId ?? groups[0]?.id ?? 0;
|
|
5082
|
+
return splitEditorGroup$1(state, targetGroupId, Left);
|
|
5083
|
+
};
|
|
5084
|
+
|
|
4945
5085
|
const splitRight = (state, groupId) => {
|
|
4946
5086
|
const {
|
|
4947
5087
|
layout
|
|
@@ -4976,10 +5116,45 @@ const splitRight = (state, groupId) => {
|
|
|
4976
5116
|
return splitEditorGroup$1(state, targetGroupId, Right);
|
|
4977
5117
|
};
|
|
4978
5118
|
|
|
5119
|
+
const splitUp = (state, groupId) => {
|
|
5120
|
+
const {
|
|
5121
|
+
layout
|
|
5122
|
+
} = state;
|
|
5123
|
+
const {
|
|
5124
|
+
groups
|
|
5125
|
+
} = layout;
|
|
5126
|
+
if (groups.length === 0) {
|
|
5127
|
+
const initialGroupId = create$c();
|
|
5128
|
+
const initialGroup = {
|
|
5129
|
+
activeTabId: undefined,
|
|
5130
|
+
focused: true,
|
|
5131
|
+
id: initialGroupId,
|
|
5132
|
+
isEmpty: true,
|
|
5133
|
+
size: 100,
|
|
5134
|
+
tabs: []
|
|
5135
|
+
};
|
|
5136
|
+
const stateWithInitialGroup = {
|
|
5137
|
+
...state,
|
|
5138
|
+
layout: {
|
|
5139
|
+
...layout,
|
|
5140
|
+
activeGroupId: initialGroupId,
|
|
5141
|
+
groups: [initialGroup]
|
|
5142
|
+
}
|
|
5143
|
+
};
|
|
5144
|
+
return splitEditorGroup$1(stateWithInitialGroup, initialGroupId, 'up');
|
|
5145
|
+
}
|
|
5146
|
+
const resolvedGroupId = groupId ?? state.layout.activeGroupId;
|
|
5147
|
+
if (!resolvedGroupId) {
|
|
5148
|
+
return state;
|
|
5149
|
+
}
|
|
5150
|
+
return splitEditorGroup$1(state, resolvedGroupId, 'up');
|
|
5151
|
+
};
|
|
5152
|
+
|
|
4979
5153
|
const commandMap = {
|
|
4980
5154
|
'MainArea.closeActiveEditor': wrapCommand(closeActiveEditor),
|
|
4981
5155
|
'MainArea.closeAll': wrapCommand(closeAll$1),
|
|
4982
5156
|
'MainArea.closeAllEditors': wrapCommand(closeAll$1),
|
|
5157
|
+
'MainArea.closeEditorGroup': wrapCommand(closeEditorGroup$1),
|
|
4983
5158
|
'MainArea.closeFocusedTab': wrapCommand(closeFocusedTab),
|
|
4984
5159
|
'MainArea.closeOthers': wrapCommand(closeOtherTabs),
|
|
4985
5160
|
'MainArea.closeSaved': wrapCommand(closeSaved$1),
|
|
@@ -5000,6 +5175,7 @@ const commandMap = {
|
|
|
5000
5175
|
'MainArea.handleClickCloseTab': wrapCommand(handleClickCloseTab),
|
|
5001
5176
|
'MainArea.handleClickTab': wrapCommand(handleClickTab),
|
|
5002
5177
|
'MainArea.handleClickTogglePreview': wrapCommand(handleClickTogglePreview),
|
|
5178
|
+
'MainArea.handleContextMenu': wrapCommand(handleContextMenu),
|
|
5003
5179
|
'MainArea.handleDoubleClick': wrapCommand(handleDoubleClick),
|
|
5004
5180
|
'MainArea.handleHeaderDoubleClick': wrapCommand(handleHeaderDoubleClick),
|
|
5005
5181
|
'MainArea.handleModifiedStatusChange': wrapCommand(handleModifiedStatusChange),
|
|
@@ -5024,7 +5200,9 @@ const commandMap = {
|
|
|
5024
5200
|
'MainArea.saveState': wrapGetter(saveState),
|
|
5025
5201
|
'MainArea.selectTab': wrapCommand(selectTab),
|
|
5026
5202
|
'MainArea.splitDown': wrapCommand(splitDown),
|
|
5203
|
+
'MainArea.splitLeft': wrapCommand(splitLeft),
|
|
5027
5204
|
'MainArea.splitRight': wrapCommand(splitRight),
|
|
5205
|
+
'MainArea.splitUp': wrapCommand(splitUp),
|
|
5028
5206
|
'MainArea.terminate': terminate
|
|
5029
5207
|
};
|
|
5030
5208
|
|