@lvce-editor/main-area-worker 1.4.0 → 1.5.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 +41 -24
- package/package.json +1 -1
|
@@ -1209,9 +1209,12 @@ const {
|
|
|
1209
1209
|
const create$1 = (uid, uri, x, y, width, height, platform, assetDir) => {
|
|
1210
1210
|
const state = {
|
|
1211
1211
|
assetDir,
|
|
1212
|
+
layout: {
|
|
1213
|
+
activeGroupId: '',
|
|
1214
|
+
direction: 'horizontal',
|
|
1215
|
+
groups: []
|
|
1216
|
+
},
|
|
1212
1217
|
platform,
|
|
1213
|
-
statusBarItemsLeft: [],
|
|
1214
|
-
statusBarItemsRight: [],
|
|
1215
1218
|
uid
|
|
1216
1219
|
};
|
|
1217
1220
|
set(uid, state, state);
|
|
@@ -1253,6 +1256,11 @@ const handleClick = async (state, name) => {
|
|
|
1253
1256
|
return state;
|
|
1254
1257
|
};
|
|
1255
1258
|
|
|
1259
|
+
const handleClickCloseTab = (state, groupId, tabId) => {
|
|
1260
|
+
// TODO
|
|
1261
|
+
return state;
|
|
1262
|
+
};
|
|
1263
|
+
|
|
1256
1264
|
const id = 7201;
|
|
1257
1265
|
const sendMessagePortToExtensionHostWorker = async port => {
|
|
1258
1266
|
await sendMessagePortToExtensionHostWorker$1(port, id);
|
|
@@ -1577,28 +1585,6 @@ const text = data => {
|
|
|
1577
1585
|
const CSS_CLASSES = {
|
|
1578
1586
|
EDITOR_GROUPS_CONTAINER: 'editor-groups-container'};
|
|
1579
1587
|
|
|
1580
|
-
const renderTab = (tab, isActive) => {
|
|
1581
|
-
return [{
|
|
1582
|
-
childCount: 2,
|
|
1583
|
-
className: 'MainTab',
|
|
1584
|
-
type: Div
|
|
1585
|
-
}, {
|
|
1586
|
-
childCount: 1,
|
|
1587
|
-
className: 'TabTitle',
|
|
1588
|
-
type: Span
|
|
1589
|
-
}, text(tab.isDirty ? `*${tab.title}` : tab.title), {
|
|
1590
|
-
childCount: 1,
|
|
1591
|
-
className: 'TabCloseButton',
|
|
1592
|
-
type: Button
|
|
1593
|
-
}, text('×')];
|
|
1594
|
-
};
|
|
1595
|
-
const renderTabBar = group => {
|
|
1596
|
-
return [{
|
|
1597
|
-
childCount: group.tabs.length,
|
|
1598
|
-
className: 'MainTabs',
|
|
1599
|
-
type: Div
|
|
1600
|
-
}, ...group.tabs.flatMap(tab => renderTab(tab))];
|
|
1601
|
-
};
|
|
1602
1588
|
const renderEditor = tab => {
|
|
1603
1589
|
if (!tab) {
|
|
1604
1590
|
return [text('Tab not found')];
|
|
@@ -1620,6 +1606,31 @@ const renderEditor = tab => {
|
|
|
1620
1606
|
type: Pre
|
|
1621
1607
|
}, text(tab.content || '')];
|
|
1622
1608
|
};
|
|
1609
|
+
|
|
1610
|
+
const renderTab = (tab, isActive) => {
|
|
1611
|
+
return [{
|
|
1612
|
+
childCount: 2,
|
|
1613
|
+
className: isActive ? 'MainTab MainTabActive' : 'MainTab',
|
|
1614
|
+
type: Div
|
|
1615
|
+
}, {
|
|
1616
|
+
childCount: 1,
|
|
1617
|
+
className: 'TabTitle',
|
|
1618
|
+
type: Span
|
|
1619
|
+
}, text(tab.isDirty ? `*${tab.title}` : tab.title), {
|
|
1620
|
+
childCount: 1,
|
|
1621
|
+
className: 'EditorTabCloseButton',
|
|
1622
|
+
type: Button
|
|
1623
|
+
}, text('×')];
|
|
1624
|
+
};
|
|
1625
|
+
|
|
1626
|
+
const renderTabBar = group => {
|
|
1627
|
+
return [{
|
|
1628
|
+
childCount: group.tabs.length,
|
|
1629
|
+
className: 'MainTabs',
|
|
1630
|
+
type: Div
|
|
1631
|
+
}, ...group.tabs.flatMap(tab => renderTab(tab, tab.id === group.activeTabId))];
|
|
1632
|
+
};
|
|
1633
|
+
|
|
1623
1634
|
const renderEditorGroup = group => {
|
|
1624
1635
|
const activeTab = group.tabs.find(tab => tab.id === group.activeTabId);
|
|
1625
1636
|
return [{
|
|
@@ -1632,6 +1643,7 @@ const renderEditorGroup = group => {
|
|
|
1632
1643
|
type: Div
|
|
1633
1644
|
}, ...renderEditor(activeTab)];
|
|
1634
1645
|
};
|
|
1646
|
+
|
|
1635
1647
|
const getMainAreaVirtualDom = layout => {
|
|
1636
1648
|
return [{
|
|
1637
1649
|
childCount: 1,
|
|
@@ -1685,11 +1697,15 @@ const render2 = (uid, diffResult) => {
|
|
|
1685
1697
|
};
|
|
1686
1698
|
|
|
1687
1699
|
const HandleClick = 11;
|
|
1700
|
+
const HandleClickClose = 12;
|
|
1688
1701
|
|
|
1689
1702
|
const renderEventListeners = () => {
|
|
1690
1703
|
return [{
|
|
1691
1704
|
name: HandleClick,
|
|
1692
1705
|
params: ['handleClick', TargetName]
|
|
1706
|
+
}, {
|
|
1707
|
+
name: HandleClickClose,
|
|
1708
|
+
params: ['handleClickClose', 'event.target.dataset.groupIndex', 'event.target.dataset.index']
|
|
1693
1709
|
}];
|
|
1694
1710
|
};
|
|
1695
1711
|
|
|
@@ -1721,6 +1737,7 @@ const commandMap = {
|
|
|
1721
1737
|
'MainArea.diff2': diff2,
|
|
1722
1738
|
'MainArea.getCommandIds': getCommandIds,
|
|
1723
1739
|
'MainArea.handleClick': wrapCommand(handleClick),
|
|
1740
|
+
'MainArea.handleClickCloseTab': wrapCommand(handleClickCloseTab),
|
|
1724
1741
|
'MainArea.initialize': initialize,
|
|
1725
1742
|
'MainArea.loadContent': wrapCommand(loadContent),
|
|
1726
1743
|
'MainArea.openUri': wrapCommand(openUri),
|