@lvce-editor/iframe-worker 4.1.0 → 5.0.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 +15 -12
- package/package.json +1 -1
package/dist/iframeWorkerMain.js
CHANGED
|
@@ -957,23 +957,18 @@ const getIframeSrcRemote = (webViews, webViewPort, webViewId, locationProtocol,
|
|
|
957
957
|
let iframeSrc = webViewUri;
|
|
958
958
|
let webViewRoot = webViewUri;
|
|
959
959
|
|
|
960
|
-
// TODO
|
|
961
|
-
|
|
960
|
+
// TODO when running in remote, try scope webviews by path or if possible by domain
|
|
962
961
|
if (platform$1 === Electron) {
|
|
963
|
-
const
|
|
964
|
-
iframeSrc = `${webViewScheme}
|
|
965
|
-
// TODO
|
|
962
|
+
const webViewId = webView.id;
|
|
963
|
+
iframeSrc = `${webViewScheme}://${webViewId}/`;
|
|
966
964
|
} else if (platform$1 === Remote) {
|
|
967
965
|
webViewRoot = webView.uri;
|
|
968
966
|
iframeSrc = createLocalHostUrl(locationProtocol, locationHost, isGitpod, webViewPort);
|
|
969
967
|
}
|
|
970
|
-
|
|
968
|
+
const iframeContent = getWebViewHtml('', '', webView.elements, assetDir);
|
|
971
969
|
// TODO either
|
|
972
970
|
// - load webviews the same as in web using blob urls
|
|
973
971
|
// - load webviews from a pattern like /webviews/:id/:fileName
|
|
974
|
-
if (!webView.path) {
|
|
975
|
-
iframeContent = iframeContent.replaceAll('/media/', '/').replaceAll('//', '/');
|
|
976
|
-
}
|
|
977
972
|
return {
|
|
978
973
|
srcDoc: '',
|
|
979
974
|
iframeSrc,
|
|
@@ -1193,9 +1188,17 @@ const setHandler = async (previewServerId, frameAncestors, webViewRoot, contentS
|
|
|
1193
1188
|
await invoke('WebViewServer.setHandler', previewServerId, frameAncestors, webViewRoot, contentSecurityPolicy, iframeContent);
|
|
1194
1189
|
};
|
|
1195
1190
|
|
|
1196
|
-
const register$3 = async previewServerId => {
|
|
1191
|
+
const register$3 = async (previewServerId, webViewPort, frameAncestors, webViewRoot, csp, iframeContent) => {
|
|
1197
1192
|
await registerProtocol();
|
|
1198
1193
|
await create(previewServerId); // TODO move this up
|
|
1194
|
+
|
|
1195
|
+
// TODO send info to electron which domain maps to which webview root.
|
|
1196
|
+
// for example, video-preview maps to domain lvce-oss-webview://video-preview
|
|
1197
|
+
// and webview root /home/user/lvce/extensions/video-preview
|
|
1198
|
+
// Then the request handler can decide by domain which webview root to use.
|
|
1199
|
+
// Another option would be in electron to check what iframe (webContents)
|
|
1200
|
+
// responds to which webviewRoot and setting a webviewRoot per webContents instance
|
|
1201
|
+
// await WebViewServer.setInfo(previewServerId)
|
|
1199
1202
|
};
|
|
1200
1203
|
|
|
1201
1204
|
const register$2 = async (previewServerId, webViewPort, frameAncestors, webViewRoot, csp, iframeContent) => {
|
|
@@ -1225,7 +1228,7 @@ const getModule = platform => {
|
|
|
1225
1228
|
}
|
|
1226
1229
|
};
|
|
1227
1230
|
|
|
1228
|
-
const register = async (previewServerId, webViewPort, frameAncestors, webViewRoot, csp, iframeContent) => {
|
|
1231
|
+
const register = async (previewServerId, webViewPort, frameAncestors, webViewRoot, csp, iframeContent, platform) => {
|
|
1229
1232
|
const fn = getModule(platform);
|
|
1230
1233
|
return fn(previewServerId, webViewPort, frameAncestors, webViewRoot, csp, iframeContent);
|
|
1231
1234
|
};
|
|
@@ -1282,7 +1285,7 @@ const create2 = async ({
|
|
|
1282
1285
|
port2
|
|
1283
1286
|
} = getPortTuple();
|
|
1284
1287
|
const portId = create$1();
|
|
1285
|
-
await register(previewServerId, webViewPort, frameAncestors, webViewRoot, csp, iframeContent);
|
|
1288
|
+
await register(previewServerId, webViewPort, frameAncestors, webViewRoot, csp, iframeContent, platform);
|
|
1286
1289
|
await invoke$1('WebView.create', id, iframeSrc, sandbox, iframeCsp, credentialless, permissionPolicyString, frameTitle);
|
|
1287
1290
|
await invoke$1('WebView.load', id);
|
|
1288
1291
|
const origin = getWebViewOrigin(webViewPort, platform, webViewScheme);
|