@lvce-editor/main-area-worker 9.43.0 → 9.44.2
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 +35 -19
- package/package.json +1 -1
|
@@ -2723,14 +2723,19 @@ const getGroupById = (state, groupId) => {
|
|
|
2723
2723
|
return groups.find(group => group.id === groupId);
|
|
2724
2724
|
};
|
|
2725
2725
|
|
|
2726
|
-
const closeTabsRight = (state, groupId) => {
|
|
2726
|
+
const closeTabsRight = (state, groupId, tabId) => {
|
|
2727
2727
|
const {
|
|
2728
2728
|
layout
|
|
2729
2729
|
} = state;
|
|
2730
2730
|
const {
|
|
2731
|
+
activeGroupId,
|
|
2731
2732
|
groups
|
|
2732
2733
|
} = layout;
|
|
2733
|
-
const
|
|
2734
|
+
const targetGroupId = groupId ?? activeGroupId;
|
|
2735
|
+
if (targetGroupId === -1) {
|
|
2736
|
+
return state;
|
|
2737
|
+
}
|
|
2738
|
+
const group = getGroupById(state, targetGroupId);
|
|
2734
2739
|
if (!group) {
|
|
2735
2740
|
return state;
|
|
2736
2741
|
}
|
|
@@ -2738,28 +2743,30 @@ const closeTabsRight = (state, groupId) => {
|
|
|
2738
2743
|
activeTabId,
|
|
2739
2744
|
tabs
|
|
2740
2745
|
} = group;
|
|
2741
|
-
|
|
2746
|
+
const targetTabId = tabId ?? activeTabId;
|
|
2747
|
+
if (targetTabId === -1) {
|
|
2742
2748
|
return state;
|
|
2743
2749
|
}
|
|
2744
|
-
const
|
|
2745
|
-
if (
|
|
2750
|
+
const targetTabIndex = tabs.findIndex(tab => tab.id === targetTabId);
|
|
2751
|
+
if (targetTabIndex === -1) {
|
|
2746
2752
|
return state;
|
|
2747
2753
|
}
|
|
2748
|
-
const newTabs = tabs.slice(0,
|
|
2754
|
+
const newTabs = tabs.slice(0, targetTabIndex + 1);
|
|
2749
2755
|
if (newTabs.length === tabs.length) {
|
|
2750
2756
|
return state;
|
|
2751
2757
|
}
|
|
2752
|
-
const groupIndex = groups.findIndex(g => g.id ===
|
|
2753
|
-
const closedTabs = tabs.slice(
|
|
2758
|
+
const groupIndex = groups.findIndex(g => g.id === targetGroupId);
|
|
2759
|
+
const closedTabs = tabs.slice(targetTabIndex + 1).map((tab, index) => ({
|
|
2754
2760
|
group,
|
|
2755
2761
|
groupIndex,
|
|
2756
2762
|
tab,
|
|
2757
|
-
tabIndex:
|
|
2763
|
+
tabIndex: targetTabIndex + index + 1
|
|
2758
2764
|
}));
|
|
2759
2765
|
const newGroups = groups.map(g => {
|
|
2760
|
-
if (g.id ===
|
|
2766
|
+
if (g.id === targetGroupId) {
|
|
2761
2767
|
return {
|
|
2762
2768
|
...g,
|
|
2769
|
+
activeTabId: newTabs.some(tab => tab.id === activeTabId) ? activeTabId : targetTabId,
|
|
2763
2770
|
isEmpty: newTabs.length === 0,
|
|
2764
2771
|
tabs: newTabs
|
|
2765
2772
|
};
|
|
@@ -4507,7 +4514,7 @@ const getGroupSegments = (groups, parentDirection) => {
|
|
|
4507
4514
|
index++;
|
|
4508
4515
|
}
|
|
4509
4516
|
segments.push({
|
|
4510
|
-
direction: group.direction,
|
|
4517
|
+
direction: nestedGroups.length === 1 ? undefined : group.direction,
|
|
4511
4518
|
groups: nestedGroups,
|
|
4512
4519
|
startIndex
|
|
4513
4520
|
});
|
|
@@ -5775,14 +5782,23 @@ const handleSashPointerUp = async state => {
|
|
|
5775
5782
|
};
|
|
5776
5783
|
};
|
|
5777
5784
|
|
|
5778
|
-
const handleTabContextMenu = async (state, button, x, y) => {
|
|
5785
|
+
const handleTabContextMenu = async (state, button, x, y, groupIndexRaw = '', tabIndexRaw = '') => {
|
|
5779
5786
|
number(x);
|
|
5780
5787
|
number(y);
|
|
5781
5788
|
const {
|
|
5782
5789
|
uid
|
|
5783
5790
|
} = state;
|
|
5791
|
+
const groupIndex = Number.parseInt(groupIndexRaw);
|
|
5792
|
+
const tabIndex = Number.parseInt(tabIndexRaw);
|
|
5793
|
+
const group = state.layout.groups[groupIndex];
|
|
5794
|
+
const tab = group?.tabs[tabIndex];
|
|
5795
|
+
const target = group && tab ? {
|
|
5796
|
+
groupId: group.id,
|
|
5797
|
+
tabId: tab.id
|
|
5798
|
+
} : {};
|
|
5784
5799
|
await show2(uid, Tab, x, y, {
|
|
5785
|
-
menuId: Tab
|
|
5800
|
+
menuId: Tab,
|
|
5801
|
+
...target
|
|
5786
5802
|
});
|
|
5787
5803
|
return state;
|
|
5788
5804
|
};
|
|
@@ -6425,15 +6441,14 @@ const getMenuEntries$2 = (state, groupId) => {
|
|
|
6425
6441
|
}];
|
|
6426
6442
|
};
|
|
6427
6443
|
|
|
6428
|
-
|
|
6429
|
-
const getMenuEntries$1 = state => {
|
|
6444
|
+
const getMenuEntries$1 = (state, groupId, tabId) => {
|
|
6430
6445
|
const {
|
|
6431
6446
|
layout
|
|
6432
6447
|
} = state;
|
|
6433
6448
|
const {
|
|
6434
6449
|
activeGroupId
|
|
6435
6450
|
} = layout;
|
|
6436
|
-
const group = findGroupById(state,
|
|
6451
|
+
const group = findGroupById(state, groupId ?? activeGroupId);
|
|
6437
6452
|
if (!group) {
|
|
6438
6453
|
return [];
|
|
6439
6454
|
}
|
|
@@ -6441,7 +6456,7 @@ const getMenuEntries$1 = state => {
|
|
|
6441
6456
|
activeTabId,
|
|
6442
6457
|
tabs
|
|
6443
6458
|
} = group;
|
|
6444
|
-
const tab = tabs.find(t => t.id === activeTabId);
|
|
6459
|
+
const tab = tabs.find(t => t.id === (tabId ?? activeTabId));
|
|
6445
6460
|
if (!tab) {
|
|
6446
6461
|
return [];
|
|
6447
6462
|
}
|
|
@@ -6459,6 +6474,7 @@ const getMenuEntries$1 = state => {
|
|
|
6459
6474
|
id: 'tabCloseOthers',
|
|
6460
6475
|
label: closeOthers()
|
|
6461
6476
|
}, {
|
|
6477
|
+
args: [group.id, tab.id],
|
|
6462
6478
|
command: 'Main.closeTabsRight',
|
|
6463
6479
|
flags: None$1,
|
|
6464
6480
|
id: 'tabCloseToTheRight',
|
|
@@ -6555,7 +6571,7 @@ const getMenuEntries = async (state, props) => {
|
|
|
6555
6571
|
case Main$1:
|
|
6556
6572
|
return getMenuEntries$2(state, props.groupId);
|
|
6557
6573
|
case Tab:
|
|
6558
|
-
return getMenuEntries$1(state);
|
|
6574
|
+
return getMenuEntries$1(state, props.groupId, props.tabId);
|
|
6559
6575
|
default:
|
|
6560
6576
|
return [];
|
|
6561
6577
|
}
|
|
@@ -7726,7 +7742,7 @@ const renderEventListeners = () => {
|
|
|
7726
7742
|
preventDefault: true
|
|
7727
7743
|
}, {
|
|
7728
7744
|
name: HandleTabContextMenu,
|
|
7729
|
-
params: ['handleTabContextMenu', Button$1, ClientX, ClientY],
|
|
7745
|
+
params: ['handleTabContextMenu', Button$1, ClientX, ClientY, 'event.target.dataset.groupIndex', 'event.target.dataset.index'],
|
|
7730
7746
|
preventDefault: true
|
|
7731
7747
|
}, {
|
|
7732
7748
|
name: HandleClickAction,
|