-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add the ability to paste from gdrive links #883
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
FYI; I also fixed an issue where it failed to create the Google Sheet when it was contained within a Shared Drive. |
| const clientId = window.__ROOT_CTX.gapi!.clientId!; | ||
| const scopes = [...SCOPES, ...(options?.scopes || [])]; | ||
| // De-dupe scopes. | ||
| const uniqueScopes = [...new Set(scopes)]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I prefer to use Array.from(new Set(scopes)) instead of the spread operator. Probably better to do it in one line as well, e.g.
const scopes = Array.from(new Set([
...SCOPES,
...(options?.scopes || []),
]));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
packages/root-cms/ui/utils/gdrive.ts
Outdated
| import {GapiClient} from '../hooks/useGapiClient.js'; | ||
|
|
||
| /** Extracts the Google Drive file ID from a URL. */ | ||
| export function getGoogleDriveId(url: string): string | null { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way this is implemented feels error prone since any URLs from google.com could potentially be pasted here and potentially return a Google Drive ID. I think this needs to be more deterministic and possibly create unit tests to verify.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
This PR adds the ability to paste text (Google Drive URLs - e.g.
https://drive.google.com/open?id=1q4466dGkfhb9vKArGxopAkqB3QcjnjQn&usp=drive_copy) into the file field (when focused) in order to have Root CMS download the file from gDrive then upload it to the CMS.