@lvce-editor/main-area-worker 8.15.0 → 8.16.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 +159 -15
- package/package.json +1 -1
|
@@ -280,6 +280,44 @@ const closeOtherTabs = (state, groupId) => {
|
|
|
280
280
|
};
|
|
281
281
|
};
|
|
282
282
|
|
|
283
|
+
const getNextActiveTabId = (tabs, newTabs, activeTabId) => {
|
|
284
|
+
if (activeTabId === undefined) {
|
|
285
|
+
return undefined;
|
|
286
|
+
}
|
|
287
|
+
if (newTabs.some(tab => tab.id === activeTabId)) {
|
|
288
|
+
return activeTabId;
|
|
289
|
+
}
|
|
290
|
+
const activeTabIndex = tabs.findIndex(tab => tab.id === activeTabId);
|
|
291
|
+
if (activeTabIndex === -1 || newTabs.length === 0) {
|
|
292
|
+
return undefined;
|
|
293
|
+
}
|
|
294
|
+
return newTabs[Math.min(activeTabIndex, newTabs.length - 1)].id;
|
|
295
|
+
};
|
|
296
|
+
const closeSavedInGroup = group => {
|
|
297
|
+
const {
|
|
298
|
+
activeTabId,
|
|
299
|
+
tabs
|
|
300
|
+
} = group;
|
|
301
|
+
const newTabs = tabs.filter(tab => tab.isDirty);
|
|
302
|
+
if (newTabs.length === tabs.length) {
|
|
303
|
+
return group;
|
|
304
|
+
}
|
|
305
|
+
const newActiveTabId = getNextActiveTabId(tabs, newTabs, activeTabId);
|
|
306
|
+
return {
|
|
307
|
+
...group,
|
|
308
|
+
activeTabId: newActiveTabId,
|
|
309
|
+
isEmpty: newTabs.length === 0,
|
|
310
|
+
tabs: newTabs
|
|
311
|
+
};
|
|
312
|
+
};
|
|
313
|
+
const closeSaved$1 = state => {
|
|
314
|
+
const {
|
|
315
|
+
groups
|
|
316
|
+
} = state.layout;
|
|
317
|
+
const newGroups = groups.map(closeSavedInGroup);
|
|
318
|
+
return withGroups(state, newGroups);
|
|
319
|
+
};
|
|
320
|
+
|
|
283
321
|
const getGroupById = (state, groupId) => {
|
|
284
322
|
return state.layout.groups.find(group => group.id === groupId);
|
|
285
323
|
};
|
|
@@ -2359,7 +2397,7 @@ const handleClickTogglePreview = async state => {
|
|
|
2359
2397
|
|
|
2360
2398
|
const CloseGroup = 'close-group';
|
|
2361
2399
|
const RetryOpen = 'retry-open';
|
|
2362
|
-
const SplitRight = 'split-right';
|
|
2400
|
+
const SplitRight$1 = 'split-right';
|
|
2363
2401
|
const TogglePreview$1 = 'toggle-preview';
|
|
2364
2402
|
|
|
2365
2403
|
const getBasename$1 = uri => {
|
|
@@ -3007,7 +3045,7 @@ const handleClickAction = async (state, action, rawGroupId) => {
|
|
|
3007
3045
|
return state;
|
|
3008
3046
|
case RetryOpen:
|
|
3009
3047
|
return retryOpen(state);
|
|
3010
|
-
case SplitRight:
|
|
3048
|
+
case SplitRight$1:
|
|
3011
3049
|
return splitEditorGroup$1(state, activeGroup.id, Right);
|
|
3012
3050
|
case TogglePreview$1:
|
|
3013
3051
|
return handleClickTogglePreview(state);
|
|
@@ -3765,14 +3803,28 @@ const Close = 'Close';
|
|
|
3765
3803
|
const CloseEditorGroup = 'Close Editor Group';
|
|
3766
3804
|
const CloseAll = 'Close All';
|
|
3767
3805
|
const CloseOthers = 'Close Others';
|
|
3806
|
+
const CloseSaved = 'Close Saved';
|
|
3768
3807
|
const CloseToTheRight = 'Close To The Right';
|
|
3769
3808
|
const CopyPath = 'Copy Path';
|
|
3770
3809
|
const CopyRelativePath = 'Copy Relative Path';
|
|
3771
3810
|
const FindFileReferences = 'Find File References';
|
|
3772
|
-
const
|
|
3811
|
+
const ReopenEditorWith = 'Reopen Editor With...';
|
|
3812
|
+
const Share = 'Share';
|
|
3813
|
+
const AddFileToChat = 'Add File to Chat';
|
|
3814
|
+
const OpenContainingFolder = 'Open Containing Folder';
|
|
3815
|
+
const RevealInExplorerView = 'Reveal in Explorer View';
|
|
3816
|
+
const KeepOpen = 'Keep Open';
|
|
3817
|
+
const Pin = 'Pin';
|
|
3818
|
+
const SplitAndMove = 'Split & Move';
|
|
3819
|
+
const MoveIntoNewWindow = 'Move into New Window';
|
|
3820
|
+
const CopyIntoNewWindow = 'Copy into New Window';
|
|
3773
3821
|
const SplitEditorGroup = 'Split Editor Group';
|
|
3822
|
+
const SplitRight = 'Split Right';
|
|
3774
3823
|
const TogglePreview = 'Toggle Preview';
|
|
3775
3824
|
|
|
3825
|
+
const splitRight$1 = () => {
|
|
3826
|
+
return i18nString(SplitRight);
|
|
3827
|
+
};
|
|
3776
3828
|
const splitEditorGroup = () => {
|
|
3777
3829
|
return i18nString(SplitEditorGroup);
|
|
3778
3830
|
};
|
|
@@ -3788,8 +3840,8 @@ const closeOthers = () => {
|
|
|
3788
3840
|
const closeAll = () => {
|
|
3789
3841
|
return i18nString(CloseAll);
|
|
3790
3842
|
};
|
|
3791
|
-
const
|
|
3792
|
-
return i18nString(
|
|
3843
|
+
const closeSaved = () => {
|
|
3844
|
+
return i18nString(CloseSaved);
|
|
3793
3845
|
};
|
|
3794
3846
|
const closeToTheRight = () => {
|
|
3795
3847
|
return i18nString(CloseToTheRight);
|
|
@@ -3803,6 +3855,36 @@ const copyPath = () => {
|
|
|
3803
3855
|
const copyRelativePath = () => {
|
|
3804
3856
|
return i18nString(CopyRelativePath);
|
|
3805
3857
|
};
|
|
3858
|
+
const reopenEditorWith = () => {
|
|
3859
|
+
return i18nString(ReopenEditorWith);
|
|
3860
|
+
};
|
|
3861
|
+
const share = () => {
|
|
3862
|
+
return i18nString(Share);
|
|
3863
|
+
};
|
|
3864
|
+
const addFileToChat = () => {
|
|
3865
|
+
return i18nString(AddFileToChat);
|
|
3866
|
+
};
|
|
3867
|
+
const openContainingFolder = () => {
|
|
3868
|
+
return i18nString(OpenContainingFolder);
|
|
3869
|
+
};
|
|
3870
|
+
const revealInExplorerView = () => {
|
|
3871
|
+
return i18nString(RevealInExplorerView);
|
|
3872
|
+
};
|
|
3873
|
+
const keepOpen = () => {
|
|
3874
|
+
return i18nString(KeepOpen);
|
|
3875
|
+
};
|
|
3876
|
+
const pin = () => {
|
|
3877
|
+
return i18nString(Pin);
|
|
3878
|
+
};
|
|
3879
|
+
const splitAndMove = () => {
|
|
3880
|
+
return i18nString(SplitAndMove);
|
|
3881
|
+
};
|
|
3882
|
+
const moveIntoNewWindow = () => {
|
|
3883
|
+
return i18nString(MoveIntoNewWindow);
|
|
3884
|
+
};
|
|
3885
|
+
const copyIntoNewWindow = () => {
|
|
3886
|
+
return i18nString(CopyIntoNewWindow);
|
|
3887
|
+
};
|
|
3806
3888
|
const togglePreview = () => {
|
|
3807
3889
|
return i18nString(TogglePreview);
|
|
3808
3890
|
};
|
|
@@ -3852,18 +3934,17 @@ const getMenuEntries$1 = state => {
|
|
|
3852
3934
|
flags: None,
|
|
3853
3935
|
id: 'tabCloseToTheRight',
|
|
3854
3936
|
label: closeToTheRight()
|
|
3937
|
+
}, {
|
|
3938
|
+
command: 'Main.closeSaved',
|
|
3939
|
+
flags: None,
|
|
3940
|
+
id: 'tabCloseSaved',
|
|
3941
|
+
label: closeSaved()
|
|
3855
3942
|
}, {
|
|
3856
3943
|
command: 'Main.closeAll',
|
|
3857
3944
|
flags: None,
|
|
3858
3945
|
id: 'tabCloseAll',
|
|
3859
3946
|
label: closeAll()
|
|
3860
3947
|
}, menuEntrySeparator, {
|
|
3861
|
-
args: [path],
|
|
3862
|
-
command: 'Explorer.revealItem',
|
|
3863
|
-
flags: None,
|
|
3864
|
-
id: 'revealInExplorer',
|
|
3865
|
-
label: revealInExplorer()
|
|
3866
|
-
}, {
|
|
3867
3948
|
args: [path],
|
|
3868
3949
|
command: 'Main.copyPath',
|
|
3869
3950
|
flags: None,
|
|
@@ -3875,6 +3956,62 @@ const getMenuEntries$1 = state => {
|
|
|
3875
3956
|
flags: None,
|
|
3876
3957
|
id: 'copyRelativePath',
|
|
3877
3958
|
label: copyRelativePath()
|
|
3959
|
+
}, menuEntrySeparator, {
|
|
3960
|
+
command: '',
|
|
3961
|
+
flags: None,
|
|
3962
|
+
id: 'reopenEditorWith',
|
|
3963
|
+
label: reopenEditorWith()
|
|
3964
|
+
}, menuEntrySeparator, {
|
|
3965
|
+
command: '',
|
|
3966
|
+
flags: None,
|
|
3967
|
+
id: 'share',
|
|
3968
|
+
label: share()
|
|
3969
|
+
}, menuEntrySeparator, {
|
|
3970
|
+
command: '',
|
|
3971
|
+
flags: None,
|
|
3972
|
+
id: 'addFileToChat',
|
|
3973
|
+
label: addFileToChat()
|
|
3974
|
+
}, menuEntrySeparator, {
|
|
3975
|
+
command: '',
|
|
3976
|
+
flags: None,
|
|
3977
|
+
id: 'openContainingFolder',
|
|
3978
|
+
label: openContainingFolder()
|
|
3979
|
+
}, {
|
|
3980
|
+
args: [path],
|
|
3981
|
+
command: 'Explorer.revealItem',
|
|
3982
|
+
flags: None,
|
|
3983
|
+
id: 'revealInExplorerView',
|
|
3984
|
+
label: revealInExplorerView()
|
|
3985
|
+
}, menuEntrySeparator, {
|
|
3986
|
+
command: '',
|
|
3987
|
+
flags: None,
|
|
3988
|
+
id: 'keepOpen',
|
|
3989
|
+
label: keepOpen()
|
|
3990
|
+
}, {
|
|
3991
|
+
command: '',
|
|
3992
|
+
flags: None,
|
|
3993
|
+
id: 'pin',
|
|
3994
|
+
label: pin()
|
|
3995
|
+
}, menuEntrySeparator, {
|
|
3996
|
+
command: 'Main.splitRight',
|
|
3997
|
+
flags: None,
|
|
3998
|
+
id: 'splitRight',
|
|
3999
|
+
label: splitRight$1()
|
|
4000
|
+
}, {
|
|
4001
|
+
command: '',
|
|
4002
|
+
flags: None,
|
|
4003
|
+
id: 'splitAndMove',
|
|
4004
|
+
label: splitAndMove()
|
|
4005
|
+
}, {
|
|
4006
|
+
command: '',
|
|
4007
|
+
flags: None,
|
|
4008
|
+
id: 'moveIntoNewWindow',
|
|
4009
|
+
label: moveIntoNewWindow()
|
|
4010
|
+
}, {
|
|
4011
|
+
command: '',
|
|
4012
|
+
flags: None,
|
|
4013
|
+
id: 'copyIntoNewWindow',
|
|
4014
|
+
label: copyIntoNewWindow()
|
|
3878
4015
|
}, menuEntrySeparator, {
|
|
3879
4016
|
args: [/* id */'References', /* focus */true, path],
|
|
3880
4017
|
command: 'SideBar.show',
|
|
@@ -4431,9 +4568,9 @@ const renderEditorGroupActions = (group, groupIndex, splitButtonEnabled) => {
|
|
|
4431
4568
|
buttons.push({
|
|
4432
4569
|
childCount: 1,
|
|
4433
4570
|
className: EditorGroupActionButton + ' ' + SplitEditorGroupButton,
|
|
4434
|
-
'data-action': SplitRight,
|
|
4571
|
+
'data-action': SplitRight$1,
|
|
4435
4572
|
'data-groupId': String(group.id),
|
|
4436
|
-
name: SplitRight,
|
|
4573
|
+
name: SplitRight$1,
|
|
4437
4574
|
onClick: HandleClickAction,
|
|
4438
4575
|
title: splitEditorGroup(),
|
|
4439
4576
|
type: Button$2
|
|
@@ -4517,14 +4654,19 @@ const renderEditorGroup = (group, groupIndex, splitButtonEnabled = false, sizePr
|
|
|
4517
4654
|
const getSashClassName = direction => {
|
|
4518
4655
|
return direction === 'horizontal' ? 'Sash SashVertical' : 'Sash SashHorizontal';
|
|
4519
4656
|
};
|
|
4657
|
+
|
|
4520
4658
|
const renderSash = (direction, sashId, style) => {
|
|
4521
4659
|
return [{
|
|
4522
|
-
childCount:
|
|
4660
|
+
childCount: 1,
|
|
4523
4661
|
className: getSashClassName(direction),
|
|
4524
4662
|
'data-sashId': sashId,
|
|
4525
4663
|
onPointerDown: HandleSashPointerDown,
|
|
4526
4664
|
style,
|
|
4527
4665
|
type: Div
|
|
4666
|
+
}, {
|
|
4667
|
+
childCount: 0,
|
|
4668
|
+
className: 'SashBorder',
|
|
4669
|
+
type: Div
|
|
4528
4670
|
}];
|
|
4529
4671
|
};
|
|
4530
4672
|
|
|
@@ -4562,7 +4704,8 @@ const getMainAreaVirtualDom = (layout, splitButtonEnabled = false) => {
|
|
|
4562
4704
|
children.push(...renderSash(direction, sashId, style));
|
|
4563
4705
|
childCount++;
|
|
4564
4706
|
}
|
|
4565
|
-
|
|
4707
|
+
const editorGroupDom = renderEditorGroup(groups[i], i, splitButtonEnabled, sizeProperty);
|
|
4708
|
+
children.push(...editorGroupDom);
|
|
4566
4709
|
childCount++;
|
|
4567
4710
|
}
|
|
4568
4711
|
return [{
|
|
@@ -4794,6 +4937,7 @@ const commandMap = {
|
|
|
4794
4937
|
'MainArea.closeAllEditors': wrapCommand(closeAll$1),
|
|
4795
4938
|
'MainArea.closeFocusedTab': wrapCommand(closeFocusedTab),
|
|
4796
4939
|
'MainArea.closeOthers': wrapCommand(closeOtherTabs),
|
|
4940
|
+
'MainArea.closeSaved': wrapCommand(closeSaved$1),
|
|
4797
4941
|
'MainArea.closeTabsRight': wrapCommand(closeTabsRight),
|
|
4798
4942
|
'MainArea.copyPath': wrapCommand(copyPath$1),
|
|
4799
4943
|
'MainArea.copyRelativePath': wrapCommand(copyRelativePath$1),
|