@lvce-editor/main-area-worker 7.0.0 → 7.2.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 +54 -2
- package/package.json +1 -1
|
@@ -1678,9 +1678,14 @@ const closeOtherTabs = (state, groupId) => {
|
|
|
1678
1678
|
layout
|
|
1679
1679
|
} = state;
|
|
1680
1680
|
const {
|
|
1681
|
+
activeGroupId,
|
|
1681
1682
|
groups
|
|
1682
1683
|
} = layout;
|
|
1683
|
-
const
|
|
1684
|
+
const targetGroupId = groupId ?? activeGroupId;
|
|
1685
|
+
if (targetGroupId === undefined) {
|
|
1686
|
+
return state;
|
|
1687
|
+
}
|
|
1688
|
+
const group = groups.find(g => g.id === targetGroupId);
|
|
1684
1689
|
if (!group) {
|
|
1685
1690
|
return state;
|
|
1686
1691
|
}
|
|
@@ -1691,7 +1696,7 @@ const closeOtherTabs = (state, groupId) => {
|
|
|
1691
1696
|
return state;
|
|
1692
1697
|
}
|
|
1693
1698
|
const newGroups = groups.map(g => {
|
|
1694
|
-
if (g.id ===
|
|
1699
|
+
if (g.id === targetGroupId) {
|
|
1695
1700
|
const newTabs = g.tabs.filter(tab => tab.id === activeTabId);
|
|
1696
1701
|
return {
|
|
1697
1702
|
...g,
|
|
@@ -1711,6 +1716,51 @@ const closeOtherTabs = (state, groupId) => {
|
|
|
1711
1716
|
};
|
|
1712
1717
|
};
|
|
1713
1718
|
|
|
1719
|
+
const closeTabsRight = (state, groupId) => {
|
|
1720
|
+
const {
|
|
1721
|
+
layout
|
|
1722
|
+
} = state;
|
|
1723
|
+
const {
|
|
1724
|
+
groups
|
|
1725
|
+
} = layout;
|
|
1726
|
+
const group = groups.find(g => g.id === groupId);
|
|
1727
|
+
if (!group) {
|
|
1728
|
+
return state;
|
|
1729
|
+
}
|
|
1730
|
+
const {
|
|
1731
|
+
activeTabId,
|
|
1732
|
+
tabs
|
|
1733
|
+
} = group;
|
|
1734
|
+
if (activeTabId === undefined) {
|
|
1735
|
+
return state;
|
|
1736
|
+
}
|
|
1737
|
+
const activeTabIndex = tabs.findIndex(tab => tab.id === activeTabId);
|
|
1738
|
+
if (activeTabIndex === -1) {
|
|
1739
|
+
return state;
|
|
1740
|
+
}
|
|
1741
|
+
const newTabs = tabs.slice(0, activeTabIndex + 1);
|
|
1742
|
+
if (newTabs.length === tabs.length) {
|
|
1743
|
+
return state;
|
|
1744
|
+
}
|
|
1745
|
+
const newGroups = groups.map(g => {
|
|
1746
|
+
if (g.id === groupId) {
|
|
1747
|
+
return {
|
|
1748
|
+
...g,
|
|
1749
|
+
isEmpty: newTabs.length === 0,
|
|
1750
|
+
tabs: newTabs
|
|
1751
|
+
};
|
|
1752
|
+
}
|
|
1753
|
+
return g;
|
|
1754
|
+
});
|
|
1755
|
+
return {
|
|
1756
|
+
...state,
|
|
1757
|
+
layout: {
|
|
1758
|
+
...layout,
|
|
1759
|
+
groups: newGroups
|
|
1760
|
+
}
|
|
1761
|
+
};
|
|
1762
|
+
};
|
|
1763
|
+
|
|
1714
1764
|
const copyPath$1 = async (state, path) => {
|
|
1715
1765
|
string(path);
|
|
1716
1766
|
await invoke('ClipBoard.writeText', path);
|
|
@@ -1741,6 +1791,7 @@ const create = (uid, uri, x, y, width, height, platform, assetDir, tabHeight = 3
|
|
|
1741
1791
|
tabHeight,
|
|
1742
1792
|
uid,
|
|
1743
1793
|
width,
|
|
1794
|
+
workspaceuri: uri,
|
|
1744
1795
|
x,
|
|
1745
1796
|
y
|
|
1746
1797
|
};
|
|
@@ -4049,6 +4100,7 @@ const commandMap = {
|
|
|
4049
4100
|
'MainArea.closeAllEditors': wrapCommand(closeAll$1),
|
|
4050
4101
|
'MainArea.closeFocusedTab': wrapCommand(closeFocusedTab),
|
|
4051
4102
|
'MainArea.closeOthers': wrapCommand(closeOtherTabs),
|
|
4103
|
+
'MainArea.closeTabsRight': wrapCommand(closeTabsRight),
|
|
4052
4104
|
'MainArea.copyPath': wrapCommand(copyPath$1),
|
|
4053
4105
|
'MainArea.copyRelativePath': wrapCommand(copyRelativePath$1),
|
|
4054
4106
|
'MainArea.create': create,
|