fix(mobile): component viewer in mobile web
This commit is contained in:
1
packages/mobile/.gitignore
vendored
1
packages/mobile/.gitignore
vendored
@@ -52,6 +52,7 @@ app-release.aab
|
|||||||
*.bundle
|
*.bundle
|
||||||
!Web.bundle
|
!Web.bundle
|
||||||
html/Web.bundle/src/web-src
|
html/Web.bundle/src/web-src
|
||||||
|
html/Web.bundle/src/components
|
||||||
ios-release.bundle.map
|
ios-release.bundle.map
|
||||||
|
|
||||||
# fastlane
|
# fastlane
|
||||||
|
|||||||
@@ -127,6 +127,7 @@ export const MobileWebAppContainer = () => {
|
|||||||
onHttpError={() => console.error('An HTTP error occurred')}
|
onHttpError={() => console.error('An HTTP error occurred')}
|
||||||
onMessage={onMessage}
|
onMessage={onMessage}
|
||||||
allowFileAccess={true}
|
allowFileAccess={true}
|
||||||
|
allowUniversalAccessFromFileURLs={true}
|
||||||
injectedJavaScript={injectedJS}
|
injectedJavaScript={injectedJS}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -6,9 +6,6 @@
|
|||||||
<meta content="IE=edge" http-equiv="X-UA-Compatible" />
|
<meta content="IE=edge" http-equiv="X-UA-Compatible" />
|
||||||
<meta content="width=device-width, initial-scale=1" name="viewport" />
|
<meta content="width=device-width, initial-scale=1" name="viewport" />
|
||||||
<link rel="stylesheet" href="web-src/app.css" />
|
<link rel="stylesheet" href="web-src/app.css" />
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<script>
|
<script>
|
||||||
window.defaultSyncServer = "https://api.standardnotes.com";
|
window.defaultSyncServer = "https://api.standardnotes.com";
|
||||||
window.defaultFilesHost = "https://files.standardnotes.com";
|
window.defaultFilesHost = "https://files.standardnotes.com";
|
||||||
@@ -20,6 +17,9 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script src="web-src/app.js"></script>
|
<script src="web-src/app.js"></script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
"start": "react-native start",
|
"start": "react-native start",
|
||||||
"tsc": "tsc --noEmit",
|
"tsc": "tsc --noEmit",
|
||||||
"upgrade:snjs": "ncu -u '@standardnotes/*'",
|
"upgrade:snjs": "ncu -u '@standardnotes/*'",
|
||||||
"web:bundle": "mkdir -p html/Web.bundle/src/web-src/ && cp -r ../web/dist/. html/Web.bundle/src/web-src/"
|
"web:bundle": "mkdir -p html/Web.bundle/src/web-src/ && cp -r ../web/dist/. html/Web.bundle/src/web-src/ && mkdir -p html/Web.bundle/src/components/assets && cp -r ../components/dist/assets/. html/Web.bundle/src/components/assets/"
|
||||||
},
|
},
|
||||||
"installConfig": {
|
"installConfig": {
|
||||||
"hoistingLimits": "workspaces"
|
"hoistingLimits": "workspaces"
|
||||||
|
|||||||
@@ -292,7 +292,7 @@ describe('featuresService', () => {
|
|||||||
const component = nativeComponent()
|
const component = nativeComponent()
|
||||||
const url = manager.urlForComponent(component)
|
const url = manager.urlForComponent(component)
|
||||||
const feature = FindNativeFeature(component.identifier) as FeatureDescription
|
const feature = FindNativeFeature(component.identifier) as FeatureDescription
|
||||||
expect(url).toEqual(`http://localhost/components/assets/${component.identifier}/${feature.index_path}`)
|
expect(url).toEqual(`components/assets/${component.identifier}/${feature.index_path}`)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('returns hosted path for third party component', () => {
|
it('returns hosted path for third party component', () => {
|
||||||
|
|||||||
@@ -285,7 +285,7 @@ export class SNComponentManager extends AbstractService<ComponentManagerEvent, E
|
|||||||
if (!isWeb) {
|
if (!isWeb) {
|
||||||
throw Error('Mobile must override urlForComponent to handle native paths')
|
throw Error('Mobile must override urlForComponent to handle native paths')
|
||||||
}
|
}
|
||||||
return `${window.location.origin}/components/assets/${component.identifier}/${nativeFeature.index_path}`
|
return `components/assets/${component.identifier}/${nativeFeature.index_path}`
|
||||||
}
|
}
|
||||||
|
|
||||||
let url = component.hosted_url || component.legacy_url
|
let url = component.hosted_url || component.legacy_url
|
||||||
|
|||||||
Reference in New Issue
Block a user