@lvce-editor/main-area-worker 6.0.0 → 6.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 +23 -28
- package/package.json +2 -2
|
@@ -98,7 +98,14 @@ const closeAll$1 = state => {
|
|
|
98
98
|
};
|
|
99
99
|
};
|
|
100
100
|
|
|
101
|
-
const Button$1 =
|
|
101
|
+
const Button$1 = 1;
|
|
102
|
+
const Div = 4;
|
|
103
|
+
const Span = 8;
|
|
104
|
+
const Text = 12;
|
|
105
|
+
const Img = 17;
|
|
106
|
+
const Pre = 51;
|
|
107
|
+
|
|
108
|
+
const Button = 'event.button';
|
|
102
109
|
const ClientX = 'event.clientX';
|
|
103
110
|
const ClientY = 'event.clientY';
|
|
104
111
|
const TargetName = 'event.target.name';
|
|
@@ -1285,7 +1292,6 @@ const sendMessagePortToExtensionHostWorker$1 = async (port, rpcId = 0) => {
|
|
|
1285
1292
|
const handleAttach = async command => {
|
|
1286
1293
|
// TODO find a better way to append editors
|
|
1287
1294
|
const parentNodeSelector = '.editor-groups-container';
|
|
1288
|
-
// @ts-ignore
|
|
1289
1295
|
await invoke('Layout.attachViewlet', parentNodeSelector, command.instanceId);
|
|
1290
1296
|
};
|
|
1291
1297
|
|
|
@@ -1353,7 +1359,6 @@ const findTab = (state, tabId) => {
|
|
|
1353
1359
|
return undefined;
|
|
1354
1360
|
};
|
|
1355
1361
|
const loadFileContent = async path => {
|
|
1356
|
-
// @ts-ignore
|
|
1357
1362
|
const content = await invoke('FileSystem.readFile', path);
|
|
1358
1363
|
return content;
|
|
1359
1364
|
};
|
|
@@ -1486,7 +1491,7 @@ const handleViewletReady = (state, editorUid) => {
|
|
|
1486
1491
|
|
|
1487
1492
|
const handleCreate = async command => {
|
|
1488
1493
|
// Safe to call - no visible side effects
|
|
1489
|
-
|
|
1494
|
+
|
|
1490
1495
|
const instanceId = Math.random(); // TODO try to find a better way to get consistent integer ids (thread safe)
|
|
1491
1496
|
|
|
1492
1497
|
await invoke('Layout.createViewlet', command.viewletModuleId, command.tabId, command.bounds, command.uri, instanceId);
|
|
@@ -1504,18 +1509,17 @@ const handleCreate = async command => {
|
|
|
1504
1509
|
|
|
1505
1510
|
const handleDetach = async command => {
|
|
1506
1511
|
// Hides viewlet but keeps it alive
|
|
1507
|
-
|
|
1512
|
+
|
|
1508
1513
|
await invoke('Viewlet.detach', command.instanceId);
|
|
1509
1514
|
};
|
|
1510
1515
|
|
|
1511
1516
|
const handleDispose = async command => {
|
|
1512
1517
|
// Fully destroys viewlet
|
|
1513
|
-
|
|
1518
|
+
|
|
1514
1519
|
await invoke('Viewlet.dispose', command.instanceId);
|
|
1515
1520
|
};
|
|
1516
1521
|
|
|
1517
1522
|
const handleSetBounds = async command => {
|
|
1518
|
-
// @ts-ignore
|
|
1519
1523
|
await invoke('Viewlet.setBounds', command.instanceId, command.bounds);
|
|
1520
1524
|
};
|
|
1521
1525
|
|
|
@@ -1649,6 +1653,7 @@ const create = (uid, uri, x, y, width, height, platform, assetDir, tabHeight = 3
|
|
|
1649
1653
|
assetDir,
|
|
1650
1654
|
fileIconCache: {},
|
|
1651
1655
|
height,
|
|
1656
|
+
iframes: [],
|
|
1652
1657
|
layout: {
|
|
1653
1658
|
activeGroupId: undefined,
|
|
1654
1659
|
direction: 'horizontal',
|
|
@@ -1847,7 +1852,6 @@ const handleClickCloseTab = (state, rawGroupIndex, rawIndex) => {
|
|
|
1847
1852
|
};
|
|
1848
1853
|
|
|
1849
1854
|
const createViewlet = async (viewletModuleId, editorUid, tabId, bounds, uri) => {
|
|
1850
|
-
// @ts-ignore
|
|
1851
1855
|
await invoke('Layout.createViewlet', viewletModuleId, editorUid, tabId, bounds, uri);
|
|
1852
1856
|
};
|
|
1853
1857
|
|
|
@@ -1997,7 +2001,7 @@ const selectTab = async (state, groupIndex, index) => {
|
|
|
1997
2001
|
const newTab = newState.layout.groups[groupIndex].tabs[index];
|
|
1998
2002
|
if (newTab.uri && (!newTab.loadingState || newTab.loadingState === 'loading')) {
|
|
1999
2003
|
// Query RendererWorker for viewlet module ID
|
|
2000
|
-
|
|
2004
|
+
|
|
2001
2005
|
const viewletModuleId = await invoke('Layout.getModuleId', newTab.uri);
|
|
2002
2006
|
if (viewletModuleId) {
|
|
2003
2007
|
// Calculate bounds: use main area bounds minus 35px for tab height
|
|
@@ -2092,7 +2096,6 @@ const handleResize = async (state, x, y, width, height) => {
|
|
|
2092
2096
|
for (const group of groups) {
|
|
2093
2097
|
for (const tab of group.tabs) {
|
|
2094
2098
|
if (tab.editorUid !== -1) {
|
|
2095
|
-
// @ts-ignore
|
|
2096
2099
|
await invoke('Viewlet.setBounds', tab.editorUid, {
|
|
2097
2100
|
height: contentHeight,
|
|
2098
2101
|
width,
|
|
@@ -2341,7 +2344,6 @@ const getViewletModuleId = async uri => {
|
|
|
2341
2344
|
// Query RendererWorker for viewlet module ID (optional, may fail in tests)
|
|
2342
2345
|
let viewletModuleId;
|
|
2343
2346
|
try {
|
|
2344
|
-
// @ts-ignore
|
|
2345
2347
|
viewletModuleId = await invoke('Layout.getModuleId', uri);
|
|
2346
2348
|
} catch {
|
|
2347
2349
|
// Viewlet creation is optional - silently ignore if RendererWorker isn't available
|
|
@@ -2387,17 +2389,16 @@ const updateTabs = (state, editorUids) => {
|
|
|
2387
2389
|
};
|
|
2388
2390
|
};
|
|
2389
2391
|
|
|
2390
|
-
const TAB_HEIGHT = 35;
|
|
2391
2392
|
const restoreAndCreateEditors = async (state, restoredLayout) => {
|
|
2392
2393
|
let newState = {
|
|
2393
2394
|
...state,
|
|
2394
2395
|
layout: restoredLayout
|
|
2395
2396
|
};
|
|
2396
2397
|
const bounds = {
|
|
2397
|
-
height: newState.height -
|
|
2398
|
+
height: newState.height - state.tabHeight,
|
|
2398
2399
|
width: newState.width,
|
|
2399
2400
|
x: newState.x,
|
|
2400
|
-
y: newState.y +
|
|
2401
|
+
y: newState.y + state.tabHeight
|
|
2401
2402
|
};
|
|
2402
2403
|
|
|
2403
2404
|
// Get viewlet module IDs for all active tabs
|
|
@@ -2843,8 +2844,6 @@ const openUri = async (state, options) => {
|
|
|
2843
2844
|
intermediateState1 = switchedState;
|
|
2844
2845
|
set(uid, state, intermediateState1);
|
|
2845
2846
|
|
|
2846
|
-
// @ts-ignore
|
|
2847
|
-
|
|
2848
2847
|
// Get the tab to extract editorUid
|
|
2849
2848
|
const tabWithViewlet = findTabById(intermediateState1, tabId);
|
|
2850
2849
|
if (!tabWithViewlet) {
|
|
@@ -2905,13 +2904,6 @@ const refresh = state => {
|
|
|
2905
2904
|
};
|
|
2906
2905
|
};
|
|
2907
2906
|
|
|
2908
|
-
const Button = 1;
|
|
2909
|
-
const Div = 4;
|
|
2910
|
-
const Span = 8;
|
|
2911
|
-
const Text = 12;
|
|
2912
|
-
const Img = 17;
|
|
2913
|
-
const Pre = 51;
|
|
2914
|
-
|
|
2915
2907
|
const text = data => {
|
|
2916
2908
|
return {
|
|
2917
2909
|
childCount: 0,
|
|
@@ -3307,7 +3299,7 @@ const renderTab = (tab, isActive, tabIndex, groupIndex) => {
|
|
|
3307
3299
|
'data-groupIndex': groupIndex,
|
|
3308
3300
|
'data-index': tabIndex,
|
|
3309
3301
|
onClick: HandleClickClose,
|
|
3310
|
-
type: Button
|
|
3302
|
+
type: Button$1
|
|
3311
3303
|
}, {
|
|
3312
3304
|
childCount: 0,
|
|
3313
3305
|
className: 'MaskIcon MaskIconClose',
|
|
@@ -3340,7 +3332,7 @@ const renderEditorGroupActions = (group, groupIndex, splitButtonEnabled) => {
|
|
|
3340
3332
|
'data-groupId': String(group.id),
|
|
3341
3333
|
onClick: HandleClickAction,
|
|
3342
3334
|
title: splitEditorGroup(),
|
|
3343
|
-
type: Button
|
|
3335
|
+
type: Button$1
|
|
3344
3336
|
}, text('split')];
|
|
3345
3337
|
};
|
|
3346
3338
|
|
|
@@ -3362,7 +3354,7 @@ const renderEditorGroup = (group, groupIndex, splitButtonEnabled = false) => {
|
|
|
3362
3354
|
className: 'EditorGroup',
|
|
3363
3355
|
type: Div
|
|
3364
3356
|
}, ...renderEditorGroupHeader(group, groupIndex, splitButtonEnabled), {
|
|
3365
|
-
childCount:
|
|
3357
|
+
childCount: 1,
|
|
3366
3358
|
className: 'EditorContainer',
|
|
3367
3359
|
type: Div
|
|
3368
3360
|
}, ...renderEditor(activeTab)];
|
|
@@ -3443,7 +3435,7 @@ const renderEventListeners = () => {
|
|
|
3443
3435
|
params: ['handleClickTab', 'event.target.dataset.groupIndex', 'event.target.dataset.index']
|
|
3444
3436
|
}, {
|
|
3445
3437
|
name: HandleTabContextMenu,
|
|
3446
|
-
params: ['handleTabContextMenu', Button
|
|
3438
|
+
params: ['handleTabContextMenu', Button, ClientX, ClientY],
|
|
3447
3439
|
preventDefault: true
|
|
3448
3440
|
}, {
|
|
3449
3441
|
name: HandleClickAction,
|
|
@@ -3487,10 +3479,13 @@ const save = async state => {
|
|
|
3487
3479
|
const {
|
|
3488
3480
|
tab
|
|
3489
3481
|
} = activeTabData;
|
|
3490
|
-
if (tab.loadingState
|
|
3482
|
+
if (tab.loadingState === 'loading') {
|
|
3491
3483
|
return state;
|
|
3492
3484
|
}
|
|
3493
3485
|
await invoke('Editor.save', tab.editorUid);
|
|
3486
|
+
if (!tab.isDirty) {
|
|
3487
|
+
return state;
|
|
3488
|
+
}
|
|
3494
3489
|
return updateTab(state, tab.id, {
|
|
3495
3490
|
isDirty: false
|
|
3496
3491
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/main-area-worker",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"description": "Main Area Worker",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -11,6 +11,6 @@
|
|
|
11
11
|
"type": "module",
|
|
12
12
|
"main": "dist/mainAreaWorkerMain.js",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@lvce-editor/virtual-dom-worker": "^6.
|
|
14
|
+
"@lvce-editor/virtual-dom-worker": "^6.9.0"
|
|
15
15
|
}
|
|
16
16
|
}
|