@lvce-editor/iframe-worker 5.17.0 → 5.18.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/iframeWorkerMain.js +21 -20
- package/package.json +7 -7
package/dist/iframeWorkerMain.js
CHANGED
|
@@ -1045,13 +1045,17 @@ const getWebViewHtml = (baseUrl, locationOrigin, elements, assetDir) => {
|
|
|
1045
1045
|
const middle = [];
|
|
1046
1046
|
middle.push('<meta charset="utf-8">');
|
|
1047
1047
|
for (const element of elements) {
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1048
|
+
switch (element.type) {
|
|
1049
|
+
case 'title':
|
|
1050
|
+
middle.push(`<title>${element.value}</title>`);
|
|
1051
|
+
break;
|
|
1052
|
+
case 'script':
|
|
1053
|
+
middle.push(`<script type="module" src="${locationOrigin}${assetDir}/js/preview-injected.js"></script>`);
|
|
1054
|
+
middle.push(`<script type="module" src="${locationOrigin}${baseUrl}/${element.path}"></script>`);
|
|
1055
|
+
break;
|
|
1056
|
+
case 'css':
|
|
1057
|
+
middle.push(`<link rel="stylesheet" href="${locationOrigin}${baseUrl}/${element.path}" />`);
|
|
1058
|
+
break;
|
|
1055
1059
|
}
|
|
1056
1060
|
}
|
|
1057
1061
|
const middleHtml = middle.join('\n ');
|
|
@@ -1313,6 +1317,7 @@ const invokeAndTransfer$1 = async (method, ...params) => {
|
|
|
1313
1317
|
|
|
1314
1318
|
const WebView = 'lvce-oss-webview';
|
|
1315
1319
|
|
|
1320
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1316
1321
|
const setPort = async (uid, port, origin, portType) => {
|
|
1317
1322
|
await invokeAndTransfer$1('WebView.setPort', uid, port, origin, portType);
|
|
1318
1323
|
};
|
|
@@ -1360,17 +1365,13 @@ const register$2 = async (previewServerId, webViewPort, frameAncestors, webViewR
|
|
|
1360
1365
|
// TODO pass coop / coep configuration to server
|
|
1361
1366
|
await create(previewServerId, useNewWebViewHandler); // TODO move this up
|
|
1362
1367
|
await start(previewServerId, webViewPort); // TODO move this up
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
});
|
|
1371
|
-
} else {
|
|
1372
|
-
await setHandler(previewServerId, frameAncestors, webViewRoot, csp, iframeContent);
|
|
1373
|
-
}
|
|
1368
|
+
await (useNewWebViewHandler ? setInfo2({
|
|
1369
|
+
webViewRoot,
|
|
1370
|
+
webViewId,
|
|
1371
|
+
contentSecurityPolicy: csp,
|
|
1372
|
+
iframeContent,
|
|
1373
|
+
remotePathPrefix
|
|
1374
|
+
}) : setHandler(previewServerId, frameAncestors, webViewRoot, csp, iframeContent));
|
|
1374
1375
|
// TODO make this work in gitpod also
|
|
1375
1376
|
};
|
|
1376
1377
|
|
|
@@ -1384,7 +1385,6 @@ const getModule = platform => {
|
|
|
1384
1385
|
return register$2;
|
|
1385
1386
|
case Electron:
|
|
1386
1387
|
return register$3;
|
|
1387
|
-
case Web:
|
|
1388
1388
|
default:
|
|
1389
1389
|
return register$1;
|
|
1390
1390
|
}
|
|
@@ -1476,6 +1476,7 @@ const invokeAndTransfer = async (method, ...params) => {
|
|
|
1476
1476
|
return invokeAndTransfer$3('WebView.compatRendererWorkerInvokeAndTransfer', method, ...params);
|
|
1477
1477
|
};
|
|
1478
1478
|
|
|
1479
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1479
1480
|
const createSecondaryWebViewConnection = async (uid, origin, port) => {
|
|
1480
1481
|
const portType = 'application';
|
|
1481
1482
|
await invokeAndTransfer('WebView.setPort', uid, port, origin, portType);
|
|
@@ -1738,7 +1739,7 @@ const saveState = async () => {
|
|
|
1738
1739
|
value: savedState
|
|
1739
1740
|
});
|
|
1740
1741
|
} catch (error) {
|
|
1741
|
-
console.
|
|
1742
|
+
console.error(error);
|
|
1742
1743
|
// TODO maybe log the error
|
|
1743
1744
|
// ignore
|
|
1744
1745
|
}
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/iframe-worker",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.18.0",
|
|
4
4
|
"description": "Web Worker to manage creation and lifecycle of iframes in Lvce Editor",
|
|
5
|
-
"
|
|
6
|
-
|
|
5
|
+
"keywords": [
|
|
6
|
+
"iframe"
|
|
7
|
+
],
|
|
7
8
|
"repository": {
|
|
8
9
|
"type": "git",
|
|
9
10
|
"url": "git@github.com:lvce-editor/iframe-worker.git"
|
|
10
11
|
},
|
|
11
|
-
"
|
|
12
|
-
"iframe"
|
|
13
|
-
],
|
|
12
|
+
"license": "MIT",
|
|
14
13
|
"author": "Lvce Editor",
|
|
15
|
-
"
|
|
14
|
+
"type": "module",
|
|
15
|
+
"main": "dist/iframeWorkerMain.js"
|
|
16
16
|
}
|