From 4153c816382a31e82866435b44cf246825657c40 Mon Sep 17 00:00:00 2001 From: Mo Date: Mon, 3 Jan 2022 10:47:33 -0600 Subject: [PATCH] fix: cloudlink url --- .../components/ComponentView/index.tsx | 2 +- .../preferences/panes/ExtensionPane.tsx | 18 ++++++++++++++++-- package.json | 2 +- yarn.lock | 8 ++++---- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/components/ComponentView/index.tsx b/app/assets/javascripts/components/ComponentView/index.tsx index 617746967..436397b70 100644 --- a/app/assets/javascripts/components/ComponentView/index.tsx +++ b/app/assets/javascripts/components/ComponentView/index.tsx @@ -238,7 +238,7 @@ export const ComponentView: FunctionalComponent = 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 diff --git a/app/assets/javascripts/preferences/panes/ExtensionPane.tsx b/app/assets/javascripts/preferences/panes/ExtensionPane.tsx index 4e8ab83d6..0f922d625 100644 --- a/app/assets/javascripts/preferences/panes/ExtensionPane.tsx +++ b/app/assets/javascripts/preferences/panes/ExtensionPane.tsx @@ -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 = observer( ({ extension, application, appState, preferencesMenu }) => { const [componentViewer] = useState( - application.componentManager.createComponentViewer(extension) + application.componentManager.createComponentViewer( + extension, + undefined, + undefined, + urlOverrideForExtension(extension) + ) ); const latestVersion = preferencesMenu.extensionsLatestVersions.getVersion(extension); diff --git a/package.json b/package.json index 3caf4f8c0..407548f69 100644 --- a/package.json +++ b/package.json @@ -89,7 +89,7 @@ "@reach/tooltip": "^0.16.2", "@standardnotes/features": "1.20.3", "@standardnotes/sncrypto-web": "1.5.3", - "@standardnotes/snjs": "2.31.20", + "@standardnotes/snjs": "2.31.21", "mobx": "^6.3.5", "mobx-react-lite": "^3.2.2", "preact": "^10.5.15", diff --git a/yarn.lock b/yarn.lock index a550aee61..fff1f6f9d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2655,10 +2655,10 @@ buffer "^6.0.3" libsodium-wrappers "^0.7.9" -"@standardnotes/snjs@2.31.20": - version "2.31.20" - resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.31.20.tgz#f33f35aae09ab0ce2652adc1a0c91852a3c00062" - integrity sha512-rPHHzPKdNe546Zis9UCpO1pNU0Wd6P0y7nxlDzpitqGsXFEdBbcGbPkdw6tBIvQ2KvpkL0/U50FrzRU6NteXLg== +"@standardnotes/snjs@2.31.21": + version "2.31.21" + resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.31.21.tgz#6821a47fa22d676682566b8be56932a6eca6a55f" + integrity sha512-U2sWYlfi6xj3s4U18UkrH+BNm7ckNuhHV0Upi7Zd8QCzokpHTDPYysq1j5cC1cnCODXR24ZR/thWiOGNx3zODw== dependencies: "@standardnotes/auth" "3.8.1" "@standardnotes/common" "1.2.1"