@lvce-editor/iframe-worker 3.6.3 → 4.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 -33
- package/package.json +1 -1
package/dist/iframeWorkerMain.js
CHANGED
|
@@ -893,6 +893,15 @@ const createLocalHostUrl = (locationProtocol, locationHost, isGitpod, webViewPor
|
|
|
893
893
|
return `http://localhost:${webViewPort}`;
|
|
894
894
|
};
|
|
895
895
|
|
|
896
|
+
const getWebView = (webViews, webViewId) => {
|
|
897
|
+
for (const webView of webViews) {
|
|
898
|
+
if (webView.id === webViewId) {
|
|
899
|
+
return webView;
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
return undefined;
|
|
903
|
+
};
|
|
904
|
+
|
|
896
905
|
const getWebViewHtml = (baseUrl, locationOrigin, elements, assetDir) => {
|
|
897
906
|
if (!elements) {
|
|
898
907
|
return '';
|
|
@@ -920,26 +929,13 @@ const getWebViewHtml = (baseUrl, locationOrigin, elements, assetDir) => {
|
|
|
920
929
|
return html;
|
|
921
930
|
};
|
|
922
931
|
|
|
923
|
-
const WebView = 'lvce-oss-webview';
|
|
924
|
-
|
|
925
|
-
const getWebView$1 = (webViews, webViewId) => {
|
|
926
|
-
for (const webView of webViews) {
|
|
927
|
-
if (webView.id === webViewId) {
|
|
928
|
-
return webView;
|
|
929
|
-
}
|
|
930
|
-
}
|
|
931
|
-
return undefined;
|
|
932
|
-
};
|
|
933
932
|
const getWebViewPath = (webViews, webViewId) => {
|
|
934
|
-
const webView = getWebView
|
|
933
|
+
const webView = getWebView(webViews, webViewId);
|
|
935
934
|
if (!webView) {
|
|
936
935
|
return '';
|
|
937
936
|
}
|
|
938
937
|
return webView.path;
|
|
939
938
|
};
|
|
940
|
-
const isWindowsPath = path => {
|
|
941
|
-
return path.startsWith('A:\\') || path.startsWith('B:\\') || path.startsWith('C:\\') || path.startsWith('D:\\') || path.startsWith('E:\\');
|
|
942
|
-
};
|
|
943
939
|
const getWebViewUri = (webViews, webViewId) => {
|
|
944
940
|
const webViewPath = getWebViewPath(webViews, webViewId);
|
|
945
941
|
if (!webViewPath) {
|
|
@@ -951,8 +947,11 @@ const getWebViewUri = (webViews, webViewId) => {
|
|
|
951
947
|
}
|
|
952
948
|
return webViewPath;
|
|
953
949
|
};
|
|
950
|
+
|
|
951
|
+
const WebView = 'lvce-oss-webview';
|
|
952
|
+
|
|
954
953
|
const getIframeSrcRemote = (webViews, webViewPort, webViewId, locationProtocol, locationHost, isGitpod, root, platform$1 = platform, assetDir) => {
|
|
955
|
-
const webView = getWebView
|
|
954
|
+
const webView = getWebView(webViews, webViewId);
|
|
956
955
|
const webViewUri = getWebViewUri(webViews, webViewId);
|
|
957
956
|
if (!webViewUri) {
|
|
958
957
|
return undefined;
|
|
@@ -967,15 +966,7 @@ const getIframeSrcRemote = (webViews, webViewPort, webViewId, locationProtocol,
|
|
|
967
966
|
iframeSrc = `${WebView}://-${relativePath}/`;
|
|
968
967
|
// TODO
|
|
969
968
|
} else if (platform$1 === Remote) {
|
|
970
|
-
|
|
971
|
-
if (webViewUri.startsWith('file://')) {
|
|
972
|
-
// ignore
|
|
973
|
-
webViewRoot = webViewUri.slice('file://'.length).replace('/index.html', '');
|
|
974
|
-
} else if (isWindowsPath(relativePath)) {
|
|
975
|
-
webViewRoot = relativePath;
|
|
976
|
-
} else {
|
|
977
|
-
webViewRoot = root + relativePath;
|
|
978
|
-
}
|
|
969
|
+
webViewRoot = webView.uri;
|
|
979
970
|
iframeSrc = createLocalHostUrl(locationProtocol, locationHost, isGitpod, webViewPort);
|
|
980
971
|
}
|
|
981
972
|
let iframeContent = getWebViewHtml('', '', webView.elements, assetDir);
|
|
@@ -1043,15 +1034,6 @@ const getIframeSrc$1 = (webView, locationOrigin, assetDir) => {
|
|
|
1043
1034
|
return undefined;
|
|
1044
1035
|
};
|
|
1045
1036
|
|
|
1046
|
-
const getWebView = (webViews, webViewId) => {
|
|
1047
|
-
for (const webView of webViews) {
|
|
1048
|
-
if (webView.id === webViewId) {
|
|
1049
|
-
return webView;
|
|
1050
|
-
}
|
|
1051
|
-
}
|
|
1052
|
-
return undefined;
|
|
1053
|
-
};
|
|
1054
|
-
|
|
1055
1037
|
const getIframeSrc = (webViews, webViewId, webViewPort, root, isGitpod, locationProtocol, locationHost, locationOrigin, platform, assetDir) => {
|
|
1056
1038
|
try {
|
|
1057
1039
|
const webView = getWebView(webViews, webViewId);
|