fix: cloudlink url

This commit is contained in:
Mo
2022-01-03 10:47:33 -06:00
parent f405333898
commit 4153c81638
4 changed files with 22 additions and 8 deletions

View File

@@ -238,7 +238,7 @@ export const ComponentView: FunctionalComponent<IProps> = observer(
ref={iframeRef}
data-component-viewer-id={componentViewer.identifier}
frameBorder={0}
src={application.componentManager.urlForComponent(component) || ''}
src={componentViewer.url || ''}
sandbox="allow-scripts allow-top-navigation-by-user-activation allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-modals allow-forms allow-downloads"
>
Loading

View File

@@ -1,6 +1,7 @@
import { PreferencesGroup, PreferencesSegment } from '@/preferences/components';
import { WebApplication } from '@/ui_models/application';
import { ComponentViewer, SNComponent } from '@standardnotes/snjs/dist/@types';
import { ComponentViewer, SNComponent } from '@standardnotes/snjs';
import { FeatureIdentifier } from '@standardnotes/features';
import { observer } from 'mobx-react-lite';
import { FunctionComponent } from 'preact';
import { ExtensionItem } from './extensions-segments';
@@ -16,10 +17,23 @@ interface IProps {
preferencesMenu: PreferencesMenu;
}
const urlOverrideForExtension = (extension: SNComponent) => {
if (extension.identifier === FeatureIdentifier.CloudLink) {
return 'https://extensions.standardnotes.org/components/cloudlink';
} else {
return undefined;
}
};
export const ExtensionPane: FunctionComponent<IProps> = observer(
({ extension, application, appState, preferencesMenu }) => {
const [componentViewer] = useState<ComponentViewer>(
application.componentManager.createComponentViewer(extension)
application.componentManager.createComponentViewer(
extension,
undefined,
undefined,
urlOverrideForExtension(extension)
)
);
const latestVersion =
preferencesMenu.extensionsLatestVersions.getVersion(extension);