@lvce-editor/main-area-worker 9.18.0 → 9.20.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 +345 -29
- package/package.json +1 -1
|
@@ -1896,6 +1896,38 @@ const closeTabsRight = (state, groupId) => {
|
|
|
1896
1896
|
return withGroups(addClosedTabs(state, closedTabs), newGroups);
|
|
1897
1897
|
};
|
|
1898
1898
|
|
|
1899
|
+
const findGroupById = (state, groupId) => {
|
|
1900
|
+
const {
|
|
1901
|
+
layout
|
|
1902
|
+
} = state;
|
|
1903
|
+
const {
|
|
1904
|
+
groups
|
|
1905
|
+
} = layout;
|
|
1906
|
+
return groups.find(group => group.id === groupId);
|
|
1907
|
+
};
|
|
1908
|
+
|
|
1909
|
+
const copyIntoNewWindow$1 = async state => {
|
|
1910
|
+
const {
|
|
1911
|
+
activeGroupId
|
|
1912
|
+
} = state.layout;
|
|
1913
|
+
const group = findGroupById(state, activeGroupId ?? 0);
|
|
1914
|
+
if (!group) {
|
|
1915
|
+
return state;
|
|
1916
|
+
}
|
|
1917
|
+
const {
|
|
1918
|
+
activeTabId
|
|
1919
|
+
} = group;
|
|
1920
|
+
if (activeTabId === undefined) {
|
|
1921
|
+
return state;
|
|
1922
|
+
}
|
|
1923
|
+
const tab = group.tabs.find(tab => tab.id === activeTabId);
|
|
1924
|
+
if (!tab?.uri) {
|
|
1925
|
+
return state;
|
|
1926
|
+
}
|
|
1927
|
+
await invoke('ElectronWindow.openNewWithUri', tab.uri);
|
|
1928
|
+
return state;
|
|
1929
|
+
};
|
|
1930
|
+
|
|
1899
1931
|
const copyPath$1 = async (state, path) => {
|
|
1900
1932
|
string(path);
|
|
1901
1933
|
await writeClipBoardText(path);
|
|
@@ -1944,6 +1976,7 @@ const create$2 = (uid, uri, x, y, width, height, platform, assetDir, tabHeight =
|
|
|
1944
1976
|
closedTabs: [],
|
|
1945
1977
|
fileIconCache: {},
|
|
1946
1978
|
height,
|
|
1979
|
+
homeDirUri: '',
|
|
1947
1980
|
iframes: [],
|
|
1948
1981
|
initial: true,
|
|
1949
1982
|
layout: {
|
|
@@ -3018,6 +3051,16 @@ const getCurrentState = state => {
|
|
|
3018
3051
|
return state;
|
|
3019
3052
|
};
|
|
3020
3053
|
|
|
3054
|
+
const getTitle = (uri, homeDir) => {
|
|
3055
|
+
if (!uri) {
|
|
3056
|
+
return '';
|
|
3057
|
+
}
|
|
3058
|
+
const normalizedHomeDir = homeDir.endsWith('/') ? homeDir.slice(0, -1) : homeDir;
|
|
3059
|
+
if (uri.startsWith('file://') && normalizedHomeDir.startsWith('file://') && (uri === normalizedHomeDir || uri.startsWith(`${normalizedHomeDir}/`))) {
|
|
3060
|
+
return `~${uri.slice(normalizedHomeDir.length)}`;
|
|
3061
|
+
}
|
|
3062
|
+
return uri;
|
|
3063
|
+
};
|
|
3021
3064
|
const getBasename$1 = uri => {
|
|
3022
3065
|
const lastSlashIndex = uri.lastIndexOf('/');
|
|
3023
3066
|
if (lastSlashIndex === -1) {
|
|
@@ -3034,6 +3077,9 @@ const getInlineDiffLabel = uri => {
|
|
|
3034
3077
|
return `${getBasename$1(workingTreeUri)} (Working Tree)`;
|
|
3035
3078
|
};
|
|
3036
3079
|
const getLabel = uri => {
|
|
3080
|
+
if (uri === 'app://keybindings') {
|
|
3081
|
+
return 'Keyboard Shortcuts';
|
|
3082
|
+
}
|
|
3037
3083
|
if (uri.startsWith('settings://')) {
|
|
3038
3084
|
return 'Settings';
|
|
3039
3085
|
}
|
|
@@ -3072,7 +3118,41 @@ const getEditorInputTitle = editorInput => {
|
|
|
3072
3118
|
}
|
|
3073
3119
|
};
|
|
3074
3120
|
|
|
3075
|
-
const
|
|
3121
|
+
const getUriTitle = (uri, homeDirUri) => {
|
|
3122
|
+
if (!uri) {
|
|
3123
|
+
return undefined;
|
|
3124
|
+
}
|
|
3125
|
+
const title = getTitle(uri, homeDirUri);
|
|
3126
|
+
return title === uri ? undefined : title;
|
|
3127
|
+
};
|
|
3128
|
+
const updateTabUriTitle = (tab, homeDirUri) => {
|
|
3129
|
+
const uriTitle = getUriTitle(tab.uri, homeDirUri);
|
|
3130
|
+
if (tab.uriTitle === uriTitle) {
|
|
3131
|
+
return tab;
|
|
3132
|
+
}
|
|
3133
|
+
return {
|
|
3134
|
+
...tab,
|
|
3135
|
+
uriTitle
|
|
3136
|
+
};
|
|
3137
|
+
};
|
|
3138
|
+
const updateTabUriTitles = state => {
|
|
3139
|
+
const {
|
|
3140
|
+
layout
|
|
3141
|
+
} = state;
|
|
3142
|
+
const homeDirUri = state.homeDirUri || '';
|
|
3143
|
+
return {
|
|
3144
|
+
...state,
|
|
3145
|
+
layout: {
|
|
3146
|
+
...layout,
|
|
3147
|
+
groups: layout.groups.map(group => ({
|
|
3148
|
+
...group,
|
|
3149
|
+
tabs: group.tabs.map(tab => updateTabUriTitle(tab, homeDirUri))
|
|
3150
|
+
}))
|
|
3151
|
+
}
|
|
3152
|
+
};
|
|
3153
|
+
};
|
|
3154
|
+
|
|
3155
|
+
const createEmptyGroup$1 = (state, uri, requestId, preview = false, title = getLabel(uri), editorType = 'text', editorInput) => {
|
|
3076
3156
|
const {
|
|
3077
3157
|
layout
|
|
3078
3158
|
} = state;
|
|
@@ -3094,7 +3174,8 @@ const createEmptyGroup = (state, uri, requestId, preview = false, title = getLab
|
|
|
3094
3174
|
language: '',
|
|
3095
3175
|
loadingState: 'loading',
|
|
3096
3176
|
title,
|
|
3097
|
-
uri
|
|
3177
|
+
uri,
|
|
3178
|
+
uriTitle: getUriTitle(uri, state.homeDirUri || '')
|
|
3098
3179
|
};
|
|
3099
3180
|
const newGroup = {
|
|
3100
3181
|
activeTabId: newTab.id,
|
|
@@ -3188,7 +3269,8 @@ const ensureActiveGroup = (state, uri, preview = false, title = getLabel(uri), e
|
|
|
3188
3269
|
language: '',
|
|
3189
3270
|
loadingState: 'loading',
|
|
3190
3271
|
title,
|
|
3191
|
-
uri
|
|
3272
|
+
uri,
|
|
3273
|
+
uriTitle: getUriTitle(uri, state.homeDirUri || '')
|
|
3192
3274
|
};
|
|
3193
3275
|
});
|
|
3194
3276
|
return {
|
|
@@ -3221,11 +3303,12 @@ const ensureActiveGroup = (state, uri, preview = false, title = getLabel(uri), e
|
|
|
3221
3303
|
language: '',
|
|
3222
3304
|
loadingState: 'loading',
|
|
3223
3305
|
title,
|
|
3224
|
-
uri: uri
|
|
3306
|
+
uri: uri,
|
|
3307
|
+
uriTitle: getUriTitle(uri, state.homeDirUri || '')
|
|
3225
3308
|
};
|
|
3226
3309
|
newState = openTab(state, activeGroup.id, newTab);
|
|
3227
3310
|
} else {
|
|
3228
|
-
newState = createEmptyGroup(state, uri, requestId, preview, title, editorType, editorInput);
|
|
3311
|
+
newState = createEmptyGroup$1(state, uri, requestId, preview, title, editorType, editorInput);
|
|
3229
3312
|
}
|
|
3230
3313
|
return newState;
|
|
3231
3314
|
};
|
|
@@ -3239,7 +3322,8 @@ const getStateWithTab = (currentState, editorInput, existingTab, shouldRetryExis
|
|
|
3239
3322
|
errorMessage: '',
|
|
3240
3323
|
loadingState: 'loading',
|
|
3241
3324
|
title,
|
|
3242
|
-
uri
|
|
3325
|
+
uri,
|
|
3326
|
+
uriTitle: getUriTitle(uri, currentState.homeDirUri || '')
|
|
3243
3327
|
}),
|
|
3244
3328
|
tabId: existingTab.tab.id
|
|
3245
3329
|
};
|
|
@@ -3253,6 +3337,7 @@ const getStateWithTab = (currentState, editorInput, existingTab, shouldRetryExis
|
|
|
3253
3337
|
|
|
3254
3338
|
const Directory = 3;
|
|
3255
3339
|
const DirectoryExpanded = 4;
|
|
3340
|
+
const File = 7;
|
|
3256
3341
|
|
|
3257
3342
|
const isLocalEditorInput = editorInput => {
|
|
3258
3343
|
if (editorInput.type !== 'editor') {
|
|
@@ -3313,6 +3398,8 @@ const getIconsCached = (dirents, fileIconCache) => {
|
|
|
3313
3398
|
return dirents.map(dirent => fileIconCache[dirent]);
|
|
3314
3399
|
};
|
|
3315
3400
|
|
|
3401
|
+
const ExtensionDetailScheme = 'extension-detail://';
|
|
3402
|
+
const ExtensionIconName = 'extensions';
|
|
3316
3403
|
const getBasename = uri => {
|
|
3317
3404
|
const lastSlashIndex = uri.lastIndexOf('/');
|
|
3318
3405
|
if (lastSlashIndex === -1) {
|
|
@@ -3331,10 +3418,17 @@ const getMissingTabs = (tabs, fileIconCache) => {
|
|
|
3331
3418
|
};
|
|
3332
3419
|
const tabToIconRequest = tab => {
|
|
3333
3420
|
const uri = tab.uri || '';
|
|
3421
|
+
if (uri.startsWith(ExtensionDetailScheme)) {
|
|
3422
|
+
return {
|
|
3423
|
+
name: ExtensionIconName,
|
|
3424
|
+
path: uri,
|
|
3425
|
+
type: Directory
|
|
3426
|
+
};
|
|
3427
|
+
}
|
|
3334
3428
|
return {
|
|
3335
3429
|
name: getBasename(uri),
|
|
3336
3430
|
path: uri,
|
|
3337
|
-
type:
|
|
3431
|
+
type: File
|
|
3338
3432
|
};
|
|
3339
3433
|
};
|
|
3340
3434
|
const getMissingIconRequestsForTabs = (tabs, fileIconCache) => {
|
|
@@ -3911,7 +4005,7 @@ const newFile = async state => {
|
|
|
3911
4005
|
targetGroupId = activeGroup.id;
|
|
3912
4006
|
} else {
|
|
3913
4007
|
// No active group, create an empty one
|
|
3914
|
-
newState = createEmptyGroup(state, '');
|
|
4008
|
+
newState = createEmptyGroup$1(state, '');
|
|
3915
4009
|
const updatedActiveGroupId = newState.layout.activeGroupId;
|
|
3916
4010
|
if (!updatedActiveGroupId) {
|
|
3917
4011
|
return state;
|
|
@@ -4296,7 +4390,8 @@ const handleUriChange = async (state, oldUri, newUri) => {
|
|
|
4296
4390
|
return {
|
|
4297
4391
|
...tab,
|
|
4298
4392
|
title: newTitle,
|
|
4299
|
-
uri: newUri
|
|
4393
|
+
uri: newUri,
|
|
4394
|
+
uriTitle: getUriTitle(newUri, state.homeDirUri || '')
|
|
4300
4395
|
};
|
|
4301
4396
|
}
|
|
4302
4397
|
return tab;
|
|
@@ -4361,6 +4456,27 @@ const initialize = async () => {
|
|
|
4361
4456
|
set$3(rpc);
|
|
4362
4457
|
};
|
|
4363
4458
|
|
|
4459
|
+
const toFileUri = path => {
|
|
4460
|
+
if (!path) {
|
|
4461
|
+
return '';
|
|
4462
|
+
}
|
|
4463
|
+
if (path.startsWith('file://')) {
|
|
4464
|
+
return path;
|
|
4465
|
+
}
|
|
4466
|
+
if (path.startsWith('/')) {
|
|
4467
|
+
return `file://${path}`;
|
|
4468
|
+
}
|
|
4469
|
+
return path;
|
|
4470
|
+
};
|
|
4471
|
+
const loadHomeDirUri = async () => {
|
|
4472
|
+
try {
|
|
4473
|
+
const homeDir = await invoke('Workspace.getHomeDir');
|
|
4474
|
+
return typeof homeDir === 'string' ? toFileUri(homeDir) : '';
|
|
4475
|
+
} catch {
|
|
4476
|
+
return '';
|
|
4477
|
+
}
|
|
4478
|
+
};
|
|
4479
|
+
|
|
4364
4480
|
const isValidTab = tab => {
|
|
4365
4481
|
return tab && typeof tab.id === 'number' && typeof tab.title === 'string' && typeof tab.isDirty === 'boolean' && typeof tab.isPreview === 'boolean' && typeof tab.editorUid === 'number' && typeof tab.icon === 'string' && (tab.editorType === 'text' || tab.editorType === 'custom');
|
|
4366
4482
|
};
|
|
@@ -4552,10 +4668,15 @@ const restoreAndCreateEditors = async (state, restoredLayout) => {
|
|
|
4552
4668
|
};
|
|
4553
4669
|
|
|
4554
4670
|
const loadContent = async (state, savedState) => {
|
|
4671
|
+
const homeDirUri = await loadHomeDirUri();
|
|
4672
|
+
const stateWithHomeDir = {
|
|
4673
|
+
...state,
|
|
4674
|
+
homeDirUri
|
|
4675
|
+
};
|
|
4555
4676
|
const restoredLayout = tryRestoreLayout(savedState);
|
|
4556
4677
|
if (restoredLayout) {
|
|
4557
4678
|
// Restore and create editors
|
|
4558
|
-
const editorState = await restoreAndCreateEditors(
|
|
4679
|
+
const editorState = await restoreAndCreateEditors(stateWithHomeDir, restoredLayout);
|
|
4559
4680
|
|
|
4560
4681
|
// Load file icons with the updated editor state
|
|
4561
4682
|
const {
|
|
@@ -4564,16 +4685,16 @@ const loadContent = async (state, savedState) => {
|
|
|
4564
4685
|
} = await loadFileIcons(editorState);
|
|
4565
4686
|
|
|
4566
4687
|
// Merge the results
|
|
4567
|
-
const finalState = {
|
|
4688
|
+
const finalState = updateTabUriTitles({
|
|
4568
4689
|
...editorState,
|
|
4569
4690
|
fileIconCache,
|
|
4570
4691
|
initial: false,
|
|
4571
4692
|
layout: updatedLayout
|
|
4572
|
-
};
|
|
4693
|
+
});
|
|
4573
4694
|
return finalState;
|
|
4574
4695
|
}
|
|
4575
4696
|
return {
|
|
4576
|
-
...
|
|
4697
|
+
...stateWithHomeDir,
|
|
4577
4698
|
initial: false,
|
|
4578
4699
|
layout: {
|
|
4579
4700
|
activeGroupId: undefined,
|
|
@@ -4711,7 +4832,7 @@ const pin = () => {
|
|
|
4711
4832
|
const splitAndMove = () => {
|
|
4712
4833
|
return i18nString(SplitAndMove);
|
|
4713
4834
|
};
|
|
4714
|
-
const moveIntoNewWindow = () => {
|
|
4835
|
+
const moveIntoNewWindow$1 = () => {
|
|
4715
4836
|
return i18nString(MoveIntoNewWindow);
|
|
4716
4837
|
};
|
|
4717
4838
|
const copyIntoNewWindow = () => {
|
|
@@ -4793,16 +4914,6 @@ const getMenuEntries$2 = (state, groupId) => {
|
|
|
4793
4914
|
}];
|
|
4794
4915
|
};
|
|
4795
4916
|
|
|
4796
|
-
const findGroupById = (state, groupId) => {
|
|
4797
|
-
const {
|
|
4798
|
-
layout
|
|
4799
|
-
} = state;
|
|
4800
|
-
const {
|
|
4801
|
-
groups
|
|
4802
|
-
} = layout;
|
|
4803
|
-
return groups.find(group => group.id === groupId);
|
|
4804
|
-
};
|
|
4805
|
-
|
|
4806
4917
|
// TODO should pass tab uri as argument or tab index
|
|
4807
4918
|
const getMenuEntries$1 = state => {
|
|
4808
4919
|
const {
|
|
@@ -4910,12 +5021,12 @@ const getMenuEntries$1 = state => {
|
|
|
4910
5021
|
id: 'splitAndMove',
|
|
4911
5022
|
label: splitAndMove()
|
|
4912
5023
|
}, {
|
|
4913
|
-
command: '',
|
|
5024
|
+
command: 'MainArea.moveIntoNewWindow',
|
|
4914
5025
|
flags: None,
|
|
4915
5026
|
id: 'moveIntoNewWindow',
|
|
4916
|
-
label: moveIntoNewWindow()
|
|
5027
|
+
label: moveIntoNewWindow$1()
|
|
4917
5028
|
}, {
|
|
4918
|
-
command: '',
|
|
5029
|
+
command: 'MainArea.copyIntoNewWindow',
|
|
4919
5030
|
flags: None,
|
|
4920
5031
|
id: 'copyIntoNewWindow',
|
|
4921
5032
|
label: copyIntoNewWindow()
|
|
@@ -4939,8 +5050,30 @@ const getMenuEntries = async (state, props) => {
|
|
|
4939
5050
|
}
|
|
4940
5051
|
};
|
|
4941
5052
|
|
|
5053
|
+
const moveIntoNewWindow = async state => {
|
|
5054
|
+
const {
|
|
5055
|
+
activeGroupId
|
|
5056
|
+
} = state.layout;
|
|
5057
|
+
const group = findGroupById(state, activeGroupId ?? 0);
|
|
5058
|
+
if (!group) {
|
|
5059
|
+
return state;
|
|
5060
|
+
}
|
|
5061
|
+
const {
|
|
5062
|
+
activeTabId
|
|
5063
|
+
} = group;
|
|
5064
|
+
if (activeTabId === undefined) {
|
|
5065
|
+
return state;
|
|
5066
|
+
}
|
|
5067
|
+
const tab = group.tabs.find(tab => tab.id === activeTabId);
|
|
5068
|
+
if (!tab?.uri) {
|
|
5069
|
+
return state;
|
|
5070
|
+
}
|
|
5071
|
+
await invoke('ElectronWindow.openNewWithUri', tab.uri);
|
|
5072
|
+
return closeTabAndSave(state, group.id, activeTabId);
|
|
5073
|
+
};
|
|
5074
|
+
|
|
4942
5075
|
const newWindow = async state => {
|
|
4943
|
-
await invoke('
|
|
5076
|
+
await invoke('ElectronWindow.openNew');
|
|
4944
5077
|
return state;
|
|
4945
5078
|
};
|
|
4946
5079
|
|
|
@@ -5508,7 +5641,7 @@ const renderTab = (tab, isActive, tabIndex, groupIndex) => {
|
|
|
5508
5641
|
onContextMenu: HandleTabContextMenu,
|
|
5509
5642
|
onMouseDown: HandleClickTab,
|
|
5510
5643
|
role: 'tab',
|
|
5511
|
-
title: tab.uri || tab.title,
|
|
5644
|
+
title: tab.uriTitle || tab.uri || tab.title,
|
|
5512
5645
|
type: Div
|
|
5513
5646
|
}, {
|
|
5514
5647
|
childCount: 0,
|
|
@@ -5985,6 +6118,178 @@ const saveState = state => {
|
|
|
5985
6118
|
};
|
|
5986
6119
|
};
|
|
5987
6120
|
|
|
6121
|
+
const flipDirection = direction => {
|
|
6122
|
+
return direction === Horizontal ? Vertical : Horizontal;
|
|
6123
|
+
};
|
|
6124
|
+
const createEmptyGroup = () => {
|
|
6125
|
+
return {
|
|
6126
|
+
activeTabId: undefined,
|
|
6127
|
+
focused: false,
|
|
6128
|
+
id: create$1(),
|
|
6129
|
+
isEmpty: true,
|
|
6130
|
+
size: 100,
|
|
6131
|
+
tabs: []
|
|
6132
|
+
};
|
|
6133
|
+
};
|
|
6134
|
+
const getActiveGroupIndex = (groups, activeGroupId) => {
|
|
6135
|
+
const activeIndex = groups.findIndex(group => group.id === activeGroupId);
|
|
6136
|
+
if (activeIndex !== -1) {
|
|
6137
|
+
return activeIndex;
|
|
6138
|
+
}
|
|
6139
|
+
const focusedIndex = groups.findIndex(group => group.focused);
|
|
6140
|
+
if (focusedIndex !== -1) {
|
|
6141
|
+
return focusedIndex;
|
|
6142
|
+
}
|
|
6143
|
+
return 0;
|
|
6144
|
+
};
|
|
6145
|
+
const mergeGroups = (target, groups, activeGroupId) => {
|
|
6146
|
+
const allGroups = [target, ...groups];
|
|
6147
|
+
const tabs = allGroups.flatMap(group => group.tabs);
|
|
6148
|
+
const activeGroup = allGroups.find(group => group.id === activeGroupId) ?? groups.findLast(group => group.activeTabId !== undefined) ?? target;
|
|
6149
|
+
const activeTabId = activeGroup.activeTabId ?? tabs[0]?.id;
|
|
6150
|
+
return {
|
|
6151
|
+
...target,
|
|
6152
|
+
activeTabId,
|
|
6153
|
+
isEmpty: tabs.length === 0,
|
|
6154
|
+
tabs
|
|
6155
|
+
};
|
|
6156
|
+
};
|
|
6157
|
+
const getGroupsForSlotCount = (groups, slotCount, activeGroupId) => {
|
|
6158
|
+
if (slotCount === 1) {
|
|
6159
|
+
const firstGroup = groups[0] ?? createEmptyGroup();
|
|
6160
|
+
return [mergeGroups(firstGroup, groups.slice(1), activeGroupId)];
|
|
6161
|
+
}
|
|
6162
|
+
if (groups.length === slotCount) {
|
|
6163
|
+
return groups;
|
|
6164
|
+
}
|
|
6165
|
+
if (groups.length < slotCount) {
|
|
6166
|
+
const missingGroups = Array.from({
|
|
6167
|
+
length: slotCount - groups.length
|
|
6168
|
+
}, createEmptyGroup);
|
|
6169
|
+
return [...groups, ...missingGroups];
|
|
6170
|
+
}
|
|
6171
|
+
const retainedGroups = groups.slice(0, slotCount);
|
|
6172
|
+
const extraGroups = groups.slice(slotCount);
|
|
6173
|
+
const lastGroup = retainedGroups.at(-1);
|
|
6174
|
+
if (!lastGroup) {
|
|
6175
|
+
return retainedGroups;
|
|
6176
|
+
}
|
|
6177
|
+
return [...retainedGroups.slice(0, -1), mergeGroups(lastGroup, extraGroups, activeGroupId)];
|
|
6178
|
+
};
|
|
6179
|
+
const setEditorLayout = (state, direction, slots) => {
|
|
6180
|
+
const {
|
|
6181
|
+
layout
|
|
6182
|
+
} = state;
|
|
6183
|
+
const groups = getGroupsForSlotCount(layout.groups, slots.length, layout.activeGroupId);
|
|
6184
|
+
const originalActiveIndex = layout.groups.findIndex(group => group.id === layout.activeGroupId);
|
|
6185
|
+
const activeIndex = originalActiveIndex >= slots.length ? slots.length - 1 : getActiveGroupIndex(groups, layout.activeGroupId);
|
|
6186
|
+
const nextGroups = groups.map((group, index) => {
|
|
6187
|
+
const slot = slots[index];
|
|
6188
|
+
const focused = index === activeIndex;
|
|
6189
|
+
return {
|
|
6190
|
+
...group,
|
|
6191
|
+
direction: slot.direction,
|
|
6192
|
+
focused,
|
|
6193
|
+
size: slot.size
|
|
6194
|
+
};
|
|
6195
|
+
});
|
|
6196
|
+
return {
|
|
6197
|
+
...state,
|
|
6198
|
+
layout: {
|
|
6199
|
+
activeGroupId: nextGroups[activeIndex]?.id,
|
|
6200
|
+
direction,
|
|
6201
|
+
groups: nextGroups
|
|
6202
|
+
}
|
|
6203
|
+
};
|
|
6204
|
+
};
|
|
6205
|
+
const flipLayout = state => {
|
|
6206
|
+
return {
|
|
6207
|
+
...state,
|
|
6208
|
+
layout: {
|
|
6209
|
+
...state.layout,
|
|
6210
|
+
direction: flipDirection(state.layout.direction),
|
|
6211
|
+
groups: state.layout.groups.map(group => ({
|
|
6212
|
+
...group,
|
|
6213
|
+
direction: group.direction === undefined ? undefined : flipDirection(group.direction)
|
|
6214
|
+
}))
|
|
6215
|
+
}
|
|
6216
|
+
};
|
|
6217
|
+
};
|
|
6218
|
+
const setEditorLayoutSingle = state => {
|
|
6219
|
+
return setEditorLayout(state, Horizontal, [{
|
|
6220
|
+
size: 100
|
|
6221
|
+
}]);
|
|
6222
|
+
};
|
|
6223
|
+
const setEditorLayoutTwoColumns = state => {
|
|
6224
|
+
return setEditorLayout(state, Horizontal, [{
|
|
6225
|
+
size: 50
|
|
6226
|
+
}, {
|
|
6227
|
+
size: 50
|
|
6228
|
+
}]);
|
|
6229
|
+
};
|
|
6230
|
+
const setEditorLayoutThreeColumns = state => {
|
|
6231
|
+
return setEditorLayout(state, Horizontal, [{
|
|
6232
|
+
size: 33.333333
|
|
6233
|
+
}, {
|
|
6234
|
+
size: 33.333333
|
|
6235
|
+
}, {
|
|
6236
|
+
size: 33.333334
|
|
6237
|
+
}]);
|
|
6238
|
+
};
|
|
6239
|
+
const setEditorLayoutTwoRows = state => {
|
|
6240
|
+
return setEditorLayout(state, Vertical, [{
|
|
6241
|
+
size: 50
|
|
6242
|
+
}, {
|
|
6243
|
+
size: 50
|
|
6244
|
+
}]);
|
|
6245
|
+
};
|
|
6246
|
+
const setEditorLayoutThreeRows = state => {
|
|
6247
|
+
return setEditorLayout(state, Vertical, [{
|
|
6248
|
+
size: 33.333333
|
|
6249
|
+
}, {
|
|
6250
|
+
size: 33.333333
|
|
6251
|
+
}, {
|
|
6252
|
+
size: 33.333334
|
|
6253
|
+
}]);
|
|
6254
|
+
};
|
|
6255
|
+
const setEditorLayoutGrid = state => {
|
|
6256
|
+
return setEditorLayout(state, Horizontal, [{
|
|
6257
|
+
direction: Vertical,
|
|
6258
|
+
size: 25
|
|
6259
|
+
}, {
|
|
6260
|
+
direction: Vertical,
|
|
6261
|
+
size: 25
|
|
6262
|
+
}, {
|
|
6263
|
+
direction: Vertical,
|
|
6264
|
+
size: 25
|
|
6265
|
+
}, {
|
|
6266
|
+
direction: Vertical,
|
|
6267
|
+
size: 25
|
|
6268
|
+
}]);
|
|
6269
|
+
};
|
|
6270
|
+
const setEditorLayoutTwoRowsRight = state => {
|
|
6271
|
+
return setEditorLayout(state, Horizontal, [{
|
|
6272
|
+
size: 50
|
|
6273
|
+
}, {
|
|
6274
|
+
direction: Vertical,
|
|
6275
|
+
size: 25
|
|
6276
|
+
}, {
|
|
6277
|
+
direction: Vertical,
|
|
6278
|
+
size: 25
|
|
6279
|
+
}]);
|
|
6280
|
+
};
|
|
6281
|
+
const setEditorLayoutTwoColumnsBottom = state => {
|
|
6282
|
+
return setEditorLayout(state, Vertical, [{
|
|
6283
|
+
size: 50
|
|
6284
|
+
}, {
|
|
6285
|
+
direction: Horizontal,
|
|
6286
|
+
size: 25
|
|
6287
|
+
}, {
|
|
6288
|
+
direction: Horizontal,
|
|
6289
|
+
size: 25
|
|
6290
|
+
}]);
|
|
6291
|
+
};
|
|
6292
|
+
|
|
5988
6293
|
const splitDown = (state, groupId) => {
|
|
5989
6294
|
const {
|
|
5990
6295
|
layout
|
|
@@ -6155,10 +6460,12 @@ const commandMap = {
|
|
|
6155
6460
|
'MainArea.closeSaved': wrapCommand(closeSaved$1),
|
|
6156
6461
|
'MainArea.closeTabsByUris': wrapCommand(closeTabsByUris),
|
|
6157
6462
|
'MainArea.closeTabsRight': wrapCommand(closeTabsRight),
|
|
6463
|
+
'MainArea.copyIntoNewWindow': wrapCommand(copyIntoNewWindow$1),
|
|
6158
6464
|
'MainArea.copyPath': wrapCommand(copyPath$1),
|
|
6159
6465
|
'MainArea.copyRelativePath': wrapCommand(copyRelativePath$1),
|
|
6160
6466
|
'MainArea.create': create$2,
|
|
6161
6467
|
'MainArea.diff2': diff2,
|
|
6468
|
+
'MainArea.flipEditorLayout': wrapCommand(flipLayout),
|
|
6162
6469
|
'MainArea.focusNext': wrapCommand(focusNextTab),
|
|
6163
6470
|
'MainArea.focusNextTab': wrapCommand(focusNextTab),
|
|
6164
6471
|
'MainArea.focusPrevious': wrapCommand(focusPreviousTab),
|
|
@@ -6186,6 +6493,7 @@ const commandMap = {
|
|
|
6186
6493
|
'MainArea.handleWorkspaceChange': wrapCommand(handleWorkspaceChange),
|
|
6187
6494
|
'MainArea.initialize': initialize,
|
|
6188
6495
|
'MainArea.loadContent': wrapCommand(loadContent),
|
|
6496
|
+
'MainArea.moveIntoNewWindow': wrapCommand(moveIntoNewWindow),
|
|
6189
6497
|
'MainArea.newFile': wrapCommand(newFile),
|
|
6190
6498
|
'MainArea.newWindow': wrapCommand(newWindow),
|
|
6191
6499
|
'MainArea.openInput': wrapCommand(openInput),
|
|
@@ -6199,6 +6507,14 @@ const commandMap = {
|
|
|
6199
6507
|
'MainArea.save': wrapCommand(save),
|
|
6200
6508
|
'MainArea.saveState': wrapGetter(saveState),
|
|
6201
6509
|
'MainArea.selectTab': wrapCommand(selectTab),
|
|
6510
|
+
'MainArea.setEditorLayoutGrid': wrapCommand(setEditorLayoutGrid),
|
|
6511
|
+
'MainArea.setEditorLayoutSingle': wrapCommand(setEditorLayoutSingle),
|
|
6512
|
+
'MainArea.setEditorLayoutThreeColumns': wrapCommand(setEditorLayoutThreeColumns),
|
|
6513
|
+
'MainArea.setEditorLayoutThreeRows': wrapCommand(setEditorLayoutThreeRows),
|
|
6514
|
+
'MainArea.setEditorLayoutTwoColumns': wrapCommand(setEditorLayoutTwoColumns),
|
|
6515
|
+
'MainArea.setEditorLayoutTwoColumnsBottom': wrapCommand(setEditorLayoutTwoColumnsBottom),
|
|
6516
|
+
'MainArea.setEditorLayoutTwoRows': wrapCommand(setEditorLayoutTwoRows),
|
|
6517
|
+
'MainArea.setEditorLayoutTwoRowsRight': wrapCommand(setEditorLayoutTwoRowsRight),
|
|
6202
6518
|
'MainArea.splitDown': wrapCommand(splitDown),
|
|
6203
6519
|
'MainArea.splitLeft': wrapCommand(splitLeft),
|
|
6204
6520
|
'MainArea.splitRight': wrapCommand(splitRight),
|