@lvce-editor/panel-worker 2.6.0 → 2.6.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/panelWorkerMain.js +31 -5
- package/package.json +1 -1
package/dist/panelWorkerMain.js
CHANGED
|
@@ -1447,7 +1447,7 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
|
|
|
1447
1447
|
currentViewletId: '',
|
|
1448
1448
|
errorCount: 0,
|
|
1449
1449
|
headerHeight: 35,
|
|
1450
|
-
height
|
|
1450
|
+
height,
|
|
1451
1451
|
initial: true,
|
|
1452
1452
|
maximized: false,
|
|
1453
1453
|
platform,
|
|
@@ -1456,9 +1456,9 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
|
|
|
1456
1456
|
uid,
|
|
1457
1457
|
views: [],
|
|
1458
1458
|
warningCount: 0,
|
|
1459
|
-
width
|
|
1460
|
-
x
|
|
1461
|
-
y
|
|
1459
|
+
width,
|
|
1460
|
+
x,
|
|
1461
|
+
y
|
|
1462
1462
|
};
|
|
1463
1463
|
set(uid, state, state);
|
|
1464
1464
|
};
|
|
@@ -1583,10 +1583,34 @@ const getUid = () => {
|
|
|
1583
1583
|
return Math.random();
|
|
1584
1584
|
};
|
|
1585
1585
|
|
|
1586
|
+
const command = 'SaveState.saveViewletStateWithStorageId';
|
|
1587
|
+
const isCommandNotFoundError = error => {
|
|
1588
|
+
if (!(error instanceof Error)) {
|
|
1589
|
+
return false;
|
|
1590
|
+
}
|
|
1591
|
+
const message = error.message.toLowerCase();
|
|
1592
|
+
return message.includes(command.toLowerCase()) && message.includes('not found');
|
|
1593
|
+
};
|
|
1594
|
+
const saveViewletState = async (childUid, viewletId) => {
|
|
1595
|
+
if (childUid <= 0 || !viewletId) {
|
|
1596
|
+
return;
|
|
1597
|
+
}
|
|
1598
|
+
try {
|
|
1599
|
+
await invoke(command, childUid, viewletId);
|
|
1600
|
+
} catch (error) {
|
|
1601
|
+
if (!isCommandNotFoundError(error)) {
|
|
1602
|
+
throw error;
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
};
|
|
1606
|
+
|
|
1586
1607
|
const openViewlet = async (state, id, focus = false, uri = '') => {
|
|
1587
1608
|
const {
|
|
1609
|
+
childUid: currentChildUid,
|
|
1610
|
+
currentViewletId,
|
|
1588
1611
|
views
|
|
1589
1612
|
} = state;
|
|
1613
|
+
await saveViewletState(currentChildUid, currentViewletId);
|
|
1590
1614
|
const childDimensions = getContentDimensions(state);
|
|
1591
1615
|
const childUid = getUid();
|
|
1592
1616
|
const tabId = getUid();
|
|
@@ -2212,10 +2236,12 @@ const resize = async (state, dimensions) => {
|
|
|
2212
2236
|
};
|
|
2213
2237
|
};
|
|
2214
2238
|
|
|
2215
|
-
const saveState = state => {
|
|
2239
|
+
const saveState = async state => {
|
|
2216
2240
|
const {
|
|
2241
|
+
childUid,
|
|
2217
2242
|
currentViewletId
|
|
2218
2243
|
} = state;
|
|
2244
|
+
await saveViewletState(childUid, currentViewletId);
|
|
2219
2245
|
return {
|
|
2220
2246
|
currentViewletId
|
|
2221
2247
|
};
|